Skip to content

Add GRE and MPLS encap-headers to network-instance/static #1308

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 11 commits into
base: master
Choose a base branch
from

Conversation

dplore
Copy link
Member

@dplore dplore commented May 15, 2025

Change Scope

  • Add GRE and MPLS encap-headers to network-instance/static
  • This change is backwards compatible

Platform Implementations

While device implementations today widely support encapsulation of MPLS, GRE and MPLS into GRE packets this PR provides a method to configure a static next-hop-group for the purpose of encapsulation. Using next-hops for this purpose is a new feature being pursued from multiple device implementations.

Tree view

         +--rw static
         |  +--rw next-hop-groups
         |  |  +--rw next-hop-group* [name]
         |  |     +--rw name         -> ../config/name
         |  |     +--rw config
         |  |     |  +--rw name?   string
         |  |     +--ro state
         |  |     |  +--ro name?   string
         |  |     +--rw next-hops
         |  |        +--rw next-hop* [index]
         |  |           +--rw index     -> ../config/index
         |  |           +--rw config
         |  |           |  +--rw index?   -> ../../../../../../next-hops/next-hop/index
         |  |           +--ro state
         |  |              +--ro index?   -> ../../../../../../next-hops/next-hop/index
         |  +--rw next-hops
         |     +--rw next-hop* [index]
         |        +--rw index            -> ../config/index
         |        +--rw config
         |        |  +--rw index?                   string
         |        |  +--rw next-network-instance?   -> /network-instances/network-instance/config/name
         |        |  +--rw next-hop?                union
         |        |  +--rw nh-network-instance?     -> /network-instances/network-instance/config/name
         |        |  +--rw recurse?                 boolean
         |        |  +--rw metric?                  uint32
         |        |  +--rw preference?              uint32
         |        +--ro state
         |        |  +--ro index?                   string
         |        |  +--ro next-network-instance?   -> /network-instances/network-instance/config/name
         |        |  +--ro next-hop?                union
         |        |  +--ro nh-network-instance?     -> /network-instances/network-instance/config/name
         |        |  +--ro recurse?                 boolean
         |        |  +--ro metric?                  uint32
         |        |  +--ro preference?              uint32
         |        +--rw encap-headers
         |           +--rw encap-header* [index]
         |              +--rw index     -> ../config/index
         |              +--rw config
         |              |  +--rw index?   uint8
         |              |  +--rw type?    oc-aftt:encapsulation-header-type
         |              +--ro state
         |              |  +--ro index?   uint8
         |              |  +--ro type?    oc-aftt:encapsulation-header-type
         |              +--rw udp-v4
         |              |  +--rw config
         |              |  |  +--rw src-ip?         oc-inet:ipv4-address
         |              |  |  +--rw dst-ip?         oc-inet:ipv4-address
         |              |  |  +--rw dscp?           oc-inet:dscp
         |              |  |  +--rw src-udp-port?   oc-inet:port-number
         |              |  |  +--rw dst-udp-port?   oc-inet:port-number
         |              |  |  +--rw ip-ttl?         uint8
         |              |  +--ro state
         |              |     +--ro src-ip?         oc-inet:ipv4-address
         |              |     +--ro dst-ip?         oc-inet:ipv4-address
         |              |     +--ro dscp?           oc-inet:dscp
         |              |     +--ro src-udp-port?   oc-inet:port-number
         |              |     +--ro dst-udp-port?   oc-inet:port-number
         |              |     +--ro ip-ttl?         uint8
+        |              +--rw gre
+        |              |  +--rw config
+        |              |  |  +--rw src-ip?   oc-inet:ip-address
+        |              |  |  +--rw dst-ip?   oc-inet:ip-address
+        |              |  +--ro state
+        |              |     +--ro src-ip?   oc-inet:ip-address
+        |              |     +--ro dst-ip?   oc-inet:ip-address
+        |              +--rw mpls
+        |                 +--rw config
+        |                 |  +--rw traffic-class?   oc-mplst:mpls-tc
+        |                 |  +--rw mpls-label?      oc-mplst:mpls-label
+        |                 +--ro state
+        |                 |  +--rw traffic-class?   oc-mplst:mpls-tc
+        |                 |  +--rw mpls-label?      oc-mplst:mpls-label

Example configuration for static next-hops with 2 MPLS labeled inside GRE encapsulation

          "next-hops": {
            "next-hop": [
              {
                "config": {
                  "index": "Dest A-NH1",
                  "metric": 10,
                  "next-hop": "1.2.3.4"
                },
                "encap-headers": {
                  "encap-header": [
                    {
                      "config": {
                        "index": 1
                      },
                      "index": 1,
                      "type": "GRE",
                      "config": {
                        "dst-ip": "gre_ipv4_dst_def",
                        "src-ip": "gre_ipv4_src1",
                        "dscp": "gre_dscp",
                      }
                    }
                    {
                      "config": {
                        "index": 2
                      },
                      "index": 2,
                      "type": "MPLS",
                      "config": {
                        "traffic-class": 2,
                        "mpls-label":  100
                        }
                      },
                    {
                      "config": {
                        "index": 3
                      },
                      "index": 3,
                      "type": "MPLS",
                      "config": {
                        "traffic-class": 2,
                        "mpls-label":  200
                        }
                      }

                    ]
                  },
                 "index": "Dest A-NH1"
               },
            ]
          }

@OpenConfigBot
Copy link

OpenConfigBot commented May 15, 2025

No major YANG version changes in commit a0b5ad6

@dplore dplore moved this to Ready to discuss in OC Operator Review May 16, 2025
@dplore dplore requested review from danameme and robshakir May 28, 2025 05:48
@dplore
Copy link
Member Author

dplore commented Jun 10, 2025

Updated the PR description to show the tree.

@dplore
Copy link
Member Author

dplore commented Jun 10, 2025

@robshakir ready for your review

type oc-inet:ip-address;
description
"The source IP address for the GRE encapsulation may be expressed
using this leaf (src-ip) or if may be derived from
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
using this leaf (src-ip) or if may be derived from
using this leaf (src-ip) or it may be derived from

description
"The source IP address for the GRE encapsulation may be expressed
using this leaf (src-ip) or if may be derived from
'../../interface-ref/state/subinterface'";
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not quite clear what this means. Do you intend to say that the source IP is set based on the interface the policy is applied to? I recall that there's some discussion of wanting to have policies that are not just applied to interfaces.

Also, is this widely supported?

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly, I cut and paste this from the existing aft definition for next-hop with GRE encapsulation, introduced at #1038

I read this intent as the src-ip for the encapsulation may be statically configured using this leaf. If not populated the src-ip is expected to be dynamically derived from the subinterface that the packet is forwarded from. If an implementation requires a static src-ip, then it should return an error if this is unspecified.

How does that sound for a description?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated description to be more explicit. @romeyod for any addition comment.

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.

4 participants