From f3dc29df905cac36525d82543ad1edf211974688 Mon Sep 17 00:00:00 2001 From: Song Yuan Date: Thu, 6 May 2021 23:03:11 -0700 Subject: [PATCH] Fix inband vlan test --- tests/test_virtual_chassis.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tests/test_virtual_chassis.py b/tests/test_virtual_chassis.py index 69eafd1ee2..b524eff89c 100644 --- a/tests/test_virtual_chassis.py +++ b/tests/test_virtual_chassis.py @@ -41,9 +41,20 @@ def config_inbandif(self, vct, inbandif_name, inband_type): if cfg_switch_type == "voq": if inband_type == "port": dvs.runcmd(f"config interface startup {inbandif_name}") - config_db.create_entry("VOQ_INBAND_INTERFACE", f"{inbandif_name}", {"inband_type": f"{inband_type}"}) + config_db.create_entry("VOQ_INBAND_INTERFACE", f"{inbandif_name}", {"inband_type": f"{inband_type}"}) + else + config_db.create_entry("VOQ_INBAND_INTERFACE", f"{inbandif_name}", + {"inband_type": f"{inband_type}", "hostif_required": "0"}) + + # Wait for inband Vlan to be created in SAI + state_db = dvs.get_state_db() + result = state_db.wait_for_entry("VLAN_TABLE", f"{inbandif_name}") + assert result["state"] == "ok" + + # Vlan type hostif is not supported in VS. So create a dummy kernel intf for inband vlan. + dvs.runcmd(f"ip link add {inbandif_name} type dummy") - def del_inbandif(self, vct, inbandif_name): + def del_inbandif(self, vct, inbandif_name, inband_type): """This function deletes existing inband interface""" dvss = vct.dvss @@ -58,7 +69,9 @@ def del_inbandif(self, vct, inbandif_name): # Applicable only for line cards if cfg_switch_type == "voq": config_db.delete_entry("VOQ_INBAND_INTERFACE", f"{inbandif_name}") - + if inband_type == "vlan": + dvs.runcmd(f"ip link delete {inbandif_name}") + def test_connectivity(self, vct): if vct is None: return @@ -294,6 +307,10 @@ def do_test_chassis_system_neigh(self, vct, inband_type): encap_index = test_neigh_entry_attrs["SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX"] assert encap_index != "" and encap_index != None, "VOQ encap index is not programmed in ASIC_DB" + # Router mac is published into chassis system neigh table if inband type is vlan. + if inband_type == "vlan": + test_neigh_mac = metatbl.get("mac").upper() + break # Verify neighbor record syncing with encap index @@ -470,7 +487,7 @@ def do_test_chassis_system_neigh(self, vct, inband_type): break # Cleanup inband if configuration - self.del_inbandif(vct, inbandif_name) + self.del_inbandif(vct, inbandif_name, inband_type) def test_chassis_system_neigh_with_inband_port(self, vct): """Test neigh record create/delete and syncing to chassis app db with inband port.