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

[orchagent] Add support for Path Tracing Midpoint #2903

Merged
merged 12 commits into from
May 24, 2024

Conversation

cscarpitta
Copy link
Contributor

@cscarpitta cscarpitta commented Sep 15, 2023

What I did
Extended PortsOrch to process the attributes required for Path Tracing.

Why I did it
This PR is required for the SRv6 Path Tracing Midpoint feature.
HLD: sonic-net/SONiC#1456

How I verified it
Added new unit tests to portmgr_ut.cpp, portsorch_ut.cpp and tests/test_port.py.

@cscarpitta cscarpitta changed the title [orchagent] Add support for SRv6 Path Tracing Midpoint [orchagent] Add support for Path Tracing Midpoint Oct 12, 2023
@ahsalam
Copy link

ahsalam commented Oct 14, 2023

@prsunny @kperumalbfn could you please help and review the code of this PR?
This feature is tracked for 202311 release and documented by this HLD sonic-net/SONiC#1456
@zhangyanzhao

{
SWSS_LOG_INFO("Path Tracing is not supported");
fvVector.emplace_back(SWITCH_CAPABILITY_TABLE_PATH_TRACING_CAPABLE, "false");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

are we using this capability check before pushing the path tracing feature to SAI? Could you check that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn The result of the Path Tracing capability check is saved to STATE DB. Then, the CLI checks if Path Tracing is supported or not before attempting to enable Path Tracing.

In addition, as requested, I added some checks to also verify if Path Tracing is supported or not before configuring it into the ASIC: 448d8a3

* Decrease TAM object ref count before removing the port, if the port
* has a TAM object assigned
*/
if (m_portPtTam.find(p.m_alias) != m_portPtTam.end())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also check if TAM module is supported in the switch using the capability check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn I added the TAM capability check, as requested: 5b57173

}
}

if (!setPortPtTam(p, m_ptTam))
Copy link
Contributor

Choose a reason for hiding this comment

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

We could move TAM create, setting TAM to port and refcount update to a different function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn I moved all the logic related to the TAM to separate functions: fc6b5ba

@@ -80,3 +85,5 @@
#define PORT_ROLE "role"
#define PORT_ADMIN_STATUS "admin_status"
#define PORT_DESCRIPTION "description"
#define PORT_PT_INTF_ID "pt_interface_id"
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn I added the two fields to the documentation: c9ff12e

@cscarpitta cscarpitta force-pushed the srv6_pt_midpoint branch 2 times, most recently from 06b7459 to b232132 Compare October 26, 2023 12:51
@cscarpitta
Copy link
Contributor Author

Hi @kperumalbfn, many thanks for the review. I addressed all comments.

}
port.pt_intf_id.is_set = true;
}
catch (const std::exception &e)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we reject this for port-channel?
Also check for the path-tracing interface id within the valid range. I believe it is between 1-4K as per HLD. Please add this case in swss tests.

Copy link
Contributor Author

@cscarpitta cscarpitta Oct 31, 2023

Choose a reason for hiding this comment

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

@kperumalbfn I did the requested changes:

  • added a check to reject Path Tracing configuration on port channel
  • added a check to ensure Path Tracing interface ID is in the valid range [1, 4095]
  • added test cases to verify that OrchAgent behaves as expected when it receives an invalid Path Tracing configuration

@cscarpitta
Copy link
Contributor Author

@kperumalbfn Many thanks for the review. All comments have been addressed.

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

@@ -86,3 +86,4 @@ extern sai_mpls_api_t* sai_mpls_api;
extern sai_counter_api_t* sai_counter_api;
extern sai_samplepacket_api_t *sai_samplepacket_api;
extern sai_fdb_api_t* sai_fdb_api;
extern sai_fdb_api_t* sai_tam_api;
Copy link
Contributor

Choose a reason for hiding this comment

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

typo sai_tam_api_t??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn Fixed, thanks!

@@ -217,6 +218,7 @@ void initSaiApi()
sai_api_query((sai_api_t)SAI_API_DASH_ENI, (void**)&sai_dash_eni_api);
sai_api_query((sai_api_t)SAI_API_DASH_VIP, (void**)&sai_dash_vip_api);
sai_api_query((sai_api_t)SAI_API_DASH_DIRECTION_LOOKUP, (void**)&sai_dash_direction_lookup_api);
sai_api_query(SAI_API_TAM, (void **)&sai_tam_api);

