Skip to content

[sonic-cfggen] Multi-key should be in form of (a,b) instead of 'a|b'#2337

Merged
lguohan merged 1 commit intosonic-net:masterfrom
taoyl-ms:taoyl/config_qos_no_m
Dec 4, 2018
Merged

[sonic-cfggen] Multi-key should be in form of (a,b) instead of 'a|b'#2337
lguohan merged 1 commit intosonic-net:masterfrom
taoyl-ms:taoyl/config_qos_no_m

Conversation

@taoyl-ms
Copy link
Contributor

@taoyl-ms taoyl-ms commented Dec 3, 2018

- What I did
The design of sonic-cfggen is that multi-key should be in the form of ('key1', 'key2') in memory data structure. In this way, the template will be able to utilize one of the keys with simply key[0]. Only when writing into DB, we serialize the keys into format of 'key1|key2'. LOOPBACK_INTERFACE acts as an example.

Please do not use format 'key1|key2' directly in sonic-cfggen as that will cause the -d and -m behaviors to be different. Here's the output in current version:

admin@sonic-7:~$ sonic-cfggen -d -v VLAN_MEMBER
{('Vlan1000', 'Ethernet96'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet40'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet72'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet4'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet80'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet92'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet32'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet84'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet52'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet36'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet56'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet16'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet68'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet64'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet12'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet60'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet8'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet48'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet20'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet88'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet44'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet76'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet24'): {'tagging_mode': 'untagged'}, ('Vlan1000', 'Ethernet28'): {'tagging_mode': 'untagged'}}
admin@sonic-7:~$ sonic-cfggen -m -v VLAN_MEMBER
{'Vlan1000|Ethernet4': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet8': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet32': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet16': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet36': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet12': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet76': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet72': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet44': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet40': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet48': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet80': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet84': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet28': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet88': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet20': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet24': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet64': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet60': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet52': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet56': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet96': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet92': {'tagging_mode': 'untagged'}, 'Vlan1000|Ethernet68': {'tagging_mode': 'untagged'}}
admin@sonic-7:~$ sonic-cfggen -m -v LOOPBACK_INTERFACE
{('Loopback0', '10.1.0.32/32'): {}, ('Loopback0', 'FC00:1::32/128'): {}}
admin@sonic-7:~$ sonic-cfggen -d -v LOOPBACK_INTERFACE 
{('Loopback0', 'FC00:1::32/128'): {}, ('Loopback0', '10.1.0.32/32'): {}}
admin@sonic-7:~$ 

