Description
Generic Config Updater is case sensitive when dealing with IPv6 addresses
Steps to reproduce the issue:
- Config a ipv6 interface and bind ipv6 addresses to it via CLI:
admin@r-bulldog-02:~$ sudo config interface ip add Ethernet12 fc00::1/126 # the address is in lowercase
admin@r-bulldog-02:~$ sudo config interface ip add Ethernet12 FC00::11/126 # the address is in uppercase
admin@r-bulldog-02:~$ show ipv6 interface
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
Bridge fe80::8841:bdff:fe6c:242d%Bridge/64 up/down N/A N/A
Ethernet0 fe80::9a03:9bff:fef8:e7c0%Ethernet0/64 up/up N/A N/A
Ethernet4 fe80::9a03:9bff:fef8:e7c0%Ethernet4/64 up/up N/A N/A
Ethernet8 fe80::9a03:9bff:fef8:e7c0%Ethernet8/64 up/up N/A N/A
Ethernet12 fc00::1/126 up/up N/A N/A
fc00::11/126 N/A N/A
fe80::9a03:9bff:fef8:e7c0%Ethernet12/64 N/A N/A
Ethernet14 fe80::9a03:9bff:fef8:e7c0%Ethernet14/64 up/up N/A N/A
......
admin@r-bulldog-02:~$ show runningconfiguration all | grep Ethernet12
"Ethernet12": {
"Ethernet12|0": {
"Ethernet12|3-4": {
"Ethernet12": {
"Ethernet12": {
"Ethernet12|0-2": {
"Ethernet12|3-4": {
"Ethernet12|5-6": {
"Ethernet12": "5m",
"Ethernet12": {},
"Ethernet12|fc00::1/126": {},
"Ethernet12|fc00::11/126": {}
SONiC accepts both lowercase and uppercase ipv6 addresses when using CLI, and the uppercase address is converted to lowercase in config db.
- Save the config and modify one adderss in config_db.json to uppercase, and reload the config
admin@r-bulldog-02:$ sudo config save -y
Running command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config_db.json
admin@r-bulldog-02:$ sudo vi /etc/sonic/config_db.json # fc00::01/126 is modified to FC00::01/126
admin@r-bulldog-02:~$ sudo config reload -y
Running command: rm -rf /tmp/dropstat-*
Disabling container monitoring ...
Stopping SONiC target ...
Running command: /usr/local/bin/sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --write-to-db
Running command: /usr/local/bin/db_migrator.py -o migrate
Running command: /usr/local/bin/sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sonic-environment.j2,/etc/sonic/sonic-environment
Restarting SONiC target ...
Enabling container monitoring ...
Reloading Monit configuration ...
Reinitializing monit daemon
admin@r-bulldog-02:~$ show ipv6 interface
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
Bridge fe80::c0cf:b0ff:fe28:91b6%Bridge/64 up/down N/A N/A
Ethernet0 fe80::9a03:9bff:fef8:e7c0%Ethernet0/64 up/up N/A N/A
Ethernet4 fe80::9a03:9bff:fef8:e7c0%Ethernet4/64 up/up N/A N/A
Ethernet8 fe80::9a03:9bff:fef8:e7c0%Ethernet8/64 up/up N/A N/A
Ethernet12 fc00::1/126 up/up N/A N/A # the ipv6 addresses are reloaded succefully
fc00::11/126 N/A N/A
fe80::9a03:9bff:fef8:e7c0%Ethernet12/64 N/A N/A
admin@r-bulldog-02:~$ show runningconfiguration interfaces
{
"Ethernet12": {},
"Ethernet12|FC00::11/126": {}, # this one is in uppercase in db
"Ethernet12|fc00::1/126": {} # this one is in lower case, both are valid
}
- Create a patch file to remove one ipv6 address from the interface but use the different case from the db
content of /tmp/test.patch file:
[
{
"path": "/INTERFACE/Ethernet12|FC00::1~1126",
"op": "remove"
}
]
- Apply the patch, failed because the ipv6 address in the patch is uppercase while is lowercase in db
admin@r-bulldog-02:$ sudo config apply-patch /tmp/test.patch
Patch Applier: Patch application starting.
Patch Applier: Patch: [{"path": "/INTERFACE/Ethernet12|FC00::11126", "op": "remove"}]
Patch Applier: Getting current config db.
Patch Applier: Simulating the target full config after applying the patch.
Failed to apply patch
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.
Error: can't remove a non-existent object 'Ethernet12|FC00::1/126'
- Modify the adderss to lowercase and try again:
admin@r-bulldog-02:$ sudo config apply-patch /tmp/test.patch
Patch Applier: Patch application starting.
Patch Applier: Patch: [{"path": "/INTERFACE/Ethernet12|fc00::11126", "op": "remove"}]
Patch Applier: Getting current config db.
Patch Applier: Simulating the target full config after applying the patch.
Patch Applier: Validating target config does not have empty tables, since they do not show up in ConfigDb.
Patch Applier: Sorting patch updates.
sonic_yang(6):Note: Below table(s) have no YANG models: DEFAULT_LOSSLESS_BUFFER_PARAMETER, KDUMP, LOSSLESS_TRAFFIC_PATTERN, SNMP, SNMP_COMMUNITY
sonic_yang(6):Note: Below table(s) have no YANG models: DEFAULT_LOSSLESS_BUFFER_PARAMETER, KDUMP, LOSSLESS_TRAFFIC_PATTERN, SNMP, SNMP_COMMUNITY
sonic_yang(6):Note: Below table(s) have no YANG models: DEFAULT_LOSSLESS_BUFFER_PARAMETER, KDUMP, LOSSLESS_TRAFFIC_PATTERN, SNMP, SNMP_COMMUNITY
Patch Applier: The patch was sorted into 1 change:
Patch Applier: * [{"op": "remove", "path": "/INTERFACE/Ethernet12|fc00::11126"}]
Patch Applier: Applying 1 change in order:
Patch Applier: * [{"op": "remove", "path": "/INTERFACE/Ethernet12|fc00::11126"}]
Patch Applier: Verifying patch updates are reflected on ConfigDB.
Patch Applier: Patch application completed.
Patch applied successfully.
admin@r-bulldog-02:~$ show runningconfiguration interface
{
"Ethernet12": {},
"Ethernet12|FC00::11/126": {}
}
Describe the results you received:
apply-patch fails with this error
Error: can't remove a non-existent object 'Ethernet12|FC00::1/126'
Describe the results you expected:
successful apply-patch
Since SONiC accept both uppercase and lowercase ipv6 addresses, the Generric Config Updater should align with the system level design, or the user expirence will not be good, especially the purpose of GCU is to improve user expirence.
Output of show version:
admin@c-anaconda-01:~$ show version
SONiC Software Version: SONiC.HEAD.0-dirty-20220727.101004
Distribution: Debian 11.4
Kernel: 5.10.0-12-2-amd64
Build commit: 4d48e6063
Build date: Wed Jul 27 02:15:44 UTC 2022
Built by: junchao@arc-build-server-2
Platform: x86_64-mlnx_msn3700c-r0
HwSKU: ACS-MSN3700C
ASIC: mellanox
ASIC Count: 1
Serial Number: MT1922X00266
Model Number: MSN3700-CS2FO
Hardware Revision: A4
Uptime: 15:33:09 up 8 days, 13:01, 1 user, load average: 0.65, 0.83, 0.89
Date: Thu 04 Aug 2022 15:33:09
Docker images:
REPOSITORY TAG IMAGE ID SIZE
docker-orchagent HEAD.0-dirty-20220727.101004 db06e05e21cd 478MB
docker-orchagent latest db06e05e21cd 478MB
docker-macsec latest e64930203515 462MB
docker-syncd-mlnx HEAD.0-dirty-20220727.101004 659b60c0d4ed 984MB
docker-syncd-mlnx latest 659b60c0d4ed 984MB
docker-platform-monitor HEAD.0-dirty-20220727.101004 55e92f3cfdbb 988MB
docker-platform-monitor latest 55e92f3cfdbb 988MB
docker-dhcp-relay latest b824da52cc45 453MB
docker-database HEAD.0-dirty-20220727.101004 d4783556eab1 444MB
docker-database latest d4783556eab1 444MB
docker-sonic-telemetry HEAD.0-dirty-20220727.101004 0c20b5dfc05f 524MB
docker-sonic-telemetry latest 0c20b5dfc05f 524MB
docker-mux HEAD.0-dirty-20220727.101004 b89573696729 492MB
docker-mux latest b89573696729 492MB
docker-router-advertiser HEAD.0-dirty-20220727.101004 289528560d7b 444MB
docker-router-advertiser latest 289528560d7b 444MB
docker-fpm-frr HEAD.0-dirty-20220727.101004 e4ce443d0e8e 458MB
docker-fpm-frr latest e4ce443d0e8e 458MB
docker-nat HEAD.0-dirty-20220727.101004 a3805611eb0e 431MB
docker-nat latest a3805611eb0e 431MB
docker-sflow HEAD.0-dirty-20220727.101004 844f80f51b0d 429MB
docker-sflow latest 844f80f51b0d 429MB
docker-teamd HEAD.0-dirty-20220727.101004 db46d8e5b4c5 429MB
docker-teamd latest db46d8e5b4c5 429MB
docker-snmp HEAD.0-dirty-20220727.101004 ce5698105e30 457MB
docker-snmp latest ce5698105e30 457MB
docker-sonic-mgmt-framework HEAD.0-dirty-20220727.101004 3caabe97cb97 558MB
docker-sonic-mgmt-framework latest 3caabe97cb97 558MB
docker-lldp HEAD.0-dirty-20220727.101004 b36e1730a9f2 454MB
docker-lldp latest b36e1730a9f2 454MB
urm.nvidia.com/sw-nbu-sws-sonic-docker/sonic-wjh 1.3.0-202205-internal-9 17e6c4a62f86 528MB
admin@c-anaconda-01:~$
Output of show techsupport:
(paste your output here or download and attach the file here )
Additional information you deem important (e.g. issue happens only occasionally):
Description
Generic Config Updater is case sensitive when dealing with IPv6 addresses
Steps to reproduce the issue:
admin@r-bulldog-02:~$ sudo config interface ip add Ethernet12 fc00::1/126 # the address is in lowercase
admin@r-bulldog-02:~$ sudo config interface ip add Ethernet12 FC00::11/126 # the address is in uppercase
admin@r-bulldog-02:~$ show ipv6 interface
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
Bridge fe80::8841:bdff:fe6c:242d%Bridge/64 up/down N/A N/A
Ethernet0 fe80::9a03:9bff:fef8:e7c0%Ethernet0/64 up/up N/A N/A
Ethernet4 fe80::9a03:9bff:fef8:e7c0%Ethernet4/64 up/up N/A N/A
Ethernet8 fe80::9a03:9bff:fef8:e7c0%Ethernet8/64 up/up N/A N/A
Ethernet12 fc00::1/126 up/up N/A N/A
fc00::11/126 N/A N/A
fe80::9a03:9bff:fef8:e7c0%Ethernet12/64 N/A N/A
Ethernet14 fe80::9a03:9bff:fef8:e7c0%Ethernet14/64 up/up N/A N/A
......
admin@r-bulldog-02:~$ show runningconfiguration all | grep Ethernet12
"Ethernet12": {
"Ethernet12|0": {
"Ethernet12|3-4": {
"Ethernet12": {
"Ethernet12": {
"Ethernet12|0-2": {
"Ethernet12|3-4": {
"Ethernet12|5-6": {
"Ethernet12": "5m",
"Ethernet12": {},
"Ethernet12|fc00::1/126": {},
"Ethernet12|fc00::11/126": {}
SONiC accepts both lowercase and uppercase ipv6 addresses when using CLI, and the uppercase address is converted to lowercase in config db.
admin@r-bulldog-02:
$ sudo config save -y$ sudo vi /etc/sonic/config_db.json # fc00::01/126 is modified to FC00::01/126Running command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config_db.json
admin@r-bulldog-02:
admin@r-bulldog-02:~$ sudo config reload -y
Running command: rm -rf /tmp/dropstat-*
Disabling container monitoring ...
Stopping SONiC target ...
Running command: /usr/local/bin/sonic-cfggen -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db.json --write-to-db
Running command: /usr/local/bin/db_migrator.py -o migrate
Running command: /usr/local/bin/sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t /usr/share/sonic/templates/sonic-environment.j2,/etc/sonic/sonic-environment
Restarting SONiC target ...
Enabling container monitoring ...
Reloading Monit configuration ...
Reinitializing monit daemon
admin@r-bulldog-02:~$ show ipv6 interface
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
Bridge fe80::c0cf:b0ff:fe28:91b6%Bridge/64 up/down N/A N/A
Ethernet0 fe80::9a03:9bff:fef8:e7c0%Ethernet0/64 up/up N/A N/A
Ethernet4 fe80::9a03:9bff:fef8:e7c0%Ethernet4/64 up/up N/A N/A
Ethernet8 fe80::9a03:9bff:fef8:e7c0%Ethernet8/64 up/up N/A N/A
Ethernet12 fc00::1/126 up/up N/A N/A # the ipv6 addresses are reloaded succefully
fc00::11/126 N/A N/A
fe80::9a03:9bff:fef8:e7c0%Ethernet12/64 N/A N/A
admin@r-bulldog-02:~$ show runningconfiguration interfaces
{
"Ethernet12": {},
"Ethernet12|FC00::11/126": {}, # this one is in uppercase in db
"Ethernet12|fc00::1/126": {} # this one is in lower case, both are valid
}
content of /tmp/test.patch file:
[
{
"path": "/INTERFACE/Ethernet12|FC00::1~1126",
"op": "remove"
}
]
admin@r-bulldog-02:
$ sudo config apply-patch /tmp/test.patch1126", "op": "remove"}]Patch Applier: Patch application starting.
Patch Applier: Patch: [{"path": "/INTERFACE/Ethernet12|FC00::1
Patch Applier: Getting current config db.
Patch Applier: Simulating the target full config after applying the patch.
Failed to apply patch
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.
Error: can't remove a non-existent object 'Ethernet12|FC00::1/126'
admin@r-bulldog-02:
$ sudo config apply-patch /tmp/test.patch1126", "op": "remove"}]Patch Applier: Patch application starting.
Patch Applier: Patch: [{"path": "/INTERFACE/Ethernet12|fc00::1
Patch Applier: Getting current config db.
Patch Applier: Simulating the target full config after applying the patch.
Patch Applier: Validating target config does not have empty tables, since they do not show up in ConfigDb.
Patch Applier: Sorting patch updates.
sonic_yang(6):Note: Below table(s) have no YANG models: DEFAULT_LOSSLESS_BUFFER_PARAMETER, KDUMP, LOSSLESS_TRAFFIC_PATTERN, SNMP, SNMP_COMMUNITY
sonic_yang(6):Note: Below table(s) have no YANG models: DEFAULT_LOSSLESS_BUFFER_PARAMETER, KDUMP, LOSSLESS_TRAFFIC_PATTERN, SNMP, SNMP_COMMUNITY
sonic_yang(6):Note: Below table(s) have no YANG models: DEFAULT_LOSSLESS_BUFFER_PARAMETER, KDUMP, LOSSLESS_TRAFFIC_PATTERN, SNMP, SNMP_COMMUNITY
Patch Applier: The patch was sorted into 1 change:
Patch Applier: * [{"op": "remove", "path": "/INTERFACE/Ethernet12|fc00::1
1126"}]1126"}]Patch Applier: Applying 1 change in order:
Patch Applier: * [{"op": "remove", "path": "/INTERFACE/Ethernet12|fc00::1
Patch Applier: Verifying patch updates are reflected on ConfigDB.
Patch Applier: Patch application completed.
Patch applied successfully.
admin@r-bulldog-02:~$ show runningconfiguration interface
{
"Ethernet12": {},
"Ethernet12|FC00::11/126": {}
}
Describe the results you received:
apply-patch fails with this error
Error: can't remove a non-existent object 'Ethernet12|FC00::1/126'
Describe the results you expected:
successful apply-patch
Since SONiC accept both uppercase and lowercase ipv6 addresses, the Generric Config Updater should align with the system level design, or the user expirence will not be good, especially the purpose of GCU is to improve user expirence.
Output of
show version:Output of
show techsupport:Additional information you deem important (e.g. issue happens only occasionally):