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

[vnetorch] Add ECMP support for vnet tunnel routes #1960

Merged
merged 4 commits into from
Nov 11, 2021

Conversation

shi-su
Copy link
Contributor

@shi-su shi-su commented Oct 14, 2021

What I did
Add functions to create/remove next hop groups for vnet tunnel routes.
Count the reference count of next hop groups to create and remove as needed.
Share the counter of next hop groups with routeorch.
Add vs test

Why I did it
To add support for overlay ECMP.

How I verified it
Verify ECMP groups are properly created and removed with the functions.
Verify vs test passes

Details if related

@@ -1066,18 +1346,48 @@ bool VNetRouteOrch::handleTunnel(const Request& request)
}
}

if (!vni_list.empty() && vni_list.size() != ip_list.size())
Copy link
Collaborator

Choose a reason for hiding this comment

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

These conditions need not be true. There could be empty comma separated list as VNI and MAC are optional fields

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought these conditions are required. The field should be either empty or the match in length. Otherwise, it would be impossible to match the fields with endpoints. For example, if the endpoint had three addresses, the vni field should be one of the choices: empty; 0,0,0(three valid values); 0,,(comma separated empty values). The field should not be something like 0,1 since it would be impossible to figure which endpoint it corresponds to.

I also noticed that the current implementation of request parser cannot handle the case of comma-separated empty values. Therefore, I updated the value type of mac and vni such to string so that we can tokenize the values and handle them in vnetorch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added support for multiple endpoints to share the same vni in the latest commit.

uint32_t vni = 0;
vector<IpAddress> ip_list;
vector<MacAddress> mac_list;
vector<uint64_t> vni_list;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be uint32?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the vni field type and made it to uint32.

}
else
{
vrf_obj->removeRoute(ipPrefix);
SWSS_LOG_ERROR("Unknown operation");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove this and have the DEL as else part. We don't get any other operations in this flow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, removed this part.

{
if (op == SET_COMMAND && !add_route(vr_id, pfx, nh_id))
sai_object_id_t nh_id;
/* The route in pointing to one single endpoint */
Copy link
Collaborator

Choose a reason for hiding this comment

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

is -> typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing it out. Fixed.

next_hop_group_entry.active_members[nexthop] = SAI_NULL_OBJECT_ID;
syncd_nexthop_groups_[vnet][nexthops] = next_hop_group_entry;
}
else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

{ -> new line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as suggested.


if (op == SET_COMMAND)
if (it_route != syncd_tunnel_routes_[vnet].end())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add some comments for this if case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments for this part.

@@ -12,6 +12,8 @@
#include "ipaddresses.h"
#include "producerstatetable.h"
#include "observer.h"
#include "intfsorch.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove if not used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

vnet_obj.fetch_exist_entries(dvs)
assert nhg1_1 not in vnet_obj.nhgs

# Create another tunnel route to the same set of endpoints
Copy link
Collaborator

Choose a reason for hiding this comment

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

add one case for IPv4 prefix over IPv6 endpoints in this same test 8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a test case as suggested.

{ "endpoint", REQ_T_IP_LIST },
{ "ifname", REQ_T_STRING },
{ "nexthop", REQ_T_STRING },
{ "vni", REQ_T_STRING },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just thinking, if this has any backward compatibility issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not think it would, since we will convert it to the right format. I think the only difference is to process the values in the request parser or vnetorch.

@@ -790,7 +902,7 @@ def test_vnet_orch_1(self, dvs, testlog):
vnet_obj.check_del_vnet_routes(dvs, 'Vnet_2001')

delete_vnet_routes(dvs, "100.100.1.1/32", 'Vnet_2000')
vnet_obj.check_del_vnet_routes(dvs, 'Vnet_2001')
vnet_obj.check_del_vnet_routes(dvs, 'Vnet_2000')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still believe this seems more like a typo, though I do not recall how I noticed this (maybe I added some more checks in the function and the test case failed). As we just removed a route from Vnet_2000, why do we want to check deleted route in Vnet_2001? I checked other calls of the same function and nowhere else use it in this way. I think it passed previously only because check_del_vnet_routes did not really check anything.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

@shi-su shi-su merged commit f502c32 into sonic-net:master Nov 11, 2021
@prsunny
Copy link
Collaborator

prsunny commented Nov 13, 2021

@dgsudharsan , got to know that you were reviewing the PR. Please feel free to provide comments and we can address in a separate PR

shi-su added a commit to shi-su/sonic-swss that referenced this pull request Jan 6, 2022
What I did
Add functions to create/remove next hop groups for vnet tunnel routes.
Count the reference count of next hop groups to create and remove as needed.
Share the counter of next hop groups with routeorch.
Add vs test

Why I did it
To add support for overlay ECMP.

How I verified it
Verify ECMP groups are properly created and removed with the functions.
Verify vs test passes
dgsudharsan pushed a commit to dgsudharsan/sonic-swss that referenced this pull request Jan 10, 2022
What I did
Add functions to create/remove next hop groups for vnet tunnel routes.
Count the reference count of next hop groups to create and remove as needed.
Share the counter of next hop groups with routeorch.
Add vs test

Why I did it
To add support for overlay ECMP.

How I verified it
Verify ECMP groups are properly created and removed with the functions.
Verify vs test passes
shi-su added a commit to shi-su/sonic-swss that referenced this pull request Jan 21, 2022
What I did
Add functions to create/remove next hop groups for vnet tunnel routes.
Count the reference count of next hop groups to create and remove as needed.
Share the counter of next hop groups with routeorch.
Add vs test

Why I did it
To add support for overlay ECMP.

How I verified it
Verify ECMP groups are properly created and removed with the functions.
Verify vs test passes
@sachinv-msft
Copy link

@prsunny Cisco requested this PR for 202012 branch, could you review and recommend next steps/add the necessary labels?

@shi-su
Copy link
Contributor Author

shi-su commented Jan 26, 2022

@prsunny Cisco requested this PR for 202012 branch, could you review and recommend next steps/add the necessary labels?

#2104 will take the changes to 202012 branch. Should be merging soon.

shi-su added a commit that referenced this pull request Jan 26, 2022
…oint health monitoring (#2104)

What I did
Cherry-pick changes in #1960, #1883, #1955, #2058

Changes in #1960:
Add functions to create/remove next hop groups for vnet tunnel routes.
Count the reference count of next hop groups to create and remove as needed.
Share the counter of next hop groups with routeorch.
Add vs test

Changes in #1883:
Implement bfdorch to program hardware BFD sessions via bfd SAI.
Add vs test for bfd sessions.

Changes in #1955:
Add functions to create/remove next hop groups for vnet tunnel routes.
Count the reference count of next hop groups to create and remove as needed.
Share the counter of next hop groups with routeorch.
Adapt route endpoint according to the BFD state of endpoints.

Changes in #2058:
Advertise active vnet tunnel routes.

Why I did it
To add support for overlay ECMP with endpoint health monitoring.
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.

4 participants