Skip to content

Commit

Permalink
[bugfix] vnet ping missing with secondary endpoints empty in priority…
Browse files Browse the repository at this point in the history
… routes. (sonic-net#2736)

Adding a priority vnet route without secondary endpoints with
custom monitoring does not result in vnet ping session creation.
This change fixes that and adds a test.
Signed-off-by: siqbal1486 <shahzad.iqbal@microsoft.com>
  • Loading branch information
siqbal1986 authored Apr 18, 2023
1 parent 81b5b4c commit 5bedf4e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions orchagent/vnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,8 @@ bool VNetRouteOrch::selectNextHopGroup(const string& vnet,
else if (!hasNextHopGroup(vnet, nexthops_primary))
{
SWSS_LOG_INFO("Creating next hop group %s", nexthops_primary.to_string().c_str());
setEndpointMonitor(vnet, monitors, nexthops_primary, "", ipPrefix);
if (!createNextHopGroup(vnet, nexthops_primary, vrf_obj, ""))
setEndpointMonitor(vnet, monitors, nexthops_primary, monitoring, ipPrefix);
if (!createNextHopGroup(vnet, nexthops_primary, vrf_obj, monitoring))
{
delEndpointMonitor(vnet, nexthops_primary, ipPrefix);
return false;
Expand Down
27 changes: 27 additions & 0 deletions tests/test_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3171,6 +3171,33 @@ def test_vnet_orch_22(self, dvs, testlog):
check_remove_state_db_routes(dvs, 'Vnet12', "100.100.1.67/32")
#adv should be gone.
check_remove_routes_advertisement(dvs, "100.100.1.0/24")

#Add priority route with no secondary enpoints
create_vnet_routes(dvs, "100.100.1.71/32", vnet_name, '19.0.0.1,19.0.0.2', ep_monitor='19.0.0.1,19.0.0.2', profile = "test_prf", primary ='19.0.0.1,19.0.0.2',monitoring='custom', adv_prefix='100.100.1.0/24')
update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.1', 'up')
update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.2', 'up')

#verify that no BFD sessions are created.
check_del_bfd_session(dvs, ['19.0.0.1'])
check_del_bfd_session(dvs, ['19.0.0.2'])
time.sleep(2)
check_state_db_routes(dvs, vnet_name, "100.100.1.71/32", ['19.0.0.1,19.0.0.2'])
# The default Vnet setting does not advertise prefix
check_routes_advertisement(dvs, "100.100.1.0/24", "test_prf")

update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.1', 'down')
check_state_db_routes(dvs, vnet_name, "100.100.1.71/32", ['19.0.0.2'])
# The default Vnet setting does not advertise prefix
check_routes_advertisement(dvs, "100.100.1.0/24", "test_prf")

update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.2', 'down')
check_remove_state_db_routes(dvs, 'Vnet12', "100.100.1.71/32")

#remove first route
delete_vnet_routes(dvs, "100.100.1.71/32", vnet_name)
vnet_obj.check_del_vnet_routes(dvs, 'Vnet12', ["100.100.1.71/32"])
check_remove_state_db_routes(dvs, 'Vnet12', "100.100.1.71/32")

delete_vnet_entry(dvs,vnet_name)
vnet_obj.check_del_vnet_entry(dvs, vnet_name)
delete_vxlan_tunnel(dvs, tunnel_name)
Expand Down

0 comments on commit 5bedf4e

Please sign in to comment.