0

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.

Binyamin Regev
  • 914
  • 5
  • 19
  • 31
  • `2$` is not a `uint32` followed by a `$`, it is one ASCII digit followed by a `$`. Strange format. I would have expected to see multiple `HSS-EsmUserProfileId` attribute values. Can you provide a reference link? – user207421 Feb 28 '17 at 00:40
  • `2` is a uint32 value, `$` is used as a separator from the IPv4 address, so if you write 210.11.12.13 you will not confuse '210' with '2$10'. – Binyamin Regev Feb 28 '17 at 08:06
  • No. `0x00000002` is a `uint32` value. `2` is a single ASCI digit value `0x32` occupying 8 bits. The fault is Erikson's, not yours, and the documentation you have quoted is self-contradictory. In the first instance I would complain to them. – user207421 Feb 28 '17 at 09:37
  • Connect, but the LDIF file work and the data is currently in the `HSS-EsmUserIpV4Address` and if it works then I don't change it. Just need to find a way to put multiple IPv4 addresses in `HSS-EsmUserIpV4Address`. – Binyamin Regev Feb 28 '17 at 11:30
  • If the LDIF file really works you don't have a problem, so I don't know why you're posting. I don't see anything in the Erickson document about newlines. I suspect it is as I said: there should be multiple attribute values. – user207421 Feb 28 '17 at 23:56
  • Read my original post - the question - I need to CHANGE the LDIF file that `HSS-EsmUserIpV4Address` can store 1 or more IPv4 addresses. Also I need to support modify the content of `HSS-EsmUserIpV4Address` that hold 1 IPv4 address to more than 1 IPv4 address. As I wrote - I am new to LDAP and still learning it. – Binyamin Regev Mar 01 '17 at 05:16

2 Answers2

1
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.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • The `\n` is only to indicate/flag there's a `NEW_LINE` character, and the line of text didn't break in the question or answer. – Binyamin Regev Mar 01 '17 at 07:32
  • @BinyaminRegev `\n` doesn't break in my answer, and it wasn't intended to. Whether it does so in your question isn't of any apparent relevance. There is nothing about `\n` in the Erikson document you've cited. I suggest you try both techniques mentioned here. Instead of just arguing. – user207421 Mar 01 '17 at 08:54
0

Thank you EJP, you have put me on the track to the answer and the reason for my previous mistake.

The solution: in the LDIF file use changeType: modify with replace, or delete.

And the correct LDIF file should be:

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
-
delete: HSS-EsmUserIpV4Address
-
add: HSS-EsmUserIpV4Address
HSS-EsmUserIpV4Address: 1$159.10.1.20
HSS-EsmUserIpV4Address: 2$159.10.1.21
HSS-EsmUserIpV4Address: 3$159.10.1.22
-
add: HSS-EsmMsisdn
HSS-EsmMsisdn: +12345678901
-

This will delete a specific value from the attribute and add 2 others:

dn: HSS-EsmImsi=312720000000207,HSS-EsmSubscriptionId=BR-02061969,
HSS-EsmSubscriptionContainerName=HSS-EsmSubscriptionContainer,
applicationName=HSS_ESM,nodeName=bnyrgvhss1
changeType: modify
delete: HSS-EsmUserIpV4Address
HSS-EsmUserIpV4Address: 2$159.10.1.20
-
add: HSS-EsmUserIpV4Address
HSS-EsmUserIpV4Address: 1$159.10.1.23
HSS-EsmUserIpV4Address: 2$159.10.1.24
-

The following code will delete all instances of the attribute and add the attribute again with 3 other values:

dn: HSS-EsmImsi=312720000000207,HSS-EsmSubscriptionId=BR-02061969,
HSS-EsmSubscriptionContainerName=HSS-EsmSubscriptionContainer,
applicationName=HSS_ESM,nodeName=bnyrgvhss1
changeType: modify
delete: HSS-EsmUserIpV4Address
-
add: HSS-EsmUserIpV4Address
HSS-EsmUserIpV4Address: 1$159.10.1.25
HSS-EsmUserIpV4Address: 2$159.10.1.26
HSS-EsmUserIpV4Address: 3$159.10.1.27
-

I found this on How To Use LDIF Files to Make Changes to an OpenLDAP System.

Screen shot of the attached link

Thank you for @EJP for his HUGE help.

Binyamin Regev
  • 914
  • 5
  • 19
  • 31
  • The `delete` option doesn't require the value lines that follow in your example. It deletes all values of the specified attribute, as mentioned in your link. The LDIF format is defined in an RFC. No need to look at arbitrary Internet junk. There's nothing here that disagrees with my answer, and specifically you've proven that my conjecture about the `\n` separator is correct. – user207421 Mar 01 '17 at 09:03