-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Generic Config Updater][IPv6] | Generic Config Updater is case sensitive when dealing with IPv6 addresses #11622
Closed
Comments
liat-grozovik
pushed a commit
to sonic-net/sonic-utilities
that referenced
this issue
Aug 11, 2022
Fixes sonic-net/sonic-buildimage#11622 - What I did Convert IPv6 addresses to lowercase in apply-patch for remove op - How I did it python regex on 'remove' op in JSON patch input file - How to verify it Manual test of created bug, Unit test
yxieca
pushed a commit
to sonic-net/sonic-utilities
that referenced
this issue
Aug 11, 2022
Fixes sonic-net/sonic-buildimage#11622 - What I did Convert IPv6 addresses to lowercase in apply-patch for remove op - How I did it python regex on 'remove' op in JSON patch input file - How to verify it Manual test of created bug, Unit test
preetham-singh
pushed a commit
to preetham-singh/sonic-utilities
that referenced
this issue
Nov 21, 2022
Fixes sonic-net/sonic-buildimage#11622 - What I did Convert IPv6 addresses to lowercase in apply-patch for remove op - How I did it python regex on 'remove' op in JSON patch input file - How to verify it Manual test of created bug, Unit test
qiluo-msft
pushed a commit
to sonic-net/sonic-utilities
that referenced
this issue
Mar 28, 2023
…2758) This reverts commit 28b6ba5. There are some issues when GCU tries to remove the interface IP in some tests, such as add rack test. In the initial config, the INTERFACE's IPv6 was all loaded in uppercase by default. "INTERFACE": { "Ethernet68": {}, "Ethernet68|10.0.0.34/31": {}, "Ethernet68|FC00::45/126": {}, "Ethernet72": {}, "Ethernet72|10.0.0.36/31": {}, "Ethernet72|FC00::49/126": {}, GCU will never be able to remove that IP because IPv6 was always translated to lowercase due to #2299 . It reported the error can't remove a non-existent object, thus making GCU fail. #2299 is to deal with this issue: sonic-net/sonic-buildimage#11622. Although config CLI always translates uppercase to lowercase when adding an IP, the user can have two choices to remove that IP: One is to use config CLI to remove that IP no matter uppercase or lowercase. Another way is to use GCU. In order to use GCU, the user has to check the IP format saved in ConfigDB because GCU operation does differentiate between uppercase and lowercase. #### What I did Revert #2299
yxieca
pushed a commit
to sonic-net/sonic-utilities
that referenced
this issue
Apr 1, 2023
…2758) This reverts commit 28b6ba5. There are some issues when GCU tries to remove the interface IP in some tests, such as add rack test. In the initial config, the INTERFACE's IPv6 was all loaded in uppercase by default. "INTERFACE": { "Ethernet68": {}, "Ethernet68|10.0.0.34/31": {}, "Ethernet68|FC00::45/126": {}, "Ethernet72": {}, "Ethernet72|10.0.0.36/31": {}, "Ethernet72|FC00::49/126": {}, GCU will never be able to remove that IP because IPv6 was always translated to lowercase due to #2299 . It reported the error can't remove a non-existent object, thus making GCU fail. #2299 is to deal with this issue: sonic-net/sonic-buildimage#11622. Although config CLI always translates uppercase to lowercase when adding an IP, the user can have two choices to remove that IP: One is to use config CLI to remove that IP no matter uppercase or lowercase. Another way is to use GCU. In order to use GCU, the user has to check the IP format saved in ConfigDB because GCU operation does differentiate between uppercase and lowercase. #### What I did Revert #2299
StormLiangMS
pushed a commit
to sonic-net/sonic-utilities
that referenced
this issue
Apr 8, 2023
…2758) This reverts commit 28b6ba5. There are some issues when GCU tries to remove the interface IP in some tests, such as add rack test. In the initial config, the INTERFACE's IPv6 was all loaded in uppercase by default. "INTERFACE": { "Ethernet68": {}, "Ethernet68|10.0.0.34/31": {}, "Ethernet68|FC00::45/126": {}, "Ethernet72": {}, "Ethernet72|10.0.0.36/31": {}, "Ethernet72|FC00::49/126": {}, GCU will never be able to remove that IP because IPv6 was always translated to lowercase due to #2299 . It reported the error can't remove a non-existent object, thus making GCU fail. #2299 is to deal with this issue: sonic-net/sonic-buildimage#11622. Although config CLI always translates uppercase to lowercase when adding an IP, the user can have two choices to remove that IP: One is to use config CLI to remove that IP no matter uppercase or lowercase. Another way is to use GCU. In order to use GCU, the user has to check the IP format saved in ConfigDB because GCU operation does differentiate between uppercase and lowercase. #### What I did Revert #2299
malletvapid23
added a commit
to malletvapid23/Sonic-Utility
that referenced
this issue
Aug 3, 2023
Fixes sonic-net/sonic-buildimage#11622 - What I did Convert IPv6 addresses to lowercase in apply-patch for remove op - How I did it python regex on 'remove' op in JSON patch input file - How to verify it Manual test of created bug, Unit test
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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):
The text was updated successfully, but these errors were encountered: