yang: add zebra specific route map options

*   Extend the route map yang model to have zebra enumerations;
*   Add zebra route map specific match/set values;

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2019-10-07 17:40:45 -03:00
parent fe362bf415
commit bc77245fa1
2 changed files with 85 additions and 18 deletions

View File

@ -179,17 +179,27 @@ module frr-route-map {
description "Match a route tag";
value 10;
}
/*
* 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";
/* zebra specific conditions. */
enum ipv4-prefix-length {
description "Match IPv4 prefix length";
value 100;
}
enum ipv6-prefix-length {
description "Match IPv6 prefix length";
value 101;
}
enum ipv4-next-hop-prefix-length {
description "Match next-hop prefix length";
value 102;
}
enum source-protocol {
description "Match prefix length";
value 103;
}
enum source-instance {
description "Match prefix length";
value 104;
}
}
}
@ -291,15 +301,9 @@ module frr-route-map {
description "Set tag";
value 3;
}
/*
* Protocol YANG models should augment the parent node to
* contain the routing protocol specific value. The protocol
* must also augment `action-value` to include its specific
* values or expand the `when` statement on the existing cases.
*/
enum routing-protocol-specific {
description "Set a routing protocol specific action";
/* zebra specific conditions. */
enum source {
description "Set source address for route";
value 100;
}
}

View File

@ -11,6 +11,10 @@ module frr-zebra {
prefix inet;
}
import frr-route-map {
prefix frr-route-map;
}
import frr-route-types {
prefix frr-route-types;
}
@ -1985,4 +1989,63 @@ module frr-zebra {
}
// End interface model augmentation
augment "/frr-route-map:lib"
+ "/frr-route-map:route-map"
+ "/frr-route-map:entry"
+ "/frr-route-map:match-condition"
+ "/frr-route-map:condition-value" {
case ipv4-prefix-length {
when "./condition = 'ipv4-prefix-length' or
./condition = 'ipv4-next-hop-prefix-length'";
leaf ipv4-prefix-length {
type uint8 {
range "0..32";
}
}
}
case ipv6-prefix-length {
when "./condition = 'ipv6-prefix-length'";
leaf ipv6-prefix-length {
type uint8 {
range "0..128";
}
}
}
case source-protocol {
when "./condition = 'source-protocol'";
leaf source-protocol {
type frr-route-types:frr-route-types;
}
}
case source-instance {
when "./condition = 'source-instance'";
leaf source-instance {
type uint8 {
range "0..255";
}
}
}
}
augment "/frr-route-map:lib"
+ "/frr-route-map:route-map"
+ "/frr-route-map:entry"
+ "/frr-route-map:set-action"
+ "/frr-route-map:action-value" {
case source-v4 {
when "./action = 'source'";
leaf source-v4 {
description "IPv4 address";
type inet:ipv4-address;
}
}
case source-v6 {
when "./action = 'source'";
leaf source-v6 {
description "IPv6 address";
type inet:ipv6-address;
}
}
}
}