Skip to content

Add v2r mapping for Switch Packet Integrity Drop counter #423

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vmittal-msft
Copy link

@vmittal-msft vmittal-msft commented Jun 17, 2025

Porting Suvarna's PR - #376

Why I did it

Add v2r mapping to get SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP counters for Chassis platform.

How I did it

Read COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP to get OID and map to Counters so that telemetry can use "COUNTERS/SWITCH*" or "COUNTERS/SWITCH_ID" or "COUNTERS/SWITCH_ID-asic0" to get packet integrity drop counters.

How to verify it

Add unit-test:

    --- PASS: TestGnmiGet/get_COUNTERS:SWITCH_ID (0.00s)
    --- PASS: TestGnmiGet/get_COUNTERS:SWITCH_ID* (0.00s)
    --- PASS: TestGnmiGet/Invalid_fabric_port_key_getSWITCH_ID- (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:SWITCH_ID-asic0 (0.00s)
    --- PASS: TestGnmiGetMultiNs/get_COUNTERS:SWITCH_ID* (0.00s)
    --- PASS: TestGnmiGetMultiNs/Invalid_fabric_port_key_getSWITCH_ID (0.00s)

Verify on Chassis:

gnmi_get -target_addr localhost:50051 -xpath "COUNTERS/SWITCH*"  -xpath_target COUNTERS_DB -insecure 
COUNTERS/SWITCH*: [{"SWITCH_ID-asic0": {'SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP': '0'}, {"SWITCH_ID-asic1": {'SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP': '0'}} 

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the v2r mapping of the Switch Packet Integrity Drop counter by introducing new mapping files, updating the virtual DB translation functions, and extending unit tests.

  • Adds mapping files that relate a switch identifier to its packet integrity drop OID.
  • Updates the virtual database client and translation functions to support the new SWITCH* vpath.
  • Extends unit tests to cover the new mapping and ensure proper response for both valid and invalid keys.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testdata/COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP.txt New mapping file defining a switch-to-OID mapping.
testdata/COUNTERS:oid:0x21000000000000.txt New mapping file for SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP counter.
testdata/COUNTERS:SWITCH_wildcardasic0.txt New asic-specific mapping file for switch wildcard queries.
testdata/COUNTERS:SWITCH_wildcard.txt New mapping file for switch wildcard queries.
testdata/COUNTERS:SWITCH_ID.txt New mapping file for switch keys with no asic appended.
sonic_data_client/virtual_db.go Implements the v2r mapping logic for switch packet integrity drop counters.
sonic_data_client/db_client.go Invokes new initialization for the switch stat mapping in the DB client.
gnmi_server/server_test.go Extends tests to load and validate the new switch mapping configurations.

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vmittal-msft
Copy link
Author

@abdosi @zbud-msft please help review

@rlhui
Copy link
Contributor

rlhui commented Jun 25, 2025

@vmittal-msft , please resolve conflicts

@mssonicbld
Copy link

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

Successfully merging this pull request may close these issues.

4 participants