Skip to content
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

Merged
merged 1 commit into from
Mar 10, 2018

Conversation

rodnymolina
Copy link
Contributor

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": {},

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": {},
@lguohan
Copy link
Collaborator

lguohan commented Mar 5, 2018

what about Ethernet1, Ethernet2 and Ethernet10, will Ethernet10 be after Ethernet2 after natsort?

@rodnymolina
Copy link
Contributor Author

Right, natsort does a proper alphanumerical sorting. See example below...

$ cat /etc/sonic/config_db.json
...
"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"
},
"Ethernet5": {
"alias": "Eth2/2",
"lanes": "70"
},
"Ethernet6": {
"alias": "Eth2/3",
"lanes": "71"
},
"Ethernet7": {
"alias": "Eth2/4",
"lanes": "72"
},
"Ethernet8": {
"alias": "Eth3/1",
"lanes": "73"
},
"Ethernet9": {
"alias": "Eth3/2",
"lanes": "74"
},
"Ethernet10": {
"alias": "Eth3/3",
"lanes": "75"
},
"Ethernet11": {
"alias": "Eth3/4",
"lanes": "76"
},
"Ethernet12": {
"alias": "Eth4/1",
"lanes": "77"
},
"Ethernet13": {
"alias": "Eth4/2",
"lanes": "78"
},
"Ethernet14": {
"alias": "Eth4/3",
"lanes": "79"
...
"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": {},
"Ethernet5|10.0.0.10/31": {},
"Ethernet6|10.0.0.12/31": {},
"Ethernet7|10.0.0.14/31": {},
"Ethernet8|10.0.0.16/31": {},
"Ethernet9|10.0.0.18/31": {},
"Ethernet10|10.0.0.20/31": {},
"Ethernet11|10.0.0.22/31": {},
"Ethernet12|10.0.0.24/31": {},
"Ethernet13|10.0.0.26/31": {},

@lguohan lguohan merged commit 913a62c into sonic-net:master Mar 10, 2018
yxieca added a commit to yxieca/sonic-buildimage that referenced this pull request Mar 3, 2021
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]>
@DavidZagury DavidZagury mentioned this pull request Mar 3, 2021
4 tasks
yxieca added a commit that referenced this pull request Mar 3, 2021
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]>
@vdahiya12 vdahiya12 mentioned this pull request Mar 9, 2021
4 tasks
vdahiya12 added a commit that referenced this pull request Mar 10, 2021
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]>
stepanblyschak pushed a commit to stepanblyschak/sonic-buildimage that referenced this pull request May 10, 2021
#### 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
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
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]>
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants