-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[multi-asic][sonic-config-engine]: Get PORT table from namespace config db #7632
Merged
SuvarnaMeenakshi
merged 8 commits into
sonic-net:master
from
SuvarnaMeenakshi:masic_cfggen
Jun 7, 2021
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
813634b
[multi-asic]: Modify get_port_config function to connect to
SuvarnaMeenakshi b598d6b
Merge remote-tracking branch 'origin/master' into cfggen_ut
SuvarnaMeenakshi a99b612
Add unit test cases.
SuvarnaMeenakshi 57f5aae
Add mock db data for unit-test.
SuvarnaMeenakshi 813ff7a
Add mock database configuration files.
SuvarnaMeenakshi 2ca66b6
Add namespace database config files.
SuvarnaMeenakshi c780d8d
Modify test case to include tpid data.
SuvarnaMeenakshi 5e4a580
Modify env variable name for unit test.
SuvarnaMeenakshi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is it working 201911 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in 201911 and here, we pass "asic_id" like 0/1 to get_path_to_port_config_file() ; That part is not modified.
The change here is that, portconfig.py consumes asic_name instead of asic_id and we get asic_id from asic_name here instead of getting that information in minigraph.py