Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yang models for static route support on south-ocnos #73

Merged
merged 3 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions yang/goldstone-nexthop.yang
Original file line number Diff line number Diff line change
@@ -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.";
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between active and fib for the nexthop-state?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ipi-claytonpascoal
Thank you for your question.
When I looked into OcNOS, there are two attributes, fib-installed and active.
I intended to represent each attribute as fib and active in the model.

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the operational data for static-route/nexthop would be better placed in a centralized RIB/FIB structure that consolidates all future protocols routing base.
Is there any plan in this direction?

Copy link
Contributor Author

@KazuyaAnazawa KazuyaAnazawa Dec 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ipi-claytonpascoal
I thought your question here is related to what I described here.

We may need to decide if we had better to add such structure in current phase (of targeting on static-route support as the first step).

I agree with your comment as OcNOS, FRR, and OpenConfig adopt such style and structure.

@ishidawataru
Do you have any advice or comments about this?

Copy link
Contributor

@ishidawataru ishidawataru Dec 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KazuyaAnazawa First, let's keep the following config/state structure (OpenConfig style) in all containers of the Goldstone primitive models.
Following this structure makes the model structure more predictable when reading.

grouping b-config {
}

grouping b-state {
// can be empty
}

grouping b-top {
  container b {
    container config {
      uses b-config;
    }
    container state {
      config false;
      uses b-config;
      uses b-state;
    }
  }
}

grouping a-config {
}

grouping a-state {
// can be empty
}

container a {
  container config {
    uses a-config;
  }
  container state {
    config false;
    uses a-config;
    uses a-state;
  }

  uses b-top;
}

At this moment, I think it's OK to keep operational information on the static route and next-hop in the corresponding state containers.
We will need to define a model for a RIB (and maybe FIB (it looks like OpenConfig doesn't have a FIB model)) when we support dynamic routing protocols. When we do that, we can consider whether it's better to move operational info to the RIB structure.

Goldstone primitive YANG model is an internal API for Goldstone management components. We're free to change it when we need to.

Also, I think we will end up refining the models when we start implementing the south daemon that supports them.
Let's don't put too much time into just defining a model. We can discuss this again when we have an actual implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ishidawataru Thank you so much for your valuable comments and advise.
I first try to define the models so that we can keep OpenConfig style, and submit the early version of the models.

}
}
}
}
}
71 changes: 71 additions & 0 deletions yang/goldstone-routing.yang
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
80 changes: 80 additions & 0 deletions yang/goldstone-static-route.yang
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
}