Skip to content

Added saithrift support to return sai_object_id for a given system_port_id and read VOQ counters for system port#1931

Merged
kcudnik merged 2 commits intoopencomputeproject:masterfrom
saksarav-nokia:saksarav-voq-counters
Dec 6, 2023
Merged

Added saithrift support to return sai_object_id for a given system_port_id and read VOQ counters for system port#1931
kcudnik merged 2 commits intoopencomputeproject:masterfrom
saksarav-nokia:saksarav-voq-counters

Conversation

@saksarav-nokia
Copy link
Copy Markdown
Contributor

For VOQ Chassis, the following two API's are added

  1. Reads all the system ports in the switch from SAI and returns the sai_object_id of the system port requested by the sonic-mgmt.
  2. Takes the sai_object_id of the system port and returns all the VOQs for that system port.

…rt_id and read VOQ counters for system port

Signed-off-by: saksarav <sakthivadivu.saravanaraj@nokia.com>
@saksarav-nokia
Copy link
Copy Markdown
Contributor Author

@vmittal-msft , this is the saithrift PR for VOQ counters.
Anshu will create PR for sonic-mgmt


extern sai_object_id_t gSwitchId;


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

extra line not needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the extra blank line

@kcudnik
Copy link
Copy Markdown
Collaborator

kcudnik commented Dec 1, 2023

should we develop saithrift v2 instead of saithrift ?

@saksarav-nokia
Copy link
Copy Markdown
Contributor Author

should we develop saithrift v2 instead of saithrift ?

I see only .h file in saithriftv2 and the source code is only in saithrift for all the existing functions.

}
// Returns sai_object_id for a system_port_id
sai_thrift_object_id_t sai_thrift_get_sys_port_obj_id_by_port_id(const int32_t sys_port_id) {
printf("sai_thrift_get_sys_port_id_by_port_id\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use SAI_THRIFT log instead of printf ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed it


status = sai_api_query(SAI_API_SWITCH, (void **) &switch_api);
if (status != SAI_STATUS_SUCCESS) {
printf("sai_api_query failed!!!\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use SAI_THRIFT log instead of printf ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed it

attr.id = SAI_SWITCH_ATTR_TYPE;
status = switch_api->get_switch_attribute(gSwitchId, 1, &attr);
if (status != SAI_STATUS_SUCCESS) {
printf("get_switch_attribute failed!!!\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use SAI_THRIFT log instead of printf ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed it

return SAI_NULL_OBJECT_ID;
}
void sai_thrift_get_system_port_attribute(sai_thrift_attribute_list_t& thrift_attr_list, const sai_thrift_object_id_t sys_port_oid) {
printf("sai_thrift_get_system_port_attribute for 0x%lx\n", sys_port_oid);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use SAI_THRIFT log instead of printf ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed it

Signed-off-by: saksarav <sakthivadivu.saravanaraj@nokia.com>
@vmittal-msft
Copy link
Copy Markdown
Contributor

@kcudnik @rlhui i don't have permission to merge. Can you please help ?

@kcudnik kcudnik merged commit 96143ee into opencomputeproject:master Dec 6, 2023
saksarav-nokia added a commit to saksarav-nokia/SAI that referenced this pull request Dec 22, 2023
…rt_id and read VOQ counters for system port (opencomputeproject#1931)

For VOQ Chassis, the following two API's are added

Reads all the system ports in the switch from SAI and returns the sai_object_id of the system port requested by the sonic-mgmt.
Takes the sai_object_id of the system port and returns all the VOQs for that system port.

Signed-off-by: saksarav <sakthivadivu.saravanaraj@nokia.com>
rlhui pushed a commit that referenced this pull request Jan 2, 2024
…rt_id and read VOQ counters for system port (#1931)

For VOQ Chassis, the following two API's are added

Reads all the system ports in the switch from SAI and returns the sai_object_id of the system port requested by the sonic-mgmt.
Takes the sai_object_id of the system port and returns all the VOQs for that system port.
kcudnik pushed a commit that referenced this pull request Jan 3, 2024
…rt_id and read VOQ counters for system port (#1931) (#1937)

For VOQ Chassis, the following two API's are added

Reads all the system ports in the switch from SAI and returns the sai_object_id of the system port requested by the sonic-mgmt.
Takes the sai_object_id of the system port and returns all the VOQs for that system port.

Signed-off-by: saksarav <sakthivadivu.saravanaraj@nokia.com>
@rlhui
Copy link
Copy Markdown
Collaborator

rlhui commented Jan 11, 2024

@saksarav-nokia which exact test this is needed? Thanks.

@saksarav-nokia
Copy link
Copy Markdown
Contributor Author

@rlhui , We have enhanced sonic-mgmt Qos LossyQTest to verify the Voq counters.
sonic-net/sonic-mgmt#11000

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