summaryrefslogtreecommitdiffstats
path: root/yang/frr-route-map.yang
diff options
context:
space:
mode:
authorSarita Patra <saritap@vmware.com>2020-10-30 07:40:10 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2021-03-30 21:58:42 +0200
commitb702f424455b208cd4171f84048c65ec8a349184 (patch)
treeed6da7252813ce7279227a1e8a3ebde3d4520095 /yang/frr-route-map.yang
parentMerge pull request #8058 from rgirada/ospf-ecmp (diff)
downloadfrr-b702f424455b208cd4171f84048c65ec8a349184.tar.xz
frr-b702f424455b208cd4171f84048c65ec8a349184.zip
lib,zebra,bgpd,ospfd,ospf6d: Route-map yang defns
This commit includes the following: 1) Modifications to the frr-route-map.yang to enable addition of bgpd, ospfd, ospf6d and zebra specific route map match/set clauses. 2) Yang definitions for bgpd match/set clauses. 3) Yang definitions for ospfd and ospf6d match/set clauses. 4) Yang definitions for zebra match/set clauses. Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com> Signed-off-by: Sarita Patra <saritap@vmware.com>
Diffstat (limited to 'yang/frr-route-map.yang')
-rw-r--r--yang/frr-route-map.yang598
1 files changed, 323 insertions, 275 deletions
diff --git a/yang/frr-route-map.yang b/yang/frr-route-map.yang
index b22a96a74..6ed3dadaa 100644
--- a/yang/frr-route-map.yang
+++ b/yang/frr-route-map.yang
@@ -53,21 +53,124 @@ module frr-route-map {
"Initial revision";
}
- /*
- * Types.
- */
+ identity rmap-match-type {
+ description
+ "Base route-map match-condition";
+ }
+
+ identity interface {
+ base rmap-match-type;
+ description
+ "Match interface";
+ }
+
+ identity ipv4-address-list {
+ base rmap-match-type;
+ description
+ "Match an IPv4 access-list";
+ }
+
+ identity ipv4-prefix-list {
+ base rmap-match-type;
+ description
+ "Match an IPv4 prefix-list";
+ }
+
+ identity ipv4-next-hop-list {
+ base rmap-match-type;
+ description
+ "Match an IPv4 next-hop";
+ }
+
+ identity ipv4-next-hop-prefix-list {
+ base rmap-match-type;
+ description
+ "Match an IPv4 next-hop prefix list";
+ }
+
+ identity ipv4-next-hop-type {
+ base rmap-match-type;
+ description
+ "Match an IPv4 next-hop type";
+ }
+
+ identity ipv6-address-list {
+ base rmap-match-type;
+ description
+ "Match an IPv6 access-list";
+ }
+
+ identity ipv6-prefix-list {
+ base rmap-match-type;
+ description
+ "Match an IPv6 prefix-list";
+ }
+
+ identity ipv6-next-hop-type {
+ base rmap-match-type;
+ description
+ "Match an IPv6 next-hop type";
+ }
+
+ identity match-metric {
+ base rmap-match-type;
+ description
+ "Match a route metric";
+ }
+
+ identity match-tag {
+ base rmap-match-type;
+ description
+ "Match a route tag";
+ }
+
+ identity rmap-set-type {
+ description
+ "Base route-map set-action";
+ }
+
+ identity ipv4-next-hop {
+ base rmap-set-type;
+ description
+ "Set IPv4 address of the next hop";
+ }
+
+ identity ipv6-next-hop {
+ base rmap-set-type;
+ description
+ "Set IPv6 address of the next hop";
+ }
+
+ identity set-metric {
+ base rmap-set-type;
+ description
+ "Set prefix/route metric";
+ }
+
+ identity set-tag {
+ base rmap-set-type;
+ description
+ "Set tag";
+ }
+
+ identity set-sr-te-color {
+ base rmap-set-type;
+ description
+ "Set Color of the SR-TE";
+ }
+
typedef route-map-sequence {
type uint16 {
range "1..65535";
}
description
- "Route map valid sequence numbers.";
+ "Route map valid sequence numbers";
}
typedef route-map-name {
type string;
description
- "Route map name format.";
+ "Route map name format";
}
typedef route-map-ref {
@@ -79,349 +182,294 @@ module frr-route-map {
"Reference to a route-map.";
}
- /*
- * Operational data.
- */
+ grouping rmap-match-condition {
+ container rmap-match-condition {
+ choice match-condition {
+ description
+ "Value to match (interpretation depends on condition type)";
+ case interface {
+ when "derived-from-or-self(../condition, 'interface')";
+ leaf interface {
+ type frr-interface:interface-ref;
+ }
+ }
+
+ case list-name {
+ when "derived-from-or-self(../condition, 'ipv4-address-list') or "
+ + "derived-from-or-self(../condition, 'ipv4-prefix-list') or "
+ + "derived-from-or-self(../condition, 'ipv4-next-hop-list') or "
+ + "derived-from-or-self(../condition, 'ipv4-next-hop-prefix-list') or "
+ + "derived-from-or-self(../condition, 'ipv6-address-list') or "
+ + "derived-from-or-self(../condition, 'ipv6-prefix-list')";
+ leaf list-name {
+ type filter:access-list-name;
+ }
+ }
+
+ case ipv4-next-hop-type {
+ when "derived-from-or-self(../condition, 'ipv4-next-hop-type')";
+ leaf ipv4-next-hop-type {
+ type enumeration {
+ enum "blackhole" {
+ value 0;
+ }
+ }
+ }
+ }
+
+ case ipv6-next-hop-type {
+ when "derived-from-or-self(../condition, 'ipv6-next-hop-type')";
+ leaf ipv6-next-hop-type {
+ type enumeration {
+ enum "blackhole" {
+ value 0;
+ }
+ }
+ }
+ }
+
+ case match-metric {
+ when "derived-from-or-self(../condition, 'match-metric')";
+ leaf metric {
+ type uint32 {
+ range "1..4294967295";
+ }
+ }
+ }
+
+ case match-tag {
+ when "derived-from-or-self(../condition, 'match-tag')";
+ leaf tag {
+ type uint32 {
+ range "1..4294967295";
+ }
+ }
+ }
+ }
+ }
+ }
+
+ grouping rmap-set-action {
+ container rmap-set-action {
+ choice set-action {
+ description
+ "Value to set (interpretation depends on action-type)";
+ case ipv4-address {
+ when "derived-from-or-self(../action, 'ipv4-next-hop')";
+ leaf ipv4-address {
+ type inet:ipv4-address;
+ description
+ "IPv4 address";
+ }
+ }
+
+ case ipv6-address {
+ when "derived-from-or-self(../action, 'ipv6-next-hop')";
+ leaf ipv6-address {
+ type inet:ipv6-address;
+ description
+ "IPv6 address";
+ }
+ }
+
+ case set-metric {
+ when "derived-from-or-self(../action, 'set-metric')";
+ choice metric-value {
+ description
+ "Metric to set or use";
+ case value {
+ leaf value {
+ type uint32 {
+ range "0..4294967295";
+ }
+ description
+ "Use the following metric value";
+ }
+ }
+
+ case add-metric {
+ leaf add-metric {
+ description "Add value to metric.";
+ type uint32 {
+ range "0..4294967295";
+ }
+ }
+ }
+
+ case subtract-metric {
+ leaf subtract-metric {
+ description "Subtract value from metric.";
+ type uint32 {
+ range "0..4294967295";
+ }
+ }
+ }
+
+ case use-round-trip-time {
+ leaf use-round-trip-time {
+ type boolean;
+ description
+ "Use the round trip time as metric";
+ }
+ }
+
+ case add-round-trip-time {
+ leaf add-round-trip-time {
+ type boolean;
+ description
+ "Add round trip time to metric";
+ }
+ }
+
+ case subtract-round-trip-time {
+ leaf subtract-round-trip-time {
+ type boolean;
+ description
+ "Subtract round trip time to metric";
+ }
+ }
+ }
+ }
+
+ case set-tag {
+ when "derived-from-or-self(../action, 'set-tag')";
+ leaf tag {
+ type uint32 {
+ range "0..4294967295";
+ }
+ description
+ "Tag value";
+ }
+ }
+
+ case set-sr-te-color {
+ when "derived-from-or-self(../action, 'set-sr-te-color')";
+ leaf policy {
+ type string;
+ description
+ "Color of the SR-TE Policies to match with";
+ }
+ }
+ }
+ }
+ }
+
container lib {
list route-map {
key "name";
description
- "Route map instance.";
+ "Route map instance";
leaf name {
type route-map-name;
description
- "Route map instance name.";
+ "Route map instance name";
}
list entry {
key "sequence";
description
- "Route map entry.";
+ "Route map entry";
leaf sequence {
- description
- "Route map instance priority (low number means higher priority).";
type route-map-sequence;
+ description
+ "Route map instance priority (low number means higher priority)";
}
leaf description {
- description "Route map description.";
type string;
+ description
+ "Route map description";
}
leaf action {
- description
- "Route map actions: permit (executes action), deny (quits evaluation).";
- mandatory true;
type enumeration {
- enum permit {
+ enum "permit" {
+ value 0;
description
"Executes configured action and permits the prefix/route
if the conditions matched. An alternative exit action can
be configured to continue processing the route map list
or jump to process another route map.";
- value 0;
}
- enum deny {
+ enum "deny" {
+ value 1;
description
"If all conditions are met the prefix/route is denied and
route map processing stops.";
- value 1;
}
}
+ mandatory true;
+ description
+ "Route map actions: permit (executes action), deny (quits evaluation)";
}
leaf call {
+ type route-map-name;
description
"Call another route map before calling `exit-policy`. If the
called route map returns deny then this route map will also
- return deny.";
- type route-map-name;
+ return deny";
}
leaf exit-policy {
- description "What do to after route map successful match, set and call.";
type enumeration {
- enum permit-or-deny {
- description "End route map evaluation and return.";
+ enum "permit-or-deny" {
value 0;
- }
- enum next {
description
- "Proceed evaluating next route map entry per sequence.";
- value 1;
+ "End route map evaluation and return";
}
- enum goto {
+ enum "next" {
+ value 1;
description
- "Go to route map entry with the provided sequence number.";
+ "Proceed evaluating next route map entry per sequence";
+ }
+ enum "goto" {
value 2;
+ description
+ "Go to route map entry with the provided sequence number";
}
}
default "permit-or-deny";
+ description
+ "What do to after route map successful match, set and call";
}
leaf goto-value {
when "../exit-policy = 'goto'";
- description
- "Sequence number to jump (when using `goto` exit policy).";
- mandatory true;
type route-map-sequence;
+ mandatory true;
+ description
+ "Sequence number to jump (when using `goto` exit policy)";
}
list match-condition {
key "condition";
description
- "Route map match conditions.";
+ "Route map match conditions";
leaf condition {
- description "Match condition.";
- type enumeration {
- enum interface {
- description "Match interface.";
- value 0;
- }
- enum ipv4-address-list {
- description "Match an IPv4 access-list.";
- value 1;
- }
- enum ipv4-prefix-list {
- description "Match an IPv4 prefix-list.";
- value 2;
- }
- enum ipv4-next-hop-list {
- description "Match an IPv4 next-hop.";
- value 3;
- }
- enum ipv4-next-hop-prefix-list {
- description "Match an IPv4 next-hop prefix list.";
- value 4;
- }
- enum ipv4-next-hop-type {
- description "Match an IPv4 next-hop type.";
- value 5;
- }
- enum ipv6-address-list {
- description "Match an IPv6 access-list.";
- value 6;
- }
- enum ipv6-prefix-list {
- description "Match an IPv6 prefix-list.";
- value 7;
- }
- enum ipv6-next-hop-type {
- description "Match an IPv6 next-hop type.";
- value 8;
- }
- enum metric {
- description "Match a route metric.";
- value 9;
- }
- enum tag {
- description "Match a route tag.";
- value 10;
- }
- /* 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 source protocol.";
- value 103;
- }
- enum source-instance {
- description "Match source protocol instance.";
- value 104;
- }
+ type identityref {
+ base rmap-match-type;
}
- }
-
- choice condition-value {
description
- "Value to match (interpretation depends on condition type).";
- mandatory true;
- case interface {
- when "./condition = 'interface'";
- leaf interface {
- type frr-interface:interface-ref;
- }
- }
-
- case list-name {
- when "./condition = 'ipv4-address-list' or
- ./condition = 'ipv4-prefix-list' or
- ./condition = 'ipv4-next-hop-list' or
- ./condition = 'ipv4-next-hop-prefix-list' or
- ./condition = 'ipv6-address-list' or
- ./condition = 'ipv6-prefix-list'";
- leaf list-name {
- type filter:access-list-name;
- }
- }
-
- case ipv4-next-hop-type {
- when "./condition = 'ipv4-next-hop-type'";
- leaf ipv4-next-hop-type {
- type enumeration {
- enum blackhole {
- value 0;
- }
- }
- }
- }
-
- case ipv6-next-hop-type {
- when "./condition = 'ipv6-next-hop-type'";
- leaf ipv6-next-hop-type {
- type enumeration {
- enum blackhole {
- value 0;
- }
- }
- }
- }
-
- case metric {
- when "./condition = 'metric'";
- leaf metric {
- type uint32 {
- range "1..4294967295";
- }
- }
- }
-
- case tag {
- when "./condition = 'tag'";
- leaf tag {
- type uint32 {
- range "1..4294967295";
- }
- }
- }
+ "Match condition";
}
+
+ uses rmap-match-condition;
}
list set-action {
- description "Route map set actions.";
-
key "action";
-
+ description
+ "Route map set actions";
leaf action {
- description "Action to do when the route map matches.";
- type enumeration {
- enum ipv4-next-hop {
- description "Set IPv4 address of the next hop.";
- value 0;
- }
- enum ipv6-next-hop {
- description "Set IPv6 address of the next hop.";
- value 1;
- }
- enum metric {
- description "Set prefix/route metric.";
- value 2;
- }
- enum tag {
- description "Set tag.";
- value 3;
- }
- /* zebra specific conditions. */
- enum source {
- description "Set source address for route.";
- value 100;
- }
+ type identityref {
+ base rmap-set-type;
}
- }
-
- choice action-value {
description
- "Value to set (interpretation depends on action-type).";
- case ipv4-address {
- when "./action = 'ipv4-next-hop'";
- leaf ipv4-address {
- description "IPv4 address.";
- type inet:ipv4-address;
- }
- }
-
- case ipv6-address {
- when "./action = 'ipv6-next-hop'";
- leaf ipv6-address {
- description "IPv6 address.";
- type inet:ipv6-address;
- }
- }
-
- case metric {
- when "./action = 'metric'";
- choice metric-value {
- description "Metric to set or use.";
- case value {
- leaf value {
- description "Use the following metric value.";
- type uint32 {
- range "0..4294967295";
- }
- }
- }
-
- case add-metric {
- leaf add-metric {
- description "Add value to metric.";
- type uint32 {
- range "0..4294967295";
- }
- }
- }
-
- case subtract-metric {
- leaf subtract-metric {
- description "Subtract value from metric.";
- type uint32 {
- range "0..4294967295";
- }
- }
- }
-
- case use-round-trip-time {
- leaf use-round-trip-time {
- description "Use the round trip time as metric.";
- type boolean;
- }
- }
-
- case add-round-trip-time {
- leaf add-round-trip-time {
- description "Add round trip time to metric.";
- type boolean;
- }
- }
-
- case subtract-round-trip-time {
- leaf subtract-round-trip-time {
- description "Subtract round trip time to metric.";
- type boolean;
- }
- }
- }
- }
-
- case tag {
- when "./action = 'tag'";
- leaf tag {
- description "Tag value.";
- type uint32 {
- range "0..4294967295";
- }
- }
- }
+ "Action to do when the route map matches";
}
+
+ uses rmap-set-action;
}
}
}