Skip to content

Commit

Permalink
Add test for fabric daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeng-arista committed Oct 9, 2023
1 parent 2fc409b commit 7b73c97
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tests/test_fabric_port.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from swsscommon import swsscommon
from dvslib.dvs_database import DVSDatabase


class TestVirtualChassis(object):
def test_voq_switch_fabric_link(self, vst):
"""Test fabric link manual isolation commands in VOQ switch.
By issuing config fabric port isolation command, the value
of isolateStatus field in config_db get changed. This test validates appl_db
updates of a fabric link isolateStatus as the value in config_db changed.
"""

dvss = vst.dvss
for name in dvss.keys():
dvs = dvss[name]
# Get the config info
config_db = dvs.get_config_db()
metatbl = config_db.get_entry("DEVICE_METADATA", "localhost")

cfg_switch_type = metatbl.get("switch_type")
if cfg_switch_type == "fabric":

# get config_db information
cdb = dvs.get_config_db()
# check if the link isolateStatus in config_db is False as a start value.
cdb.wait_for_field_match("FABRIC_PORT", "Fabric1", {"isolateStatus": "False"})

# set config_db to isolateStatus: True
cdb.update_entry("FABRIC_PORT", "Fabric1", {"isolateStatus": "True"})
cdb.wait_for_field_match("FABRIC_PORT", "Fabric1", {"isolateStatus": "True"})

# check if appl_db value changes to isolateStatus: True
adb = dvs.get_app_db()
adb.wait_for_field_match("FABRIC_PORT_TABLE", "Fabric1", {"isolateStatus": "True"})

# cleanup
cdb.update_entry("FABRIC_PORT", "Fabric1", {"isolateStatus": "False"})
cdb.wait_for_field_match("FABRIC_PORT", "Fabric1", {"isolateStatus": "False"})
adb.wait_for_field_match("FABRIC_PORT_TABLE", "Fabric1", {"isolateStatus": "False"})
else:
print( "We do not check switch type:", cfg_switch_type )


# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
def test_nonflaky_dummy():
pass


0 comments on commit 7b73c97

Please sign in to comment.