Skip to content
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

Refactor non-compliant/overlapping YANG definition for BGP MED #1165

Merged
merged 15 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 54 additions & 14 deletions release/models/bgp/openconfig-bgp-policy.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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 "7.1.0";
oc-ext:openconfig-version "8.0.0";

revision "2024-08-23" {
description
"Separate the ability to set the BGP MED along with an appropriate
action.";
reference "8.0.0";
}

revision "2024-07-02" {
description
Expand Down Expand Up @@ -210,23 +217,40 @@ module openconfig-bgp-policy {
typedef bgp-set-med-type {
type union {
type uint32;
type string {
pattern '[+-][0-9]+';
oc-ext:posix-pattern '^[+-][0-9]+$';
}
type enumeration {
enum IGP {
description "set the MED value to the IGP cost toward the
next hop for the route";
description
"Set the MED value to the IGP cost toward the next hop for
the route";
}
}
}
description
"Type definition for specifying how the BGP MED can
be set in BGP policy actions. The three choices are to set
the MED directly using the uint32 type or increment/decrement
using +/- notation in the string type or setting it to
the IGP cost using the enum (predefined value).";
"Type definition for specifying how the BGP MED can be set in BGP
policy actions. The MED can be specified as a direct integer
value or setting it to the IGP cost. To be used in conjunction
with `bgp-set-med-action` in order to specify the appropriate
action to take on this value.";
}

typedef bgp-set-med-action {
type enumeration {
enum SET {
description
"Action to set the MED to a specific value.";
}
enum ADD {
description
"Action to increment the previous MED value.";
}
enum SUBTRACT {
description
"Action to decrement the previous MED value.";
}
dplore marked this conversation as resolved.
Show resolved Hide resolved
}
description
"Specifies which action to take on the value specified by the
bgp-set-med-type.";
}

// grouping statements
Expand Down Expand Up @@ -1345,8 +1369,24 @@ module openconfig-bgp-policy {

leaf set-med {
type bgp-set-med-type;
description "set the med metric attribute in the route
update";
must "../set-med-action" {
error-message
"set-med cannot be specified without a valid set-med-action";
}
description
"Set the MED metric attribute in the route update. When set, a
valid `set-med-action` must be specified.";
}

leaf set-med-action {
type bgp-set-med-action;
must "../set-med" {
error-message
"set-med-action cannot be specified without a set-med value";
}
description
"When set-med is specified, this leaf is mandatory to set the
appropriate action on the MED metric value.";
}
}

Expand Down
Loading