-
Notifications
You must be signed in to change notification settings - Fork 557
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments
orchagent/vnetorch.cpp
Outdated
|
||
/* | ||
* 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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?
orchagent/vnetorch.cpp
Outdated
return true; | ||
} | ||
|
||
bool subnet = (!nh.ips.getSize())?true:false; |
There was a problem hiding this comment.
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"); | ||
} | ||
} |
There was a problem hiding this comment.
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, ???
There was a problem hiding this comment.
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.
orchagent/vnetorch.cpp
Outdated
{ | ||
throw std::runtime_error("Route add failed"); | ||
throw std::runtime_error("Route update failed"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orchagent/vnetorch.cpp
Outdated
return (routes_.size() + tunnels_.size()); | ||
} | ||
|
||
bool VNetVrfObject::getRouteNH(IpPrefix& ipPrefix, nextHop& nh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> getRouteNexthop
orchagent/vnetorch.cpp
Outdated
return true; | ||
} | ||
|
||
sai_object_id_t VNetVrfObject::getNextHop(tunnelEndpoint& endp) |
There was a problem hiding this comment.
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
orchagent/vnetorch.cpp
Outdated
return nh_id; | ||
} | ||
|
||
bool VNetVrfObject::removeNextHop(tunnelEndpoint& endp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removeTunnelNexthop
orchagent/vnetorch.cpp
Outdated
|
||
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()); |
There was a problem hiding this comment.
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
orchagent/vxlanorch.cpp
Outdated
auto tunnel_obj = getVxlanTunnel(tunnelName); | ||
|
||
//Delete request for the nh tunnel id | ||
return tunnel_obj->removeNHTunnel(ipAddr, macAddress, vni); |
There was a problem hiding this comment.
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
orchagent/vxlanorch.h
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> updateNexthop
we should probably increase the crm counter.
823 { Refers to: orchagent/vnetorch.cpp:484 in 91d77df. [](commit_id = 91d77df, deletion_comment = False) |
Added breakout subcommand in config command Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
Signed-off-by: Guohan Lu <lguohan@gmail.com>
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