]> git.puffer.fish Git - mirror/frr.git/commitdiff
yang: add zebra specific route map options
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 7 Oct 2019 20:40:45 +0000 (17:40 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 23 Mar 2020 10:55:13 +0000 (07:55 -0300)
*   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>
yang/frr-route-map.yang
yang/frr-zebra.yang

index 34a7e28a775b4665d6090f073e73aaa548c0f33e..dd8ce5e6fc671e5492b18f17d7a90a4d465b7220 100644 (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;
               }
             }
index 74922a22f793d7a8d9c10575cd46248804c63d63..58798455d52e0085e3e31cec2d9061c54e92f333 100644 (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;
+      }
+    }
+  }
 }