Skip to content

Add packet trimming counters#1458

Open
sallylsy wants to merge 2 commits intoopenconfig:masterfrom
sallylsy:pkt_trim_cnt_0325
Open

Add packet trimming counters#1458
sallylsy wants to merge 2 commits intoopenconfig:masterfrom
sallylsy:pkt_trim_cnt_0325

Conversation

@sallylsy
Copy link
Copy Markdown
Contributor

Change Scope

  • Add paths to support packet trimming counters.
  • This change is backwards compatible.

Platform Implementations

Tree View

 module: openconfig-interfaces
   +--rw interfaces
      +--rw interface* [name]
         +--ro state
         |  +--ro counters
         |  |  +--ro in-octets?               oc-yang:counter64
         |  |  +--ro in-pkts?                 oc-yang:counter64
         |  |  +--ro in-unicast-pkts?         oc-yang:counter64
         |  |  +--ro in-broadcast-pkts?       oc-yang:counter64
         |  |  +--ro in-multicast-pkts?       oc-yang:counter64
         |  |  +--ro in-errors?               oc-yang:counter64
         |  |  +--ro in-discards?             oc-yang:counter64
         |  |  +--ro out-octets?              oc-yang:counter64
         |  |  +--ro out-pkts?                oc-yang:counter64
         |  |  +--ro out-unicast-pkts?        oc-yang:counter64
         |  |  +--ro out-broadcast-pkts?      oc-yang:counter64
         |  |  +--ro out-multicast-pkts?      oc-yang:counter64
         |  |  +--ro out-discards?            oc-yang:counter64
         |  |  +--ro out-errors?              oc-yang:counter64
         |  |  +--ro last-clear?              oc-types:timeticks64
         |  |  +--ro in-unknown-protos?       oc-yang:counter64
         |  |  +--ro in-fcs-errors?           oc-yang:counter64
         |  |  x--ro carrier-transitions?     oc-yang:counter64
         |  |  +--ro interface-transitions?   oc-yang:counter64
         |  |  +--ro link-transitions?        oc-yang:counter64
         |  |  +--ro resets?                  oc-yang:counter64
+        |  |  +--ro out-trim-pkts?           oc-yang:counter64
+        |  |  +--ro trim-pkts?               oc-yang:counter64
+        |  |  +--ro dropped-trim-pkts?       oc-yang:counter64
 module: openconfig-platform
   +--rw components
      +--rw component* [name]
         +--rw integrated-circuit
         |  +--ro oc-ppc:pipeline-counters
         |     +--ro oc-ppc:packet
         |     |  +--ro oc-ppc:interface-block
         |     |  |  +--ro oc-ppc:state
         |     |  |     +--ro oc-ppc:in-packets?    oc-yang:counter64
         |     |  |     +--ro oc-ppc:out-packets?   oc-yang:counter64
         |     |  |     +--ro oc-ppc:in-bytes?      oc-yang:counter64
         |     |  |     +--ro oc-ppc:out-bytes?     oc-yang:counter64
+        |     |  +--ro oc-ppc:trim
+        |     |     +--ro oc-ppc:state
+        |     |        +--ro oc-ppc:trim-pkts?           oc-yang:counter64
+        |     |        +--ro oc-ppc:dropped-trim-pkts?   oc-yang:counter64
 module: openconfig-qos
   +--rw qos
      +--rw config
      +--ro state
      +--rw interfaces
      |  +--rw interface* [interface-id]
      |     +--rw output
      |        +--rw config
      |        |  +--rw buffer-allocation-profile?             -> ../../../../../buffer-allocation-profiles/buffer-allocation-profile/config/name
      |        |  +--rw multicast-buffer-allocation-profile?   -> ../../../../../buffer-allocation-profiles/buffer-allocation-profile/config/name
      |        |  +--rw unicast-buffer-allocation-profile?     -> ../../../../../buffer-allocation-profiles/buffer-allocation-profile/config/name
      |        +--ro state
      |        |  +--ro buffer-allocation-profile?             -> ../../../../../buffer-allocation-profiles/buffer-allocation-profile/config/name
      |        |  +--ro multicast-buffer-allocation-profile?   -> ../../../../../buffer-allocation-profiles/buffer-allocation-profile/config/name
      |        |  +--ro unicast-buffer-allocation-profile?     -> ../../../../../buffer-allocation-profiles/buffer-allocation-profile/config/name
      |        +--rw classifiers
      |        |  +--rw classifier* [type]
      |        |     +--rw type      -> ../config/type
      |        |     +--rw config
      |        |     |  +--rw name?   -> ../../../../../../../classifiers/classifier/config/name
      |        |     |  +--rw type?   enumeration
      |        |     +--ro state
      |        |     |  +--ro name?   -> ../../../../../../../classifiers/classifier/config/name
      |        |     |  +--ro type?   enumeration
      |        |     +--rw terms
      |        |        +--ro term* [id]
      |        |           +--ro id       -> ../state/id
      |        |           +--ro state
      |        |              +--ro id?                -> ../../../../../../../../../classifiers/classifier[name=current()/../../../../config/name]/terms/term/config/id
      |        |              +--ro matched-packets?   oc-yang:counter64
      |        |              +--ro matched-octets?    oc-yang:counter64
      |        +--rw queues
      |        |  +--rw queue* [name]
      |        |     +--rw name      -> ../config/name
      |        |     +--rw config
      |        |     |  +--rw name?                       string
      |        |     |  +--rw queue-management-profile?   -> ../../../../../../../queue-management-profiles/queue-management-profile/config/name
      |        |     +--ro state
      |        |        +--ro name?                       string
      |        |        +--ro queue-management-profile?   -> ../../../../../../../queue-management-profiles/queue-management-profile/config/name
      |        |        +--ro max-queue-len?              oc-yang:counter64
      |        |        +--ro avg-queue-len?              oc-yang:counter64
      |        |        +--ro transmit-pkts?              oc-yang:counter64
      |        |        +--ro transmit-octets?            oc-yang:counter64
      |        |        +--ro dropped-pkts?               oc-yang:counter64
      |        |        +--ro dropped-octets?             oc-yang:counter64
      |        |        +--ro ecn-marked-pkts?            oc-yang:counter64
      |        |        +--ro ecn-marked-octets?          oc-yang:counter64
      |        |        +--ro ecn-selected-pkts?          oc-yang:counter64
      |        |        +--ro ecn-selected-octets?        oc-yang:counter64
