Skip to content

Commit

Permalink
Fix inband vlan test
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmanman committed May 7, 2021
1 parent cdf5f36 commit f3dc29d
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions tests/test_virtual_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit f3dc29d

Please sign in to comment.