This PR fixes the issue and unify the result from -d and -m into
{('Vlan1000', 'Ethernet96'): {'tagging_mode': 'untagged'} format.

@lguohan lguohan merged commit aedfd6e into sonic-net:master Dec 4, 2018
yxieca added a commit to yxieca/sonic-buildimage that referenced this pull request Jul 17, 2022
swss:
* 7841930 2022-07-15 | [vxlan]Fixing L2MC vlan member caching issue (sonic-net#2378) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam]
* b8cd435 2022-07-14 | [muxorch] Always use direct link for SoC IPs (sonic-net#2369) [Longxiang Lyu]
* 6158d5c 2022-07-08 | Add BGP profile to Vnet routes (sonic-net#2337) [Prince Sunny]
* bdb7ffd 2022-07-06 | [teammgr]: Waiting MACsec ready before doLagMemberTask (sonic-net#2286) [Ze Gan]

sairedis:
* 58359d4 2022-06-30 | [sairedis] Perform log rotate on request (sonic-net#1058) (HEAD -> 202205, github/202205) [Kamil Cudnik]
* cad0268 2022-07-13 | Enable cisco debug shell by default (sonic-net#1078) [VenkatCisco]

Signed-off-by: Ying Xie <[email protected]>
yxieca added a commit that referenced this pull request Jul 18, 2022
swss:
* 7841930 2022-07-15 | [vxlan]Fixing L2MC vlan member caching issue (#2378) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam]
* b8cd435 2022-07-14 | [muxorch] Always use direct link for SoC IPs (#2369) [Longxiang Lyu]
* 6158d5c 2022-07-08 | Add BGP profile to Vnet routes (#2337) [Prince Sunny]
* bdb7ffd 2022-07-06 | [teammgr]: Waiting MACsec ready before doLagMemberTask (#2286) [Ze Gan]

sairedis:
* 58359d4 2022-06-30 | [sairedis] Perform log rotate on request (#1058) (HEAD -> 202205, github/202205) [Kamil Cudnik]
* cad0268 2022-07-13 | Enable cisco debug shell by default (#1078) [VenkatCisco]

Signed-off-by: Ying Xie <[email protected]>
skbarista pushed a commit to skbarista/sonic-buildimage that referenced this pull request Aug 17, 2022
swss:
* 7841930 2022-07-15 | [vxlan]Fixing L2MC vlan member caching issue (sonic-net#2378) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam]
* b8cd435 2022-07-14 | [muxorch] Always use direct link for SoC IPs (sonic-net#2369) [Longxiang Lyu]
* 6158d5c 2022-07-08 | Add BGP profile to Vnet routes (sonic-net#2337) [Prince Sunny]
* bdb7ffd 2022-07-06 | [teammgr]: Waiting MACsec ready before doLagMemberTask (sonic-net#2286) [Ze Gan]

sairedis:
* 58359d4 2022-06-30 | [sairedis] Perform log rotate on request (sonic-net#1058) (HEAD -> 202205, github/202205) [Kamil Cudnik]
* cad0268 2022-07-13 | Enable cisco debug shell by default (sonic-net#1078) [VenkatCisco]

Signed-off-by: Ying Xie <[email protected]>
vivekrnv pushed a commit to vivekrnv/sonic-buildimage that referenced this pull request Aug 26, 2022
*Add BGP profile support to Vnet routes
dprital added a commit to dprital/sonic-buildimage that referenced this pull request Feb 7, 2023
Update sonic-utilities submodule pointer to include the following:
* f9130d1 [db_migrator] make LOG_LEVEL_DB migration more robust ([sonic-net#2651](sonic-net/sonic-utilities#2651))
* a2520e6 Fixed a bug in show vnet routes all causing screen overrun. ([sonic-net#2644](sonic-net/sonic-utilities#2644))
* c57c3fa show logging CLI support for logs stored in tmpfs ([sonic-net#2641](sonic-net/sonic-utilities#2641))
* 5d23934 [chassis][voq] Add asic id for linecards so show fabric counters queue/port can work. ([sonic-net#2499](sonic-net/sonic-utilities#2499))
* 79ffd9f Add Transceiver PM basic CLI support to show output from TRANSCEIVER_PM table for ZR ([sonic-net#2615](sonic-net/sonic-utilities#2615))
* 1b71985 [masic support] 'show run bgp' support for multi-asic ([sonic-net#2427](sonic-net/sonic-utilities#2427))
* 8239e9a Making 'show feature autorestart' more resilient to missing auto_restart config in CONFIG_DB ([sonic-net#2592](sonic-net/sonic-utilities#2592))
* 9ee6ac2 [doc] Update docs for dhcp_relay config cli ([sonic-net#2598](sonic-net/sonic-utilities#2598))
* c3c92a4 Skip saidump for Spine Router as this can take more than 5 sec ([sonic-net#2637](sonic-net/sonic-utilities#2637))
* 6fe8599 Secure upgrade ([sonic-net#2337](sonic-net/sonic-utilities#2337))

Signed-off-by: dprital <[email protected]>
liat-grozovik pushed a commit that referenced this pull request Feb 8, 2023
Update sonic-utilities submodule pointer to include the following:
* f9130d1 [db_migrator] make LOG_LEVEL_DB migration more robust ([#2651](sonic-net/sonic-utilities#2651))
* a2520e6 Fixed a bug in show vnet routes all causing screen overrun. ([#2644](sonic-net/sonic-utilities#2644))
* c57c3fa show logging CLI support for logs stored in tmpfs ([#2641](sonic-net/sonic-utilities#2641))
* 5d23934 [chassis][voq] Add asic id for linecards so show fabric counters queue/port can work. ([#2499](sonic-net/sonic-utilities#2499))
* 79ffd9f Add Transceiver PM basic CLI support to show output from TRANSCEIVER_PM table for ZR ([#2615](sonic-net/sonic-utilities#2615))
* 1b71985 [masic support] 'show run bgp' support for multi-asic ([#2427](sonic-net/sonic-utilities#2427))
* 8239e9a Making 'show feature autorestart' more resilient to missing auto_restart config in CONFIG_DB ([#2592](sonic-net/sonic-utilities#2592))
* 9ee6ac2 [doc] Update docs for dhcp_relay config cli ([#2598](sonic-net/sonic-utilities#2598))
* c3c92a4 Skip saidump for Spine Router as this can take more than 5 sec ([#2637](sonic-net/sonic-utilities#2637))
* 6fe8599 Secure upgrade ([#2337](sonic-net/sonic-utilities#2337))

Signed-off-by: dprital <[email protected]>
StormLiangMS added a commit that referenced this pull request Mar 1, 2023
b817342 - [GCU] Add Sample Unit Test for RDMA Headroom Pool Size Tuning ([device/celestica] blacklist gpio_ich kernel module on haliburton #2692) (5 hours ago) [isabelmsft]
6f84aae - Add begin logs to config reload/config minigraph/warm-reboot/fast-reboot (RPC syncd docker image does not start RPC server automatically #2694) (27 hours ago) [Junchao-Mellanox]
e98011f - Revert "Secure upgrade ([sonic-cfggen] Multi-key should be in form of (a,b) instead of 'a|b' #2337)" (Add Broadcom XLR/GTS ((BCM9COMX2XMC) support for Tomahawk switch (BCM956960K) #2675) (34 hours ago) [StormLiangMS]
eda4e91 - [show][muxcable] add some new commands health, reset-cause, queue_info support for muxcable (DUT takes more than 7 seconds to finish update ip v6 neighbor #2414) (4 days ago) [vdahiya12]
54e2635 - Replace pickle by json (Add autoneg to 7170-Q59S20 #2636) (4 days ago) [Mai Bui]
xumia pushed a commit to xumia/sonic-buildimage-1 that referenced this pull request Mar 10, 2023
b817342 - [GCU] Add Sample Unit Test for RDMA Headroom Pool Size Tuning ([device/celestica] blacklist gpio_ich kernel module on haliburton sonic-net#2692) (5 hours ago) [isabelmsft]
6f84aae - Add begin logs to config reload/config minigraph/warm-reboot/fast-reboot (RPC syncd docker image does not start RPC server automatically sonic-net#2694) (27 hours ago) [Junchao-Mellanox]
e98011f - Revert "Secure upgrade ([sonic-cfggen] Multi-key should be in form of (a,b) instead of 'a|b' sonic-net#2337)" (Add Broadcom XLR/GTS ((BCM9COMX2XMC) support for Tomahawk switch (BCM956960K) sonic-net#2675) (34 hours ago) [StormLiangMS]
eda4e91 - [show][muxcable] add some new commands health, reset-cause, queue_info support for muxcable (DUT takes more than 7 seconds to finish update ip v6 neighbor sonic-net#2414) (4 days ago) [vdahiya12]
54e2635 - Replace pickle by json (Add autoneg to 7170-Q59S20 sonic-net#2636) (4 days ago) [Mai Bui]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants