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

New set-as-path BGP action, and support last AS for for setting and updating AS path. #1148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xuqma
Copy link
Contributor

@xuqma xuqma commented Jul 15, 2024

Change Scope

  • Add set-as-path BGP action to replacing the AS path with the following new paths:
    • /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-as-path/config/method (INLINE or REFERENCE)
    • /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-as-path/inline/config/as-paths (a list of ASNs or last-as)
    • /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-as-path/reference/config/as-path-set-ref (reference to a single as-path-set, do we still need this leaf since it has been deprecated in set-community and set-ext-community)
    • /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-as-path/reference/config/as-path-set-refs (reference to multiple as-path-sets)
  • Add oc-bgp-pol:bgp-as-mode-type to specify last AS in set-as-path and set-as-path-prepend.
    • This type is only used for BGP policies, so I decided to put it in oc-bgp-pol instead of oc-bgp-types.
  • Add set-as-path-prepend/config/mode of type oc-bgp-pol:bgp-as-mode-type, to allow prepending last AS to the path.

New paths after the model update:

+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/config
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/config/method
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/config/options
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/inline
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/inline/config
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/inline/config/as-paths
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/inline/state
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/inline/state/as-paths
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/reference
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/reference/config
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/reference/config/as-path-set-refs
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/reference/state
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/reference/state/as-path-set-refs
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/state
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/state/method
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path/state/options
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path-prepend/config/use-last-as
+ /openconfig-routing-policy:routing-policy/policy-definitions/policy-definition/statements/statement/actions/openconfig-bgp-policy:bgp-actions/set-as-path-prepend/state/use-last-as

Platform Implementations

@xuqma xuqma requested a review from a team as a code owner July 15, 2024 05:05
@dplore
Copy link
Member

dplore commented Jul 16, 2024

/gcbrun

@OpenConfigBot
Copy link

OpenConfigBot commented Jul 16, 2024

No major YANG version changes in commit 9b86431

@xuqma
Copy link
Contributor Author

xuqma commented Jul 16, 2024

Removed the extra comma and rebased against master.

@dplore
Copy link
Member

dplore commented Aug 7, 2024

/gcbrun

@dplore dplore self-assigned this Aug 7, 2024
Comment on lines 924 to 930
leaf mode {
type bgp-as-mode-type;
description
"Use a special AS number, e.g. last AS, to prepend to the
AS path. If neither leaf nor asn leaf is specified but
repeat-n is set, then the local AS number will be used for
prepending.";
Copy link
Member

Choose a reason for hiding this comment

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

Since there is only one enum and no clear use cases for expanding this, maybe it makes sense to sense to just make this leaf use-last-as

Copy link
Contributor Author

@xuqma xuqma Aug 9, 2024

Choose a reason for hiding this comment

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

Updated the leaf to use-last-as as a boolean. Let me know if this looks better.

release/models/bgp/openconfig-bgp-policy.yang Outdated Show resolved Hide resolved
@@ -229,6 +236,19 @@ module openconfig-bgp-policy {
the IGP cost using the enum (predefined value).";
}

typedef bgp-as-mode-type {
Copy link
Member

Choose a reason for hiding this comment

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

We use the term 'builtin' in other parts of OC to refer to special values or logic that is defined by the device.

Suggested change
typedef bgp-as-mode-type {
typedef bgp-as-builtin-type {

release/models/bgp/openconfig-bgp-policy.yang Outdated Show resolved Hide resolved
release/models/bgp/openconfig-bgp-policy.yang Outdated Show resolved Hide resolved
@xuqma xuqma force-pushed the master branch 2 times, most recently from 5af3102 to 99c5637 Compare August 9, 2024 22:26
…repend/use-last-as to support last AS for setting and updating AS path.
typedef bgp-set-as-path-option-type {
type enumeration {
// TODO(xqm): maybe use prepend instead?
enum ADD {
Copy link
Contributor Author

@xuqma xuqma Aug 9, 2024

Choose a reason for hiding this comment

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

I am not so sure about certain behaviors after thinking about this a little more. Unlike communities, as-path is ordered and therefore could be a bit tricky.

  1. I wonder what would the expected behavior for add as-path "1 2 3". Do we prepend "1 2 3" to the AS path? How about `delete as-path "1 2 3"? Do we delete 1) every AS1, AS2 and AS3 from the path 2) all "1 2 3" sub-paths from the as-path?
  2. Using as-path-set reference as input might complicate things further. For instance, an as-path-set can have multiple members such as ["1 2", "3 4 5"]. After replace as-path-set, will the AS path become "1 2 3 4 5"? If there are regex in as-path-set, maybe it works for delete, but it's more like invalid input for add/replace.

Would like to have your thoughts to better define the semantics in these cases. Thanks Darren!

@dplore @tiborschneider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants