forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[202012][multi-asic][sonic-config-engine]: Get PORT table from namesp…
…ace config db (sonic-net#10475) Why I did it Cherry-pick of: sonic-net#7632 portconfig.py gets PORT table from config_db if it is present. If not, port_config.ini files are parsed. For multi-asic platform, if namespace is passed to get_port_config(), config_db connection was done to host namespace always and not to asic specific namespace. Provides fix for: sonic-net#7161 How I did it Modify db connection function to connect to namespace config_db. How to verify it Unit-test passed. Verified on multi-asic VS platform.
- Loading branch information
1 parent
0761850
commit ec9732a
Showing
18 changed files
with
897 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
98 changes: 98 additions & 0 deletions
98
src/sonic-config-engine/tests/mock_tables/asic0/config_db.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"PORT|Ethernet0": { | ||
"index": "0", | ||
"lanes": "33,34,35,36", | ||
"description": "01T2:Ethernet1:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Ethernet1/1", | ||
"admin_status": "up", | ||
"role": "Ext", | ||
"speed": "40000", | ||
"asic_port_name": "Eth0-ASIC0" | ||
}, | ||
"PORT|Ethernet4": { | ||
"index": "1", | ||
"lanes": "29,30,31,32", | ||
"description": "01T2:Ethernet2:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Ethernet1/2", | ||
"admin_status": "up", | ||
"role": "Ext", | ||
"speed": "40000", | ||
"asic_port_name": "Eth1-ASIC0" | ||
}, | ||
"PORT|Ethernet8": { | ||
"index": "2", | ||
"lanes": "41,42,43,44", | ||
"description": "Ethernet1/3:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Ethernet1/3", | ||
"admin_status": "up", | ||
"role": "Ext", | ||
"speed": "40000", | ||
"asic_port_name": "Eth2-ASIC0" | ||
}, | ||
"PORT|Ethernet12": { | ||
"index": "3", | ||
"lanes": "37,38,39,40", | ||
"description": "Ethernet1/4:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Ethernet1/4", | ||
"admin_status": "up", | ||
"role": "Ext", | ||
"speed": "40000", | ||
"asic_port_name": "Eth3-ASIC0" | ||
}, | ||
"PORT|Ethernet-BP0": { | ||
"index": "0", | ||
"lanes": "13,14,15,16", | ||
"description": "ASIC2:Eth0-ASIC2:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Eth4-ASIC0", | ||
"admin_status": "up", | ||
"role": "Int", | ||
"speed": "40000", | ||
"asic_port_name": "Eth4-ASIC0" | ||
}, | ||
"PORT|Ethernet-BP4": { | ||
"index": "1", | ||
"lanes": "17,18,19,20", | ||
"description": "ASIC2:Eth1-ASIC2:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Eth5-ASIC0", | ||
"admin_status": "up", | ||
"role": "Int", | ||
"speed": "40000", | ||
"asic_port_name": "Eth5-ASIC0" | ||
}, | ||
"PORT|Ethernet-BP8": { | ||
"index": "2", | ||
"lanes": "21,22,23,24", | ||
"description": "ASIC3:Eth0-ASIC3:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Eth6-ASIC0", | ||
"admin_status": "up", | ||
"role": "Int", | ||
"speed": "40000", | ||
"asic_port_name": "Eth6-ASIC0" | ||
}, | ||
"PORT|Ethernet-BP12": { | ||
"index": "3", | ||
"lanes": "25,26,27,28", | ||
"description": "ASIC3:Eth1-ASIC3:config_db", | ||
"pfc_asym": "off", | ||
"mtu": "9100", | ||
"alias": "Eth7-ASIC0", | ||
"admin_status": "up", | ||
"role": "Int", | ||
"speed": "40000", | ||
"asic_port_name": "Eth7-ASIC0" | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/sonic-config-engine/tests/mock_tables/asic0/database_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"INSTANCES": { | ||
"redis": { | ||
"hostname" : "127.0.0.1", | ||
"port" : 6379, | ||
"unix_socket_path" : "/var/run/redis/redis.sock" | ||
} | ||
}, | ||
"DATABASES" : { | ||
"APPL_DB" : { | ||
"id" : 0, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"ASIC_DB" : { | ||
"id" : 1, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"COUNTERS_DB" : { | ||
"id" : 2, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"LOGLEVEL_DB" : { | ||
"id" : 3, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"CONFIG_DB" : { | ||
"id" : 4, | ||
"separator": "|", | ||
"instance" : "redis" | ||
}, | ||
"PFC_WD_DB" : { | ||
"id" : 5, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"FLEX_COUNTER_DB" : { | ||
"id" : 5, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"STATE_DB" : { | ||
"id" : 6, | ||
"separator": "|", | ||
"instance" : "redis" | ||
}, | ||
"SNMP_OVERLAY_DB" : { | ||
"id" : 7, | ||
"separator": "|", | ||
"instance" : "redis" | ||
} | ||
}, | ||
"VERSION" : "1.1" | ||
} |
2 changes: 2 additions & 0 deletions
2
src/sonic-config-engine/tests/mock_tables/asic1/config_db.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
57 changes: 57 additions & 0 deletions
57
src/sonic-config-engine/tests/mock_tables/asic1/database_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"INSTANCES": { | ||
"redis": { | ||
"hostname" : "127.0.0.1", | ||
"port" : 6379, | ||
"unix_socket_path" : "/var/run/redis/redis.sock" | ||
} | ||
}, | ||
"DATABASES" : { | ||
"APPL_DB" : { | ||
"id" : 0, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"ASIC_DB" : { | ||
"id" : 1, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"COUNTERS_DB" : { | ||
"id" : 2, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"LOGLEVEL_DB" : { | ||
"id" : 3, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"CONFIG_DB" : { | ||
"id" : 4, | ||
"separator": "|", | ||
"instance" : "redis" | ||
}, | ||
"PFC_WD_DB" : { | ||
"id" : 5, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"FLEX_COUNTER_DB" : { | ||
"id" : 5, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"STATE_DB" : { | ||
"id" : 6, | ||
"separator": "|", | ||
"instance" : "redis" | ||
}, | ||
"SNMP_OVERLAY_DB" : { | ||
"id" : 7, | ||
"separator": "|", | ||
"instance" : "redis" | ||
} | ||
}, | ||
"VERSION" : "1.1" | ||
} |
2 changes: 2 additions & 0 deletions
2
src/sonic-config-engine/tests/mock_tables/asic2/config_db.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
57 changes: 57 additions & 0 deletions
57
src/sonic-config-engine/tests/mock_tables/asic2/database_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"INSTANCES": { | ||
"redis": { | ||
"hostname" : "127.0.0.1", | ||
"port" : 6379, | ||
"unix_socket_path" : "/var/run/redis/redis.sock" | ||
} | ||
}, | ||
"DATABASES" : { | ||
"APPL_DB" : { | ||
"id" : 0, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"ASIC_DB" : { | ||
"id" : 1, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"COUNTERS_DB" : { | ||
"id" : 2, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"LOGLEVEL_DB" : { | ||
"id" : 3, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"CONFIG_DB" : { | ||
"id" : 4, | ||
"separator": "|", | ||
"instance" : "redis" | ||
}, | ||
"PFC_WD_DB" : { | ||
"id" : 5, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"FLEX_COUNTER_DB" : { | ||
"id" : 5, | ||
"separator": ":", | ||
"instance" : "redis" | ||
}, | ||
"STATE_DB" : { | ||
"id" : 6, | ||
"separator": "|", | ||
"instance" : "redis" | ||
}, | ||
"SNMP_OVERLAY_DB" : { | ||
"id" : 7, | ||
"separator": "|", | ||
"instance" : "redis" | ||
} | ||
}, | ||
"VERSION" : "1.1" | ||
} |
2 changes: 2 additions & 0 deletions
2
src/sonic-config-engine/tests/mock_tables/asic3/config_db.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
Oops, something went wrong.