ldapldifchangetype

How to modify IPv4 address using LDIF Files


enter image description hereI need to change an IPv4 address to multiple IPv4 addresses using LDIF file. The original LDIF file which was used to create the HSS ESM is the following:

dn: HSS-EsmImsi=312720000000207,HSS-EsmSubscriptionId=BR-02061969,
    HSS-EsmSubscriptionContainerName=HSS-EsmSubscriptionContainer,
    applicationName=HSS_ESM,nodeName=bnyrgvhss1
    changeType: modify
    add: HSS-EsmUserProfileId
    HSS-EsmUserProfileId: HSS-EsmProfile_APCCI_METERING
    -
    add: HSS-EsmUserIpV4Address
    HSS-EsmUserIpV4Address: 4$10.11.12.13
    -
    add: HSS-EsmMsisdn
    HSS-EsmMsisdn: +1 234 567 8901
    -

Now, I need to do 2 things:

  1. Change the IPv4 address (e.g. 10.13.15.17).
  2. Modify the HSS ESM User Object Class, so HSS-EsmUserIpV4Address will store multiple IPv4 addresses.

According to Erickson's - ESM LDAP Interface Description this should be done with a string in the following format: [contextId1]$[IPv4-Address1]\n [contextId2]$[IPv4-Address2]\n ...[contextIdNN]$[IPv4-AddressNN]\n.

Legend:

  1. [contextId] datatype is uint32.
  2. $ is a CONSTANT (US Dollar sign).
  3. [IPv4-Address] IP Addresses are dotted-decimal of string datatype, e.g. 10.12.14.16.
  4. \n is a CONSTANT (New-Line).

I am new to LDAP and will appreciate any help on how the LDIF file should be to so that HSS-EsmUserIpV4Address will store, for example, the following IPv4 addresses:

2$159.10.1.20
7$159.10.1.21
8$159.10.1.22

I tried to change the LDIF file to do Delete and Add like this:

... (the original code)...
changeType: modify
delete: HSS-EsmUserProfileId
-
add: HSS-EsmUserProfileId
HSS-EsmUserProfileId: 2$159.10.1.20\n7$159.10.1.21\n8$159.10.1.22\n
-

But, it didn't work (no error messages, just no change).

I will appreciate any help, I am here (at work) to stay until I make this happen.


Solution

  • add: HSS-EsmUserProfileId
    HSS-EsmUserProfileId: 2$159.10.1.20\n7$159.10.1.21\n8$159.10.1.22\n
    

    First, you're changing the wrong attribute. It should be

    add: HSS-EsmUserIpV4Address
    HSS-EsmUserIpV4Address: 2$159.10.1.20\n7$159.10.1.21\n8$159.10.1.22\n
    

    and you may have damaged the original value of this attribute, so you need to put it back:

    delete: HSS-EsmUserProfileId
    add: HSS-EsmUserProfileId
    HSS-EsmUserProfileId: HSS-EsmProfile_APCCI_METERING
    

    Second, I don't know where you got this format with \n separators from. I don't see it in the documentation you cited. The normal LDIF syntax for multiple attribute values would be:

    add: HSS-EsmUserIpV4Address
    HSS-EsmUserIpV4Address: 2$159.10.1.20
    HSS-EsmUserIpV4Address: 7$159.10.1.21
    HSS-EsmUserIpV4Address: 8$159.10.1.22
    

    Note that this will preserve the prior value starting with 4$, unless you previously used delete: as above.