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

[SRv6]: SRv6 VPN SID #2793

Closed
wants to merge 8 commits into from
Closed

Conversation

shuaishang
Copy link

What I did
HLD: SRv6 VPN HLD for 202305 release

Why I did it
This PR is to support SRv6 VPN functions

It depends on SAI 1.12. opencomputeproject/SAI #1744

How I verified it
pytest test_srv6.py
PS: to reduce the PR size, i created another PR #2766 for vs test.

Details if related

@zhangyanzhao
Copy link
Collaborator

added more reviewers

@prsunny prsunny changed the title [202305][SRv6]: SRv6 VPN SID [SRv6]: SRv6 VPN SID May 27, 2023
@prsunny prsunny requested review from stephenxs and kperumalbfn May 27, 2023 00:17
@shuaishang
Copy link
Author

Reviewed in Routing WG weekly meeting 06082023:
https://lists.sonicfoundation.dev/g/sonic-wg-routing/wiki/34083

@@ -634,6 +635,13 @@ void RouteOrch::doTask(Consumer& consumer)
if (fvField(i) == "seg_src")
srv6_source = fvValue(i);

if (fvField(i) == "vpn_sid" && fvValue(i) != "")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you update these new fields in doc/swss-schema.md

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@@ -634,6 +635,13 @@ void RouteOrch::doTask(Consumer& consumer)
if (fvField(i) == "seg_src")
srv6_source = fvValue(i);

if (fvField(i) == "vpn_sid" && fvValue(i) != "")
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this code change handle SRV6 policy referenced in HLD? There is no reference to SRv6_POLICY_TABLE table?

Copy link
Author

Choose a reason for hiding this comment

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

This PR only includes SRv6 VPN feature, no SRv6 Policy.

NextHopKey(const std::string &str) :
vni(0), mac_address()
vni(0), mac_address(),
srv6_vpn_sid(""),
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move the vpn_sid to the end of NH key without affecting the non-VPN NH key?

Copy link
Author

Choose a reason for hiding this comment

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

It will not affect non-VPN NH key, however I moved srv6_vpn_sid to end of NH key.

@prsunny
Copy link
Collaborator

prsunny commented Jun 13, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

uint32_t Srv6Orch::getAggId(const NextHopGroupKey &nhg)
{
SWSS_LOG_ENTER();
static uint32_t g_agg_id = 1;
Copy link
Contributor

@kperumalbfn kperumalbfn Jun 14, 2023

Choose a reason for hiding this comment

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

instead of having static g_agg_id inside a member function, can we move this to srv6Orch object?

It will be better to use some sort of index allocator instead of looping over the indices to determine the free index. Index allocator will be better for performance.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed, changed to member "m_srv6_agg_id".

Copy link
Author

Choose a reason for hiding this comment

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

Since there is no "index allocator" library in orch and we don't want to introduce dependency by new library, we write this simple function to get the id. And in our system level test, there is no performance issue. Is it ok to keep this function?

{
if (!deleteSrv6Vpn(sr_nh, getAggId(it_nhg)))
{
SWSS_LOG_ERROR("Failed to delete SRV6 vpn %s", sr_nh.to_string(false, true).c_str());
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also include prefix aggId in the error log for better debugging

Copy link
Author

Choose a reason for hiding this comment

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

Fixed, add it in "createSrv6Vpn/deleteSrv6Vpn" error log.

void Srv6Orch::increasePrefixAggIdRefCount(const NextHopGroupKey &nhg)
{
SWSS_LOG_ENTER();
string k = nhg.get_srv6_vpn_key();
Copy link
Contributor

Choose a reason for hiding this comment

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

When the set of NHs are same, but the order of NHs in NHG key are different, does it have a different key? If so, we will use different prefix_agg_id. Could you please clarify this case?

Copy link
Author

Choose a reason for hiding this comment

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

It should be treated as same key, I fixed it.
Appreciated for your review comments~

@shuaishang
Copy link
Author

@prsunny @kperumalbfn
Any more comments? Could this PR be approved?

tunnel_map_entry_attr.value.u32 = prefix_agg_id;
tunnel_map_entry_attrs.push_back(tunnel_map_entry_attr);

IpAddress vpn_sid(nh.srv6_vpn_sid);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have any sonic-utility CLI to dump these map entries? We have VLAN-->VNI, VRF-->VNI map entries under 'show vxlan'. We could have one more for SRV6 tunnel map entries.

Copy link
Author

Choose a reason for hiding this comment

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

sure, I can add the CLI in sonic-utility after this PR merged.

@kperumalbfn
Copy link
Contributor

@prsunny @kperumalbfn Any more comments? Could this PR be approved?

@shuaishang Please check the sanity failures and update the branch. Added one comment, pls check.

@shuaishang
Copy link
Author

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 2793 in repo sonic-net/sonic-swss

kperumalbfn
kperumalbfn previously approved these changes Aug 11, 2023
@lguohan
Copy link
Contributor

lguohan commented Aug 22, 2023

there isn't any unit test code for such pr? @prsunny , what is our guidance for the unit test coverage for such pr?

Copy link
Contributor

@lguohan lguohan left a comment

Choose a reason for hiding this comment

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

please add unit test coverage to be 90%

@kperumalbfn
Copy link
Contributor

there isn't any unit test code for such pr? @prsunny , what is our guidance for the unit test coverage for such pr?

sonic-swss tests are in a separate PR - #2766

@shuaishang It will be better to merge these two PRs.

@prsunny
Copy link
Collaborator

prsunny commented Sep 7, 2023

there isn't any unit test code for such pr? @prsunny , what is our guidance for the unit test coverage for such pr?

sonic-swss tests are in a separate PR - #2766

@shuaishang It will be better to merge these two PRs.

Agree, the test and PR must be together and in same PR.

@shuaishang
Copy link
Author

@kperumalbfn @prsunny
Done. Merged the unit tests from #2766 into this PR.

@shuaishang
Copy link
Author

@kperumalbfn @prsunny Done. Merged the unit tests from #2766 into this PR.

@kperumalbfn @prsunny could you please help to check? any more comments?

@shuaishang
Copy link
Author

@kperumalbfn Any more comments?

@kperumalbfn
Copy link
Contributor

@shuaishang Any plan for SRV6 sonic-mgmt tests? If so, please add those PRs.

@shuaishang
Copy link
Author

@shuaishang Any plan for SRV6 sonic-mgmt tests? If so, please add those PRs.

@kperumalbfn No plan yet since the SONiC VS (linux) can't support SRv6 VPN packet yet..

Copy link
Contributor

@kperumalbfn kperumalbfn left a comment

Choose a reason for hiding this comment

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

LGTM

@shuaishang shuaishang closed this Nov 19, 2024
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.

5 participants