Skip to content
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

VNET and BGP route coexistence #3345

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

siqbal1986
Copy link
Contributor

@siqbal1986 siqbal1986 commented Oct 29, 2024

What I did
This PR adds the logic to give Vnet routes precedence over BGP learnt route.
This PR also refactors the test_vnet.py to break out the common code into a library.
Why I did it
Currently if a route is learnt via BGP and added into the hardware, adding a VNET route results in failure. In addition due to a bug in VnetOrch, we start advertising the failed route, This prompts the BGP to remove the learnt route in favor of the local route. Since the Vnet Orch doesn't retry adding the Vnet route, This results in no route being present in the Hardware.
How I verified it
Added 2 tests to verify the learnt route is removed when a Vnet route is added.
One test covers the scnerio where BFD sessions are brought up before the Vnet route is added and the 2nd covers when the Vnet route is added before the BFD sessions are brought up.
Details if related

Tests covering this chage.
sonic-net/sonic-mgmt#15710

image

@siqbal1986 siqbal1986 changed the title vnet route precedence over BGP learnt route. VNET and BGP route coexistence Oct 29, 2024
@prsunny
Copy link
Collaborator

prsunny commented Oct 30, 2024

Can you fix coverage?

tests/test_vnet.py Outdated Show resolved Hide resolved
@siqbal1986
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

context.vrf_id = gVirtualRouterId;
if (removeRoute(context))
{
SWSS_LOG_INFO("Could not find the route with prefix %s", prefix.to_string().c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment missing

@@ -989,6 +992,7 @@ bool VNetRouteOrch::selectNextHopGroup(const string& vnet,
// This is followed by an attempt to create a NHG which can be subset of nexthops_primary
// depending on the endpoint monitor state. If no NHG from primary is created, we attempt
// the same for secondary.
SWSS_LOG_NOTICE("Route recieved with monitoring %s and secondary NHG %s.\n",monitoring.c_str(), nexthops_secondary.to_string().c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recieved typo. Also this may be frequent, suggest to change to INFO

if (failed)
{
// This is an unrecoverable error, Throw a LOG_ERROR and return
SWSS_LOG_ERROR("Inconsistant Hardware State. Failed to create tunnel routes\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

ipPrefixsubnet.to_string().c_str());
if (gRouteOrch && !gRouteOrch->removeRouteIfExists(ipPrefixsubnet))
{
SWSS_LOG_ERROR("Couldn't Removed existing bgp route for prefix : %s\n", ipPrefixsubnet.to_string().c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

route_state = "";
}
}
SWSS_LOG_NOTICE("advertisement of prefix: %s with profile:%s, status: %s via %s\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisit the NOTICE logs, prefer to keep it INFO

auto ipPrefixsubnet = ipPrefix.getSubnet();
SWSS_LOG_INFO("Attempting to remove BGP learnt route for prefix : %s\n",
ipPrefixsubnet.to_string().c_str());
if (gRouteOrch && !gRouteOrch->removeRouteIfExists(ipPrefixsubnet))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for route existence first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants