From 6fd1f5d24d35b693864aa3218315b2acbeae9055 Mon Sep 17 00:00:00 2001 From: Darren Loher Date: Wed, 13 Mar 2024 18:01:04 -0700 Subject: [PATCH] add bgp comm regex-match (#1043) * (M) release/models/bgp/openconfig-bgp-errors.yang * (M) release/models/bgp/openconfig-bgp-policy.yang * (M) release/models/bgp/openconfig-bgp-types.yang * (M) release/models/types/openconfig-types.yang Adds posix-regex type and bgp-community-regex type and changes the bgp community-member list to include use the new posix community type. This is a breaking change due to changing an existing union type. Also clarifies the linkbw community type description. --- release/models/bgp/openconfig-bgp-errors.yang | 9 ++++- release/models/bgp/openconfig-bgp-policy.yang | 40 ++++++++++++++----- release/models/bgp/openconfig-bgp-types.yang | 28 +++++++++---- release/models/types/openconfig-types.yang | 16 +++++++- 4 files changed, 74 insertions(+), 19 deletions(-) diff --git a/release/models/bgp/openconfig-bgp-errors.yang b/release/models/bgp/openconfig-bgp-errors.yang index 395fb2d3f..662395606 100644 --- a/release/models/bgp/openconfig-bgp-errors.yang +++ b/release/models/bgp/openconfig-bgp-errors.yang @@ -18,7 +18,14 @@ submodule openconfig-bgp-errors { "This module defines BGP NOTIFICATION message error codes and subcodes"; - oc-ext:openconfig-version "5.6.0"; + oc-ext:openconfig-version "6.0.0"; + + revision "2024-01-31" { + description + "Update community-sets/members/member union type by replacing + the bgp-regex type with posix-eregexp."; + reference "6.0.0"; + } revision "2023-12-26" { description diff --git a/release/models/bgp/openconfig-bgp-policy.yang b/release/models/bgp/openconfig-bgp-policy.yang index 169f78652..03dd2ab8d 100644 --- a/release/models/bgp/openconfig-bgp-policy.yang +++ b/release/models/bgp/openconfig-bgp-policy.yang @@ -13,7 +13,7 @@ module openconfig-bgp-policy { import openconfig-policy-types { prefix oc-pol-types; } import openconfig-bgp-types { prefix oc-bgp-types; } import openconfig-extensions { prefix oc-ext; } - + import openconfig-types { prefix oc-types; } // meta organization @@ -28,7 +28,14 @@ module openconfig-bgp-policy { It augments the base routing-policy module with BGP-specific options for conditions and actions."; - oc-ext:openconfig-version "6.4.0"; + oc-ext:openconfig-version "7.0.0"; + + revision "2024-01-31" { + description + "Update community-sets/members/member union type by replacing + the bgp-regex type with posix-eregexp."; + reference "7.0.0"; + } revision "2023-12-19" { description @@ -593,13 +600,20 @@ module openconfig-bgp-policy { type oc-bgp-types:bgp-well-known-community-type; } description - "members of the community set. - For an ADD operation these are the communities that will be added; - the regexp type is not valid in this operation. + "Members of the community set. + For an ADD operation these are the communities that will be + added. The regexp type is not valid in this operation. + For REMOVE or REPLACE operations then matching communities will be removed unless match-set-options is INVERT which will reverse this to mean that anything that does not match will be - removed."; + removed. + + For MATCH operations the posix-eregexp type should be evaluated + against each community associated with a prefix one community + at a time. Communities must be represented as strings in formats + conforming to oc-bgp-types:bgp-std-community-type. For example: + `1000:1000` for a standard community"; } leaf match-set-options { @@ -672,16 +686,24 @@ module openconfig-bgp-policy { leaf-list ext-community-member { type union { type oc-bgp-types:bgp-ext-community-type; - type oc-bgp-types:bgp-community-regexp-type; + type oc-types:posix-eregexp; } description - "members of the extended community set + "Members of the extended community set. For an ADD operation these are the communities that will be added; the regexp type is not valid in this operation. + For REMOVE or REPLACE operations then matching communities will be removed unless match-set-options is INVERT which will reverse this to mean that anything that does not match will be - removed."; + removed. + + For MATCH operations the posix-eregexp type should be evaluated + against each community associated with a prefix one community + at a time. Communities must be represented as strings in formats + conforming to oc-bgp-types:bgp-ext-community-type. For example: + `route-origin:1000:1000` for the origin type extended community, + and so on."; } leaf match-set-options { diff --git a/release/models/bgp/openconfig-bgp-types.yang b/release/models/bgp/openconfig-bgp-types.yang index b2ce46ef7..2a9298a6a 100644 --- a/release/models/bgp/openconfig-bgp-types.yang +++ b/release/models/bgp/openconfig-bgp-types.yang @@ -4,7 +4,6 @@ module openconfig-bgp-types { namespace "http://openconfig.net/yang/bgp-types"; prefix "oc-bgp-types"; - import openconfig-types { prefix "oc-types"; } import openconfig-inet-types { prefix "oc-inet"; } import openconfig-extensions { prefix "oc-ext"; } @@ -25,7 +24,13 @@ module openconfig-bgp-types { policy. It can be imported by modules that make use of BGP attributes"; - oc-ext:openconfig-version "5.6.0"; + oc-ext:openconfig-version "6.0.0"; + + revision "2024-02-01" { + description + "Modify bgp-community-regexp-type."; + reference "6.0.0"; + } revision "2023-12-26" { description @@ -635,11 +640,15 @@ module openconfig-bgp-types { - route-origin:<2b ASN>:<4b value> per RFC4360 section 5 - route-origin:<4b IPv4>:<2b value> per RFC4360 section 5 - color::<4b value> per draft-ietf-idr-segment-routing-te-policy - section 3"; + section 3 + - link-bandwidth:<2 byte asn>: per + draft-ietf-idr-link-bandwidth-07"; + reference "RFC 4360 - BGP Extended Communities Attribute RFC 5668 - 4-Octet AS Specific BGP Extended Community - draft-ietf-idr-segment-routing-te-policy"; + draft-ietf-idr-segment-routing-te-policy + draft-ietf-idr-link-bandwidth-07"; } typedef bgp-ext-community-recv-type { @@ -673,12 +682,15 @@ module openconfig-bgp-types { } typedef bgp-community-regexp-type { - // TODO: needs more work to decide what format these regexps can - // take. - type oc-types:std-regexp; + type oc-types:posix-eregexp; description "Type definition for communities specified as regular - expression patterns"; + expression patterns. The regular expression must be a + POSIX extended regular expression with some limitations + which are commonly found in device implementations described + in draft-ietf-idr-bgp-model."; + reference + "draft-ietf-idr-bgp-model"; } typedef bgp-origin-attr-type { diff --git a/release/models/types/openconfig-types.yang b/release/models/types/openconfig-types.yang index 89e32d515..a146b9b76 100644 --- a/release/models/types/openconfig-types.yang +++ b/release/models/types/openconfig-types.yang @@ -21,7 +21,13 @@ module openconfig-types { are used across OpenConfig models. It can be imported by modules that make use of these types."; - oc-ext:openconfig-version "0.6.0"; + oc-ext:openconfig-version "1.0.0"; + + revision "2024-01-31" { + description + "Add posix-eregexp type and promote model to version 1.0.0."; + reference "1.0.0"; + } revision "2019-04-16" { description @@ -101,6 +107,14 @@ module openconfig-types { supported. An initial proposal is POSIX compatible."; } + typedef posix-eregexp { + type string; + description + "This is a string which represents an extended POSIX + regular expression."; + reference "IEEE Std 1003.1-2017"; + } + typedef timeticks64 { type uint64; units "nanoseconds";