diff --git a/tests/common/helpers/voq_helpers.py b/tests/common/helpers/voq_helpers.py index c5a11aa1296..574a5df4e4d 100644 --- a/tests/common/helpers/voq_helpers.py +++ b/tests/common/helpers/voq_helpers.py @@ -1102,7 +1102,12 @@ def check_neighbors_are_gone(duthosts, all_cfg_facts, per_host, asic, neighbors) asicdb_neigh_table = asicdb.dump_neighbor_table() app_neigh_table = appdb.dump_neighbor_table() - voqdb = VoqDbCli(duthosts.supervisor_nodes[0]) + if len(duthosts) == 1: + voqdb = VoqDbCli(duthosts.frontend_nodes[0]) + elif len(duthosts) > 1: + voqdb = VoqDbCli(duthosts.supervisor_nodes[0]) + else: + raise RuntimeError("Length of duthosts is:{}".format(len(duthosts))) voq_dump = voqdb.dump_neighbor_table() for neighbor in neighbors: diff --git a/tests/voq/test_voq_chassis_app_db_consistency.py b/tests/voq/test_voq_chassis_app_db_consistency.py index b4c829c397d..aee12ad4229 100644 --- a/tests/voq/test_voq_chassis_app_db_consistency.py +++ b/tests/voq/test_voq_chassis_app_db_consistency.py @@ -29,7 +29,10 @@ def verify_data_in_db(tmp_pc, pc_members, duthosts, pc_nbr_ip, duthost, pc_nbr_i # Verifcation on SYSTEM_LAG_MEMBER_TABLE voq_lag.verify_lag_member_in_chassis_db(duthosts, pc_members) # Verification on SYSTEM_NEIGH for pc_nbr_ip - voqdb = VoqDbCli(duthosts.supervisor_nodes[0]) + if len(duthosts) == 1: + voqdb = VoqDbCli(duthosts.frontend_nodes[0]) + else: + voqdb = VoqDbCli(duthosts.supervisor_nodes[0]) neigh_key = voqdb.get_neighbor_key_by_ip(pc_nbr_ip) if tmp_pc not in neigh_key: logging.error("Portchannel Neigh ip {} is not allocated to tmp portchannel {}".format(pc_nbr_ip, tmp_pc)) @@ -263,10 +266,18 @@ def get_db_dump(duthosts, duthost): chassis_app_db_sysparams = {} system_lag_id = {} key = "*SYSTEM*|*" + duthost.sonichost.hostname + "*" - chassis_app_db_result = redis_get_keys(duthosts.supervisor_nodes[0], "CHASSIS_APP_DB", key) + if len(duthosts) == 1: + chassis_app_db_result = redis_get_keys(duthosts.frontend_nodes[0], "CHASSIS_APP_DB", key) + voqdb = VoqDbCli(duthosts.frontend_nodes[0]) + elif len(duthosts) > 1: + chassis_app_db_result = redis_get_keys(duthosts.supervisor_nodes[0], "CHASSIS_APP_DB", key) + voqdb = VoqDbCli(duthosts.supervisor_nodes[0]) + else: + raise RuntimeError("Length of duthosts is:{}".format(len(duthosts))) + if chassis_app_db_result is not None: chassis_app_db_sysparams["CHASSIS_APP_DB"] = chassis_app_db_result - voqdb = VoqDbCli(duthosts.supervisor_nodes[0]) + system_lag_id["SYSTEM_LAG_ID_TABLE"] = voqdb.dump("SYSTEM_LAG_ID_TABLE")["SYSTEM_LAG_ID_TABLE"]['value'] SYSTEM_LAG_ID_SET = voqdb.dump("SYSTEM_LAG_ID_SET")["SYSTEM_LAG_ID_SET"]['value'] end = int(voqdb.dump("SYSTEM_LAG_ID_END")["SYSTEM_LAG_ID_END"]['value']) diff --git a/tests/voq/test_voq_disrupts.py b/tests/voq/test_voq_disrupts.py index 61e84d84efd..9fa83280c9e 100644 --- a/tests/voq/test_voq_disrupts.py +++ b/tests/voq/test_voq_disrupts.py @@ -169,6 +169,8 @@ def test_reboot_supervisor(duthosts, localhost, all_cfg_facts, nbrhosts, nbr_mac nbrhosts: nbrhosts fixture nbr_macs: nbr_macs fixture """ + if len(duthosts) == 1: + pytest.skip("Test only applicable for modular chassis") logger.info("=" * 80) logger.info("Precheck") logger.info("-" * 80) diff --git a/tests/voq/test_voq_fabric_capacity.py b/tests/voq/test_voq_fabric_capacity.py index 11e6ab3e266..fb964b3778f 100644 --- a/tests/voq/test_voq_fabric_capacity.py +++ b/tests/voq/test_voq_fabric_capacity.py @@ -82,13 +82,12 @@ def test_fabric_capacity(duthosts, enum_frontend_dut_hostname): # Start the test. Isolate a link and check if the capacity command get updated. # Unisolate the link and check if the capacity command get updated. - if duthost.is_multi_asic: - asicName = "asic{}".format(asic) - else: - asicName = "" try: # isolate a link on the chip - cmd = "sudo config fabric port isolate {} {}".format(shutlink, asicName) + if duthost.is_multi_asic: + cmd = "sudo config fabric port isolate {} -n asic{}".format(shutlink, asic) + else: + cmd = "sudo config fabric port isolate {}".format(shutlink) cmd_output = duthost.shell(cmd, module_ignore_errors=True)["stdout"].split("\n") # check the output of "show fabric monitor capcity" command @@ -98,7 +97,10 @@ def test_fabric_capacity(duthosts, enum_frontend_dut_hostname): "The number of opertional links should be {}".format(exp_links)) # unisolate the link so the capacity is back - cmd = "sudo config fabric port unisolate {} {}".format(shutlink, asicName) + if duthost.is_multi_asic: + cmd = "sudo config fabric port unisolate {} -n asic{}".format(shutlink, asic) + else: + cmd = "sudo config fabric port unisolate {}".format(shutlink) cmd_output = duthost.shell(cmd, module_ignore_errors=True)["stdout"].split("\n") # check the output of "show fabric monitor capcity" command @@ -108,7 +110,10 @@ def test_fabric_capacity(duthosts, enum_frontend_dut_hostname): "The number of opertional links should be {}".format(exp_links)) finally: # clean up the test - cmd = "sudo config fabric port unisolate {} {}".format(shutlink, asicName) + if duthost.is_multi_asic: + cmd = "sudo config fabric port unisolate {} -n asic{}".format(shutlink, asic) + else: + cmd = "sudo config fabric port unisolate {}".format(shutlink) cmd_output = duthost.shell(cmd, module_ignore_errors=True)["stdout"].split("\n") diff --git a/tests/voq/test_voq_ipfwd.py b/tests/voq/test_voq_ipfwd.py index 32bd31dff2e..9e0f8f89fd9 100644 --- a/tests/voq/test_voq_ipfwd.py +++ b/tests/voq/test_voq_ipfwd.py @@ -216,10 +216,21 @@ def pick_ports(duthosts, all_cfg_facts, nbrhosts, tbinfo, port_type_a="ethernet" for a_dut in duthosts: minigraph_facts = a_dut.get_extended_minigraph_facts(tbinfo) minigraph_neighbors = minigraph_facts['minigraph_neighbors'] + minigraph_portchannels = minigraph_facts['minigraph_portchannels'] + portT1_neigh = defaultdict(list) for key, value in list(minigraph_neighbors.items()): if 'T1' in value['name'] or 'LT2' in value['name']: dutA = a_dut - break + asic = value['namespace'][-1] if value['namespace'] else "0" + port = None + for port_ch, val in list(minigraph_portchannels.items()): + if key in val['members']: + port = port_ch + if not port: + port = key + if port not in portT1_neigh[asic]: + portT1_neigh[asic].append(port) + if dutA: break @@ -229,10 +240,12 @@ def pick_ports(duthosts, all_cfg_facts, nbrhosts, tbinfo, port_type_a="ethernet" for asic_index, asic_cfg in enumerate(all_cfg_facts[dutA.hostname]): cfg_facts = asic_cfg['ansible_facts'] - cfgd_intfs = cfg_facts['INTERFACE'] if 'INTERFACE' in cfg_facts else {} - cfgd_pos = cfg_facts['PORTCHANNEL_INTERFACE'] if 'PORTCHANNEL_INTERFACE' in cfg_facts else {} - eths = [intf for intf in cfgd_intfs if "ethernet" in intf.lower() and cfgd_intfs[intf] != {}] - pos = [intf for intf in cfgd_pos if "portchannel" in intf.lower()] + eths = [] + pos = [] + for asic, intf in portT1_neigh.items(): + if int(asic) == asic_index: + eths = [n for n in intf if n.startswith("Ethernet")] + pos = [n for n in intf if n.startswith("PortChannel")] if port_type_a == "ethernet": if len(eths) != 0: intfs_to_test['portA'] = get_info_for_a_port(cfg_facts, eths, version, dutA, asic_index, nbrhosts) @@ -283,23 +296,34 @@ def pick_ports(duthosts, all_cfg_facts, nbrhosts, tbinfo, port_type_a="ethernet" other_dut_to_use = None minigraph_facts = dut.get_extended_minigraph_facts(tbinfo) minigraph_neighbors = minigraph_facts['minigraph_neighbors'] + minigraph_portchannels = minigraph_facts['minigraph_portchannels'] + portT3_neigh = defaultdict(list) for key, value in list(minigraph_neighbors.items()): if 'T3' in value['name']: other_dut_to_use = dut - break + asic = value['namespace'][-1] if value['namespace'] else "0" + port = None + for port_ch, val in list(minigraph_portchannels.items()): + if key in val['members']: + port = port_ch + if not port: + port = key + if port not in portT3_neigh[asic]: + portT3_neigh[asic].append(port) if other_dut_to_use is None: # This DUT is not connected to T3 VM's - ignore it continue cfg_facts = asic_cfg['ansible_facts'] - cfgd_intfs = cfg_facts['INTERFACE'] if 'INTERFACE' in cfg_facts else {} cfgd_dev_neighbor = cfg_facts['DEVICE_NEIGHBOR'] if 'DEVICE_NEIGHBOR' in cfg_facts else {} cfgd_dev_neigh_md = cfg_facts['DEVICE_NEIGHBOR_METADATA'] if 'DEVICE_NEIGHBOR_METADATA' in cfg_facts else {} - cfgd_pos = cfg_facts['PORTCHANNEL_INTERFACE'] if 'PORTCHANNEL_INTERFACE' in cfg_facts else {} cfgd_pc_members = cfg_facts['PORTCHANNEL_MEMBER'] if 'PORTCHANNEL_MEMBER' in cfg_facts else {} - eths_orig = [intf for intf in cfgd_intfs if "ethernet" in intf.lower() and cfgd_intfs[intf] != {}] - pos = [intf for intf in cfgd_pos if "portchannel" in intf.lower()] - + eths_orig = [] + pos = [] + for asic, intf in portT3_neigh.items(): + if int(asic) == asic_index: + eths_orig = [n for n in intf if n.startswith("Ethernet")] + pos = [n for n in intf if n.startswith("PortChannel")] # Remove the interface from eths and pos if the BGP neighbor is of type RegionalHub dev_rh_neigh = [neigh for neigh in cfgd_dev_neigh_md if cfgd_dev_neigh_md[neigh]["type"] == "RegionalHub"]