Skip to content

Commit

Permalink
Use switch ID from config_db for test_fabric_reach.py
Browse files Browse the repository at this point in the history
Previously we were using a hardcoded offset called supervisorAsicBase
for calculating the module ID/switch ID. However, we could directly
query this from the CONFIG_DB on the supervisor for uniformity across
all platforms.
  • Loading branch information
arista-hpandya committed Dec 24, 2024
1 parent 8ac0169 commit 612b682
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion tests/voq/fabric_data/Arista-7804R3-FM.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
moduleIdBase: '300'
asicPerSlot: '2'
1 change: 0 additions & 1 deletion tests/voq/fabric_data/Arista-7808R3A-FM.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
moduleIdBase: '300'
asicPerSlot: '2'
9 changes: 6 additions & 3 deletions tests/voq/test_fabric_reach.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def test_fabric_reach_linecards(duthosts, enum_frontend_dut_hostname,
if len(duthosts.supervisor_nodes) == 0:
logger.info("Please run the test on modular systems")
return
duthost = duthosts.supervisor_nodes[0]
logger.info("duthost: {}".format(duthost.hostname))
supervisor = duthosts.supervisor_nodes[0]
logger.info("duthost: {}".format(supervisor.hostname))

# Load the reference data file.
duthost = duthosts[enum_frontend_dut_hostname]
Expand Down Expand Up @@ -135,7 +135,10 @@ def test_fabric_reach_linecards(duthosts, enum_frontend_dut_hostname,
remoteSlot = int(referencePortData['peer slot'])
remoteAsic = int(referencePortData['peer asic'])
remoteMod = (remoteSlot - 1)*2 + remoteAsic
referenceRemoteModule = str(remoteMod)
# Get the fabric switch ID from config DB
referenceRemoteModule = supervisor.shell(
'sonic-db-cli -n asic{} CONFIG_DB HGET "DEVICE_METADATA|localhost" "switch_id"'
.format(remoteMod))["stdout"]
referenceRemotePort = referencePortData['peer lk']
pytest_assert(remoteModule == referenceRemoteModule,
"Remote module mismatch for port {}"
Expand Down

0 comments on commit 612b682

Please sign in to comment.