Skip to content

Commit

Permalink
Fixing UT issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsudharsan committed Aug 2, 2022
1 parent 29a3294 commit 86f3ec3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
44 changes: 22 additions & 22 deletions orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1863,20 +1863,18 @@ bool VxlanTunnel::isTunnelReferenced()
Port tunnelPort;
bool dip_tunnels_used = tunnel_orch->isDipTunnelsSupported();

ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
if (!ret)
{
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
return false;
}


if (dip_tunnels_used)
{
return (getDipTunnelCnt() != 0);
}
else
{
ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
if (!ret)
{
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
return false;
}
if (tunnelPort.m_fdb_count != 0)
{
return true;
Expand Down Expand Up @@ -2058,26 +2056,27 @@ bool VxlanTunnelMapOrch::delOperation(const Request& request)
auto port_tunnel_name = tunnel_orch->getTunnelPortName(src_vtep, true);
bool ret;

ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
// If there are Dynamic DIP Tunnels referring to this SIP Tunnel
// then mark it as pending for delete.
if (!tunnel_obj->isTunnelReferenced())
{
if (!ret)
{
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
return true;
}
ret = gPortsOrch->removeBridgePort(tunnelPort);
if (!ret)
if (!tunnel_orch->isDipTunnelsSupported())
{
SWSS_LOG_ERROR("Remove Bridge port failed for source vtep = %s fdbcount = %d",
port_tunnel_name.c_str(), tunnelPort.m_fdb_count);
return true;
ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
if (!ret)
{
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
return true;
}
ret = gPortsOrch->removeBridgePort(tunnelPort);
if (!ret)
{
SWSS_LOG_ERROR("Remove Bridge port failed for source vtep = %s fdbcount = %d",
port_tunnel_name.c_str(), tunnelPort.m_fdb_count);
return true;
}
gPortsOrch->removeTunnel(tunnelPort);
}

gPortsOrch->removeTunnel(tunnelPort);

uint8_t mapper_list=0;
TUNNELMAP_SET_VLAN(mapper_list);
TUNNELMAP_SET_VRF(mapper_list);
Expand All @@ -2093,6 +2092,7 @@ bool VxlanTunnelMapOrch::delOperation(const Request& request)
}
else
{
gPortsOrch->getPort(port_tunnel_name, tunnelPort);
SWSS_LOG_WARN("Postponing the SIP Tunnel HW deletion Remote reference count = %d",
gPortsOrch->getBridgePortReferenceCount(tunnelPort));
}
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, False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=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', False)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=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, False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=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', False)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=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, False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=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', False)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=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, False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=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', False)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=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, False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=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', False)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=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, False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=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', False)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=False)

0 comments on commit 86f3ec3

Please sign in to comment.