+     |        |        +--ro out-trim-pkts?              oc-yang:counter64
+     |        |        +--ro trim-pkts?                  oc-yang:counter64
+     |        |        +--ro dropped-trim-pkts?          oc-yang:counter64

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances network observability by introducing a set of packet trimming counters across various OpenConfig YANG models. The changes provide detailed metrics on packets that undergo trimming, including those successfully transmitted and those dropped, at the interface, integrated circuit, and QoS queue levels. This update ensures backward compatibility while expanding the data model to support more granular monitoring of network device behavior related to packet processing.

Highlights

  • New Packet Trimming Counters: Introduced three new packet trimming counters: out-trim-pkts (packets trimmed and successfully transmitted), trim-pkts (total packets trimmed), and dropped-trim-pkts (packets trimmed but dropped).
  • Expanded Observability: These new counters are integrated into OpenConfig YANG models at multiple levels: interface, integrated circuit (switch-wide), and QoS output queue, providing comprehensive visibility into packet trimming operations.
  • YANG Module Updates: Updated openconfig-interfaces, openconfig-platform-integrated-circuit, openconfig-platform-pipeline-counters, and openconfig-qos-interfaces modules to incorporate the new counter definitions and augment existing data models.
  • QoS Grouping Refactoring: The qos-interface-queue-root-top grouping in openconfig-qos-interfaces was refactored into qos-interface-input-queue-root-top and qos-interface-output-queue-root-top to better differentiate input and output queue contexts.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new YANG definitions for packet trimming counters across various OpenConfig modules. It updates openconfig-interfaces, openconfig-platform-integrated-circuit, openconfig-platform-pipeline-counters, and openconfig-qos-interfaces to include these new counter types at port, switch, and queue levels, respectively. The review comments highlight several typos in the revision descriptions and suggest grammatical improvements for the descriptions of the new counter leaves.

@sallylsy sallylsy force-pushed the pkt_trim_cnt_0325 branch from 2464c3d to 9d626f4 Compare March 26, 2026 19:27
@ElodinLaarz
Copy link
Copy Markdown
Contributor

Discussed at OC Operators Meeting March 31, 2026:

Can we add information (maybe updating the descriptions for the existing packet counters) about how these trimmed packet counters interact with the existing discard / out packet counters?

@sallylsy sallylsy force-pushed the pkt_trim_cnt_0325 branch from 9d626f4 to 3c76ad8 Compare April 1, 2026 00:32
@sallylsy
Copy link
Copy Markdown
Contributor Author

sallylsy commented Apr 1, 2026

Discussed at OC Operators Meeting March 31, 2026:

Can we add information (maybe updating the descriptions for the existing packet counters) about how these trimmed packet counters interact with the existing discard / out packet counters?

Updated the description for

/interfaces/interface/state/counters/out-discards

and

/qos/interfaces/interface/output/queues/queue/state/dropped-pkts

@ElodinLaarz
Copy link
Copy Markdown
Contributor

/gcbrun

@OpenConfigBot
Copy link
Copy Markdown

OpenConfigBot commented Apr 2, 2026

No major YANG version changes in commit 52823be

@sallylsy sallylsy force-pushed the pkt_trim_cnt_0325 branch from 3c76ad8 to 1f3ef98 Compare April 2, 2026 18:53
@ElodinLaarz
Copy link
Copy Markdown
Contributor

/gcbrun

@sallylsy sallylsy force-pushed the pkt_trim_cnt_0325 branch from 1f3ef98 to a4229cc Compare April 2, 2026 21:31
@ElodinLaarz
Copy link
Copy Markdown
Contributor

/gcbrun

@ElodinLaarz
Copy link
Copy Markdown
Contributor

/gcbrun

@ElodinLaarz ElodinLaarz moved this to Ready to discuss in OC Operator Review Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Ready to discuss

Development

Successfully merging this pull request may close these issues.

3 participants