-
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
Sorting all json config-elements residing in config_db.json #1454
Conversation
Just a simple change to make sonic's user life a little bit easier. Displaying the multiple elements of config_db.json in an orderly fashion allows a more intuitive user-experience. For this change i'm simply intercepting the config-state that is about to be dumped to config_db.json, and i'm placing it in an ordered-dictionary, so that information is pushed to file in natural/alphanumerical ordering. Example: admin@lnos-x1-a-csw01:~$ sudo sonic-cfggen -m /etc/sonic/minigraph.xml --print-data { ... "PORT": { "Ethernet0": { "alias": "Eth1/1", "lanes": "65" }, "Ethernet1": { "alias": "Eth1/2", "lanes": "66" }, "Ethernet2": { "alias": "Eth1/3", "lanes": "67" }, "Ethernet3": { "alias": "Eth1/4", "lanes": "68" }, "Ethernet4": { "alias": "Eth2/1", "lanes": "69" }, ... ... "INTERFACE": { "Ethernet0|10.0.0.0/31": {}, "Ethernet1|10.0.0.2/31": {}, "Ethernet2|10.0.0.4/31": {}, "Ethernet3|10.0.0.6/31": {}, "Ethernet4|10.0.0.8/31": {},
what about Ethernet1, Ethernet2 and Ethernet10, will Ethernet10 be after Ethernet2 after natsort? |
Right, natsort does a proper alphanumerical sorting. See example below... $ cat /etc/sonic/config_db.json |
swss: * 9376ec6 2021-02-22 | [orchagent] Increase SAI REDIS response timeout to support FW upgrade during init (Mellanox only). (sonic-net#1637) (HEAD -> 202012) [Lior Avramov] * 6c285f6 2021-02-22 | Updated PFCWD to use single ACL table for PFCWD and MUX (sonic-net#1620) [vmittal-msft] utilities: * d2f0e8f 2021-02-24 | [route_check]: Dropped redundant code. (sonic-net#1463) (HEAD -> 202012, github/202012) [Renuka Manavalan] * 9aaef9b 2021-02-25 | [Mellanox] Add support for SN4600 system (sonic-net#1462) [DavidZagury] * 60843dd 2021-03-01 | [reboot] Add platform-specific reboot cause update hook (sonic-net#1454) [rkdevi27] * d9c308c 2021-02-24 | [vlan] Vlan deletion is not allowed when there are members assigned to this VLAN. (sonic-net#1420) [Eran Dahan] * a72165a 2021-02-25 | [psushow] Add more output columns; Add option to output in JSON format (sonic-net#1416) [Joe LeVeque] Signed-off-by: Ying Xie <[email protected]>
swss: * 9376ec6 2021-02-22 | [orchagent] Increase SAI REDIS response timeout to support FW upgrade during init (Mellanox only). (#1637) (HEAD -> 202012) [Lior Avramov] * 6c285f6 2021-02-22 | Updated PFCWD to use single ACL table for PFCWD and MUX (#1620) [vmittal-msft] utilities: * d2f0e8f 2021-02-24 | [route_check]: Dropped redundant code. (#1463) (HEAD -> 202012, github/202012) [Renuka Manavalan] * 9aaef9b 2021-02-25 | [Mellanox] Add support for SN4600 system (#1462) [DavidZagury] * 60843dd 2021-03-01 | [reboot] Add platform-specific reboot cause update hook (#1454) [rkdevi27] * d9c308c 2021-02-24 | [vlan] Vlan deletion is not allowed when there are members assigned to this VLAN. (#1420) [Eran Dahan] * a72165a 2021-02-25 | [psushow] Add more output columns; Add option to output in JSON format (#1416) [Joe LeVeque] Signed-off-by: Ying Xie <[email protected]>
this PR updates the following commits in sonic-utilities 13ce4b6 [show][config] fix show mux status health field; add support for hwmode functionality to toggle mux, check mux direction for Y cable (#1467) f78e7ce [acl-loader] Improve input validation for acl_loader (#1479) 748dbbf [show] Fix 'show mac' output, when FDB entry with Vlan 1 is present (#1368) 64604db [acl] Expand VLAN into VLAN members when creating an ACL table (#1475) 10de91d [config reload]: On dual ToR systems, cache ARP and FDB tables (#1465) 10a359a [Mellanox] Change mellanox buffer migrator for new SKU Mellanox-SN2700-D40C8S8 (#1470) 38c8e00 [acl-loader] Add support for matching on ICMP and VLAN info (#1469) e555ea9 [SKU creator] fix wrong speed in case breakout of 2x50 (#1380) 4a78c01 [config] Enable/disable container monitoring when starting/stopping the services. (#1471) dd3c2c3 [warm-reboot] Check if warm restart flag is set when issuing a warm-reboot (#1460) e32b5ac Add soft-reboot reboot type (#1453) 8b3bc18 [reload] Improve reload by using sonic.target. (#1199) 99673bc [reboot] Add platform-specific reboot cause update hook (#1454) 2f6e36e [CLI][techsupport] Add NOOP option for commands that did not have that option (#1445) 1fa4b94 [psushow] Add more output columns; Add option to output in JSON format (#1416) 79ccd03 [show] cli support for show muxcable cableinfo (#1448) Signed-off-by: vaibhav-dahiya <[email protected]>
#### What I did The S6000 devices, the cold reboot is abrupt and it is likely to cause issues which will cause the device to land into EFI shell. Hence the platform reboot will happen after graceful unmount of all the filesystems as in S6100. #### How I did it In reboot script, if platform-specific reboot cause update script exists, run it
this PR updates the following commits in sonic-utilities 13ce4b6 [show][config] fix show mux status health field; add support for hwmode functionality to toggle mux, check mux direction for Y cable (sonic-net#1467) f78e7ce [acl-loader] Improve input validation for acl_loader (sonic-net#1479) 748dbbf [show] Fix 'show mac' output, when FDB entry with Vlan 1 is present (sonic-net#1368) 64604db [acl] Expand VLAN into VLAN members when creating an ACL table (sonic-net#1475) 10de91d [config reload]: On dual ToR systems, cache ARP and FDB tables (sonic-net#1465) 10a359a [Mellanox] Change mellanox buffer migrator for new SKU Mellanox-SN2700-D40C8S8 (sonic-net#1470) 38c8e00 [acl-loader] Add support for matching on ICMP and VLAN info (sonic-net#1469) e555ea9 [SKU creator] fix wrong speed in case breakout of 2x50 (sonic-net#1380) 4a78c01 [config] Enable/disable container monitoring when starting/stopping the services. (sonic-net#1471) dd3c2c3 [warm-reboot] Check if warm restart flag is set when issuing a warm-reboot (sonic-net#1460) e32b5ac Add soft-reboot reboot type (sonic-net#1453) 8b3bc18 [reload] Improve reload by using sonic.target. (sonic-net#1199) 99673bc [reboot] Add platform-specific reboot cause update hook (sonic-net#1454) 2f6e36e [CLI][techsupport] Add NOOP option for commands that did not have that option (sonic-net#1445) 1fa4b94 [psushow] Add more output columns; Add option to output in JSON format (sonic-net#1416) 79ccd03 [show] cli support for show muxcable cableinfo (sonic-net#1448) Signed-off-by: vaibhav-dahiya <[email protected]>
this PR updates the following commits in sonic-utilities 13ce4b6 [show][config] fix show mux status health field; add support for hwmode functionality to toggle mux, check mux direction for Y cable (sonic-net#1467) f78e7ce [acl-loader] Improve input validation for acl_loader (sonic-net#1479) 748dbbf [show] Fix 'show mac' output, when FDB entry with Vlan 1 is present (sonic-net#1368) 64604db [acl] Expand VLAN into VLAN members when creating an ACL table (sonic-net#1475) 10de91d [config reload]: On dual ToR systems, cache ARP and FDB tables (sonic-net#1465) 10a359a [Mellanox] Change mellanox buffer migrator for new SKU Mellanox-SN2700-D40C8S8 (sonic-net#1470) 38c8e00 [acl-loader] Add support for matching on ICMP and VLAN info (sonic-net#1469) e555ea9 [SKU creator] fix wrong speed in case breakout of 2x50 (sonic-net#1380) 4a78c01 [config] Enable/disable container monitoring when starting/stopping the services. (sonic-net#1471) dd3c2c3 [warm-reboot] Check if warm restart flag is set when issuing a warm-reboot (sonic-net#1460) e32b5ac Add soft-reboot reboot type (sonic-net#1453) 8b3bc18 [reload] Improve reload by using sonic.target. (sonic-net#1199) 99673bc [reboot] Add platform-specific reboot cause update hook (sonic-net#1454) 2f6e36e [CLI][techsupport] Add NOOP option for commands that did not have that option (sonic-net#1445) 1fa4b94 [psushow] Add more output columns; Add option to output in JSON format (sonic-net#1416) 79ccd03 [show] cli support for show muxcable cableinfo (sonic-net#1448) Signed-off-by: vaibhav-dahiya <[email protected]>
A simple change to make sonic's user life a little bit easier. Displaying the multiple elements of config_db.json in an orderly fashion allows a more intuitive user-experience.
For this change i'm simply intercepting the config-state that is about to be dumped to config_db.json, and i'm placing it in an ordered-dictionary, so that information is pushed to file in natural/alphanumerical ordering.
Example:
admin@lnos-x1-a-csw01:~$ sudo sonic-cfggen -m /etc/sonic/minigraph.xml --print-data
{
...
"PORT": {
"Ethernet0": {
"alias": "Eth1/1",
"lanes": "65"
},
"Ethernet1": {
"alias": "Eth1/2",
"lanes": "66"
},
"Ethernet2": {
"alias": "Eth1/3",
"lanes": "67"
},
"Ethernet3": {
"alias": "Eth1/4",
"lanes": "68"
},
"Ethernet4": {
"alias": "Eth2/1",
"lanes": "69"
},
...
...
"INTERFACE": {
"Ethernet0|10.0.0.0/31": {},
"Ethernet1|10.0.0.2/31": {},
"Ethernet2|10.0.0.4/31": {},
"Ethernet3|10.0.0.6/31": {},
"Ethernet4|10.0.0.8/31": {},