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 support for TSA state. #2926
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.
Please provide full description of the behavior as to when TSA is applied with some examples.
/azp run |
Commenter does not have sufficient privileges for PR 2926 in repo sonic-net/sonic-swss |
/azpw run |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
orchagent/bfdorch.cpp
Outdated
@@ -298,6 +352,10 @@ bool BfdOrch::create_bfd_session(const string& key, const vector<FieldValueTuple | |||
{ | |||
tos = to_uint<uint8_t>(value); | |||
} | |||
else if (fvField(i) == "tsa_shutdown") |
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 the purpose of this section?
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 have added a comment in the code and I have changed the name of the field to shutdown_bfd_during_tsa. The BFD tsa shutdown is handled by the bfd cache in the caller function. This block is added to avoid getting the unknown parameter syslog.
orchagent/vnetorch.cpp
Outdated
@@ -1817,6 +1817,7 @@ void VNetRouteOrch::createBfdSession(const string& vnet, const NextHopKey& endpo | |||
FieldValueTuple fvTuple("local_addr", src_ip.to_string()); | |||
data.push_back(fvTuple); | |||
data.emplace_back("multihop", "true"); | |||
data.emplace_back("tsa_shutdown", "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.
not clear of the meaning of this variable - 'tsa_shutdown' ?
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.
renamed it already and added comments.
//specified session gets removed when the device goes into TSA state. | ||
//if this parameter is not specified or set to false for a session, the | ||
// corrosponding BFD session would be maintained even in TSA state. | ||
if (fvField(i) == "shutdown_bfd_during_tsa" && value == "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.
@arlakshm , fyi (This param can control the individual BFD session state during TSA)
orchagent/bfdorch.cpp
Outdated
|
||
void BfdOrch::handleTsaStateChange(bool tsaState) | ||
{ | ||
SWSS_LOG_INFO("BfdOrch TSA state Changed to %d.\n", int(tsaState)); |
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.
Can you please change this to NOTICE? , also log the existing state
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.
done. now log is in the caller function.
orchagent/bfdorch.cpp
Outdated
{ | ||
SWSS_LOG_ENTER(); | ||
tsa_enabled = false; | ||
SWSS_LOG_ERROR("BgpGlobalStateOrch init complete\n"); |
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 this ERROR log, please remove
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.
done
orchagent/bfdorch.cpp
Outdated
@@ -74,6 +74,16 @@ BfdOrch::BfdOrch(DBConnector *db, string tableName, TableConnector stateDbBfdSes | |||
|
|||
Orch::addExecutor(bfdStateNotificatier); | |||
register_state_change_notif = false; | |||
BgpGlobalStateOrch* bgp_global_state_orch = gDirectory.get<BgpGlobalStateOrch*>(); |
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 think you don't need this section. Just initialize tsa_enabled
to false in class and handle TSA change in the normal update path.
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.
fixed
orchagent/bfdorch.cpp
Outdated
notify_session_state_down(it.first); | ||
if (!remove_bfd_session(it.first)) | ||
{ | ||
SWSS_LOG_ERROR("Failed to remove BFD session %s\n", it.first.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.
Please remove the error log as its handled in the remove function already
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.
done
orchagent/bfdorch.cpp
Outdated
{ | ||
if (!create_bfd_session(it.first, it.second)) | ||
{ | ||
SWSS_LOG_ERROR("Failed to create BFD session %s\n", it.first.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.
please remove the error 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.
done
orchagent/bfdorch.cpp
Outdated
{ | ||
notify_session_state_down(it.first); | ||
remove_bfd_session(it.first); | ||
} else |
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.
else
-> next line
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.
done
Please check coverage of test. |
@@ -3428,6 +3443,83 @@ def test_vnet_orch_24(self, dvs, testlog): | |||
# delete vxlan tunnel | |||
delete_vxlan_tunnel(dvs, tunnel_name) | |||
|
|||
''' | |||
Test 25 - Test for BFD TSA and TSB behaviour within overlay tunnel routes. |
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.
add description of test here
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.
done
These changes enable us to bring certain BFD sessions down when the device goes into TSA. when the device switches to TSB, these sessions are brought up.
What I did
Added a session cache in BFD orch which records sessions with the "tsa_shutdown" parameter and removes/adds these sessions when switching between TSA/TSB.
Why I did it
In TSA a device is not supposed to be forwarding data plane traffic but in the existing implementation, BFD sessions were kept up for Vxlan tunnels with BFD monitoring. This gives the Vxlan tunnel traffic receiver the impression that the device is active but not sending traffic.
How I verified it
The following tests were added
BFD Test - apply and remove TSA
BFD Test- remove active session in TSA
Details if related
Example