diff --git a/release/models/bgp/openconfig-bgp-policy.yang b/release/models/bgp/openconfig-bgp-policy.yang index f4c0c18c4..b7f692248 100644 --- a/release/models/bgp/openconfig-bgp-policy.yang +++ b/release/models/bgp/openconfig-bgp-policy.yang @@ -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 "7.2.0"; + + revision "2024-08-09" { + description + "Add set-as-path BGP action and use-last-as leaf to + set-as-path-prepend to prepend last AS."; + reference "7.2.0"; + } revision "2024-07-02" { description @@ -163,6 +170,29 @@ module openconfig-bgp-policy { // typedef statements + typedef bgp-set-as-path-option-type { + type enumeration { + // TODO(xqm): maybe use prepend instead? + enum ADD { + description + "add the specified AS path to the existing AS path attribute"; + } + enum REMOVE { + description + "remove the specified AS path from the existing AS path attribute"; + } + enum REPLACE { + description + "replace the existing AS path attribute with the specified AS path. + If an empty set is specified, this removes all AS numbers from + the AS path of the route."; + } + } + description + "Type definition for options when setting the AS path + attribute in a policy action"; + } + typedef bgp-set-community-option-type { type enumeration { enum ADD { @@ -896,9 +926,19 @@ module openconfig-bgp-policy { leaf asn { type oc-inet:as-number; description - "The AS number to prepend to the AS path. If this leaf is - not specified and repeat-n is set, then the local AS - number will be used for prepending."; + "The AS number to prepend to the AS path. If neither this + leaf nor mode leaf is specified but repeat-n is set, then + the local AS number will be used for prepending."; + } + + leaf use-last-as { + type boolean; + description + "Indicates whether to use the last AS number, which is also the + most recent AS number, to prepend to the AS path. + If neither use-last-as leaf nor asn leaf is specified + but repeat-n is set, then the local AS number will be + used for prepending."; } } @@ -1322,6 +1362,191 @@ module openconfig-bgp-policy { } } + grouping set-as-path-inline-config { + description + "Configuration data for inline specification of + set-as-path action"; + + leaf-list as-paths { + type union { + type oc-inet:as-number; + type oc-bgp-types:bgp-as-builtin-type; + } + description + "Set the AS path values for the update inline + with a list."; + } + } + + grouping set-as-path-inline-state { + description + "Operational state data or inline specification of + set-as-path action"; + } + + grouping set-as-path-inline-top { + description + "Top-level grouping for inline specification of set-as-path + action"; + + container inline { + when "../config/method='INLINE'" { + description + "Active only when the set-as-path method is INLINE"; + } + description + "Set the AS path values for the action inline with + a list."; + + container config { + description + "Configuration data for inline specification of + set-as-path action"; + + uses set-as-path-inline-config; + } + + container state { + + config false; + + description + "Operational state data or inline specification of + set-as-path action"; + + uses set-as-path-inline-config; + uses set-as-path-inline-state; + } + } + } + + grouping set-as-path-reference-config { + description + "Configuration data for referening an as-path-set + in the set-as-path action"; + + leaf-list as-path-set-refs { + type leafref { + path "/oc-rpol:routing-policy/oc-rpol:defined-sets/" + + "oc-bgp-pol:bgp-defined-sets/" + + "oc-bgp-pol:as-path-sets/" + + "oc-bgp-pol:as-path-set/" + + "oc-bgp-pol:as-path-set-name"; + } + description + "References a list of defined AS path sets by name"; + } + } + + grouping set-as-path-reference-state { + description + "Operational state data for referening an as-path-set + in the set-as-path action"; + } + + grouping set-as-path-reference-top { + description + "Top-level grouping for referening an as-path-set in the + set-as-path action"; + + container reference { + when "../config/method='REFERENCE'" { + description + "Active only when the set-as-path method is REFERENCE"; + } + description + "Provide a reference to an as-path-set for the + set-as-path action"; + + container config { + description + "Configuration data for referening an as-path-set + in the set-as-path action"; + + uses set-as-path-reference-config; + } + + container state { + + config false; + + description + "Operational state data for referening an + as-path-set in the set-as-path action"; + + uses set-as-path-reference-config; + uses set-as-path-reference-state; + } + } + } + + grouping set-as-path-action-config { + description + "Configuration data for the set-as-path action"; + + leaf method { + type enumeration { + enum INLINE { + description + "The AS path is specified inline as a list"; + } + enum REFERENCE { + description + "The AS path is specified by referencing a defined as-path set"; + } + } + description + "Indicates the method used to specify the AS path + for the set-as-path action"; + } + + leaf options { + type bgp-set-as-path-option-type; + description + "Options for modifying the AS path attribute with + the specified values. These options apply to both + methods of setting the AS path attribute."; + } + } + + grouping set-as-path-action-state { + description + "Operational state data for the set-as-path action"; + } + + grouping set-as-path-action-top { + description + "Top-level grouping for the set-as-path action"; + + container set-as-path { + description + "Action to set the AS path attributes of the route, + along with options to modify how the AS path is modified. + AS path may be set using an inline list OR a reference + to an existing defined set (but not both)."; + + container config { + description + "Configuration data for the set-as-path action"; + + uses set-as-path-action-config; + } + + container state { + + config false; + + description + "Operational state data for the set-as-path action"; + + uses set-as-path-action-config; + uses set-as-path-action-state; + } + uses set-as-path-inline-top; + uses set-as-path-reference-top; + } + } + grouping bgp-actions-config { description "Configuration data for BGP-specific actions"; @@ -1381,6 +1606,7 @@ module openconfig-bgp-policy { uses bgp-actions-state; } uses as-path-prepend-top; + uses set-as-path-action-top; uses set-community-action-top; uses set-ext-community-action-top; } diff --git a/release/models/bgp/openconfig-bgp-types.yang b/release/models/bgp/openconfig-bgp-types.yang index 2a9298a6a..6b4b93679 100644 --- a/release/models/bgp/openconfig-bgp-types.yang +++ b/release/models/bgp/openconfig-bgp-types.yang @@ -24,7 +24,13 @@ module openconfig-bgp-types { policy. It can be imported by modules that make use of BGP attributes"; - oc-ext:openconfig-version "6.0.0"; + oc-ext:openconfig-version "6.1.0"; + + revision "2024-08-09" { + description + "Add new bgp-as-builtin-type to support last AS for AS path actions"; + reference "6.1.0"; + } revision "2024-02-01" { description @@ -837,4 +843,17 @@ module openconfig-bgp-types { description "Defines the types of BGP AS path segments."; } + + typedef bgp-as-builtin-type { + type enumeration { + enum LAST { + description + "The last AS in the AS path, which is also the most recent + AS added to the path."; + } + } + description + "Type definition for specifying the built in AS types + that can be used for setting AS path actions."; + } }