Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed VS test case failures
Browse files Browse the repository at this point in the history
Vasant committed May 14, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 51f1fbb commit aa72b67
Showing 3 changed files with 24 additions and 10 deletions.
15 changes: 15 additions & 0 deletions tests/port_dpb.py
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ def __init__(self, dvs, name = None):
self._asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
self._asic_db_ptbl = swsscommon.Table(self._asic_db, "ASIC_STATE:SAI_OBJECT_TYPE_PORT")
self._counters_db = redis.Redis(unix_socket_path=self._dvs.redis_sock, db=swsscommon.COUNTERS_DB)
self._dvs_asic_db = dvs.get_asic_db()

def set_name(self, name):
self._name = name
@@ -173,13 +174,27 @@ def exists_in_app_db(self):
def sync_oid(self):
self._oid = self._counters_db.hget("COUNTERS_PORT_NAME_MAP", self.get_name())

"""
Expectation of the caller is that the port does exist in ASIC DB.
"""
def exists_in_asic_db(self):
self.sync_oid()
if self._oid is None:
return False
(status, _) = self._asic_db_ptbl.get(self._oid)
return status

"""
Expectation of the caller is that the port does NOT exists in ASIC DB.
"""
def not_exists_in_asic_db(self):
self.sync_oid()
if self._oid is None:
return True

result = self._dvs_asic_db.wait_for_deleted_entry("ASIC_STATE:SAI_OBJECT_TYPE_PORT", self._oid)
return (not bool(result))

def verify_config_db(self):
(status, fvs) = self._cfg_db_ptbl.get(self.get_name())
assert(status == True)
6 changes: 3 additions & 3 deletions tests/test_fdb_update.py
Original file line number Diff line number Diff line change
@@ -251,7 +251,7 @@ def test_FDBLearnedAndUpdated(self, dvs, testlog):
dvs.set_interface_status("Ethernet72", "down")

# remove vlan ip
self.remove_entry_tbl(dvs.cdb, "VLAN_INTERFACE", key)
dvs.remove_ip_address("Vlan6", "6.6.6.1/24")

# bring down vlan
dvs.set_interface_status("Vlan6", "down")
@@ -298,7 +298,7 @@ def test_FDBLearnedAndFlushed(self, dvs, testlog):
time.sleep(2)

# check that the FDB entries were inserted into ASIC DB
mac = get_mac_by_bridge_id(dvs, iface_2_bridge_port_id[PORT])
mac = self.get_mac_by_bridge_id(dvs, iface_2_bridge_port_id[PORT])
assert server_mac in mac

# bring down port
@@ -307,7 +307,7 @@ def test_FDBLearnedAndFlushed(self, dvs, testlog):
time.sleep(2)

# fdb should be flushed
mac = get_mac_by_bridge_id(dvs, iface_2_bridge_port_id[PORT])
mac = self.get_mac_by_bridge_id(dvs, iface_2_bridge_port_id[PORT])
assert not mac

# remove vlan ip
13 changes: 6 additions & 7 deletions tests/test_port_dpb_vlan.py
Original file line number Diff line number Diff line change
@@ -30,9 +30,8 @@ def test_dependency(self, dvs):
assert(p.exists_in_asic_db() == True)

self.dvs_vlan.remove_vlan_member(vlan, p.get_name())
time.sleep(1)
# Verify that port is deleted
assert(p.exists_in_asic_db() == False)
assert(p.not_exists_in_asic_db() == True)

#Create the port back and delete the VLAN
p.write_to_config_db()
@@ -70,7 +69,7 @@ def test_one_port_one_vlan(self, dvs):

self.dvs_vlan.remove_vlan_member(vlan, "Ethernet0")
self.dvs_vlan.get_and_verify_vlan_member_ids(0)
assert(p.exists_in_asic_db() == False)
assert(p.not_exists_in_asic_db() == True)
#print "Ethernet0 removed from VLAN and also from ASIC DB"

dpb.create_child_ports(dvs, p, 4)
@@ -99,7 +98,7 @@ def test_one_port_one_vlan(self, dvs):
self.dvs_vlan.remove_vlan_member(vlan, cp.get_name())
vlan_member_count = vlan_member_count - 1
self.dvs_vlan.get_and_verify_vlan_member_ids(vlan_member_count)
assert(cp.exists_in_asic_db() == False)
assert(cp.not_exists_in_asic_db() == True)
#print "Deleted %s from VLAN"%port_names

p.write_to_config_db()
@@ -149,7 +148,7 @@ def test_one_port_multiple_vlan(self, dvs):

self.dvs_vlan.remove_vlan_member(vlans[2], "Ethernet0")
self.dvs_vlan.get_and_verify_vlan_member_ids(0)
assert(p.exists_in_asic_db() == False)
assert(p.not_exists_in_asic_db() == True)
#print "Ethernet0 removed from VLAN102 and also from ASIC DB"

dpb.create_child_ports(dvs, p, 4)
@@ -163,7 +162,7 @@ def test_one_port_multiple_vlan(self, dvs):
cp.delete_from_config_db()
assert(cp.exists_in_config_db() == False)
assert(cp.exists_in_app_db() == False)
assert(cp.exists_in_asic_db() == False)
assert(cp.not_exists_in_asic_db() == True)
#print "Deleted %s and verified all DBs"%port_names

#Add back Ethernet0
@@ -220,7 +219,7 @@ def test_all_port_10_vlans(self, dvs):
self.dvs_vlan.remove_vlan_member(vlan_name, port_name)

self.dvs_vlan.get_and_verify_vlan_member_ids((num_ports*num_vlans)-(len(ports)*num_vlans))
assert(p.exists_in_asic_db() == False)
assert(p.not_exists_in_asic_db() == True)
#print "All %d ports are removed from all %d VLANs and deleted"%(num_ports,num_vlans)

for p in ports:

0 comments on commit aa72b67

Please sign in to comment.