Copy link
Contributor

Choose a reason for hiding this comment

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

pls check the alignments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn Fixed, thanks!

Copy link
Contributor

@kperumalbfn kperumalbfn Nov 2, 2023

Choose a reason for hiding this comment

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

@cscarpitta could you fix the alignment for sai_api_query

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn Fixed, many thanks for the review.

@prsunny
Copy link
Collaborator

prsunny commented Nov 2, 2023

@kperumalbfn , please signoff

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

@ahsalam
Copy link

ahsalam commented Nov 13, 2023

@prsunny the PR has been approved by @kperumalbfn. It is ready for merge. can you merge the PR?

@cscarpitta
Copy link
Contributor Author

@prsunny The PR has been reviewed and approved. It is ready for merge. Could you please merge the PR?

@cscarpitta
Copy link
Contributor Author

@dgsudharsan Did you have a chance to review this PR? Can you please have a look?

@prsunny

@dgsudharsan dgsudharsan removed their request for review November 28, 2023 15:55
@prsunny
Copy link
Collaborator

prsunny commented Mar 18, 2024

Can you please fix coverage and rebase the code?

@cscarpitta cscarpitta force-pushed the srv6_pt_midpoint branch 2 times, most recently from e057773 to f628fb7 Compare April 5, 2024 09:35
@liat-grozovik
Copy link
Collaborator

@cscarpitta in order to merge the PR we need all checkers to pass and the coverage to be extended.
if you wish the feature to be included in 202405 you need to be fast on that :-)

@cscarpitta cscarpitta force-pushed the srv6_pt_midpoint branch 5 times, most recently from 92c7c33 to 0a61f3e Compare May 18, 2024 19:46
@cscarpitta cscarpitta force-pushed the srv6_pt_midpoint branch 6 times, most recently from 61dc3db to 6cc0bae Compare May 20, 2024 20:37
@zhangyanzhao
Copy link
Collaborator

@prsunny can you please help to check and merge this PR? Thanks.

@cscarpitta
Copy link
Contributor Author

@cscarpitta in order to merge the PR we need all checkers to pass and the coverage to be extended. if you wish the feature to be included in 202405 you need to be fast on that :-)

@liat-grozovik Many thanks for the review.

I added some test cases to extend the coverage as requested. The CI checks are failing for reasons unrelated to this PR.

Could you please take a look again?

@prsunny
Copy link
Collaborator

prsunny commented May 22, 2024

@prsunny can you please help to check and merge this PR? Thanks.

ack. will merge after rerunning the tests

@prsunny
Copy link
Collaborator

prsunny commented May 23, 2024

@cscarpitta , can you please resolve conflict and rebase?

Extend PortsOrch to support PT Midpoint.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
During PortsOrch initialization, SwitchOrch->set_switch_capability() is called
to set Path Tracing capability in STATE DB. Currently, SwitchOrch is not
initialized in FdbOrch UT, which causes a Segmentation Fault.

Let's initialize SwitchOrch during the test case setup.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
During PortsOrch initialization, SwitchOrch->set_switch_capability() is called
to set Path Tracing capability in STATE DB. Currently, PortshOrch is
initialized before initializing SwitchOrch in MuxOrch UT, which causes a
Segmentation Fault.

Let's move SwitchOrch initialization before PortsOrch initialization.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
During its initialization, PortsOrch queries switch capabilities to verify
if Path Tracing is supported or not.

Currently, PortsOrch UTs fail because the TAM object type required by Path Tracing
tests is not in the list of object types supported by the switch.

This commit mocks get_switch_attribute() SAI API in PortsOrch UT to return TAM object type
as part of the object types supported by the switch.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
@prsunny
Copy link
Collaborator

prsunny commented May 23, 2024

PR tests are passing now, can you please fix coverage?

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
@cscarpitta
Copy link
Contributor Author

PR tests are passing now, can you please fix coverage?

@prsunny Done. I extended the coverage, tests are passing and coverage requirements are met now.

Can you please take a look again?

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.

6 participants