diff --git a/orchagent/vxlanorch.cpp b/orchagent/vxlanorch.cpp index 7850727bd2..579fd0ba2d 100644 --- a/orchagent/vxlanorch.cpp +++ b/orchagent/vxlanorch.cpp @@ -494,67 +494,6 @@ VxlanTunnel::~VxlanTunnel() src_creation_, false); } -bool VxlanTunnel::createTunnel(MAP_T encap, MAP_T decap, uint8_t encap_ttl) -{ - try - { - VxlanTunnelOrch* tunnel_orch = gDirectory.get(); - sai_ip_address_t ips, ipd, *ip=nullptr; - uint8_t mapper_list = 0; - swss::copy(ips, src_ip_); - - // Only a single mapper type is created - - if (decap == MAP_T::VNI_TO_BRIDGE) - { - TUNNELMAP_SET_BRIDGE(mapper_list); - } - else if (decap == MAP_T::VNI_TO_VLAN_ID) - { - TUNNELMAP_SET_VLAN(mapper_list); - } - else - { - TUNNELMAP_SET_VRF(mapper_list); - } - - createMapperHw(mapper_list, (encap == MAP_T::MAP_TO_INVALID) ? - TUNNEL_MAP_USE_DECAP_ONLY: TUNNEL_MAP_USE_DEDICATED_ENCAP_DECAP); - - if (encap != MAP_T::MAP_TO_INVALID) - { - ip = &ips; - } - - ids_.tunnel_id = create_tunnel(&ids_, ip, NULL, gUnderlayIfId, false, encap_ttl); - - if (ids_.tunnel_id != SAI_NULL_OBJECT_ID) - { - tunnel_orch->addTunnelToFlexCounter(ids_.tunnel_id, tunnel_name_); - } - - ip = nullptr; - if (!dst_ip_.isZero()) - { - swss::copy(ipd, dst_ip_); - ip = &ipd; - } - - ids_.tunnel_term_id = create_tunnel_termination(ids_.tunnel_id, ips, ip, gVirtualRouterId); - active_ = true; - tunnel_map_ = { encap, decap }; - } - catch (const std::runtime_error& error) - { - SWSS_LOG_ERROR("Error creating tunnel %s: %s", tunnel_name_.c_str(), error.what()); - // FIXME: add code to remove already created objects - return false; - } - - SWSS_LOG_NOTICE("Vxlan tunnel '%s' was created", tunnel_name_.c_str()); - return true; -} - sai_object_id_t VxlanTunnel::addEncapMapperEntry(sai_object_id_t obj, uint32_t vni, tunnel_map_type_t type) { const auto encap_id = getEncapMapId(type); @@ -2013,7 +1952,6 @@ bool VxlanTunnelMapOrch::addOperation(const Request& request) if (!tunnel_obj->isActive()) { //@Todo, currently only decap mapper is allowed - //tunnel_obj->createTunnel(MAP_T::MAP_TO_INVALID, MAP_T::VNI_TO_VLAN_ID); uint8_t mapper_list = 0; TUNNELMAP_SET_VLAN(mapper_list); TUNNELMAP_SET_VRF(mapper_list); @@ -2218,7 +2156,19 @@ bool VxlanVrfMapOrch::addOperation(const Request& request) { if (!tunnel_obj->isActive()) { - tunnel_obj->createTunnel(MAP_T::VRID_TO_VNI, MAP_T::VNI_TO_VRID); + uint8_t mapper_list = 0; + TUNNELMAP_SET_VLAN(mapper_list); + TUNNELMAP_SET_VRF(mapper_list); + tunnel_obj->createTunnelHw(mapper_list,TUNNEL_MAP_USE_DEDICATED_ENCAP_DECAP); + Port tunPort; + auto src_vtep = tunnel_obj->getSrcIP().to_string(); + if (!tunnel_orch->getTunnelPort(src_vtep, tunPort, true)) + { + auto port_tunnel_name = tunnel_orch->getTunnelPortName(src_vtep, true); + gPortsOrch->addTunnel(port_tunnel_name, tunnel_obj->getTunnelId(), false); + gPortsOrch->getPort(port_tunnel_name,tunPort); + gPortsOrch->addBridgePort(tunPort); + } } vrf_id = vrf_orch->getVRFid(vrf_name); } diff --git a/orchagent/vxlanorch.h b/orchagent/vxlanorch.h index 0b56e76faa..84a23df2e9 100644 --- a/orchagent/vxlanorch.h +++ b/orchagent/vxlanorch.h @@ -149,7 +149,6 @@ class VxlanTunnel return active_; } - bool createTunnel(MAP_T encap, MAP_T decap, uint8_t encap_ttl=0); sai_object_id_t addEncapMapperEntry(sai_object_id_t obj, uint32_t vni, tunnel_map_type_t type=TUNNEL_MAP_T_VIRTUAL_ROUTER); sai_object_id_t addDecapMapperEntry(sai_object_id_t obj, uint32_t vni, diff --git a/tests/test_evpn_l3_vxlan_p2mp.py b/tests/test_evpn_l3_vxlan_p2mp.py index c704cb3788..449c801d9a 100644 --- a/tests/test_evpn_l3_vxlan_p2mp.py +++ b/tests/test_evpn_l3_vxlan_p2mp.py @@ -37,12 +37,12 @@ def test_sip_tunnel_vrf_vni_map(self, dvs, testlog): vxlan_obj.create_vxlan_tunnel(dvs, tunnel_name, '6.6.6.6') vxlan_obj.create_evpn_nvo(dvs, 'nvo1', tunnel_name) - print ("\tCreate Vlan-VNI map and VRF-VNI map") - vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100') - vxlan_obj.create_vrf(dvs, "Vrf-RED") vxlan_obj.create_vxlan_vrf_tunnel_map(dvs, 'Vrf-RED', '1000') + print ("\tCreate Vlan-VNI map and VRF-VNI map") + vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100') + print ("\tTesting VRF-VNI map in APP DB") vlanlist = ['100'] vnilist = ['1000']