From 3398d06456b47b232662e3c42619baaee8d14d01 Mon Sep 17 00:00:00 2001 From: KazuyaAnazawa Date: Tue, 27 Dec 2022 13:23:11 +0900 Subject: [PATCH 1/3] yang: introduce gs-routing model --- yang/goldstone-routing.yang | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 yang/goldstone-routing.yang diff --git a/yang/goldstone-routing.yang b/yang/goldstone-routing.yang new file mode 100644 index 00000000..f3a11fe5 --- /dev/null +++ b/yang/goldstone-routing.yang @@ -0,0 +1,71 @@ +module goldstone-routing { + + yang-version "1"; + + namespace "http://goldstone.net/yang/goldstone-routing"; + prefix gs-routing; + + organization + "GoldStone"; + + contact + "Goldstone"; + + description + "Goldstone Routing"; + + revision 2022-12-14 { + description + "Initial revision."; + } + + typedef control-plane-protocol { + type enumeration { + enum STATIC; + } + } + + typedef administrative-distance { + type uint8 { + range "1..255"; + } + description + "Admin distance associated with the route."; + } + + grouping routing-config { + description + "Configuration data nodes common to the routing + subsystems"; + + leaf type { + type control-plane-protocol; + description + "Type of the control-plane protocol"; + } + + leaf name { + type string; + description + "An arbitrary name of the control-plane protocol + instance."; + } + } + + grouping routing-state { + } + + container routing { + description + "Configuration parameters for the routing subsystem."; + + container config { + uses routing-config; + } + container state { + config false; + uses routing-config; + uses routing-state; + } + } +} From c8c9581206074369f279ecc1a533b9beb1ea4eb9 Mon Sep 17 00:00:00 2001 From: KazuyaAnazawa Date: Tue, 27 Dec 2022 13:23:27 +0900 Subject: [PATCH 2/3] yang: introduce gs-static-route model --- yang/goldstone-static-route.yang | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 yang/goldstone-static-route.yang diff --git a/yang/goldstone-static-route.yang b/yang/goldstone-static-route.yang new file mode 100644 index 00000000..901e9749 --- /dev/null +++ b/yang/goldstone-static-route.yang @@ -0,0 +1,80 @@ +module goldstone-static-route { + + yang-version "1"; + + namespace "http://goldstone.net/yang/goldstone-static-route"; + prefix gs-static-route; + + import goldstone-routing { + prefix gs-rt; + } + + import goldstone-nexthop { + prefix nexthop; + } + + import ietf-inet-types { + prefix inet; + } + + organization + "GoldStone"; + + description + "This module contains a collection of YANG definitions for + managing and configuring static route"; + + revision 2022-12-14 { + description + "Initial revision."; + } + + grouping static-route-config { + description + "Configuration data for static routes."; + + leaf prefix { + type inet:ipv4-prefix; + description + "Destination IPv4 prefix for the static route"; + } + } + + grouping static-route-state { + } + + augment "/gs-rt:routing" { + container static-route { + when "../gs-rt:config/gs-rt:type = 'STATIC'" { + description + "This container is only valid for the static routing + protocol in goldstone."; + } + description + "List of configured static routes"; + + list route-list { + key "prefix"; + description + "List of configured static routes"; + + leaf prefix { + type leafref { + path "../config/prefix"; + } + } + + container config { + uses static-route-config; + } + container state { + config false; + uses static-route-config; + uses static-route-state; + } + + uses nexthop:nexthops-top; + } + } + } +} From 57f8aec3dce83757eaa66db29644917d48aa7d33 Mon Sep 17 00:00:00 2001 From: KazuyaAnazawa Date: Tue, 27 Dec 2022 13:23:49 +0900 Subject: [PATCH 3/3] yang: introduce gs-nexthop model --- yang/goldstone-nexthop.yang | 128 ++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 yang/goldstone-nexthop.yang diff --git a/yang/goldstone-nexthop.yang b/yang/goldstone-nexthop.yang new file mode 100644 index 00000000..a8e695ed --- /dev/null +++ b/yang/goldstone-nexthop.yang @@ -0,0 +1,128 @@ +module goldstone-nexthop { + + yang-version "1"; + + namespace "http://goldstone.net/yang/goldstone-nexthop"; + prefix gs-nexthop; + + import goldstone-interfaces { prefix gs-if; } + import goldstone-routing { prefix gs-rt; } + + import ietf-inet-types { + prefix inet; + } + + organization + "GoldStone"; + + description + "Goldstone Nexthop"; + + revision 2022-12-14 { + description + "Initial revision."; + } + + typedef blackhole-type { + type enumeration { + enum "unspec" { + description + "Generic unreachable."; + } + enum "null" { + description + "Null type."; + } + enum "reject" { + description + "ICMP unreachable."; + } + enum "prohibited" { + description + "ICMP admin-prohibited."; + } + } + default "null"; + description + "Nexthop blackhole types."; + } + + grouping nexthop-config { + leaf index { + type uint32; + description + "An user-specified identifier utilised to uniquely reference + the next-hop entry in the next-hop list."; + } + + leaf gateway { + type inet:ipv4-address; + description + "The nexthop gateway address."; + } + + leaf interface { + type gs-if:interface-ref; + description + "The nexthop egress interface."; + } + + leaf distance { + type gs-rt:administrative-distance; + description + "Admin distance associated with this route."; + } + + leaf blackhole-type { + type blackhole-type; + description + "A blackhole sub-type, if the nexthop is a blackhole type."; + } + + leaf onlink { + type boolean; + default "false"; + description + "Nexthop is directly connected."; + } + } + + grouping nexthop-state { + leaf active { + type boolean; + description + "Nexthop is active."; + } + + leaf fib { + type boolean; + description + "Nexthop is installed in fib."; + } + } + + grouping nexthops-top { + container nexthops { + list nexthop { + key "index"; + description + "A list of nexthop objects."; + + leaf index { + type leafref { + path "../config/index"; + } + } + + container config { + uses nexthop-config; + } + container state { + config false; + uses nexthop-config; + uses nexthop-state; + } + } + } + } +}