-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add v2r mapping for Fabric Counters in VoQ Chassis (#365)
<!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` ** If this is a bug fix, make sure your description includes "fixes #xxxx", or "closes #xxxx" or "resolves #xxxx" Please provide the following information: --> #### Why I did it 1. In order to retrieve Fabric Counters using Streaming telemetry, the COUNTERS_FABRIC_PORT_NAME_MAP table in COUNTERS_DB has to be queried first to get PORT name to OID mapping, then COUNTERS:oid:<> table in COUNTERS_DB has to be queried to get the Fabric Counters. To make the retrieval easy, changes are made in this PR to add v2r mapping for Fabric Counters in Packet Chassis similar to Ethernet interface counters. Reference sonic-net/sonic-telemetry#77 2 The Fabric counters Port name is unique within a given asic namespace and is not unique across a linecard. For example, there will be a port named PORT0 in asic0 and PORT0 in asic1 namespace as well. In order to make this unique across a multi-asic linecard, this PR appends asic namespace in the interface name. For example, PORT0 in asic0 will be called "PORT0-asic0". #### How I did it 1. Add v2r mapping support to read all ports from COUNTERS_FABRIC_PORT_NAME_MAP so that Streaming telemetry can query using Fabric port name and COUNTERS_DB. 2. Modify the Fabric Port name by appending Asic namespace. 3. Add unit-test 4. Modify clean up and set up multi namespace to reset countersFabricPortNameMap so that the port map is re-initialized when changing from single to multi- namespace in unit-test #### How to verify it Verified on a multi-asic linecard: ``` gnmi_get -target_addr localhost:50051 -xpath COUNTERS/PORT0-asic0 -xpath_target COUNTERS_DB -insecure == getRequest: prefix: < target: "COUNTERS_DB" > path: < elem: < name: "COUNTERS" > elem: < name: "PORT0-asic0" > > encoding: JSON_IETF == getResponse: notification: < timestamp: 1737484675266818454 prefix: < target: "COUNTERS_DB" > update: < path: < elem: < name: "COUNTERS" > elem: < name: "PORT0-asic0" > > val: < json_ietf_val: "{\"SAI_PORT_STAT_IF_IN_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS\":\"0\",\"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES\":\"0\",\"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES\":\"0\",\"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_IN_OCTETS\":\"0\",\"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS\":\"0\",\"SAI_PORT_STAT_IF_OUT_OCTETS\":\"0\"}" > > > ``` Verified on single asic Linecard: ``` gnmi_get -target_addr localhost:50051 -xpath COUNTERS/PORT0 -xpath_target COUNTERS_DB -insecure == getRequest: prefix: < target: "COUNTERS_DB" > path: < elem: < name: "COUNTERS" > elem: < name: "PORT0" > > encoding: JSON_IETF == getResponse: notification: < timestamp: 1737567049704926166 prefix: < target: "COUNTERS_DB" > update: < path: < elem: < name: "COUNTERS" > elem: < name: "PORT0" > > val: < json_ietf_val: "{\"SAI_PORT_STAT_IF_IN_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS\":\"181562945\",\"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES\":\"0\",\"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES\":\"0\",\"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS\":\"0\",\"SAI_PORT_STAT_IF_IN_OCTETS\":\"40499614075\",\"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS\":\"11152\",\"SAI_PORT_STAT_IF_OUT_OCTETS\":\"2588370\"}" > > > gnmi_get -target_addr localhost:50051 -xpath COUNTERS/PORT* -xpath_target COUNTERS_DB -insecure ``` Verified on Pizza box to ensure no error log is seen. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog <!-- Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
- Loading branch information
1 parent
2c4b9c8
commit bcfc802
Showing
9 changed files
with
287 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS": "6428", | ||
"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_OUT_OCTETS": "1007545", | ||
"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS": "16807108", | ||
"SAI_PORT_STAT_IF_IN_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_OCTETS": "3747867283" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"PORT0": { | ||
"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS": "6428", | ||
"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_OUT_OCTETS": "1007545", | ||
"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS": "16807108", | ||
"SAI_PORT_STAT_IF_IN_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_OCTETS": "3747867283" | ||
}, | ||
"PORT1": { | ||
"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_OUT_OCTETS": "0", | ||
"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS": "0", | ||
"SAI_PORT_STAT_IF_IN_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_OCTETS": "0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"PORT0-asic0": { | ||
"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS": "6428", | ||
"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_OUT_OCTETS": "1007545", | ||
"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS": "16807108", | ||
"SAI_PORT_STAT_IF_IN_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_OCTETS": "3747867283" | ||
}, | ||
"PORT1-asic0": { | ||
"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_OUT_OCTETS": "0", | ||
"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS": "0", | ||
"SAI_PORT_STAT_IF_IN_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_OCTETS": "0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS": "6428", | ||
"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_OUT_OCTETS": "1007545", | ||
"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS": "16807108", | ||
"SAI_PORT_STAT_IF_IN_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_OCTETS": "3747867283" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"SAI_PORT_STAT_IF_OUT_FABRIC_DATA_UNITS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_SYMBOL_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_NOT_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_IN_FEC_CORRECTABLE_FRAMES": "0", | ||
"SAI_PORT_STAT_IF_OUT_OCTETS": "0", | ||
"SAI_PORT_STAT_IF_IN_FABRIC_DATA_UNITS": "0", | ||
"SAI_PORT_STAT_IF_IN_ERRORS": "0", | ||
"SAI_PORT_STAT_IF_IN_OCTETS": "0" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"PORT0": "oid:0x1000000000081", | ||
"PORT1": "oid:0x1000000000082" | ||
} |