Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
30 changes: 28 additions & 2 deletions vslib/vpp/SwitchVpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ SwitchVpp::SwitchVpp(
SwitchStateBase(switch_id, manager, config),
m_object_db(this),
m_tunnel_mgr(this),
m_tunnel_mgr_srv6(this)
m_tunnel_mgr_srv6(this),
m_tunnel_mgr_ipip(this)
{
SWSS_LOG_ENTER();

Expand All @@ -37,7 +38,8 @@ SwitchVpp::SwitchVpp(
SwitchStateBase(switch_id, manager, config, warmBootState),
m_object_db(this),
m_tunnel_mgr(this),
m_tunnel_mgr_srv6(this)
m_tunnel_mgr_srv6(this),
m_tunnel_mgr_ipip(this)
{
SWSS_LOG_ENTER();

Expand Down Expand Up @@ -1039,6 +1041,20 @@ sai_status_t SwitchVpp::create(
return SAI_STATUS_SUCCESS;
}

if (object_type == SAI_OBJECT_TYPE_TUNNEL_TERM_TABLE_ENTRY)
{
// Check if this is an IPINIP tunnel term
for (uint32_t i = 0; i < attr_count; i++) {
if (attr_list[i].id == SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_TUNNEL_TYPE &&
attr_list[i].value.s32 == SAI_TUNNEL_TYPE_IPINIP) {
CHECK_STATUS(m_tunnel_mgr_ipip.create_ipip_tunnel_term(
serializedObjectId, switch_id, attr_count, attr_list));
break;
}
}
return create_internal(object_type, serializedObjectId, switch_id, attr_count, attr_list);
}

return create_internal(object_type, serializedObjectId, switch_id, attr_count, attr_list);
}

Expand Down Expand Up @@ -1347,6 +1363,16 @@ sai_status_t SwitchVpp::remove(
return remove_internal(object_type, serializedObjectId);
}

if (object_type == SAI_OBJECT_TYPE_TUNNEL_TERM_TABLE_ENTRY)
{
sai_status_t status = m_tunnel_mgr_ipip.remove_ipip_tunnel_term(serializedObjectId);
if (status != SAI_STATUS_SUCCESS) {
SWSS_LOG_ERROR("Failed to remove IPinIP tunnel decap term");
return status;
}
return remove_internal(object_type, serializedObjectId);
}

return remove_internal(object_type, serializedObjectId);
}

Expand Down
2 changes: 2 additions & 0 deletions vslib/vpp/SwitchVpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,10 @@ namespace saivs
std::shared_ptr<RealObjectIdManager> m_realObjectIdManager;

friend class TunnelManagerSRv6;
friend class TunnelManagerIpIp;

TunnelManagerSRv6 m_tunnel_mgr_srv6;
TunnelManagerIpIp m_tunnel_mgr_ipip;

protected: // switch capability related
virtual sai_status_t queryNextHopGroupTypeCapability(
Expand Down
5 changes: 5 additions & 0 deletions vslib/vpp/SwitchVppRif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1028,6 +1028,9 @@ sai_status_t SwitchVpp::vpp_add_del_intf_ip_addr_norif (

if (ret == 0)
{
if (is_add) {
m_tunnel_mgr_ipip.retry_pending_unnumbered(vpp_ip_prefix.prefix_addr);
}
return SAI_STATUS_SUCCESS;
}
else {
Expand Down Expand Up @@ -1187,6 +1190,8 @@ sai_status_t SwitchVpp::vpp_interface_ip_address_update (
int ret = interface_ip_address_add_del(vppIfname, &ip_route, is_add);
if (ret != 0) {
SWSS_LOG_ERROR("interface_ip_address_add returned error");
} else if (is_add) {
m_tunnel_mgr_ipip.retry_pending_unnumbered(ip_route.prefix_addr);
}

return SAI_STATUS_SUCCESS;
Expand Down
13 changes: 13 additions & 0 deletions vslib/vpp/SwitchVppUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,16 @@ void saivs::vpp_ip_addr_t_to_sai_ip_address_t(vpp_ip_addr_t& src, sai_ip_address
sizeof(sin6->sin6_addr.s6_addr));
}
}

bool saivs::sai_ip_address_equal(const sai_ip_address_t &a, const sai_ip_address_t &b)
{
SWSS_LOG_ENTER();

if (a.addr_family != b.addr_family) {
return false;
}
if (a.addr_family == SAI_IP_ADDR_FAMILY_IPV4) {
return a.addr.ip4 == b.addr.ip4;
}
return memcmp(a.addr.ip6, b.addr.ip6, sizeof(a.addr.ip6)) == 0;
}
2 changes: 2 additions & 0 deletions vslib/vpp/SwitchVppUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ namespace saivs

/* Utility function for IP addr translation from VS to SAI */
void vpp_ip_addr_t_to_sai_ip_address_t(vpp_ip_addr_t& src, sai_ip_address_t& dst);

bool sai_ip_address_equal(const sai_ip_address_t &a, const sai_ip_address_t &b);
}
Loading
Loading