Skip to content

Commit 168bd3b

Browse files
authored
[EVPN]Modified tunnel creation logic when creating tunnel in VRF-VNI map creation flow (#2404)
Same as PR #2387 - What I did To fix issue sonic-net/sonic-buildimage#11428 Modified the logic of tunnel map creation to create tunnel with tunnel map for vlan-vni map in addition to vrf-vni map when tunnel is created first time in the VRF-VNI map processing flow. Modified the tunnel stats interval to 10 sec Modified the logic to create bridge port for p2mp tunnel only when p2p tunnel is not supported - Why I did it During the configuration phase when VRF-VNI map arrives before VLAN-VNI map, the tunnel is created without a tunnel map for vlan-vni membership. This is problematic when VLAN to VNI map arrives later, tunnel map entry cannot be created since the tunnel map doesn't exist and its a create only attribute in SAI. - How I verified it Modified UT to add VRF-VNI map first and VLAN-VLAN map later
1 parent 2489ad5 commit 168bd3b

File tree

5 files changed

+100
-148
lines changed

5 files changed

+100
-148
lines changed

orchagent/vxlanorch.cpp

+48-92
Original file line numberDiff line numberDiff line change
@@ -494,67 +494,6 @@ VxlanTunnel::~VxlanTunnel()
494494
src_creation_, false);
495495
}
496496

