I have the following tree in LDAP
Legend
$Msisdn = 13217654321 // 11 digits phone number: (contry)+(area)+(number)
$Imsi = 999888000007777 // standard 15 digits IMSI number
$MobileDomain = ims.mnc888.mcc999.3gppnetwork.org
+ HssNodeName
| + HSS
| | + HSS-Subscribers
| | | + HSS-Subscriber (HSS-SubscriberID=$Msisdn@$MobileDomain)
| | | | + HSS-User (HSS-PrivateUserId=$Imsi)
| | | | + HSS-Msisdn (HSS-Msisdn=$Msisdn)
| | | | + HSS-SubscriberServiceProfile
| | | | + HSS-PublicIdentificationData (sip:$Imsi@$MobileDomain)
| | | | + HSS-PublicIdentificationData (sip:\+$Msisdn@$MobileDomain)
| | | | + HSS-PublicIdentificationData (tel:\+$Msisdn)
I need to delete HSS-Subscriber and all the entities under it. I have LDIF files with the following commands (each LDIF file contains 1 command):
** PublicIdentificationDataTel.ldif **
dn: HSS-PublicIdValue=tel:\+$Msisdn,
HSS-SubscriberID=$Msisdn@$MobileDomain,
HSS-SubscriberContainerName=HSS-Subscribers,
applicationName=HSS,nodeName=HssNodeName
changeType: delete
** PublicIdentificationDataSip2.ldif **
dn: HSS-PublicIdValue=sip:\+$Msisdn@$MobileDomain,
HSS-SubscriberID=$Msisdn@$MobileDomain,
HSS-SubscriberContainerName=HSS-Subscribers,
applicationName=HSS,nodeName=HssNodeName
changeType: delete
** PublicIdentificationDataSip1.ldif **
dn: HSS-PublicIdValue=sip:$Imsi@$MobileDomain,
HSS-SubscriberID=$Msisdn@$MobileDomain,
HSS-SubscriberContainerName=HSS-Subscribers,
applicationName=HSS,nodeName=HssNodeName
** SubscriberServiceProfile.ldif **
dn: HSS-SubscriberServiceProfileId=SubServProf$Msisdn,
HSS-SubscriberID= $Msisdn@$MobileDomain,
HSS-SubscriberContainerName=HSS-Subscribers,
applicationName=HSS,nodeName=HssNodeName
changetype: delete
** MsIsdn.ldif **
dn: HSS-Msisdn=$Msisdn,
HSS-PrivateUserID=$Imsi@$MobileDomain,
HSS-SubscriberID=$Msisdn@$MobileDomain,
HSS-SubscriberContainerName=HSS-Subscribers,
applicationName=HSS,nodeName=HssNodeName
changeType: delete
** HssUser.ldif **
dn: HSS-PrivateUserID=$Imsi,
HSS-SubscriberId=$Msisdn@$MobileDomain,
HSS-SubscriberContainerName=HSS-Subscribers,
applicationName=HSS,nodeName=HssNodeName
changeType: delete
** HssSubscriber.ldif **
dn: HSS-SubscriberId=$Msisdn@$MobileDomain,
HSS-SubscriberContainerName=HSS-Subscribers,
applicationName=HSS,nodeName=$NODENAME
changeType: delete
Running the above LDIF files in the order I wrote them works properly, but sending 8 delete commands for 1 object I want to delete... it is not very elegant. I am looking for a better and more elegant way to do this. I know that I cannot delete an entry that has entries under it, but I am hoping to find a way to make my delete process shorter and more elegant.
I saw the questions how to delete all entries ldap java, the solution there does not apply to my problem as it involves Spring framework
which we do not use. There's a plan to integrate Spring framework
in our project, but it will be AFTER we need to deliver this for our customer.
Is there are a way to recursively delete an entity from the tree? for example, I will send the DN of the object (top of the tree) that I want to delete and somehow LDAP will automatically delete it and all the entries under it.
I am currently looking at ldapdelete
switches to see if any of them can help me with this.
I will appreciate any help.
There's no solution for this because the LDAP server doesn't support the TreeDelete extended operation.