Skip to content

Commit

Permalink
Modifying UT to ignore bridge port for p2p supported flow
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsudharsan committed Aug 2, 2022
1 parent eafa891 commit 29a3294
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
34 changes: 19 additions & 15 deletions tests/evpn_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def check_vxlan_tunnel_map_entry(self, dvs, tunnel_name, vidlist, vnidlist):
(exitcode, out) = dvs.runcmd(iplinkcmd)
assert exitcode == 0, "Kernel device not created"

def check_vxlan_sip_tunnel_delete(self, dvs, tunnel_name, sip):
def check_vxlan_sip_tunnel_delete(self, dvs, tunnel_name, sip, ignore_bp = True):
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
app_db = swsscommon.DBConnector(swsscommon.APPL_DB, dvs.redis_sock, 0)

Expand All @@ -511,11 +511,13 @@ def check_vxlan_sip_tunnel_delete(self, dvs, tunnel_name, sip):
status, fvs = tbl.get(self.tunnel_map_map[tunnel_name][3])
assert status == False, "SIP Tunnel mapper3 not deleted from ASIC_DB"

tbl = swsscommon.Table(asic_db, self.ASIC_BRIDGE_PORT)
status, fvs = tbl.get(self.bridgeport_map[sip])
assert status == False, "Tunnel bridgeport entry not deleted"
if not ignore_bp:
tbl = swsscommon.Table(asic_db, self.ASIC_BRIDGE_PORT)
status, fvs = tbl.get(self.bridgeport_map[sip])
assert status == False, "Tunnel bridgeport entry not deleted"

def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, dst_ip = '0.0.0.0', skip_dst_ip = 'True'):
def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist,
dst_ip = '0.0.0.0', skip_dst_ip = 'True', ignore_bp = True):
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
app_db = swsscommon.DBConnector(swsscommon.APPL_DB, dvs.redis_sock, 0)

Expand Down Expand Up @@ -590,16 +592,18 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, ds
assert len(ret) == 1, "More than 1 Tunn statetable entry created"
self.tunnel_appdb[tunnel_name] = ret[0]

expected_bridgeport_attributes = {
'SAI_BRIDGE_PORT_ATTR_TYPE': 'SAI_BRIDGE_PORT_TYPE_TUNNEL',
'SAI_BRIDGE_PORT_ATTR_TUNNEL_ID': tunnel_id,
'SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE': 'SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE',
'SAI_BRIDGE_PORT_ATTR_ADMIN_STATE': 'true',
}
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_BRIDGE_PORT, expected_bridgeport_attributes)
assert len(ret) > 0, "Bridgeport entry not created"
assert len(ret) == 1, "More than 1 bridgeport entry created"
self.bridgeport_map[src_ip] = ret[0]
if not ignore_bp:
expected_bridgeport_attributes = {
'SAI_BRIDGE_PORT_ATTR_TYPE': 'SAI_BRIDGE_PORT_TYPE_TUNNEL',
'SAI_BRIDGE_PORT_ATTR_TUNNEL_ID': tunnel_id,
'SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE': 'SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE',
'SAI_BRIDGE_PORT_ATTR_ADMIN_STATE': 'true',
}
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_BRIDGE_PORT, expected_bridgeport_attributes)
assert len(ret) > 0, "Bridgeport entry not created"
assert len(ret) == 1, "More than 1 bridgeport entry created"
self.bridgeport_map[src_ip] = ret[0]

self.tunnel_map_ids.update(tunnel_map_id)
self.tunnel_ids.add(tunnel_id)
self.tunnel_term_ids.add(tunnel_term_id)
Expand Down
16 changes: 8 additions & 8 deletions tests/test_evpn_l3_vxlan_p2mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_sip_tunnel_vrf_vni_map(self, dvs, testlog):
helper.check_object(self.pdb, "VXLAN_VRF_TABLE", "%s:%s" % (tunnel_name, vrf_map_name), exp_attr1)

print ("\tTesting SIP Tunnel Creation")
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, False)

print ("\tTesting Tunnel Vlan VNI Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
Expand All @@ -88,7 +88,7 @@ def test_sip_tunnel_vrf_vni_map(self, dvs, testlog):
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
time.sleep(2)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', False)
vxlan_obj.remove_vlan(dvs, "100")


Expand Down Expand Up @@ -141,7 +141,7 @@ def test_prefix_route_create_remote_endpoint(self, dvs, testlog):
helper.check_object(self.pdb, "VXLAN_VRF_TABLE", "%s:%s" % (tunnel_name, vrf_map_name), exp_attr1)

print ("\tTesting SIP Tunnel Creation")
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, False)

print ("\tTesting Tunnel Vlan Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
Expand Down Expand Up @@ -179,7 +179,7 @@ def test_prefix_route_create_remote_endpoint(self, dvs, testlog):
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
time.sleep(2)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', False)
vxlan_obj.remove_vrf(dvs, "Vrf-RED")
vxlan_obj.remove_vlan_member(dvs, "100", "Ethernet24")
vxlan_obj.remove_vlan(dvs, "100")
Expand Down Expand Up @@ -233,7 +233,7 @@ def test_remote_ipv4_routes(self, dvs, testlog):
helper.check_object(self.pdb, "VXLAN_VRF_TABLE", "%s:%s" % (tunnel_name, vrf_map_name), exp_attr1)

print ("\tTesting SIP Tunnel Creation")
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, False)

print ("\tTesting Tunnel Vlan Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
Expand Down Expand Up @@ -380,7 +380,7 @@ def test_remote_ipv4_routes(self, dvs, testlog):
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
time.sleep(2)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', False)
vxlan_obj.remove_vrf(dvs, "Vrf-RED")
vxlan_obj.remove_vlan_member(dvs, "100", "Ethernet24")
vxlan_obj.remove_vlan(dvs, "100")
Expand Down Expand Up @@ -436,7 +436,7 @@ def test_remote_ipv6_routes(self, dvs, testlog):
helper.check_object(self.pdb, "VXLAN_VRF_TABLE", "%s:%s" % (tunnel_name, vrf_map_name), exp_attr1)

print ("\tTesting SIP Tunnel Creation")
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, False)

print ("\tTesting Tunnel Vlan Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
Expand Down Expand Up @@ -584,7 +584,7 @@ def test_remote_ipv6_routes(self, dvs, testlog):
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
time.sleep(2)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', False)
vxlan_obj.remove_vrf(dvs, "Vrf-RED")
vxlan_obj.remove_vlan_member(dvs, "100", "Ethernet24")
vxlan_obj.remove_vlan(dvs, "100")
Expand Down
8 changes: 4 additions & 4 deletions tests/test_evpn_tunnel_p2mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_p2mp_tunnel(self, dvs, testlog):
vnilist = ['1000', '1001', '1002']

print("Testing SIP Tunnel Creation")
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, False)

print("Testing Tunnel Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
Expand All @@ -43,7 +43,7 @@ def test_p2mp_tunnel(self, dvs, testlog):

print("Testing SIP Tunnel Deletion")
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', False)

# Test 2 - Vlan extension Tests
def test_vlan_extension(self, dvs, testlog):
Expand All @@ -62,7 +62,7 @@ def test_vlan_extension(self, dvs, testlog):
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name_2, '1002', 'Vlan102')

vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, False)
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)

vxlan_obj.create_evpn_nvo(dvs, 'nvo1', tunnel_name)
Expand Down Expand Up @@ -121,4 +121,4 @@ def test_vlan_extension(self, dvs, testlog):
print("Testing SIP Tunnel Deletion")
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', False)

0 comments on commit 29a3294

Please sign in to comment.