]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: FRR next-hop yang data model.
authorSantosh P K <sapk@vmware.com>
Fri, 20 Dec 2019 08:30:57 +0000 (00:30 -0800)
committerSantosh P K <sapk@vmware.com>
Thu, 16 Apr 2020 14:49:10 +0000 (07:49 -0700)
A common nexthop and group nexthop yang data model
for all protocols in FRR.

Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: Vishaldhingra <vdhingra@vmware.com>
Signed-off-by: Santosh P K <sapk@vmware.com>
yang/frr-nexthop.yang

index 3657ecbd75bde2254505c0a2f0bbff4d11bc9cfb..17c3eaa403571a397c1af4e17a1c13242a3a2e70 100644 (file)
@@ -10,10 +10,15 @@ module frr-nexthop {
   import ietf-routing-types {
     prefix rt-types;
   }
+
   import frr-interface {
     prefix frr-interface;
   }
 
+  import frr-vrf {
+    prefix "frr-vrf";
+  }
+
   organization
     "FRRouting";
   contact
@@ -27,10 +32,19 @@ module frr-nexthop {
       "Initial revision.";
   }
 
-  typedef gateway-address {
-    type inet:ip-address;
+  typedef optional-ip-address {
+     type union {
+       type inet:ip-address;
+       type string {
+         pattern
+           '';
+       }
+     }
   }
 
+  /*
+   * Nexthop types.
+   */
   typedef nexthop-type {
     type enumeration {
       enum "ifindex" {
@@ -68,6 +82,9 @@ module frr-nexthop {
       "Nexthop types.";
   }
 
+  /*
+   * Blockhole nexthop type.
+   */
   typedef blackhole-type {
     type enumeration {
       enum "unspec" {
@@ -97,113 +114,132 @@ module frr-nexthop {
   }
 
   /*
-   * Nexthop object
+   * Common nexthop attributes grouping.
    */
-
-  grouping frr-nexthop {
+  grouping frr-nexthop-attributes {
     leaf nh-type {
       type nexthop-type;
       mandatory true;
       description
         "The nexthop type.";
     }
-
-    leaf gateway {
-      type gateway-address;
-      description
-        "The nexthop gateway address.";
-    }
-
     leaf vrf {
-      type string {
-        length "1..36";
-      }
+      type frr-vrf:vrf-ref;
       description
         "The nexthop vrf name, if different from the route.";
     }
-
+    leaf gateway {
+      type frr-nexthop:optional-ip-address;
+      description
+        "The nexthop gateway address.";
+    }
     leaf interface {
       type frr-interface:interface-ref;
       description
         "The nexthop egress interface.";
     }
-
     leaf bh-type {
+      when "../nh-type = 'blackhole'";
       type blackhole-type;
       description
         "A blackhole sub-type, if the nexthop is a blackhole type.";
     }
-
-    leaf flags {
-      type uint32;
+    leaf onlink {
+      when "../nh-type = 'ip4-ifindex' or
+            ../nh-type = 'ip6-ifindex'";
+      type boolean;
+      default false;
       description
-        "The nexthop's raw flags value.";
+        "Nexthop is directly connected.";
     }
-
-    leaf is-duplicate {
-      type empty;
+    uses rt-types:mpls-label-stack {
       description
-        "Duplicate nexthop; will be ignored.";
+        "Nexthop's MPLS label stack.";
     }
+  }
 
-    leaf is-recursive {
+  /*
+   * operational common attributes for nexthop
+   */
+  grouping frr-nexthop-operational {
+    leaf duplicate {
+      config false;
       type empty;
       description
-        "Nexthop must be resolved through another gateway.";
+        "Duplicate nexthop";
     }
-
-    leaf is-onlink {
+    leaf recursive {
+      config false;
       type empty;
       description
-        "Nexthop is directly connected.";
+        "Nexthop resolved through another gateway.";
     }
-
-    leaf is-active {
+    leaf active {
+      config false;
       type empty;
       description
         "Nexthop is active.";
     }
-
-    uses rt-types:mpls-label-stack {
+    leaf fib {
+      config false;
+      type empty;
       description
-        "Nexthop's MPLS label stack.";
+        "Nexthop is installed in fib.";
     }
+  }
 
-    leaf mtu {
-      type uint32;
+  /*
+   * Single nexthop grouping.
+   */
+  grouping frr-nexthop {
+    container frr-nexthops {
       description
-        "The nexthop's specific MTU.";
+        "FRR nexthop object.";
+      list nexthop {
+        key "nh-type gateway interface";
+        description
+          "A list of nexthop objects.";
+
+        uses frr-nexthop-attributes;
+      }
     }
   }
 
-  // End of nexthop
+
   /*
-   * Nexthop-group container
+   * Container for FRR nexthop group.
    */
-
-  grouping frr-nexthop-group {
-    description
-      "A nexthop-group, represented as a list of nexthop objects.";
-    leaf name {
-      type string;
+  grouping frr-nexthop-grouping {
+    list nexthop-group {
+      key "name";
       description
-        "The nexthop-group name.";
-    }
+        "A group of nexthops.";
 
-    list entry {
-      key "id";
-      description
-        "A list of nexthop objects.";
-      leaf id {
-        type uint32;
+      leaf name {
+        type string;
         description
-          "Identifies a nexthop within a nexthop group; the entries
-           are ordered by id value, and the value has no other meaning.";
+          "The nexthop-group name.";
       }
 
       uses frr-nexthop;
     }
   }
 
-  // End of frr-nexthop-group
+  container frr-nexthop-group {
+    description
+      "A nexthop-group, represented as a list of nexthop objects.";
+
+    uses frr-nexthop-grouping;
+  }
+
+  /*
+   * Agument weight attributes to nexthop group.
+   */
+  augment "/frr-nexthop-group/nexthop-group/frr-nexthops/nexthop" {
+    leaf weight {
+      type uint8;
+      description
+        "Weight to be used by the nexthop for purposes of ECMP";
+    }
+  }
 }