-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
yang: models for route map and filters #4733
Conversation
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-8447/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
CLANG Static Analyzer Summary
No Changes in Static Analysis warnings compared to base1 Static Analyzer issues remaining.See details at |
This looks okay to me -- it might be good to have a file showing the model themselves, and documentation? |
@riw777 I couldn't get JSON representation because that would require instance data and we don't have it yet, but I got a tree representation of the YANG models that should help... https://gist.github.com/rzalamena/109f6372bd93bef0b466822bb8c27c8f If you want to generate it yourself later, you can use the following command: yanglint -f tree /path/to/frr/yang/frr-route-map.yang |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but please see my review comments.
Also, some daemons support ACLs but not prefix-lists. So I think it would be better to move prefix-lists to a separate module of their own. This would also simplify the code as ACLs and prefix-lists are implemented on different files.
enum permit { | ||
description "Accept an entry"; | ||
value 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The code also contains a FILTER_DYNAMIC
enum value but it isn't being used anywhere. I think you can remove it later when converting the code.
yang/frr-filter.yang
Outdated
Extended access list: source value to match."; | ||
mandatory true; | ||
|
||
case host { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the other case
statements from here can be omitted for simplicity.
RFC 7950 says the following (section 7.9.2):
As a shorthand, the "case" statement can be omitted if the branch
contains a single "anydata", "anyxml", "choice", "container", "leaf",
"list", or "leaf-list" statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree... I don't expect to ever change this to add more case
s.
typedef access-list-legacy { | ||
description "Standard/Extended IPv4 access list"; | ||
type uint16 { | ||
range "1..199 | 1300..2699"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This range overlaps with "100..199 | 2000..2699" from access-list-extended
. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. They overlap because it is the union of standard and extended legacy access lists (using numbers instead of name).
New model based on FRR's CLI and data structures. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This model contains the description of access-list, prefix-list and other lists used by route map and other filtering interfaces. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Import the new YANG model filter and use its types. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Based on @rwestphal feedback, lets remove `case`s where we don't expect to add more items or items with more than one `leaf`. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
11bc133
to
bec0aa8
Compare
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-8498/ This is a comment from an automated CI system. Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
CLANG Static Analyzer Summary
No Changes in Static Analysis warnings compared to base1 Static Analyzer issues remaining.See details at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Requirement
This PR depends on #4649 .
Summary
Here is my suggestion of YANG models for the FRR route-map, access-list and prefix list implementation.
I've read and got inspiration from the following sources:
Source code;
IETF's route policy model: https://tools.ietf.org/html/draft-ietf-rtgwg-policy-model-06#section-10 ;
Our documentation
Cisco route map YANG model: https://github.com/YangModels/yang/blob/master/vendor/cisco/xe/1671/Cisco-IOS-XE-route-map.yang
Cisco access list YANG model: https://github.com/YangModels/yang/blob/master/vendor/cisco/xe/1661/Cisco-IOS-XE-acl.yang
The current models ONLY cover the functionality implemented by
lib
, but I've enabled the models to expect and receive augmentations later to support code outside oflibfrr
. For an example: the current access list only covers IPv4, IPv6 and MAC, however BGP implements access lists for AS, communities and ext communities. You can find clues in the YANG models, here is a snippet:Developers would add another leaf to signal its custom type (we can't augment enumerations, so we need another leaf) and then augment the
value
orcondition-value
choices to include their custom choice values.My plan now is to implement northbound for EIGRP, filters and lastly route maps and see how they integrate. Please let me know if you need more clarifications.
NOTE: there is an IETF ACL YANG model, but its intent is to support firewalls and not exactly routing protocols access-lists ( https://tools.ietf.org/html/rfc8519 ).
Components
yang