497-
bool VxlanTunnel::createTunnel(MAP_T encap, MAP_T decap, uint8_t encap_ttl)
498-
{
499-
try
500-
{
501-
VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();
502-
sai_ip_address_t ips, ipd, *ip=nullptr;
503-
uint8_t mapper_list = 0;
504-
swss::copy(ips, src_ip_);
505-
506-
// Only a single mapper type is created
507-
508-
if (decap == MAP_T::VNI_TO_BRIDGE)
509-
{
510-
TUNNELMAP_SET_BRIDGE(mapper_list);
511-
}
512-
else if (decap == MAP_T::VNI_TO_VLAN_ID)
513-
{
514-
TUNNELMAP_SET_VLAN(mapper_list);
515-
}
516-
else
517-
{
518-
TUNNELMAP_SET_VRF(mapper_list);
519-
}
520-
521-
createMapperHw(mapper_list, (encap == MAP_T::MAP_TO_INVALID) ?
522-
TUNNEL_MAP_USE_DECAP_ONLY: TUNNEL_MAP_USE_DEDICATED_ENCAP_DECAP);
523-
524-
if (encap != MAP_T::MAP_TO_INVALID)
525-
{
526-
ip = &ips;
527-
}
528-
529-
ids_.tunnel_id = create_tunnel(&ids_, ip, NULL, gUnderlayIfId, false, encap_ttl);
530-
531-
if (ids_.tunnel_id != SAI_NULL_OBJECT_ID)
532-
{
533-
tunnel_orch->addTunnelToFlexCounter(ids_.tunnel_id, tunnel_name_);
534-
}
535-
536-
ip = nullptr;
537-
if (!dst_ip_.isZero())
538-
{
539-
swss::copy(ipd, dst_ip_);
540-
ip = &ipd;
541-
}
542-
543-
ids_.tunnel_term_id = create_tunnel_termination(ids_.tunnel_id, ips, ip, gVirtualRouterId);
544-
active_ = true;
545-
tunnel_map_ = { encap, decap };
546-
}
547-
catch (const std::runtime_error& error)
548-
{
549-
SWSS_LOG_ERROR("Error creating tunnel %s: %s", tunnel_name_.c_str(), error.what());
550-
// FIXME: add code to remove already created objects
551-
return false;
552-
}
553-
554-
SWSS_LOG_NOTICE("Vxlan tunnel '%s' was created", tunnel_name_.c_str());
555-
return true;
556-
}
557-
558497
sai_object_id_t VxlanTunnel::addEncapMapperEntry(sai_object_id_t obj, uint32_t vni, tunnel_map_type_t type)
559498
{
560499
const auto encap_id = getEncapMapId(type);
@@ -1924,20 +1863,18 @@ bool VxlanTunnel::isTunnelReferenced()
19241863
Port tunnelPort;
19251864
bool dip_tunnels_used = tunnel_orch->isDipTunnelsSupported();
19261865

1927-
ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
1928-
if (!ret)
1929-
{
1930-
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
1931-
return false;
1932-
}
1933-
1934-
19351866
if (dip_tunnels_used)
19361867
{
19371868
return (getDipTunnelCnt() != 0);
19381869
}
19391870
else
19401871
{
1872+
ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
1873+
if (!ret)
1874+
{
1875+
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
1876+
return false;
1877+
}
19411878
if (tunnelPort.m_fdb_count != 0)
19421879
{
19431880
return true;
@@ -2013,19 +1950,21 @@ bool VxlanTunnelMapOrch::addOperation(const Request& request)
20131950
if (!tunnel_obj->isActive())
20141951
{
20151952
//@Todo, currently only decap mapper is allowed
2016-
//tunnel_obj->createTunnel(MAP_T::MAP_TO_INVALID, MAP_T::VNI_TO_VLAN_ID);
20171953
uint8_t mapper_list = 0;
20181954
TUNNELMAP_SET_VLAN(mapper_list);
20191955
TUNNELMAP_SET_VRF(mapper_list);
20201956
tunnel_obj->createTunnelHw(mapper_list,TUNNEL_MAP_USE_DEDICATED_ENCAP_DECAP);
2021-
Port tunPort;
2022-
auto src_vtep = tunnel_obj->getSrcIP().to_string();
2023-
if (!tunnel_orch->getTunnelPort(src_vtep, tunPort, true))
1957+
if (!tunnel_orch->isDipTunnelsSupported())
20241958
{
2025-
auto port_tunnel_name = tunnel_orch->getTunnelPortName(src_vtep, true);
2026-
gPortsOrch->addTunnel(port_tunnel_name, tunnel_obj->getTunnelId(), false);
2027-
gPortsOrch->getPort(port_tunnel_name,tunPort);
2028-
gPortsOrch->addBridgePort(tunPort);
1959+
Port tunPort;
1960+
auto src_vtep = tunnel_obj->getSrcIP().to_string();
1961+
if (!tunnel_orch->getTunnelPort(src_vtep, tunPort, true))
1962+
{
1963+
auto port_tunnel_name = tunnel_orch->getTunnelPortName(src_vtep, true);
1964+
gPortsOrch->addTunnel(port_tunnel_name, tunnel_obj->getTunnelId(), false);
1965+
gPortsOrch->getPort(port_tunnel_name,tunPort);
1966+
gPortsOrch->addBridgePort(tunPort);
1967+
}
20291968
}
20301969
}
20311970

@@ -2117,26 +2056,27 @@ bool VxlanTunnelMapOrch::delOperation(const Request& request)
21172056
auto port_tunnel_name = tunnel_orch->getTunnelPortName(src_vtep, true);
21182057
bool ret;
21192058

2120-
ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
21212059
// If there are Dynamic DIP Tunnels referring to this SIP Tunnel
21222060
// then mark it as pending for delete.
21232061
if (!tunnel_obj->isTunnelReferenced())
21242062
{
2125-
if (!ret)
2063+
if (!tunnel_orch->isDipTunnelsSupported())
21262064
{
2127-
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
2128-
return true;
2065+
ret = gPortsOrch->getPort(port_tunnel_name, tunnelPort);
2066+
if (!ret)
2067+
{
2068+
SWSS_LOG_ERROR("Get port failed for source vtep %s", port_tunnel_name.c_str());
2069+
return true;
2070+
}
2071+
ret = gPortsOrch->removeBridgePort(tunnelPort);
2072+
if (!ret)
2073+
{
2074+
SWSS_LOG_ERROR("Remove Bridge port failed for source vtep = %s fdbcount = %d",
2075+
port_tunnel_name.c_str(), tunnelPort.m_fdb_count);
2076+
return true;
2077+
}
2078+
gPortsOrch->removeTunnel(tunnelPort);
21292079
}
2130-
ret = gPortsOrch->removeBridgePort(tunnelPort);
2131-
if (!ret)
2132-
{
2133-
SWSS_LOG_ERROR("Remove Bridge port failed for source vtep = %s fdbcount = %d",
2134-
port_tunnel_name.c_str(), tunnelPort.m_fdb_count);
2135-
return true;
2136-
}
2137-
2138-
gPortsOrch->removeTunnel(tunnelPort);
2139-
21402080
uint8_t mapper_list=0;
21412081
TUNNELMAP_SET_VLAN(mapper_list);
21422082
TUNNELMAP_SET_VRF(mapper_list);
@@ -2152,6 +2092,7 @@ bool VxlanTunnelMapOrch::delOperation(const Request& request)
21522092
}
21532093
else
21542094
{
2095+
gPortsOrch->getPort(port_tunnel_name, tunnelPort);
21552096
SWSS_LOG_WARN("Postponing the SIP Tunnel HW deletion Remote reference count = %d",
21562097
gPortsOrch->getBridgePortReferenceCount(tunnelPort));
21572098
}
@@ -2218,7 +2159,22 @@ bool VxlanVrfMapOrch::addOperation(const Request& request)
22182159
{
22192160
if (!tunnel_obj->isActive())
22202161
{
2221-
tunnel_obj->createTunnel(MAP_T::VRID_TO_VNI, MAP_T::VNI_TO_VRID);
2162+
uint8_t mapper_list = 0;
2163+
TUNNELMAP_SET_VLAN(mapper_list);
2164+
TUNNELMAP_SET_VRF(mapper_list);
2165+
tunnel_obj->createTunnelHw(mapper_list,TUNNEL_MAP_USE_DEDICATED_ENCAP_DECAP);
2166+
if (!tunnel_orch->isDipTunnelsSupported())
2167+
{
2168+
Port tunPort;
2169+
auto src_vtep = tunnel_obj->getSrcIP().to_string();
2170+
if (!tunnel_orch->getTunnelPort(src_vtep, tunPort, true))
2171+
{
2172+
auto port_tunnel_name = tunnel_orch->getTunnelPortName(src_vtep, true);
2173+
gPortsOrch->addTunnel(port_tunnel_name, tunnel_obj->getTunnelId(), false);
2174+
gPortsOrch->getPort(port_tunnel_name,tunPort);
2175+
gPortsOrch->addBridgePort(tunPort);
2176+
}
2177+
}
22222178
}
22232179
vrf_id = vrf_orch->getVRFid(vrf_name);
22242180
}

orchagent/vxlanorch.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ typedef enum
3737
#define IS_TUNNELMAP_SET_BRIDGE(x) ((x)& (1<<TUNNEL_MAP_T_BRIDGE))
3838

3939
#define TUNNEL_STAT_COUNTER_FLEX_COUNTER_GROUP "TUNNEL_STAT_COUNTER"
40-
#define TUNNEL_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS 1000
40+
#define TUNNEL_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS 10000
4141
#define LOCAL_TUNNEL_PORT_PREFIX "Port_SRC_VTEP_"
4242
#define EVPN_TUNNEL_PORT_PREFIX "Port_EVPN_"
4343
#define EVPN_TUNNEL_NAME_PREFIX "EVPN_"
@@ -149,7 +149,6 @@ class VxlanTunnel
149149
return active_;
150150
}
151151

152-
bool createTunnel(MAP_T encap, MAP_T decap, uint8_t encap_ttl=0);
153152
sai_object_id_t addEncapMapperEntry(sai_object_id_t obj, uint32_t vni,
154153
tunnel_map_type_t type=TUNNEL_MAP_T_VIRTUAL_ROUTER);
155154
sai_object_id_t addDecapMapperEntry(sai_object_id_t obj, uint32_t vni,

tests/evpn_tunnel.py

+36-39
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def check_vxlan_tunnel_map_entry(self, dvs, tunnel_name, vidlist, vnidlist):
485485
(exitcode, out) = dvs.runcmd(iplinkcmd)
486486
assert exitcode == 0, "Kernel device not created"
487487

488-
def check_vxlan_sip_tunnel_delete(self, dvs, tunnel_name, sip):
488+
def check_vxlan_sip_tunnel_delete(self, dvs, tunnel_name, sip, ignore_bp = True):
489489
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
490490
app_db = swsscommon.DBConnector(swsscommon.APPL_DB, dvs.redis_sock, 0)
491491

@@ -511,36 +511,35 @@ def check_vxlan_sip_tunnel_delete(self, dvs, tunnel_name, sip):
511511
status, fvs = tbl.get(self.tunnel_map_map[tunnel_name][3])
512512
assert status == False, "SIP Tunnel mapper3 not deleted from ASIC_DB"
513513

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

518-
def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, dst_ip = '0.0.0.0', skip_dst_ip = 'True'):
519+
def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist,
520+
dst_ip = '0.0.0.0', skip_dst_ip = 'True', ignore_bp = True):
519521
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
520522
app_db = swsscommon.DBConnector(swsscommon.APPL_DB, dvs.redis_sock, 0)
521523

522524
tunnel_map_id = self.helper.get_created_entries(asic_db, self.ASIC_TUNNEL_MAP, self.tunnel_map_ids, 4)
523525
tunnel_id = self.helper.get_created_entry(asic_db, self.ASIC_TUNNEL_TABLE, self.tunnel_ids)
524526
tunnel_term_id = self.helper.get_created_entry(asic_db, self.ASIC_TUNNEL_TERM_ENTRY, self.tunnel_term_ids)
525-
tunnel_map_entry_id = self.helper.get_created_entries(asic_db, self.ASIC_TUNNEL_MAP_ENTRY, self.tunnel_map_entry_ids, 3)
526527

527528
# check that the vxlan tunnel termination are there
528529
assert self.helper.how_many_entries_exist(asic_db, self.ASIC_TUNNEL_MAP) == (len(self.tunnel_map_ids) + 4), "The TUNNEL_MAP wasn't created"
529530
assert self.helper.how_many_entries_exist(asic_db, self.ASIC_TUNNEL_MAP_ENTRY) == (len(self.tunnel_map_entry_ids) + 3), "The TUNNEL_MAP_ENTRY is created"
530531
assert self.helper.how_many_entries_exist(asic_db, self.ASIC_TUNNEL_TABLE) == (len(self.tunnel_ids) + 1), "The TUNNEL wasn't created"
531532
assert self.helper.how_many_entries_exist(asic_db, self.ASIC_TUNNEL_TERM_ENTRY) == (len(self.tunnel_term_ids) + 1), "The TUNNEL_TERM_TABLE_ENTRY wasm't created"
532533

533-
self.helper.check_object(asic_db, self.ASIC_TUNNEL_MAP, tunnel_map_id[2],
534-
{
535-
'SAI_TUNNEL_MAP_ATTR_TYPE': 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID',
536-
}
537-
)
534+
expected_attributes_1 = {}
535+
expected_attributes_1['SAI_TUNNEL_MAP_ATTR_TYPE'] = 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID'
536+
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_TUNNEL_MAP, expected_attributes_1)
537+
assert len(ret) == 1, "Unexpected number of tunnel maps created for type SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID"
538+
539+
expected_attributes_1['SAI_TUNNEL_MAP_ATTR_TYPE'] = 'SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI'
540+
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_TUNNEL_MAP, expected_attributes_1)
541+
assert len(ret) == 1, "Unexpected number of tunnel maps created for type SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI"
538542

