-
Notifications
You must be signed in to change notification settings - Fork 539
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
BFD Tx, Rx interval support for Vnet Monitored routes. #3335
base: master
Are you sure you want to change the base?
Changes from 5 commits
e5984e7
10f75e1
a527cef
3cd9611
b3971b8
5f6b445
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1080,6 +1080,7 @@ bool VNetRouteOrch::doRouteTask<VNetVrfObject>(const string& vnet, IpPrefix& ipP | |
NextHopGroupKey& nexthops, string& op, string& profile, | ||
const string& monitoring, NextHopGroupKey& nexthops_secondary, | ||
const IpPrefix& adv_prefix, | ||
bool check_directly_connected, | ||
const map<NextHopKey, IpAddress>& monitors) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
@@ -1829,7 +1830,8 @@ void VNetRouteOrch::delRoute(const IpPrefix& ipPrefix) | |
syncd_routes_.erase(route_itr); | ||
} | ||
|
||
void VNetRouteOrch::createBfdSession(const string& vnet, const NextHopKey& endpoint, const IpAddress& monitor_addr) | ||
void VNetRouteOrch::createBfdSession(const string& vnet, const NextHopKey& endpoint, const IpAddress& monitor_addr, | ||
bool has_monitor_interval, u_int64_t tx_monitor_interval, u_int64_t rx_monitor_interval) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
|
@@ -1857,6 +1859,13 @@ void VNetRouteOrch::createBfdSession(const string& vnet, const NextHopKey& endpo | |
// when the device goes into TSA. The following parameter ensures that these session are | ||
// brought down while transitioning to TSA and brought back up when transitioning to TSB. | ||
data.emplace_back("shutdown_bfd_during_tsa", "true"); | ||
if (has_monitor_interval) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a note that without tx/rx interval in the DB, BFD session will use the default timers BFD_SESSION_DEFAULT_TX_INTERVAL and BFD_SESSION_DEFAULT_RX_INTERVAL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ill add it. |
||
{ | ||
FieldValueTuple fvTuple1("tx_interval", to_string(tx_monitor_interval)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please include sonic-mgmt tests with Rx/Tx timer to check if these are supported by vendor SAI for BFD hardware offload. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ill add those tests after I have made the changes for directly connected nexthops. |
||
data.push_back(fvTuple1); | ||
FieldValueTuple fvTuple2("rx_interval", to_string(rx_monitor_interval)); | ||
data.push_back(fvTuple2); | ||
} | ||
bfd_session_producer_.set(key, data); | ||
bfd_sessions_[monitor_addr].bfd_state = SAI_BFD_SESSION_STATE_DOWN; | ||
} | ||
|
@@ -1963,7 +1972,19 @@ void VNetRouteOrch::removeMonitoringSession(const string& vnet, const NextHopKey | |
void VNetRouteOrch::setEndpointMonitor(const string& vnet, const map<NextHopKey, IpAddress>& monitors, NextHopGroupKey& nexthops, const string& monitoring, IpPrefix& ipPrefix) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
bool has_monitor_internvals = false; | ||
uint64_t tx_monitor_interval = 0; | ||
uint64_t rx_monitor_interval = 0; | ||
|
||
if (monitoring != "custom") | ||
{ | ||
if (prefix_to_monitor_intervals_.find(ipPrefix) != prefix_to_monitor_intervals_.end()) | ||
{ | ||
has_monitor_internvals = true; | ||
tx_monitor_interval = prefix_to_monitor_intervals_[ipPrefix].tx_monitor_timer; | ||
rx_monitor_interval = prefix_to_monitor_intervals_[ipPrefix].rx_monitor_timer; | ||
} | ||
} | ||
for (auto monitor : monitors) | ||
{ | ||
NextHopKey nh = monitor.first; | ||
|
@@ -1989,7 +2010,7 @@ void VNetRouteOrch::setEndpointMonitor(const string& vnet, const map<NextHopKey, | |
{ | ||
if (nexthop_info_[vnet].find(nh.ip_address) == nexthop_info_[vnet].end()) | ||
{ | ||
createBfdSession(vnet, nh, monitor_ip); | ||
createBfdSession(vnet, nh, monitor_ip, has_monitor_internvals, tx_monitor_interval, rx_monitor_interval); | ||
} | ||
nexthop_info_[vnet][nh.ip_address].ref_count++; | ||
} | ||
|
@@ -2620,6 +2641,10 @@ bool VNetRouteOrch::handleTunnel(const Request& request) | |
swss::IpPrefix adv_prefix; | ||
bool has_priority_ep = false; | ||
bool has_adv_pfx = false; | ||
bool has_monitor_intervals = false; | ||
uint64_t rx_monitor_timer = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these must be initialized to defaults instead of 0 |
||
uint64_t tx_monitor_timer = 0; | ||
bool check_directly_connected = false; | ||
for (const auto& name: request.getAttrFieldNames()) | ||
{ | ||
if (name == "endpoint") | ||
|
@@ -2657,6 +2682,20 @@ bool VNetRouteOrch::handleTunnel(const Request& request) | |
adv_prefix = request.getAttrIpPrefix(name); | ||
has_adv_pfx = true; | ||
} | ||
else if (name == "rx_monitor_timer") | ||
{ | ||
rx_monitor_timer = request.getAttrUint(name); | ||
has_monitor_intervals = true; | ||
} | ||
else if (name == "tx_monitor_timer") | ||
{ | ||
tx_monitor_timer = request.getAttrUint(name); | ||
has_monitor_intervals = true; | ||
} | ||
else if (name == "check_directly_connected") | ||
{ | ||
check_directly_connected = request.getAttrBool(name); | ||
} | ||
else | ||
{ | ||
SWSS_LOG_INFO("Unknown attribute: %s", name.c_str()); | ||
|
@@ -2746,9 +2785,32 @@ bool VNetRouteOrch::handleTunnel(const Request& request) | |
{ | ||
adv_prefix = ip_pfx; | ||
} | ||
if (has_monitor_intervals) | ||
{ | ||
struct VnetRouteMonitorIntervals intervals; | ||
intervals.rx_monitor_timer = rx_monitor_timer; | ||
intervals.tx_monitor_timer = tx_monitor_timer; | ||
prefix_to_monitor_intervals_[ip_pfx] = intervals; | ||
} | ||
if ( op == DEL_COMMAND) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra space |
||
{ | ||
if (prefix_to_monitor_intervals_.find(ip_pfx) != prefix_to_monitor_intervals_.end()) | ||
{ | ||
prefix_to_monitor_intervals_.erase(ip_pfx); | ||
} | ||
} | ||
if (vnet_orch_->isVnetExecVrf()) | ||
{ | ||
return doRouteTask<VNetVrfObject>(vnet_name, ip_pfx, (has_priority_ep == true) ? nhg_primary : nhg, op, profile, monitoring, nhg_secondary, adv_prefix, monitors); | ||
return doRouteTask<VNetVrfObject>(vnet_name, | ||
ip_pfx, | ||
(has_priority_ep == true) ? nhg_primary : nhg, | ||
op, | ||
profile, | ||
monitoring, | ||
nhg_secondary, | ||
adv_prefix, | ||
check_directly_connected, | ||
monitors); | ||
} | ||
|
||
return true; | ||
|
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.
This check will be added later, right?
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.
yes