@@ -1015,6 +1015,8 @@ bool VNetRouteOrch::selectNextHopGroup(const string& vnet,
10151015 NextHopGroupKey& nexthops_primary,
10161016 NextHopGroupKey& nexthops_secondary,
10171017 const string& monitoring,
1018+ const int32_t rx_monitor_timer,
1019+ const int32_t tx_monitor_timer,
10181020 IpPrefix& ipPrefix,
10191021 VNetVrfObject *vrf_obj,
10201022 NextHopGroupKey& nexthops_selected,
@@ -1033,18 +1035,18 @@ bool VNetRouteOrch::selectNextHopGroup(const string& vnet,
10331035 auto it_route = syncd_tunnel_routes_[vnet].find (ipPrefix);
10341036 if (it_route == syncd_tunnel_routes_[vnet].end ())
10351037 {
1036- setEndpointMonitor (vnet, monitors, nexthops_primary, monitoring, ipPrefix);
1037- setEndpointMonitor (vnet, monitors, nexthops_secondary, monitoring, ipPrefix);
1038+ setEndpointMonitor (vnet, monitors, nexthops_primary, monitoring, rx_monitor_timer, tx_monitor_timer, ipPrefix);
1039+ setEndpointMonitor (vnet, monitors, nexthops_secondary, monitoring, rx_monitor_timer, tx_monitor_timer, ipPrefix);
10381040 }
10391041 else
10401042 {
10411043 if (it_route->second .primary != nexthops_primary)
10421044 {
1043- setEndpointMonitor (vnet, monitors, nexthops_primary, monitoring, ipPrefix);
1045+ setEndpointMonitor (vnet, monitors, nexthops_primary, monitoring, rx_monitor_timer, tx_monitor_timer, ipPrefix);
10441046 }
10451047 if (it_route->second .secondary != nexthops_secondary)
10461048 {
1047- setEndpointMonitor (vnet, monitors, nexthops_secondary, monitoring, ipPrefix);
1049+ setEndpointMonitor (vnet, monitors, nexthops_secondary, monitoring, rx_monitor_timer, tx_monitor_timer, ipPrefix);
10481050 }
10491051 nexthops_selected = it_route->second .nhg_key ;
10501052 return true ;
@@ -1103,7 +1105,7 @@ bool VNetRouteOrch::selectNextHopGroup(const string& vnet,
11031105 else if (!hasNextHopGroup (vnet, nexthops_primary))
11041106 {
11051107 SWSS_LOG_INFO (" Creating next hop group %s" , nexthops_primary.to_string ().c_str ());
1106- setEndpointMonitor (vnet, monitors, nexthops_primary, monitoring, ipPrefix);
1108+ setEndpointMonitor (vnet, monitors, nexthops_primary, monitoring, rx_monitor_timer, tx_monitor_timer, ipPrefix);
11071109 if (!createNextHopGroup (vnet, nexthops_primary, vrf_obj, monitoring))
11081110 {
11091111 delEndpointMonitor (vnet, nexthops_primary, ipPrefix);
@@ -1117,7 +1119,10 @@ bool VNetRouteOrch::selectNextHopGroup(const string& vnet,
11171119template <>
11181120bool VNetRouteOrch::doRouteTask<VNetVrfObject>(const string& vnet, IpPrefix& ipPrefix,
11191121 NextHopGroupKey& nexthops, string& op, string& profile,
1120- const string& monitoring, NextHopGroupKey& nexthops_secondary,
1122+ const string& monitoring,
1123+ const int32_t rx_monitor_timer,
1124+ const int32_t tx_monitor_timer,
1125+ NextHopGroupKey& nexthops_secondary,
11211126 const IpPrefix& adv_prefix,
11221127 const map<NextHopKey, IpAddress>& monitors)
11231128{
@@ -1158,7 +1163,7 @@ bool VNetRouteOrch::doRouteTask<VNetVrfObject>(const string& vnet, IpPrefix& ipP
11581163 {
11591164 sai_object_id_t nh_id = SAI_NULL_OBJECT_ID;
11601165 NextHopGroupKey active_nhg (" " , true );
1161- if (!selectNextHopGroup (vnet, nexthops, nexthops_secondary, monitoring, ipPrefix, vrf_obj, active_nhg, monitors))
1166+ if (!selectNextHopGroup (vnet, nexthops, nexthops_secondary, monitoring, rx_monitor_timer, tx_monitor_timer, ipPrefix, vrf_obj, active_nhg, monitors))
11621167 {
11631168 return true ;
11641169 }
@@ -1981,7 +1986,7 @@ void VNetRouteOrch::delRoute(const IpPrefix& ipPrefix)
19811986 syncd_routes_.erase (route_itr);
19821987}
19831988
1984- void VNetRouteOrch::createBfdSession (const string& vnet, const NextHopKey& endpoint, const IpAddress& monitor_addr)
1989+ void VNetRouteOrch::createBfdSession (const string& vnet, const NextHopKey& endpoint, const IpAddress& monitor_addr, const int32_t rx_monitor_timer, const int32_t tx_monitor_timer )
19851990{
19861991 SWSS_LOG_ENTER ();
19871992
@@ -2012,6 +2017,19 @@ void VNetRouteOrch::createBfdSession(const string& vnet, const NextHopKey& endpo
20122017 // when the device goes into TSA. The following parameter ensures that these session are
20132018 // brought down while transitioning to TSA and brought back up when transitioning to TSB.
20142019 data.emplace_back (" shutdown_bfd_during_tsa" , " true" );
2020+
2021+ if (rx_monitor_timer >= 0 )
2022+ {
2023+ FieldValueTuple fv_rx (" rx_interval" , to_string (rx_monitor_timer));
2024+ data.push_back (fv_rx);
2025+ }
2026+
2027+ if (tx_monitor_timer >= 0 )
2028+ {
2029+ FieldValueTuple fv_tx (" tx_interval" , to_string (tx_monitor_timer));
2030+ data.push_back (fv_tx);
2031+ }
2032+
20152033 bfd_session_producer_.set (key, data);
20162034 bfd_sessions_[monitor_addr].bfd_state = SAI_BFD_SESSION_STATE_DOWN;
20172035 }
@@ -2116,7 +2134,7 @@ void VNetRouteOrch::removeMonitoringSession(const string& vnet, const NextHopKey
21162134 monitor_info_[vnet][ipPrefix].erase (monitor_addr);
21172135}
21182136
2119- void VNetRouteOrch::setEndpointMonitor (const string& vnet, const map<NextHopKey, IpAddress>& monitors, NextHopGroupKey& nexthops, const string& monitoring, IpPrefix& ipPrefix)
2137+ void VNetRouteOrch::setEndpointMonitor (const string& vnet, const map<NextHopKey, IpAddress>& monitors, NextHopGroupKey& nexthops, const string& monitoring, const int32_t rx_monitor_timer, const int32_t tx_monitor_timer, IpPrefix& ipPrefix)
21202138{
21212139 SWSS_LOG_ENTER ();
21222140
@@ -2145,7 +2163,7 @@ void VNetRouteOrch::setEndpointMonitor(const string& vnet, const map<NextHopKey,
21452163 {
21462164 if (nexthop_info_[vnet].find (nh.ip_address ) == nexthop_info_[vnet].end ())
21472165 {
2148- createBfdSession (vnet, nh, monitor_ip);
2166+ createBfdSession (vnet, nh, monitor_ip, rx_monitor_timer, tx_monitor_timer );
21492167 }
21502168 nexthop_info_[vnet][nh.ip_address ].ref_count ++;
21512169 }
@@ -2863,6 +2881,8 @@ bool VNetRouteOrch::handleTunnel(const Request& request)
28632881 vector<IpAddress> primary_list;
28642882 vector<IpAddress> secondary_list;
28652883 string monitoring;
2884+ int32_t rx_monitor_timer = -1 ;
2885+ int32_t tx_monitor_timer = -1 ;
28662886 swss::IpPrefix adv_prefix;
28672887 bool has_priority_ep = false ;
28682888 bool has_adv_pfx = false ;
@@ -2908,6 +2928,14 @@ bool VNetRouteOrch::handleTunnel(const Request& request)
29082928 {
29092929 check_directly_connected = request.getAttrBool (name);
29102930 }
2931+ else if (name == " rx_monitor_timer" )
2932+ {
2933+ rx_monitor_timer = static_cast <int32_t >(request.getAttrUint (name));
2934+ }
2935+ else if (name == " tx_monitor_timer" )
2936+ {
2937+ tx_monitor_timer = static_cast <int32_t >(request.getAttrUint (name));
2938+ }
29112939 else
29122940 {
29132941 SWSS_LOG_INFO (" Unknown attribute: %s" , name.c_str ());
@@ -3043,7 +3071,7 @@ bool VNetRouteOrch::handleTunnel(const Request& request)
30433071 }
30443072 if (vnet_orch_->isVnetExecVrf ())
30453073 {
3046- return doRouteTask<VNetVrfObject>(vnet_name, ip_pfx, (has_priority_ep == true ) ? nhg_primary : nhg, op, profile, monitoring, nhg_secondary, adv_prefix, monitors);
3074+ return doRouteTask<VNetVrfObject>(vnet_name, ip_pfx, (has_priority_ep == true ) ? nhg_primary : nhg, op, profile, monitoring, rx_monitor_timer, tx_monitor_timer, nhg_secondary, adv_prefix, monitors);
30473075 }
30483076
30493077 return true ;
0 commit comments