Skip to content

Add ingress-sa-failure counter to IPsec connection counters - #1574

Open
romeyod wants to merge 3 commits into
openconfig:masterfrom
romeyod:master
Open

romeyod wants to merge 3 commits into
openconfig:masterfrom
romeyod:master

Conversation

@romeyod

@romeyod romeyod commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Change Scope

  • Add an ingress counter to IPv4 and IPv6 IPsec for packets discarded when the inbound SPI/SAD lookup
    finds no matching active Security Association (RFC 4301 §5.2).
  • This counter is tracked separately from existing anti-replay and integrity-check drops.
  • This change is backwards compatible.

Tree View

 module: openconfig-security-ipsec
    augment /oc-ni:network-instances/oc-ni:network-instance/oc-sec:security:
      +--ro ipsec
         +--ro ipv4
         |  +--ro connections
         |     +--ro connection* [name]
         |        +--ro state
         |           +--ro counters
         |              +--ro replay-failure       yang:counter64
         |              +--ro integrity-failure    yang:counter64
         |              +--ro encryption-failure   yang:counter64
+        |              +--ro ingress-sa-failure   yang:counter64
         +--ro ipv6
         |  +--ro connections
         |     +--ro connection* [name]
         |        +--ro state
         |           +--ro counters
         |              +--ro replay-failure       yang:counter64
         |              +--ro integrity-failure    yang:counter64
         |              +--ro encryption-failure   yang:counter64
+        |              +--ro ingress-sa-failure   yang:counter64

@gemini-code-assist

Copy link
Copy Markdown
Contributor

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 the OpenConfig IPsec model by introducing a new operational state counter. This change provides better visibility into packet drops occurring during inbound SPI/SAD lookups, allowing for more granular troubleshooting of IPsec connection issues while maintaining backward compatibility.

Highlights

  • New IPsec Counter: Added the ingress-sa-failure counter to the IPv4 IPsec connection state to track packets dropped due to missing or invalid Security Associations.
  • Model Versioning: Updated the module version to 0.2.0 and included a new revision entry to reflect the schema changes.
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 the 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 counterproductive. 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. ↩

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

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.

Code Review

This pull request updates the "openconfig-security-ipsec.yang" module to version 0.2.0 and introduces a new "ingress-sa-failure" counter leaf to track packets dropped due to invalid security associations or SPIs in IPv4 IPsec connections. The review feedback correctly identifies that this counter is missing from the corresponding IPv6 IPsec connection counters. To ensure consistency across IPv4 and IPv6 telemetry, it is recommended to add the "ingress-sa-failure" leaf to the IPv6 counters container as well.

Comment on lines +216 to +222
leaf ingress-sa-failure {
type yang:counter64;
mandatory true;
description
"Count of packets dropped due to invalid security
association or SPI.";
}

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.

high

The ingress-sa-failure counter has been added to the IPv4 IPsec connection counters, but it is missing from the IPv6 IPsec connection counters (under /oc-ni:network-instances/oc-ni:network-instance/oc-sec:security/ipsec/ipv6/connections/connection/state/counters). To ensure consistency across IPv4 and IPv6 IPsec telemetry, this leaf should also be added to the IPv6 counters container.

Vendor Implementation Comparison

Pursuant to the repository style guide, here is a comparison of the ingress-sa-failure leaf with industry implementations:

Network Operating System Command / Path Description Documentation URL
Cisco IOS-XR show crypto ipsec sa Displays SA statistics including packets dropped due to no matching SA / invalid SPI. Cisco IOS-XR Crypto Command Reference
Juniper JunOS show security ipsec security-associations statistics Shows statistics for security associations, including "No SA" drop counters. Juniper JunOS IPsec SA Statistics
Nokia SR Linux /state/ipsec/statistics Tracks IPsec global and SA-specific statistics, including drops due to missing SA or invalid SPI. Nokia SR Linux IPsec State
Arista EOS show ipsec security-association Displays IPsec SA details and packet drop counters for SA lookup failures. Arista EOS IPsec TOI
NVIDIA Cumulus Linux swanctl --stats / ip xfrm state count Shows XFRM state statistics, including error/drop counters for SA lookup failures. NVIDIA Cumulus Linux IPsec VPN
SONiC ip xfrm state count Tracks Linux XFRM framework counters, including SA lookup failures. SONiC IPsec User Guide

Since all six major implementations support tracking drops due to missing or invalid SAs, this change meets the minimum OpenConfig guidelines for vendor-neutral modeling.

Please add the following block to the IPv6 counters container (around line 522 in the original file):

                leaf ingress-sa-failure {
                  type yang:counter64;
                  mandatory true;
                  description
                    "Count of packets dropped due to invalid security
                    association or SPI.";
                }
References
  1. Compare the yang changes with the documentation of implementations of network operating systems from Cisco IOS-XR, Nokia SR Linux, Juniper JunOS/JunOS Evolved, Arista EOS, NVIDIA Cumulus Linux and SONiC, and generate a comparison table. (link)

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.

Added the IPv6 counter

@romeyod romeyod changed the title Add ingress-sa-failure counter to the IPv4 IPsec connection counters Add ingress-sa-failure counter to IPsec connection counters Oct 15, 2026
@romeyod
romeyod marked this pull request as ready for review October 15, 2026 16:41
@romeyod
romeyod requested a review from a team as a code owner October 15, 2026 16:41
@dplore

dplore commented Oct 15, 2026

Copy link
Copy Markdown
Member

/gcbrun

@dplore dplore moved this to Ready to discuss in OC Operator Review Oct 15, 2026

@dplore dplore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. OC Operators review on Oct 20,2026.

@dplore dplore moved this from Ready to discuss to last-call in OC Operator Review Oct 15, 2026
@OpenConfigBot

Copy link
Copy Markdown

No major YANG version changes in commit 1ed9665

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: last-call

Development

Successfully merging this pull request may close these issues.

3 participants