Skip to content

Commit

Permalink
add bgp comm regex-match (#1043)
Browse files Browse the repository at this point in the history
* (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.
  • Loading branch information
dplore authored Mar 14, 2024
1 parent 0cdabe1 commit 6fd1f5d
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 19 deletions.
9 changes: 8 additions & 1 deletion release/models/bgp/openconfig-bgp-errors.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 31 additions & 9 deletions release/models/bgp/openconfig-bgp-policy.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
28 changes: 20 additions & 8 deletions release/models/bgp/openconfig-bgp-types.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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"; }
Expand All @@ -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
Expand Down Expand Up @@ -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:<CO bits>:<4b value> per draft-ietf-idr-segment-routing-te-policy
section 3";
section 3
- link-bandwidth:<2 byte asn>:<bandwidth_value> 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 {
Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 15 additions & 1 deletion release/models/types/openconfig-types.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 6fd1f5d

Please sign in to comment.