diff --git a/yang/frr-nexthop.yang b/yang/frr-nexthop.yang index 7d8ce1b8ed14..0aa5df5f21bf 100644 --- a/yang/frr-nexthop.yang +++ b/yang/frr-nexthop.yang @@ -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 "Free Range Routing"; contact @@ -100,75 +105,84 @@ module frr-nexthop { * Nexthop object */ - grouping frr-nexthop { + grouping frr-nexthop-attributes { leaf nh-type { type nexthop-type; mandatory true; description "The nexthop type."; } - + leaf vrf { + type frr-vrf:vrf-ref; + description + "The nexthop vrf name, if different from the route."; + } leaf gateway { - type gateway-address; + when "../nh-type = 'ip4' or ../nh-type = 'ip6'"; + type frr-nexthop:gateway-address; description "The nexthop gateway address."; } - - leaf vrf { - type string { - length "1..36"; + container gateway-interface { + when "../nh-type = 'ip4-ifindex' or" + + "../nh-type = 'ip6-ifindex'"; + leaf gateway { + type frr-nexthop:gateway-address; + description + "The nexthop gateway address."; + } + leaf interface { + type frr-interface:interface-ref; + description + "The nexthop egress interface."; + } + leaf onlink { + type boolean; + default false; + description + "Nexthop is directly connected."; } - description - "The nexthop vrf name, if different from the route."; } leaf interface { + when "../nh-type = 'ifindex'"; 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; description "The nexthop's raw flags value."; } - - leaf is-duplicate { - type empty; + leaf duplicate { + type boolean; + default false; description "Duplicate nexthop; will be ignored."; } - - leaf is-recursive { - type empty; + leaf recursive { + type boolean; + default false; description "Nexthop must be resolved through another gateway."; } - - leaf is-onlink { - type empty; - description - "Nexthop is directly connected."; - } - - leaf is-active { - type empty; + leaf active { + type boolean; + default true; description "Nexthop is active."; } - uses rt-types:mpls-label-stack { description "Nexthop's MPLS label stack."; } - leaf mtu { type uint32; description @@ -176,20 +190,10 @@ module frr-nexthop { } } - // End of nexthop - /* - * Nexthop-group container - */ - grouping frr-nexthop-group { + container frr-nexthop { description - "A nexthop-group, represented as a list of nexthop objects."; - leaf name { - type string; - description - "The nexthop-group name."; - } - + "FRR nexthop."; list entry { key "id"; description @@ -197,13 +201,47 @@ module frr-nexthop { leaf id { type uint32; description - "Identifies a nexthop within a nexthop group; the entries + "Identifies a nexthop within a list of nexthops; the entries are ordered by id value, and the value has no other meaning."; } + uses frr-nexthop-attributes; + } + } - uses frr-nexthop; + typedef frr-nexthop-ref { + type leafref { + path "/frr-nexthop:frr-nexthop/frr-nexthop:entry/frr-nexthop:id"; } + description + "Reference to a nexthop."; } - // End of frr-nexthop-group + container frr-nexthop-group { + description + "A nexthop-group, represented as a list of nexthop objects."; + + list group-entry { + key "group-id"; + description + "A group of nexthops."; + leaf group-id { + type uint32; + description + "Identifies a set of nexthops in a group." + } + leaf name { + type string; + description + "The nexthop-group name."; + } + list group-nexthop { + key "group-sub-id"; + leaf group-sub-id { + type frr-nexthop-ref; + description + "A reference to a frr-nexthop."; + } + } + } + } }