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

VNet/Vxlan delete handling #766

Merged
merged 6 commits into from
Feb 7, 2019
Merged

VNet/Vxlan delete handling #766

merged 6 commits into from
Feb 7, 2019

Conversation

prsunny
Copy link
Collaborator

@prsunny prsunny commented Jan 24, 2019

What I did
Delete handling for VNet Routes, NH tunnels and VNets

Why I did it
To support deletion scenarios

How I verified it
Tested on DUT. VS test case would be added subsequently

Details if related
Based on design sonic-net/SONiC#324

Copy link
Collaborator

@marian-pritsak marian-pritsak left a comment

Choose a reason for hiding this comment

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

As comments


/*
* VRF Modeling and VNetVrf class definitions
*/
std::vector<VR_TYPE> vr_cntxt;

VNetVrfObject::VNetVrfObject(const std::string& vnet, string& tunnel, set<string>& peer,
vector<sai_attribute_t>& attrs) : VNetObject(tunnel, peer)
VNetVrfObject::VNetVrfObject(const std::string& vnet, string& tunnel, set<string>& peer, uint32_t vni,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it is worth considering grouping all these parameters into a single struct VnetInfo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed


if (!vxlan_orch->removeVxlanTunnelMap(vrf_obj->getTunnelName(), vrf_obj->getVni()))
{
SWSS_LOG_ERROR("VNET '%s' map delete failed", vnet_name.c_str());
Copy link
Contributor

Choose a reason for hiding this comment

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

SWSS_LOG_ERROR("VNET '%s' map delete failed", vnet_name.c_str()); [](start = 16, length = 65)

why no return false here?

return true;
}

bool subnet = (!nh.ips.getSize())?true:false;
Copy link
Contributor

Choose a reason for hiding this comment

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

subnet [](start = 9, length = 6)

->isSubnet

{
throw std::runtime_error("Route add failed");
throw std::runtime_error("Route update failed");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

what is else condition? do we need to print warning, log, ???

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The else case is handled by the Bitmap implementation. So it is left intentionally.

{
throw std::runtime_error("Route add failed");
throw std::runtime_error("Route update failed");
Copy link
Contributor

Choose a reason for hiding this comment

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

throw std::runtime_error("Route update failed"); [](start = 10, length = 50)

it looks to me it is dangerous to crash here. what if the nexthop interface is not created yet in the doRouteTask.

Copy link
Contributor

Choose a reason for hiding this comment

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

I checked the routeorch.cpp, it does not throw error, if add or delete route fails.


In reply to: 253250419 [](ancestors = 253250419)

Copy link
Contributor

Choose a reason for hiding this comment

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

it just retry.


In reply to: 253250430 [](ancestors = 253250430,253250419)

return (routes_.size() + tunnels_.size());
}

bool VNetVrfObject::getRouteNH(IpPrefix& ipPrefix, nextHop& nh)
Copy link
Contributor

Choose a reason for hiding this comment

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

-> getRouteNexthop

return true;
}

sai_object_id_t VNetVrfObject::getNextHop(tunnelEndpoint& endp)
Copy link
Contributor

Choose a reason for hiding this comment

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

getNextHop [](start = 31, length = 10)

-> getTunnelNexthop

return nh_id;
}

bool VNetVrfObject::removeNextHop(tunnelEndpoint& endp)
Copy link
Contributor

Choose a reason for hiding this comment

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

removeTunnelNexthop


if (!vxlan_orch->removeNextHopTunnel(tun_name, endp.ip, endp.mac, endp.vni))
{
SWSS_LOG_ERROR("VNET %s NH remove failed for '%s'", vnet_name_.c_str(), endp.ip.to_string().c_str());
Copy link
Contributor

Choose a reason for hiding this comment

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

NH [](start = 32, length = 2)

-> tunnel nexthop

auto tunnel_obj = getVxlanTunnel(tunnelName);

//Delete request for the nh tunnel id
return tunnel_obj->removeNHTunnel(ipAddr, macAddress, vni);
Copy link
Contributor

Choose a reason for hiding this comment

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

removeNHTunnel [](start = 23, length = 14)

since it is already a tunnel object, you do not need tunnel in the function name. -> removeNexthop

@@ -56,13 +104,23 @@ class VxlanTunnel
return ids_.tunnel_encap_id;
}

void updateNHTunnel(IpAddress& ipAddr, MacAddress macAddress, uint32_t vni, sai_object_id_t nh_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

-> updateNexthop

@lguohan
Copy link
Contributor

lguohan commented Feb 2, 2019

sai_status_t status = sai_route_api->create_route_entry(&route_entry, 1, &route_attr);

we should probably increase the crm counter.

     if (route_entry.destination.addr_family == SAI_IP_ADDR_FAMILY_IPV4)

823 {
824 gCrmOrch->incCrmResUsedCounter(CrmResourceType::CRM_IPV4_ROUTE);
825 }
826 else
827 {
828 gCrmOrch->incCrmResUsedCounter(CrmResourceType::CRM_IPV6_ROUTE);
829 }


Refers to: orchagent/vnetorch.cpp:484 in 91d77df. [](commit_id = 91d77df, deletion_comment = False)

@prsunny prsunny merged commit 6d5424d into sonic-net:master Feb 7, 2019
@prsunny prsunny deleted the vnet_del branch March 19, 2020 01:33
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
Added breakout subcommand in config command

Signed-off-by: Sangita Maity <[email protected]>
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-swss that referenced this pull request Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants