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 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 entire AS path attribute with the following new path:
    • /routing-policy/policy-definitions/policy-definition/statements/statement/actions/bgp-actions/set-as-path (a list of ASNs or last-as)
  • Add oc-bgp-pol:bgp-as-mode-type to specify last AS in set-as-path.
    • This type is only used for BGP policies, so I decided to put it in oc-bgp-pol instead of oc-bgp-types.
  • This change is backwards compatible.

New paths after the model update:

To be updated.

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 bffc29b

@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
release/models/bgp/openconfig-bgp-policy.yang Outdated Show resolved Hide resolved
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 3 times, most recently from 68a38ff to bffc29b Compare August 9, 2024 22:28
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

Copy link
Member

Choose a reason for hiding this comment

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

Regarding precedence, I am aware of as path prepending 'n' times, adding the "last-asn" to the list and replacing the originating asn with one's own asn (as-override) .

I'm not aware of existing implementations that allow arbitrary add/remove operations from an asn path.

Regarding "editing" an as-path set, practically in gNMI (although OC isn't gnmi only, netconf is also used), there is no 'list editing / insert' operation. To change an 'ordered-by-user' list in gnmi, the whole list must be replaced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Maybe we can remove the set-as-path-option and set-as-path-method altogether, since only replacing the whole list is supported. I also updated set-as-path to be a leaf-list under bgp-actions as it does not require other input now. Let me know if this looks better (or worse).

@dplore
Copy link
Member

dplore commented Nov 12, 2024

/gcbrun

set-as-path action";

leaf-list as-paths {
type union {
Copy link
Member

Choose a reason for hiding this comment

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

I think this need to be ordered-by-user .

Is there precedence for this in existing implementations or is this intended to be a new feature request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Updated type with ordered-by user.

IIUC, only Arista support replacing the entire AS path with [set as-path match all replacement] (https://www.arista.com/en/um-eos/eos-acls-and-route-maps#xx1313923). This is the recommended Arista implementation for the existing as-path-expand in Juniper, which is also vendor specific unefortunately. I am not sure which one fits the model better (neither is ideal due to single-vendor support). set-as-path might be slightly more generic based on our past discussions. Kindly share your thoughts please.

typedef bgp-set-as-path-option-type {
type enumeration {
// TODO(xqm): maybe use prepend instead?
enum ADD {
Copy link
Member

Choose a reason for hiding this comment

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

Regarding precedence, I am aware of as path prepending 'n' times, adding the "last-asn" to the list and replacing the originating asn with one's own asn (as-override) .

I'm not aware of existing implementations that allow arbitrary add/remove operations from an asn path.

Regarding "editing" an as-path set, practically in gNMI (although OC isn't gnmi only, netconf is also used), there is no 'list editing / insert' operation. To change an 'ordered-by-user' list in gnmi, the whole list must be replaced.

@@ -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 "8.0.0";
oc-ext:openconfig-version "8.2.0";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split the change for last-as support to #1221 as discussed offline, which takes version 8.1.0. This change is expected to merge after that PR, so we use version 8.2.0 after that.

@xuqma xuqma changed the title New set-as-path BGP action, and support last AS for for setting and updating AS path. New set-as-path BGP action, and support last AS for for setting AS path. Nov 14, 2024
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