539-
self.helper.check_object(asic_db, self.ASIC_TUNNEL_MAP, tunnel_map_id[3],
540-
{
541-
'SAI_TUNNEL_MAP_ATTR_TYPE': 'SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI',
542-
}
543-
)
544543

545544
decapstr = '2:' + tunnel_map_id[0] + ',' + tunnel_map_id[2]
546545
encapstr = '2:' + tunnel_map_id[1] + ',' + tunnel_map_id[3]
@@ -571,15 +570,15 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, ds
571570

572571
expected_attributes_1 = {
573572
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP_TYPE': 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VLAN_ID',
574-
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP': tunnel_map_id[0],
575573
'SAI_TUNNEL_MAP_ENTRY_ATTR_VLAN_ID_VALUE': vidlist[0],
576574
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY': vnidlist[0],
577575
}
578576

579577
for x in range(len(vidlist)):
580578
expected_attributes_1['SAI_TUNNEL_MAP_ENTRY_ATTR_VLAN_ID_VALUE'] = vidlist[x]
581579
expected_attributes_1['SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY'] = vnidlist[x]
582-
self.helper.check_object(asic_db, self.ASIC_TUNNEL_MAP_ENTRY, tunnel_map_entry_id[x], expected_attributes_1)
580+
self.helper.get_key_with_attr(asic_db, self.ASIC_TUNNEL_MAP_ENTRY, expected_attributes_1)
581+
assert len(ret) == 1, "Unexpected number of tunnel map entries created for VLAN to VNI mapping"
583582

584583
expected_siptnl_attributes = {
585584
'src_ip': src_ip,
@@ -593,16 +592,18 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist, ds
593592
assert len(ret) == 1, "More than 1 Tunn statetable entry created"
594593
self.tunnel_appdb[tunnel_name] = ret[0]
595594

596-
expected_bridgeport_attributes = {
597-
'SAI_BRIDGE_PORT_ATTR_TYPE': 'SAI_BRIDGE_PORT_TYPE_TUNNEL',
598-
'SAI_BRIDGE_PORT_ATTR_TUNNEL_ID': tunnel_id,
599-
'SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE': 'SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE',
600-
'SAI_BRIDGE_PORT_ATTR_ADMIN_STATE': 'true',
601-
}
602-
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_BRIDGE_PORT, expected_bridgeport_attributes)
603-
assert len(ret) > 0, "Bridgeport entry not created"
604-
assert len(ret) == 1, "More than 1 bridgeport entry created"
605-
self.bridgeport_map[src_ip] = ret[0]
595+
if not ignore_bp:
596+
expected_bridgeport_attributes = {
597+
'SAI_BRIDGE_PORT_ATTR_TYPE': 'SAI_BRIDGE_PORT_TYPE_TUNNEL',
598+
'SAI_BRIDGE_PORT_ATTR_TUNNEL_ID': tunnel_id,
599+
'SAI_BRIDGE_PORT_ATTR_FDB_LEARNING_MODE': 'SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE',
600+
'SAI_BRIDGE_PORT_ATTR_ADMIN_STATE': 'true',
601+
}
602+
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_BRIDGE_PORT, expected_bridgeport_attributes)
603+
assert len(ret) > 0, "Bridgeport entry not created"
604+
assert len(ret) == 1, "More than 1 bridgeport entry created"
605+
self.bridgeport_map[src_ip] = ret[0]
606+
606607
self.tunnel_map_ids.update(tunnel_map_id)
607608
self.tunnel_ids.add(tunnel_id)
608609
self.tunnel_term_ids.add(tunnel_term_id)
@@ -797,37 +798,33 @@ def check_vxlan_tunnel_entry(self, dvs, tunnel_name, vnet_name, vni_id):
797798
def check_vxlan_tunnel_vrf_map_entry(self, dvs, tunnel_name, vrf_name, vni_id):
798799
asic_db = swsscommon.DBConnector(swsscommon.ASIC_DB, dvs.redis_sock, 0)
799800

