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

yang: models for route map and filters #4733

Merged
merged 4 commits into from
Aug 6, 2019

Conversation

rzalamena
Copy link
Member

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:

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 of libfrr. 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:

            /*
             * Protocol YANG models should augment the parent node to
             * contain the routing protocol specific value. The protocol
             * must also augment `condition-value` to include its specific
             * values or expand the `when` statement on the existing cases.
             */
            enum routing-protocol-specific {
              description "Match a routing protocol specific type";
              value 100;
            }

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 or condition-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

@LabN-CI
Copy link
Collaborator

LabN-CI commented Jul 25, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4733 11bc133
Date 07/25/2019
Start 16:50:28
Finish 17:12:13
Run-Time 21:45
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-07-25-16:50:28.txt
Log autoscript-2019-07-25-16:51:15.log.bz2
Memory 428 427 361

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-8447/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: changelog-should-mention-nmu

CLANG Static Analyzer Summary

  • Github Pull Request 4733, comparing to Git base SHA 51e75ed

No Changes in Static Analysis warnings compared to base

1 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-8447/artifact/shared/static_analysis/index.html

@riw777
Copy link
Member

riw777 commented Jul 30, 2019

This looks okay to me -- it might be good to have a file showing the model themselves, and documentation?

@rzalamena
Copy link
Member Author

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

@donaldsharp
Copy link
Member

LGTM

Copy link
Member

@rwestphal rwestphal left a 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;
}
Copy link
Member

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.

Extended access list: source value to match.";
mandatory true;

case host {
Copy link
Member

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.

Copy link
Member Author

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 cases.

typedef access-list-legacy {
description "Standard/Extended IPv4 access list";
type uint16 {
range "1..199 | 1300..2699";
Copy link
Member

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?

Copy link
Member Author

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>
@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 1, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4733 bec0aa8
Date 08/01/2019
Start 19:00:25
Finish 19:22:30
Run-Time 22:05
Total 1815
Pass 1815
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-08-01-19:00:25.txt
Log autoscript-2019-08-01-19:01:26.log.bz2
Memory 436 431 360

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, 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.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Warnings Generated during build:

Debian 10 amd64 build: Successful with additional warnings

Debian Package lintian failed for Debian 10 amd64 build:
(see full package build log at https://ci1.netdef.org/browse/FRR-FRRPULLREQ-8498/artifact/DEB10BUILD/ErrorLog/log_lintian.txt)

W: frr source: changelog-should-mention-nmu

CLANG Static Analyzer Summary

  • Github Pull Request 4733, comparing to Git base SHA cf347ba

No Changes in Static Analysis warnings compared to base

1 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-8498/artifact/shared/static_analysis/index.html

@rzalamena rzalamena marked this pull request as ready for review August 2, 2019 19:54
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

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

LGTM

@riw777 riw777 merged commit 112fed9 into FRRouting:master Aug 6, 2019
@rzalamena rzalamena deleted the route-map-yang branch October 9, 2019 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants