Skip to content

IPv6 Address Stored in Uncompressed Form in DB When Configured via gNMI #174

@sauumyaaa

Description

@sauumyaaa

### Problem Overview:

When configuring an IPv6 address via gNMI, if the IP address is provided in uncompressed format, it is stored in the database exactly as provided, without compressing it.

This leads to an inconsistency:
If the user later tries to gnmi_get the same data using a compressed form of the IPv6 address (which is typically expected), it fails with a "resource not found" error - even though the data exists in the DB.

Detailed Example & Behavior:

1. Step: Configure IPv6 using uncompressed IP address via gNMI

Payload (ipv6.json):

{ "openconfig-interfaces:interface": [ { "name": "Ethernet0", "subinterfaces": { "subinterface": [ { "index": 0, "openconfig-if-ip:ipv6": { "addresses": { "address": [ { "ip": "2001:0db8:abcd:0016::1", "config": { "ip": "2001:0db8:abcd:0016::1", "prefix-length": 64 } } ] } } } ] } } ] }
Run gnmi_set:

gnmi_set -target_addr localhost:8080 -insecure -notls \ -update /openconfig-interfaces:interfaces/interface[name=Ethernet0]:@./ipv6.json \ -xpath_target OC-YANG
2. Check the database:

After applying the above configuration, check the DB using:

redis-cli -n 4 KEYS Ethernet0

Observed Key Example:
INTERFACE|Ethernet0|2001:0db8:abcd:0016::1/64
The IP is stored in its original uncompressed form (2001:0db8:abcd:0016::1), instead of being normalized to compressed form (2001:db8:abcd:16::1).

3. Try fetching with compressed IP via gNMI get:

gnmi_get -target_addr localhost:8080 -insecure -notls \ -xpath_target OC-YANG \ -xpath /openconfig-interfaces:interfaces/interface[name=Ethernet0]/subinterfaces/subinterface[index=0]/ipv6/addresses/address[ip='2001:db8:abcd:16::1']

Result:
Get failed: rpc error: code = NotFound desc = Resource not found

This happens because the DB key was created using the uncompressed IP, but the get request tries to access it using the compressed format.

( Fetching with uncompressed IP will succeed:

gnmi_get -target_addr localhost:8080 -insecure -notls \ -xpath_target OC-YANG \ -xpath /openconfig-interfaces:interfaces/interface[name=Ethernet0]/subinterfaces/subinterface[index=0]/ipv6/addresses/address[ip='2001:0db8:abcd:0016::1']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions