Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated handling of VRF_VNI mapping and VLAN_VNI mapping for same VNI ID #2538

Merged
merged 5 commits into from
Dec 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updated L3 VxLAN P2MP Test case
tapashdas committed Dec 14, 2022
commit 521aa3a41be322852f5d8c0db293f2fb64f095a0
17 changes: 16 additions & 1 deletion orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
@@ -2204,11 +2204,11 @@ bool VxlanVrfMapOrch::addOperation(const Request& request)
try
{
entry.isL2Vni = vxlan_tun_map_orch->isVniVlanMapExists(vni_id, vniVlanMapName, &tnl_map_entry_id, &vlan_id);
entry.vni_id = vni_id;
if (entry.isL2Vni)
{
entry.vniVlanMapName = vniVlanMapName;
entry.vlan_id = vlan_id;
entry.vni_id = vni_id;
remove_tunnel_map_entry(tnl_map_entry_id);
SWSS_LOG_DEBUG("remove_tunnel_map_entry name %s, vlan %d, vni %d\n", entry.vniVlanMapName.c_str(), entry.vlan_id, entry.vni_id);
}
@@ -2246,6 +2246,9 @@ bool VxlanVrfMapOrch::delOperation(const Request& request)
VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();
VxlanTunnelMapOrch* vxlan_tun_map_orch = gDirectory.get<VxlanTunnelMapOrch*>();
const auto full_map_entry_name = request.getFullKey();
std::string vniVlanMapName;
uint32_t vlan_id = 0;
sai_object_id_t tnl_map_entry_id = SAI_NULL_OBJECT_ID;

if (!isVrfMapExists(full_map_entry_name))
{
@@ -2286,6 +2289,18 @@ bool VxlanVrfMapOrch::delOperation(const Request& request)
remove_tunnel_map_entry(entry.decap_id);
vrf_orch->decreaseVrfRefCount(vrf_name);

if (!entry.isL2Vni)
{
entry.isL2Vni = vxlan_tun_map_orch->isVniVlanMapExists(entry.vni_id, vniVlanMapName, &tnl_map_entry_id, &vlan_id);
SWSS_LOG_NOTICE("VxlanVrfMapOrch vni %d, isL2Vni %d\n", entry.vni_id, entry.isL2Vni);

if (entry.isL2Vni)
{
entry.vniVlanMapName = vniVlanMapName;
entry.vlan_id = vlan_id;
SWSS_LOG_DEBUG("add_tunnel_map_entry name %s, vlan %d, vni %d\n", entry.vniVlanMapName.c_str(), entry.vlan_id, entry.vni_id);
}
}
if(entry.isL2Vni)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please have space afterif.

{
const auto tunnel_map_id = tunnel_obj->getDecapMapId(TUNNEL_MAP_T_VLAN);
2 changes: 0 additions & 2 deletions tests/evpn_tunnel.py
Original file line number Diff line number Diff line change
@@ -488,8 +488,6 @@ def check_vxlan_tunnel_map_entry(self, dvs, tunnel_name, vidlist, vnidlist):
def check_vxlan_tunnel_map_entry_removed(self, dvs, tunnel_name, vidlist, vnidlist):
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)

tbl = swsscommon.Table(asic_db, self.ASIC_TUNNEL_MAP_ENTRY)

expected_attributes_1 = {
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP_TYPE': 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VLAN_ID',
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP': self.tunnel_map_map[tunnel_name][0],
20 changes: 12 additions & 8 deletions tests/test_evpn_l3_vxlan_p2mp.py
Original file line number Diff line number Diff line change
@@ -67,10 +67,10 @@ 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, ignore_bp=False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=False, tunnel_map_entry_count=2)

print ("\tTesting Tunnel Vlan VNI Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.check_vxlan_tunnel_map_entry_removed(dvs, tunnel_name, vlanlist, vnilist)

print ("\tTesting Tunnel VRF VNI Map Entry")
vxlan_obj.check_vxlan_tunnel_vrf_map_entry(dvs, tunnel_name, 'Vrf-RED', '1000')
@@ -81,6 +81,7 @@ def test_sip_tunnel_vrf_vni_map(self, dvs, testlog):
vxlan_obj.check_vxlan_tunnel_vrf_map_entry_remove(dvs, tunnel_name, 'Vrf-RED', '1000')

print ("\tTesting Tunnel Vlan VNI Map entry removal")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
vxlan_obj.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)

@@ -141,10 +142,10 @@ 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, ignore_bp=False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=False, tunnel_map_entry_count=2)

print ("\tTesting Tunnel Vlan Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.check_vxlan_tunnel_map_entry_removed(dvs, tunnel_name, vlanlist, vnilist)

print ("\tTesting Tunnel Vrf Map Entry")
vxlan_obj.check_vxlan_tunnel_vrf_map_entry(dvs, tunnel_name, 'Vrf-RED', '1000')
@@ -172,6 +173,7 @@ def test_prefix_route_create_remote_endpoint(self, dvs, testlog):
vxlan_obj.check_del_router_interface(dvs, "Vlan100")

print ("\tTesting Tunnel Map entry removal")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
vxlan_obj.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)

@@ -233,10 +235,10 @@ 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, ignore_bp=False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=False, tunnel_map_entry_count=2)

print ("\tTesting Tunnel Vlan Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.check_vxlan_tunnel_map_entry_removed(dvs, tunnel_name, vlanlist, vnilist)

print ("\tTesting Tunnel Vrf Map Entry")
vxlan_obj.check_vxlan_tunnel_vrf_map_entry(dvs, tunnel_name, 'Vrf-RED', '1000')
@@ -373,6 +375,7 @@ def test_remote_ipv4_routes(self, dvs, testlog):
vxlan_obj.check_del_router_interface(dvs, "Vlan100")

print ("\tTesting Tunnel Map entry removal")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
vxlan_obj.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)

@@ -436,10 +439,10 @@ 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, ignore_bp=False)
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=False, tunnel_map_entry_count=2)

print ("\tTesting Tunnel Vlan Map Entry")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.check_vxlan_tunnel_map_entry_removed(dvs, tunnel_name, vlanlist, vnilist)

print ("\tTesting Tunnel Vrf Map Entry")
vxlan_obj.check_vxlan_tunnel_vrf_map_entry(dvs, tunnel_name, 'Vrf-RED', '1000')
@@ -577,6 +580,7 @@ def test_remote_ipv6_routes(self, dvs, testlog):
vxlan_obj.check_del_router_interface(dvs, "Vlan100")

print ("\tTesting Tunnel Map entry removal")
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
vxlan_obj.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)