summaryrefslogtreecommitdiffstats
path: root/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
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')
-rw-r--r--yang/frr-bgp-filter.yang329
-rw-r--r--yang/frr-bgp-route-map.yang820
-rw-r--r--yang/frr-ospf-route-map.yang52
-rw-r--r--yang/frr-ospf6-route-map.yang47
-rw-r--r--yang/frr-route-map.yang598
-rw-r--r--yang/frr-zebra-route-map.yang126
-rw-r--r--yang/frr-zebra.yang61
-rw-r--r--yang/subdir.am5
8 files changed, 1702 insertions, 336 deletions
diff --git a/yang/frr-bgp-filter.yang b/yang/frr-bgp-filter.yang
new file mode 100644
index 000000000..199e70997
--- /dev/null
+++ b/yang/frr-bgp-filter.yang
@@ -0,0 +1,329 @@
+module frr-bgp-filter {
+ yang-version 1.1;
+ namespace "http://frrouting.org/yang/bgp-filter";
+ prefix frr-bgp-filter;
+
+ import frr-filter {
+ prefix frr-filter;
+ }
+
+ import ietf-routing-types {
+ prefix rt-types;
+ }
+
+ organization
+ "Free Range Routing";
+ contact
+ "FRR Users List: <mailto:frog@lists.frrouting.org>
+ FRR Development List: <mailto:dev@lists.frrouting.org>";
+ description
+ "This module defines filter settings";
+
+ revision 2020-01-15 {
+ description
+ "Initial revision";
+ }
+
+ typedef list-sequence {
+ type uint32 {
+ range "1..4294967295";
+ }
+ description
+ "List instance priority (low number means higher priority)";
+ }
+
+ typedef list-action {
+ type enumeration {
+ enum "deny" {
+ value 0;
+ description
+ "Deny an entry";
+ }
+ enum "permit" {
+ value 1;
+ description
+ "Accept an entry";
+ }
+ }
+ description
+ "Return action on match";
+ }
+
+ typedef bgp-list-name {
+ type string;
+ description
+ "List name";
+ }
+
+ typedef community-string {
+ type string {
+ pattern "(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)|((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0):(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))|(local-AS)|(no-advertise)|(no-export)|(internet)";
+ }
+ description
+ "The BGP community string";
+ }
+
+ typedef large-community-string {
+ type string {
+ pattern "(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0)|(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0)|(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0):(429496729[0-5]|42949672[0-8][0-9]|4294967[01][0-9]{2}|429496[0-6][0-9]{3}|42949[0-5][0-9]{4}|4294[0-8][0-9]{5}|429[0-3][0-9]{6}|42[0-8][0-9]{7}|4[01][0-9]{8}|[1-3][0-9]{9}|[1-9][0-9]{0,8}|0)";
+ }
+ description
+ "The BGP large-community string";
+ }
+
+ augment "/frr-filter:lib" {
+ list community-list {
+ key "name";
+ description
+ "Community-list instance";
+ leaf name {
+ type string;
+ }
+
+ list entry {
+ key "sequence";
+ description
+ "Community-list entry";
+ leaf sequence {
+ type list-sequence;
+ }
+
+ leaf action {
+ type list-action;
+ }
+
+ leaf type {
+ type enumeration {
+ enum "community-list-standard" {
+ value 0;
+ description
+ "Standard community-list name/identifier";
+ }
+ enum "community-list-extended" {
+ value 1;
+ description
+ "Expanded community-list name/identifier";
+ }
+ }
+ mandatory true;
+ description
+ "Community-list instance name/identifier";
+ }
+
+ choice community-string {
+ description
+ "Community string";
+ case standard {
+ when "./type = 'community-list-standard'";
+ leaf-list standard-community-string {
+ type community-string;
+ description
+ "Community string";
+ }
+ }
+
+ case expanded {
+ when "./type = 'community-list-extended'";
+ leaf expanded-community-string {
+ type string;
+ description
+ "Community string reg-ex";
+ }
+ }
+ }
+ }
+ }
+
+ list large-community-list {
+ key "name";
+ description
+ "Large community-list instance";
+ leaf name {
+ type string;
+ }
+
+ list entry {
+ key "sequence";
+ description
+ "Large community-list entry";
+ leaf sequence {
+ type list-sequence;
+ }
+
+ leaf action {
+ type list-action;
+ }
+
+ leaf type {
+ type enumeration {
+ enum "large-community-list-standard-id" {
+ value 0;
+ description
+ "Standard large-community-list identifier";
+ }
+ enum "large-community-list-extended-id" {
+ value 1;
+ description
+ "Expanded large-community-list identifier";
+ }
+ enum "large-community-list-standard-name" {
+ value 2;
+ description
+ "Standard large-community-list name";
+ }
+ enum "large-community-list-extended-name" {
+ value 3;
+ description
+ "Expanded large-community-list name";
+ }
+ }
+ mandatory true;
+ description
+ "Large community-list instance name/identifier";
+ }
+
+ choice large-community-string {
+ description
+ "Large community string";
+ case standard {
+ when "./type = 'large-community-list-standard-id' or "
+ + "./type = 'large-community-list-standard-name'";
+ leaf-list standard-large-community-string {
+ type large-community-string;
+ description
+ "Large community string";
+ }
+ }
+
+ case expanded {
+ when "./type = 'large-community-list-extended-id' or "
+ + "./type = 'large-community-list-extended-name'";
+ leaf expanded-large-community-string {
+ type string;
+ description
+ "Large community string reg-ex";
+ }
+ }
+ }
+ }
+ }
+
+ list extcommunity-list {
+ key "name";
+ description
+ "Extcommunity-list instance";
+ leaf name {
+ type string;
+ }
+
+ list entry {
+ key "sequence";
+ description
+ "Extcommunity-list entry";
+ leaf sequence {
+ type list-sequence;
+ }
+
+ leaf action {
+ type list-action;
+ }
+
+ leaf type {
+ type enumeration {
+ enum "extcommunity-list-standard-id" {
+ value 0;
+ description
+ "Standard extcommunity-list identifier";
+ }
+ enum "extcommunity-list-extended-id" {
+ value 1;
+ description
+ "Expanded extcommunity-list identifier";
+ }
+ enum "extcommunity-list-standard-name" {
+ value 2;
+ description
+ "Standard extcommunity-list name";
+ }
+ enum "extcommunity-list-extended-name" {
+ value 3;
+ description
+ "Expanded extcommunity-list name";
+ }
+ }
+ mandatory true;
+ description
+ "Extcommunity-list instance name/identifier";
+ }
+
+ choice extcommunity-string {
+ description
+ "Extcommunity string";
+ case standard {
+ when "./type = 'extcommunity-list-standard-id' or "
+ + "./type = 'extcommunity-list-standard-name'";
+ choice standard-extcommunity-string {
+ description
+ "Value of the ext-community";
+ case extcommunity-rt {
+ description
+ "Set BGP ext-community route-target attribute";
+ leaf-list extcommunity-rt {
+ type rt-types:route-target;
+ }
+ }
+
+ case extcommunity-soo {
+ description
+ "Set BGP ext-community site-of-origin attribute";
+ leaf-list extcommunity-soo {
+ type rt-types:route-target;
+ }
+ }
+ }
+ }
+
+ case expanded {
+ when "./type = 'extcommunity-list-extended-id' or "
+ + "./type = 'extcommunity-list-extended-name'";
+ leaf expanded-extcommunity-string {
+ type string;
+ description
+ "Extcommunity string reg-ex";
+ }
+ }
+ }
+ }
+ }
+
+ list as-path-list {
+ key "name";
+ description
+ "AS-path access-list instance";
+ leaf name {
+ type string;
+ description
+ "AS-path access-list instance name/identifier";
+ }
+
+ list entry {
+ key "sequence";
+ description
+ "AS-path access-list entry";
+ leaf sequence {
+ type list-sequence;
+ }
+
+ leaf action {
+ type list-action;
+ }
+
+ leaf as-path {
+ type string;
+ description
+ "AS-path access-list string reg-ex";
+ }
+ }
+ }
+ }
+}
diff --git a/yang/frr-bgp-route-map.yang b/yang/frr-bgp-route-map.yang
new file mode 100644
index 000000000..96505b08a
--- /dev/null
+++ b/yang/frr-bgp-route-map.yang
@@ -0,0 +1,820 @@
+module frr-bgp-route-map {
+ yang-version 1.1;
+ namespace "http://frrouting.org/yang/bgp-route-map";
+ prefix frr-bgp-route-map;
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ import frr-route-map {
+ prefix frr-route-map;
+ }
+
+ import frr-filter {
+ prefix filter;
+ }
+
+ import frr-bgp-filter {
+ prefix bgp-filter;
+ }
+
+ import ietf-routing-types {
+ prefix rt-types;
+ }
+
+ organization
+ "Free Range Routing";
+ contact
+ "FRR Users List: <mailto:frog@lists.frrouting.org>
+ FRR Development List: <mailto:dev@lists.frrouting.org>";
+ description
+ "This module defines bgp route map settings";
+
+ revision 2020-01-02 {
+ description
+ "Initial revision";
+ }
+
+ identity match-local-preference {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match local-preference of routes";
+ }
+
+ identity match-script {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match script of routes";
+ }
+
+ identity match-origin {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match BGP route origin code";
+ }
+
+ identity rpki {
+ base frr-route-map:rmap-match-type;
+ description
+ "Control rpki specific settings";
+ }
+
+ identity probability {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match portion of routes defined by percentage value";
+ }
+
+ identity source-vrf {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match source vrf of routes";
+ }
+
+ identity peer {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match peer address";
+ }
+
+ identity mac-address-list {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match MAC address access-list";
+ }
+
+ identity ip-route-source {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match advertising source address of route";
+ }
+
+ identity ip-route-source-prefix-list {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match advertising source address of route";
+ }
+
+ identity evpn-route-type {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match EVPN route type";
+ }
+
+ identity evpn-default-route {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match EVPN default Type-5 route";
+ }
+
+ identity evpn-vni {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match EVPN VNI";
+ }
+
+ identity evpn-rd {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match EVPN route distinguisher";
+ }
+
+ identity match-community {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match BGP community list";
+ }
+
+ identity match-large-community {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match BGP large-community list";
+ }
+
+ identity match-extcommunity {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match BGP extcommunity list";
+ }
+
+ identity as-path-list {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match BGP AS path list";
+ }
+
+ identity ipv4-nexthop {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match IPv4 next hop address";
+ }
+
+ identity ipv6-nexthop {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match IPv6 next hop address";
+ }
+
+ identity distance {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP administrative distance to use";
+ }
+
+ identity set-extcommunity-rt {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP extended community attribute";
+ }
+
+ identity set-extcommunity-soo {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP extended community attribute";
+ }
+
+ identity set-extcommunity-lb {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP extended community attribute";
+ }
+
+ identity set-ipv4-nexthop {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the IPv4 next-hop to peer-address/unchanged";
+ }
+
+ identity ipv4-vpn-address {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set IPv4 VPN next-hop address";
+ }
+
+ identity ipv6-nexthop-global {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set IPv6 next-hop global address";
+ }
+
+ identity ipv6-prefer-global {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set IPv6 next-hop to prefer global address";
+ }
+
+ identity ipv6-peer-address {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set IPv6 next-hop peer address";
+ }
+
+ identity ipv6-vpn-address {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set IPv6 VPN next-hop address";
+ }
+
+ identity label-index {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the label index to associate with the prefixs";
+ }
+
+ identity set-local-preference {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP local preference path attribute";
+ }
+
+ identity set-origin {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP route origin code";
+ }
+
+ identity weight {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP weight attribute";
+ }
+
+ identity originator-id {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP originator ID attribute";
+ }
+
+ identity table {
+ base frr-route-map:rmap-set-type;
+ description
+ "Export route to non-main kernel table";
+ }
+
+ identity atomic-aggregate {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP atomic-aggregate attribute";
+ }
+
+ identity as-path-prepend {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP AS-path attribute";
+ }
+
+ identity as-path-exclude {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP AS-path attribute";
+ }
+
+ identity set-community {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP community attribute";
+ }
+
+ identity set-large-community {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP large-community attribute";
+ }
+
+ identity aggregator {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the BGP aggregator attribute";
+ }
+
+ identity comm-list-delete {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP community list (for deletion)";
+ }
+
+ identity large-comm-list-delete {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set BGP large community list (for deletion)";
+ }
+
+ grouping extcommunity-non-transitive-types {
+ leaf two-octet-as-specific {
+ type boolean;
+ description
+ "Non-Transitive Two-Octet AS-Specific Extended Community";
+ }
+ }
+
+ typedef extcommunity-lb-type {
+ type enumeration {
+ enum "explicit-bandwidth" {
+ value 0;
+ description
+ "Bandwidth value in Mbps";
+ }
+ enum "cumulative-bandwidth" {
+ value 1;
+ description
+ "Cumulative bandwidth of all multipaths (outbound-only)";
+ }
+ enum "computed-bandwidth" {
+ value 2;
+ description
+ "Internally computed bandwidth based on number of multipaths (outbound-only)";
+ }
+ }
+ description
+ "ext-community link bandwidth types.";
+ }
+
+ augment "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:rmap-match-condition/frr-route-map:match-condition" {
+ case local-preference {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'match-local-preference')";
+ leaf local-preference {
+ type uint32 {
+ range "0..4294967295";
+ }
+ }
+ }
+
+ case script {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'match-script')";
+ leaf script {
+ type string;
+ }
+ }
+
+ case origin {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'match-origin')";
+ leaf origin {
+ type enumeration {
+ enum "egp" {
+ value 0;
+ description
+ "Remote EGP";
+ }
+ enum "igp" {
+ value 1;
+ description
+ "Local IGP";
+ }
+ enum "incomplete" {
+ value 2;
+ description
+ "Unknown heritage";
+ }
+ }
+ }
+ }
+
+ case rpki {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'rpki')";
+ leaf rpki {
+ type enumeration {
+ enum "invalid" {
+ value 0;
+ description
+ "Invalid prefix";
+ }
+ enum "notfound" {
+ value 1;
+ description
+ "Prefix not found";
+ }
+ enum "valid" {
+ value 2;
+ description
+ "Valid prefix";
+ }
+ }
+ }
+ }
+
+ case probability {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'probability')";
+ leaf probability {
+ type uint8 {
+ range "0..100";
+ }
+ }
+ }
+
+ case source-vrf {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'source-vrf')";
+ leaf source-vrf {
+ type string;
+ }
+ }
+
+ case peer {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'peer')";
+ choice peer {
+ description
+ "Value of the peer";
+ case peer-ipv4-address {
+ description
+ "IP address of peer";
+ leaf peer-ipv4-address {
+ type inet:ipv4-address;
+ }
+ }
+
+ case peer-interface {
+ description
+ "Interface name of peer";
+ leaf peer-interface {
+ type string;
+ }
+ }
+
+ case peer-ipv6-address {
+ description
+ "IPv6 address of peer";
+ leaf peer-ipv6-address {
+ type inet:ipv6-address;
+ }
+ }
+
+ case peer-local {
+ description
+ "Static or Redistributed routes";
+ leaf peer-local {
+ type boolean;
+ }
+ }
+ }
+ }
+
+ case access-list-name {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'mac-address-list') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'as-path-list') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'ip-route-source') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'ip-route-source-prefix-list')";
+ description
+ "Access-list name";
+ leaf list-name {
+ type filter:access-list-name;
+ }
+ }
+
+ case evpn-default-route {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'evpn-default-route')";
+ description
+ "Match default EVPN type-5 route";
+ leaf evpn-default-route {
+ type empty;
+ }
+ }
+
+ case evpn-vni {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'evpn-vni')";
+ description
+ "Match eVPN VNI";
+ leaf evpn-vni {
+ type uint32 {
+ range "1..16777215";
+ }
+ }
+ }
+
+ case evpn-route-type {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'evpn-route-type')";
+ description
+ "Match eVPN route-type";
+ leaf evpn-route-type {
+ type enumeration {
+ enum "macip" {
+ value 0;
+ description
+ "Mac-IP route";
+ }
+ enum "multicast" {
+ value 1;
+ description
+ "IMET route";
+ }
+ enum "prefix" {
+ value 2;
+ description
+ "Prefix route";
+ }
+ }
+ }
+ }
+
+ case evpn-rd {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'evpn-rd')";
+ description
+ "Match eVPN route-distinguisher";
+ leaf route-distinguisher {
+ type rt-types:route-distinguisher;
+ }
+ }
+
+ case comm-list-name {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'match-community') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'match-large-community') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'match-extcommunity')";
+ container comm-list {
+ leaf comm-list-name {
+ type bgp-filter:bgp-list-name;
+ }
+
+ leaf comm-list-name-exact-match {
+ type boolean;
+ description
+ "Do exact matching of communities";
+ }
+ }
+ }
+
+ case ipv4-address {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'ipv4-nexthop')";
+ leaf ipv4-address {
+ type inet:ipv4-address;
+ description
+ "IPv4 address";
+ }
+ }
+
+ case ipv6-address {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:condition, 'ipv6-nexthop')";
+ leaf ipv6-address {
+ type inet:ipv6-address;
+ description
+ "IPv6 address";
+ }
+ }
+ }
+
+ augment "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:rmap-set-action/frr-route-map:set-action" {
+ case distance {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'distance')";
+ leaf distance {
+ type uint8 {
+ range "0..255";
+ }
+ }
+ }
+
+ case extcommunity-rt {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-extcommunity-rt')";
+ description
+ "Value of the ext-community";
+ leaf extcommunity-rt {
+ type string;
+ description
+ "Set BGP ext-community route-target attribute";
+ }
+ }
+
+ case extcommunity-soo {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-extcommunity-soo')";
+ description
+ "Value of the ext-community";
+ leaf extcommunity-soo {
+ type string;
+ description
+ "Set BGP ext-community site-of-origin attribute";
+ }
+ }
+
+ case extcommunity-lb {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-extcommunity-lb')";
+ container extcommunity-lb {
+ description
+ "Value of the ext-community.";
+ leaf lb-type {
+ type frr-bgp-route-map:extcommunity-lb-type;
+ }
+
+ leaf bandwidth {
+ when "../lb-type = 'explicit-bandwidth'";
+ type uint16 {
+ range "1..25600";
+ }
+ description
+ "Bandwidth value in Mbps";
+ }
+ uses extcommunity-non-transitive-types;
+ }
+ }
+
+ case ipv4-address {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'ipv4-vpn-address')";
+ description
+ "Set the IPv4 address";
+ leaf ipv4-address {
+ type inet:ipv4-address;
+ }
+ }
+
+ case ipv4-nexthop {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-ipv4-nexthop')";
+ leaf ipv4-nexthop {
+ type string;
+ }
+ }
+
+ case ipv6-address {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'ipv6-nexthop-global') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'ipv6-vpn-address')";
+ description
+ "Set the IPv6 address";
+ leaf ipv6-address {
+ type inet:ipv6-address;
+ }
+ }
+
+ case preference {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'ipv6-prefer-global') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'ipv6-peer-address')";
+ leaf preference {
+ type boolean;
+ }
+ }
+
+ case label-index {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'label-index')";
+ leaf label-index {
+ type uint32 {
+ range "0..1048560";
+ }
+ }
+ }
+
+ case local-pref {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-local-preference')";
+ leaf local-pref {
+ type string;
+ }
+ }
+
+ case weight {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'weight')";
+ leaf weight {
+ type uint32 {
+ range "0..4294967295";
+ }
+ }
+ }
+
+ case origin {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-origin')";
+ leaf origin {
+ type enumeration {
+ enum "egp" {
+ value 0;
+ description
+ "Remote EGP";
+ }
+ enum "igp" {
+ value 1;
+ description
+ "Local IGP";
+ }
+ enum "incomplete" {
+ value 2;
+ description
+ "Unknown heritage";
+ }
+ }
+ }
+ }
+
+ case originator-id {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'originator-id')";
+ leaf originator-id {
+ type inet:ipv4-address;
+ }
+ }
+
+ case table {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'table')";
+ leaf table {
+ type uint32 {
+ range "1..4294967295";
+ }
+ }
+ }
+
+ case atomic-aggregate {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'atomic-aggregate')";
+ leaf atomic-aggregate {
+ type empty;
+ }
+ }
+
+ case as-path-prepend {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'as-path-prepend')";
+ choice as-path-prepend {
+ description
+ "Value of the BGP AS-path attribute";
+ case prepend-as {
+ description
+ "Prepend the mentioned AS-path";
+ leaf prepend-as-path {
+ type string;
+ }
+ }
+
+ case last-as {
+ description
+ "Prepend the last ASN in the AS-path";
+ leaf last-as {
+ type uint8 {
+ range "1..10";
+ }
+ }
+ }
+ }
+ }
+
+ case as-path-exclude {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'as-path-exclude')";
+ leaf exclude-as-path {
+ type string;
+ description
+ "Exclude the mentioned AS-path";
+ }
+ }
+
+ case community {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-community')";
+ choice community {
+ description
+ "Value of the BGP community attribute";
+ case none {
+ description
+ "No community attribute";
+ leaf community-none {
+ type boolean;
+ }
+ }
+
+ case community-string {
+ description
+ "Community string";
+ leaf community-string {
+ type string;
+ }
+ }
+ }
+ }
+
+ case large-community {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'set-large-community')";
+ choice large-community {
+ description
+ "Value of the BGP large-community attribute";
+ case none {
+ description
+ "No large-community attribute";
+ leaf large-community-none {
+ type boolean;
+ }
+ }
+
+ case large-community-string {
+ description
+ "Large-Community string";
+ leaf large-community-string {
+ type string;
+ }
+ }
+ }
+ }
+
+ case aggregator {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'aggregator')";
+ container aggregator {
+ leaf aggregator-asn {
+ type uint32 {
+ range "1..4294967295";
+ }
+ description
+ "ASN of the aggregator";
+ }
+
+ leaf aggregator-address {
+ when "../aggregator-asn > 0 or "
+ + "../aggregator-asn <= 4294967295";
+ type inet:ipv4-address;
+ description
+ "IPv4 address of the aggregator";
+ }
+ }
+ }
+
+ case comm-list-name {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'comm-list-delete') or "
+ + "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'large-comm-list-delete')";
+ leaf comm-list-name {
+ type bgp-filter:bgp-list-name;
+ }
+ }
+ }
+}
diff --git a/yang/frr-ospf-route-map.yang b/yang/frr-ospf-route-map.yang
new file mode 100644
index 000000000..ad7ba5c1b
--- /dev/null
+++ b/yang/frr-ospf-route-map.yang
@@ -0,0 +1,52 @@
+module frr-ospf-route-map {
+ yang-version 1.1;
+ namespace "http://frrouting.org/yang/ospf-route-map";
+ prefix frr-ospf-route-map;
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ import frr-route-map {
+ prefix frr-route-map;
+ }
+
+ organization
+ "Free Range Routing";
+ contact
+ "FRR Users List: <mailto:frog@lists.frrouting.org>
+ FRR Development List: <mailto:dev@lists.frrouting.org>";
+ description
+ "This module defines ospf route map settings";
+
+ revision 2020-01-02 {
+ description
+ "Initial revision";
+ }
+
+ identity metric-type {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the type of metric";
+ }
+
+ augment "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:rmap-set-action/frr-route-map:set-action" {
+ case metric-type {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'metric-type')";
+ leaf metric-type {
+ type enumeration {
+ enum "type-1" {
+ value 0;
+ description
+ "OSPF6 external type 1 metric";
+ }
+ enum "type-2" {
+ value 1;
+ description
+ "OSPF6 external type 2 metric";
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/yang/frr-ospf6-route-map.yang b/yang/frr-ospf6-route-map.yang
new file mode 100644
index 000000000..e5d4969d4
--- /dev/null
+++ b/yang/frr-ospf6-route-map.yang
@@ -0,0 +1,47 @@
+module frr-ospf6-route-map {
+ yang-version 1.1;
+ namespace "http://frrouting.org/yang/ospf6-route-map";
+ prefix frr-ospf6-route-map;
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ import frr-route-map {
+ prefix frr-route-map;
+ }
+
+ organization
+ "Free Range Routing";
+ contact
+ "FRR Users List: <mailto:frog@lists.frrouting.org>
+ FRR Development List: <mailto:dev@lists.frrouting.org>";
+ description
+ "This module defines ospf6 route map settings";
+
+ revision 2020-01-02 {
+ description
+ "Initial revision";
+ }
+
+ identity forwarding-address {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the forwarding address";
+ }
+
+ identity metric-type {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set the type of metric";
+ }
+
+ augment "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:rmap-set-action/frr-route-map:set-action" {
+ case ipv6-address {
+ when "derived-from-or-self(/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:action, 'forwarding-address')";
+ leaf ipv6-address {
+ type inet:ipv6-address;
+ }
+ }
+ }
+}
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;
}
}
}
diff --git a/yang/frr-zebra-route-map.yang b/yang/frr-zebra-route-map.yang
new file mode 100644
index 000000000..91f4c87e3
--- /dev/null
+++ b/yang/frr-zebra-route-map.yang
@@ -0,0 +1,126 @@
+module frr-zebra-route-map {
+ yang-version 1.1;
+ namespace "http://frrouting.org/yang/zebra-route-map";
+ prefix frr-zebra-route-map;
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+
+ import frr-route-map {
+ prefix frr-route-map;
+ }
+
+ import frr-route-types {
+ prefix frr-route-types;
+ }
+
+ organization
+ "Free Range Routing";
+ contact
+ "FRR Users List: <mailto:frog@lists.frrouting.org>
+ FRR Development List: <mailto:dev@lists.frrouting.org>";
+ description
+ "This module defines zebra route map settings";
+
+ revision 2020-01-02 {
+ description
+ "Initial revision";
+ }
+
+ identity ipv4-prefix-length {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match IPv4 address prefix length";
+ }
+
+ identity ipv4-next-hop-prefix-length {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match IPv4 next-hop address prefix length";
+ }
+
+ identity ipv6-prefix-length {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match IPv6 address prefix length";
+ }
+
+ identity source-instance {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match the protocol's instance number";
+ }
+
+ identity source-protocol {
+ base frr-route-map:rmap-match-type;
+ description
+ "Match protocol via which the route was learnt";
+ }
+
+ identity src-address {
+ base frr-route-map:rmap-set-type;
+ description
+ "Set IPv4/IPv6 source address for route";
+ }
+
+ augment "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:match-condition/frr-route-map:rmap-match-condition/frr-route-map:match-condition" {
+ case ipv4-prefix-length {
+ when "derived-from-or-self(../condition, 'ipv4-prefix-length') or "
+ + "derived-from-or-self(../condition, 'ipv4-next-hop-prefix-length')";
+ leaf ipv4-prefix-length {
+ type uint8 {
+ range "0..32";
+ }
+ }
+ }
+
+ case ipv6-prefix-length {
+ when "derived-from-or-self(../condition, 'ipv6-prefix-length')";
+ leaf ipv6-prefix-length {
+ type uint8 {
+ range "0..128";
+ }
+ }
+ }
+
+ case source-instance {
+ when "derived-from-or-self(../condition, 'source-instance')";
+ leaf source-instance {
+ type uint8 {
+ range "0..255";
+ }
+ }
+ }
+
+ case source-protocol {
+ when "derived-from-or-self(../condition, 'source-protocol')";
+ leaf source-protocol {
+ type frr-route-types:frr-route-types;
+ }
+ }
+ }
+
+ augment "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:entry/frr-route-map:set-action/frr-route-map:rmap-set-action/frr-route-map:set-action" {
+ case src-address {
+ when "derived-from-or-self(../action, 'src-address')";
+ choice src-address {
+ description
+ "Value of the source address";
+ case ipv4-src-address {
+ leaf ipv4-src-address {
+ type inet:ipv4-address;
+ mandatory true;
+ }
+ }
+
+ case ipv6-src-address {
+ leaf ipv6-src-address {
+ type inet:ipv6-address;
+ mandatory true;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang
index be2f7b5a6..5c2560837 100644
--- a/yang/frr-zebra.yang
+++ b/yang/frr-zebra.yang
@@ -2175,65 +2175,4 @@ module frr-zebra {
}
// End of operational / state container
}
-
- // 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;
- }
- }
- }
}
diff --git a/yang/subdir.am b/yang/subdir.am
index da4432b62..a2243fb8e 100644
--- a/yang/subdir.am
+++ b/yang/subdir.am
@@ -25,6 +25,11 @@ dist_yangmodels_DATA += yang/frr-nexthop.yang
dist_yangmodels_DATA += yang/frr-test-module.yang
dist_yangmodels_DATA += yang/frr-interface.yang
dist_yangmodels_DATA += yang/frr-route-map.yang
+dist_yangmodels_DATA += yang/frr-zebra-route-map.yang
+dist_yangmodels_DATA += yang/frr-ospf-route-map.yang
+dist_yangmodels_DATA += yang/frr-ospf6-route-map.yang
+dist_yangmodels_DATA += yang/frr-bgp-filter.yang
+dist_yangmodels_DATA += yang/frr-bgp-route-map.yang
dist_yangmodels_DATA += yang/frr-vrf.yang
dist_yangmodels_DATA += yang/frr-route-types.yang
dist_yangmodels_DATA += yang/frr-routing.yang