800-
if (self.tunnel_map_map.get(tunnel_name) is None):
801-
tunnel_map_id = self.helper.get_created_entries(asic_db, self.ASIC_TUNNEL_MAP, self.tunnel_map_ids, 4)
802-
else:
803-
tunnel_map_id = self.tunnel_map_map[tunnel_name]
804-
805801
tunnel_map_entry_id = self.helper.get_created_entries(asic_db, self.ASIC_TUNNEL_MAP_ENTRY, self.tunnel_map_entry_ids, 3)
806802

807803
# check that the vxlan tunnel termination are there
808804
assert self.helper.how_many_entries_exist(asic_db, self.ASIC_TUNNEL_MAP_ENTRY) == (len(self.tunnel_map_entry_ids) + 3), "The TUNNEL_MAP_ENTRY is created too early"
809805

810-
self.helper.check_object(asic_db, self.ASIC_TUNNEL_MAP_ENTRY, tunnel_map_entry_id[1],
806+
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_TUNNEL_MAP_ENTRY,
811807
{
812808
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP_TYPE': 'SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI',
813-
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP': tunnel_map_id[3],
814809
'SAI_TUNNEL_MAP_ENTRY_ATTR_VIRTUAL_ROUTER_ID_KEY': self.vr_map[vrf_name].get('ing'),
815810
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_VALUE': vni_id,
816811
}
817812
)
818813

819-
self.tunnel_map_vrf_entry_ids.update(tunnel_map_entry_id[1])
814+
assert len(ret) == 1, "Invalid number of tunnel map entries for SAI_TUNNEL_MAP_TYPE_VIRTUAL_ROUTER_ID_TO_VNI"
815+
816+
self.tunnel_map_vrf_entry_ids.update(ret[0])
820817

821-
self.helper.check_object(asic_db, self.ASIC_TUNNEL_MAP_ENTRY, tunnel_map_entry_id[2],
818+
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_TUNNEL_MAP_ENTRY,
822819
{
823820
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP_TYPE': 'SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID',
824-
'SAI_TUNNEL_MAP_ENTRY_ATTR_TUNNEL_MAP': tunnel_map_id[2],
825821
'SAI_TUNNEL_MAP_ENTRY_ATTR_VNI_ID_KEY': vni_id,
826822
'SAI_TUNNEL_MAP_ENTRY_ATTR_VIRTUAL_ROUTER_ID_VALUE': self.vr_map[vrf_name].get('egr'),
827823
}
828824
)
829825

830-
self.tunnel_map_vrf_entry_ids.update(tunnel_map_entry_id[2])
826+
assert len(ret) == 1, "Invalid number of tunnel map entries for SAI_TUNNEL_MAP_TYPE_VNI_TO_VIRTUAL_ROUTER_ID"
827+
self.tunnel_map_vrf_entry_ids.update(ret[0])
831828
self.tunnel_map_entry_ids.update(tunnel_map_entry_id)
832829

833830
def check_vxlan_tunnel_vrf_map_entry_remove(self, dvs, tunnel_name, vrf_name, vni_id):

0 commit comments

Comments
 (0)