Skip to content

Commit 5bedf4e

Browse files
authored
[bugfix] vnet ping missing with secondary endpoints empty in priority 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 <[email protected]>
1 parent 81b5b4c commit 5bedf4e

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

orchagent/vnetorch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,8 @@ bool VNetRouteOrch::selectNextHopGroup(const string& vnet,
10611061
else if (!hasNextHopGroup(vnet, nexthops_primary))
10621062
{
10631063
SWSS_LOG_INFO("Creating next hop group %s", nexthops_primary.to_string().c_str());
1064-
setEndpointMonitor(vnet, monitors, nexthops_primary, "", ipPrefix);
1065-
if (!createNextHopGroup(vnet, nexthops_primary, vrf_obj, ""))
1064+
setEndpointMonitor(vnet, monitors, nexthops_primary, monitoring, ipPrefix);
1065+
if (!createNextHopGroup(vnet, nexthops_primary, vrf_obj, monitoring))
10661066
{
10671067
delEndpointMonitor(vnet, nexthops_primary, ipPrefix);
10681068
return false;

tests/test_vnet.py

+27
Original file line numberDiff line numberDiff line change
@@ -3171,6 +3171,33 @@ def test_vnet_orch_22(self, dvs, testlog):
31713171
check_remove_state_db_routes(dvs, 'Vnet12', "100.100.1.67/32")
31723172
#adv should be gone.
31733173
check_remove_routes_advertisement(dvs, "100.100.1.0/24")
3174+
3175+
#Add priority route with no secondary enpoints
3176+
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')
3177+
update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.1', 'up')
3178+
update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.2', 'up')
3179+
3180+
#verify that no BFD sessions are created.
3181+
check_del_bfd_session(dvs, ['19.0.0.1'])
3182+
check_del_bfd_session(dvs, ['19.0.0.2'])
3183+
time.sleep(2)
3184+
check_state_db_routes(dvs, vnet_name, "100.100.1.71/32", ['19.0.0.1,19.0.0.2'])
3185+
# The default Vnet setting does not advertise prefix
3186+
check_routes_advertisement(dvs, "100.100.1.0/24", "test_prf")
3187+
3188+
update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.1', 'down')
3189+
check_state_db_routes(dvs, vnet_name, "100.100.1.71/32", ['19.0.0.2'])
3190+
# The default Vnet setting does not advertise prefix
3191+
check_routes_advertisement(dvs, "100.100.1.0/24", "test_prf")
3192+
3193+
update_monitor_session_state(dvs, '100.100.1.71/32', '19.0.0.2', 'down')
3194+
check_remove_state_db_routes(dvs, 'Vnet12', "100.100.1.71/32")
3195+
3196+
#remove first route
3197+
delete_vnet_routes(dvs, "100.100.1.71/32", vnet_name)
3198+
vnet_obj.check_del_vnet_routes(dvs, 'Vnet12', ["100.100.1.71/32"])
3199+
check_remove_state_db_routes(dvs, 'Vnet12', "100.100.1.71/32")
3200+
31743201
delete_vnet_entry(dvs,vnet_name)
31753202
vnet_obj.check_del_vnet_entry(dvs, vnet_name)
31763203
delete_vxlan_tunnel(dvs, tunnel_name)

0 commit comments

Comments
 (0)