]> git.puffer.fish Git - mirror/frr.git/commitdiff
yang: redefine nexthop operational model
authorChirag Shah <chirag@cumulusnetworks.com>
Fri, 29 May 2020 04:44:37 +0000 (21:44 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Wed, 10 Jun 2020 23:25:18 +0000 (16:25 -0700)
Separate out nexthop config and operational models.
nexthop-group config model has list of nexthop-groups
where else operational nexthop group is single entity
underneath list of nexthops.

The common code is fectored into grouping to use among
config and operational model.

nexthop operational model caters to RIB operational model.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
yang/frr-nexthop.yang
yang/frr-zebra.yang

index ce6f21a6637f986458ad2272a4b1e53a22e28462..779c56df7f7676f317b76b3e394526fc72dec6d9 100644 (file)
@@ -137,6 +137,13 @@ module frr-nexthop {
       "Nexthop blackhole types.";
   }
 
+  typedef nexthop-group-ref {
+    type leafref {
+      path "/frr-nexthop:frr-nexthop-group/frr-nexthop:nexthop-groups/frr-nexthop:name";
+      require-instance false;
+    }
+  }
+
   /*
    * Common nexthop attributes grouping.
    */
@@ -147,6 +154,7 @@ module frr-nexthop {
       description
         "The nexthop type.";
     }
+
     leaf vrf {
       type frr-vrf:vrf-ref;
       description
@@ -157,17 +165,20 @@ module frr-nexthop {
       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 onlink {
       when "../nh-type = 'ip4-ifindex' or
             ../nh-type = 'ip6-ifindex'";
@@ -223,6 +234,15 @@ module frr-nexthop {
     }
   }
 
+  grouping nexthop-grouping {
+    list nexthop {
+      key "nh-type gateway interface";
+      description
+        "A list of nexthop objects.";
+      uses frr-nexthop-attributes;
+    }
+  }
+
   /*
    * Single nexthop grouping.
    */
@@ -230,12 +250,7 @@ module frr-nexthop {
     container frr-nexthops {
       description
         "FRR nexthop object.";
-      list nexthop {
-        key "nh-type gateway interface";
-        description
-          "A list of nexthop objects.";
-        uses frr-nexthop-attributes;
-      }
+      uses nexthop-grouping;
     }
   }
 
@@ -244,11 +259,10 @@ module frr-nexthop {
    * Container for FRR nexthop group.
    */
   grouping frr-nexthop-grouping {
-    list nexthop-group {
+    list nexthop-groups {
       key "name";
       description
-        "A group of nexthops.";
-
+        "List of nexthop groups, each contains group of nexthops";
       leaf name {
         type string;
         description
@@ -259,23 +273,31 @@ module frr-nexthop {
     }
   }
 
+  /* Operational nexthop-group */
+  grouping frr-nexthop-group-operational {
+    container nexthop-group {
+      description
+        "A group of nexthops.";
+      leaf id {
+        type uint32;
+        description
+          "The nexthop-group id.";
+      }
+
+      uses nexthop-grouping;
+    }
+  }
+
   container frr-nexthop-group {
     description
       "A nexthop-group, represented as a list of nexthop objects.";
     uses frr-nexthop-grouping;
   }
 
-  typedef nexthop-group-ref {
-    type leafref {
-      require-instance false;
-      path "/frr-nexthop:frr-nexthop-group/frr-nexthop:nexthop-group/frr-nexthop:name";
-    }
-  }
-
   /*
    * Augment weight attributes to nexthop group.
    */
-  augment "/frr-nexthop-group/nexthop-group/frr-nexthops/nexthop" {
+  augment "/frr-nexthop-group/nexthop-groups/frr-nexthops/nexthop" {
     leaf weight {
       type uint8;
       description
index 4aeba1412903d7622fd9ccdc10786a8702960fed..159dd8f791c6bc3c653628384af3546acd4bf4b2 100644 (file)
@@ -316,7 +316,7 @@ module frr-zebra {
         "Uptime for the route.";
     }
 
-    uses frr-nh:frr-nexthop-grouping;
+    uses frr-nh:frr-nexthop-group-operational;
   }
 
   // End of route-common
@@ -2074,7 +2074,7 @@ module frr-zebra {
     }
   }
 
-  augment "/frr-vrf:lib/frr-vrf:vrf/frr-zebra:zebra/ribs/rib/route/route-entry/nexthop-group/frr-nexthops/nexthop" {
+  augment "/frr-vrf:lib/frr-vrf:vrf/frr-zebra:zebra/ribs/rib/route/route-entry/nexthop-group/nexthop" {
     uses frr-nh:frr-nexthop-operational;
   }