Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-05 Thread Gris Ge via networkmanager-list
Hi Guys,

I believe we can cast vote on these options based on feedback:

Option A:
https://gist.github.com/cathay4t/70b69bda1de0f60ec533bf98fdc04f95
Notes:
* The basic layout: info['routes'][0] = 
* Each route entry will have 'family' property.
* The route protocol has changed to 'origin' to indicate where
  this route is from: 'static', 'dhcp', 'ipv6-ra'.
* To delete certain entry, mark entry as 'status: absent'.

Option B:
https://gist.github.com/cathay4t/491b7420bf79af6b4630671e2b7528c1
Notes:
* The basic layout:
info['routes']['ipv4'][0] = 
info['routes']['ipv6'][0] = 
* The ipv4_route and ipv6_route schema could enforce their own
  syntax of 'destination' address.
* The IPv4 route protocol changed to 'origin' holding
  'static' or 'dhcp'.
* The IPv6 route protocol changed to 'origin' holding
  'static' or 'router-advertisement'.
* To delete certain entry, mark entry as 'status: absent'.

Option C:
We need another schema.

Let me know you vote.

Thank you.
Best regards.
-- 
Gris Ge


signature.asc
Description: PGP signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-05 Thread Edward Haas via networkmanager-list
On Tue, Mar 5, 2019 at 9:35 AM Edward Haas  wrote:

>
>
> On Tue, Mar 5, 2019 at 9:25 AM Gris Ge  wrote:
>
>> On Mon, Mar 04, 2019 at 05:58:01PM +0100, Thomas Haller wrote:
>> > On Mon, 2019-03-04 at 22:11 +0800, Gris Ge wrote:
>> > >  * Top tree is 'routes', and subtree is 'ipv4' and 'ipv6'.
>> > >Even the IPv4 and IPv6 route entry are mostly identical, but we
>> > > need
>> > >schema to differentiate the 'destination' address type in a simple
>> > >way.
>> >
>> > Hi,
>> >
>> >   {
>> > routes: {
>> >   [0] = {
>> > addr-family: ipv4,
>> > ...
>> >   },
>> >   ...
>> > },
>> >   }
>> >
>> > I think the answer is "yes".
>> I agree. But Edward has some concern about how to enforce the
>> 'destination' format if we unified the route, which I think we can lose
>> the schema on the destination to string let runtime do the syntax check.
>>
>
> The issue is with the nmstate clients, not nmstate itself.
> The clients will have to write their own code to make sure they are passing
> the correct thing. schema to code generator would have done that for them
> automatically.
>

As far as I know, existing schema standards do not support changing the
type or format of one
entry based on a different entry value.


> > "protocol" possibly should still be renamed to "source". Or "origin"?
>> The origin is better. Source might confuse with source routing.
>> >
>> > best,
>> > Thomas
>>
>>
>>
>> --
>> Gris Ge
>>
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-04 Thread Edward Haas via networkmanager-list
On Tue, Mar 5, 2019 at 9:25 AM Gris Ge  wrote:

> On Mon, Mar 04, 2019 at 05:58:01PM +0100, Thomas Haller wrote:
> > On Mon, 2019-03-04 at 22:11 +0800, Gris Ge wrote:
> > >  * Top tree is 'routes', and subtree is 'ipv4' and 'ipv6'.
> > >Even the IPv4 and IPv6 route entry are mostly identical, but we
> > > need
> > >schema to differentiate the 'destination' address type in a simple
> > >way.
> >
> > Hi,
> >
> >   {
> > routes: {
> >   [0] = {
> > addr-family: ipv4,
> > ...
> >   },
> >   ...
> > },
> >   }
> >
> > I think the answer is "yes".
> I agree. But Edward has some concern about how to enforce the
> 'destination' format if we unified the route, which I think we can lose
> the schema on the destination to string let runtime do the syntax check.
>

The issue is with the nmstate clients, not nmstate itself.
The clients will have to write their own code to make sure they are passing
the correct thing. schema to code generator would have done that for them
automatically.

> "protocol" possibly should still be renamed to "source". Or "origin"?
> The origin is better. Source might confuse with source routing.
> >
> > best,
> > Thomas
>
>
>
> --
> Gris Ge
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-04 Thread Gris Ge via networkmanager-list
On Mon, Mar 04, 2019 at 05:58:01PM +0100, Thomas Haller wrote:
> On Mon, 2019-03-04 at 22:11 +0800, Gris Ge wrote:
> >  * Top tree is 'routes', and subtree is 'ipv4' and 'ipv6'.
> >Even the IPv4 and IPv6 route entry are mostly identical, but we
> > need
> >schema to differentiate the 'destination' address type in a simple
> >way.
> 
> Hi,
> 
>   {
> routes: {
>   [0] = {
> addr-family: ipv4,
> ...
>   },
>   ...
> },
>   } 
> 
> I think the answer is "yes".
I agree. But Edward has some concern about how to enforce the
'destination' format if we unified the route, which I think we can lose
the schema on the destination to string let runtime do the syntax check.
> "protocol" possibly should still be renamed to "source". Or "origin"?
The origin is better. Source might confuse with source routing.
> 
> best,
> Thomas



-- 
Gris Ge


signature.asc
Description: PGP signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-04 Thread Edward Haas via networkmanager-list
On Mon, Mar 4, 2019 at 6:58 PM Thomas Haller  wrote:

> On Mon, 2019-03-04 at 22:11 +0800, Gris Ge wrote:
> > Based on feedbacks, this is V2 scheme for review:
> >
> > ```
> > {
> > "routes": {
> > "ipv4": [   # Sorted with 'table-id' then
> > 'destination'
> > {
> > "status": "up",
> > # up or absent(to be removed)
> > # If not defined, use 'up'
> > "table-name": "main",
> > # Empty if no name attached,
> > "table-id": 254,
> > # If not defined, use 'main' route table id
> > "protocol": "dhcp", # "static" or "dhcp"
> > # If not defined, use 'static'
> > "metric": 100,
> > # If not defined, let NetworkManager to
> > decided.
> > "destination": "0.0.0.0/0",
> > # Mandatory
> > "next-hop-iface": "eth0",
> > # Mandatory
> > "next-hop-address": "192.0.2.1"
> > # ^ Empty on point-to-point link
> > },
> > ],
> > "ipv6": [# Sorted with 'table-id' then 'destination'
> > {
> > "status": "up",
> > "table-name": "main",
> > "table-id": 254,
> > "protocol": "router-advertisement",
> > # ^ "static" or "router-advertisement"
> > "metric": 100,
> > "destination": "::/0",
> > "next-hop-iface": "eth0",
> > "next-hop-address": "fe80::1"
> > },
> > ],
> > }
> > }
> > ```
> >
> > Changes since V1:
> >
> >  * Top tree is 'routes', and subtree is 'ipv4' and 'ipv6'.
> >Even the IPv4 and IPv6 route entry are mostly identical, but we
> > need
> >schema to differentiate the 'destination' address type in a simple
> >way.
>
> Hi,
>
> I don't think there is any fundamental difference between
>
>   {
> ipv4-routes: { ... },
> ipv6-routes: { ... },
>   }
>
> and
>
>   {
> routes: {
>   ipv4: { ... },
>   ipv6: { ... },
> },
>   }
>
>
> Instead, the more fundamntal question is whether IPv4 and IPv6 routes
> should be merged together and expressed by the same "object"/"type",
> and get a "addr-family" field to differenciate.
>
>   {
> routes: {
>   [0] = {
> addr-family: ipv4,
> ...
>   },
>   ...
> },
>   }
>
> I think the answer is "yes". It seems better to me to treat routes the
> same on a higher layer, and move the differenciation between address
> families closer the places that care about the difference.
>

It is indeed nicer in terms of human readability, but it is not trivial (or
even possible)
to describe it using a schema.
nmstate clients are usually applications, which will use the schema to
potentially generate
code structures per the language they use.
Having the same key accepting different types (IPv4 vs IPv6 addresses) is
problematic.
Even if you consider these as strings, they still usually have a format
validation and converting
this union to a typed language structures is challenging.
I have also not seen this used with schemas, therefore, I think we should
follow the classic
definition for now, especially when we already have the same for
`interfaces`.

With that said, if we do find it simpler and get feedback that a different
format is better, we can
always change and still keep compatibility through versioning (which we
should introduce eventually).



>
>
>
> >  * Add 'status: absent' to simplify the route deletion.
> >
> >  * Add comments to show the default value if not defined.
>
> "protocol" possibly should still be renamed to "source". Or "origin"?
>
> +1


> best,
> Thomas
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-04 Thread Thomas Haller via networkmanager-list
On Mon, 2019-03-04 at 22:11 +0800, Gris Ge wrote:
> Based on feedbacks, this is V2 scheme for review:
> 
> ```
> {
> "routes": {
> "ipv4": [   # Sorted with 'table-id' then
> 'destination'
> {
> "status": "up",
> # up or absent(to be removed)
> # If not defined, use 'up'
> "table-name": "main",
> # Empty if no name attached,
> "table-id": 254,
> # If not defined, use 'main' route table id
> "protocol": "dhcp", # "static" or "dhcp"
> # If not defined, use 'static'
> "metric": 100,
> # If not defined, let NetworkManager to
> decided.
> "destination": "0.0.0.0/0",
> # Mandatory
> "next-hop-iface": "eth0",
> # Mandatory
> "next-hop-address": "192.0.2.1"
> # ^ Empty on point-to-point link
> },
> ],
> "ipv6": [# Sorted with 'table-id' then 'destination'
> {
> "status": "up",
> "table-name": "main",
> "table-id": 254,
> "protocol": "router-advertisement",
> # ^ "static" or "router-advertisement"
> "metric": 100,
> "destination": "::/0",
> "next-hop-iface": "eth0",
> "next-hop-address": "fe80::1"
> },
> ],
> }
> }
> ```
> 
> Changes since V1:
> 
>  * Top tree is 'routes', and subtree is 'ipv4' and 'ipv6'.
>Even the IPv4 and IPv6 route entry are mostly identical, but we
> need
>schema to differentiate the 'destination' address type in a simple
>way.

Hi,

I don't think there is any fundamental difference between

  {
ipv4-routes: { ... },
ipv6-routes: { ... },
  }

and

  {
routes: {
  ipv4: { ... },
  ipv6: { ... },
},
  }


Instead, the more fundamntal question is whether IPv4 and IPv6 routes
should be merged together and expressed by the same "object"/"type",
and get a "addr-family" field to differenciate.

  {
routes: {
  [0] = {
addr-family: ipv4,
...
  },
  ...
},
  } 

I think the answer is "yes". It seems better to me to treat routes the
same on a higher layer, and move the differenciation between address
families closer the places that care about the difference.




>  * Add 'status: absent' to simplify the route deletion.
> 
>  * Add comments to show the default value if not defined.

"protocol" possibly should still be renamed to "source". Or "origin"?


best,
Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-04 Thread Gris Ge via networkmanager-list
Based on feedbacks, this is V2 scheme for review:

```
{
"routes": {
"ipv4": [   # Sorted with 'table-id' then 'destination'
{
"status": "up",
# up or absent(to be removed)
# If not defined, use 'up'
"table-name": "main",
# Empty if no name attached,
"table-id": 254,
# If not defined, use 'main' route table id
"protocol": "dhcp", # "static" or "dhcp"
# If not defined, use 'static'
"metric": 100,
# If not defined, let NetworkManager to decided.
"destination": "0.0.0.0/0",
# Mandatory
"next-hop-iface": "eth0",
# Mandatory
"next-hop-address": "192.0.2.1"
# ^ Empty on point-to-point link
},
],
"ipv6": [# Sorted with 'table-id' then 'destination'
{
"status": "up",
"table-name": "main",
"table-id": 254,
"protocol": "router-advertisement",
# ^ "static" or "router-advertisement"
"metric": 100,
"destination": "::/0",
"next-hop-iface": "eth0",
"next-hop-address": "fe80::1"
},
],
}
}
```

Changes since V1:

 * Top tree is 'routes', and subtree is 'ipv4' and 'ipv6'.
   Even the IPv4 and IPv6 route entry are mostly identical, but we need
   schema to differentiate the 'destination' address type in a simple
   way.

 * Add 'status: absent' to simplify the route deletion.

 * Add comments to show the default value if not defined.

Thank you very much!
Best regards.

-- 
Gris Ge


signature.asc
Description: PGP signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-03 Thread Edward Haas via networkmanager-list
On Fri, Mar 1, 2019 at 9:41 AM Thomas Haller  wrote:

> On Thu, 2019-02-28 at 22:40 +0200, Edward Haas via networkmanager-list
> wrote:
> > Thank you Gris.
> > Comments in-line.
> >
> > On Tue, Feb 26, 2019 at 8:56 AM Gris Ge  wrote:
> > > Hi Guys,
> > >
> > > Could you review below schema for routing in nmstate before we
> > > start
> > > add routing support in nmstate?
> > >
> > > ```
> >
> > What is the root level key? `routing`?
> >
> > > {
> > > "ipv4-routes": [# Sorted with 'table-id' then
> > > 'destination'
> >
> >
> > ipv4 and ipv6 look identical to me here.
> > It makes sense then to have `route` as the subtree and a `family`
> > entry inside.
> > > {
> > > "table-name": "main",   # Empty if no name attached
> > > "table-id": 254,
> > > "protocol": "dhcp", # "static" or "dhcp"
> > > "metric": 100,
> > > "destination": "0.0.0.0/0",
> > > "next-hop-iface": "eth0",   # Mandatory
> >
> > This is not mandatory on `iproute2`, it is usually resolved based on
> > the address next hop.
> > I think it is mandatory for p2p links only.
>
> I think it should be mandatory. Kernel or iproute2 may detect certain
> next-hop-interfaces by looking at whether there is a direct route to
> the next hop (on an interface). But that seems fragile to me, and
> something you can do ad-hoc (at the moment when issuing the iproute2
> command), but not so well in a description of the state (which, is
> kinda timeless).
>
> Also, it is mandatory *for a lot* of cases. It's effort to pin down
> exactly when it's mandatory and when not.
>
> Also, a mandatory paramter can later always be relaxed for bing not
> mandatory. But making it mandatory later is an API break.
>

The implementation can require it per its logic, but I prefer the schema to
allow it.
I think that most usages are for simple IP route entries and not P2P ones,
in which
we do not want to be bound to a specific device at the desired state.
If this is supported, changes to the devices names or addresses on them do
not
need to change the route/desired state.
For a user, it also does not require knowledge about which device to use,
the system
will take care of that for him.


>
> best,
> Thomas
>
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-03-03 Thread Edward Haas via networkmanager-list
On Fri, Mar 1, 2019 at 9:43 AM Thomas Haller  wrote:

> Hi,
>
> On Tue, 2019-02-26 at 14:56 +0800, Gris Ge via networkmanager-list
>
> > "protocol": "dhcp", # "static" or "dhcp"
>
> "protocol" sounds a bit like iproute2's "protocol" option (struct
> rtmsg's rtm_protocol). But I think it's not.
>
> I would call this "source".
>
+1

>
>
> best,
> Thomas
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-02-28 Thread Thomas Haller via networkmanager-list
Hi,

On Tue, 2019-02-26 at 14:56 +0800, Gris Ge via networkmanager-list

> "protocol": "dhcp", # "static" or "dhcp"

"protocol" sounds a bit like iproute2's "protocol" option (struct
rtmsg's rtm_protocol). But I think it's not.

I would call this "source".


best,
Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-02-28 Thread Thomas Haller via networkmanager-list
On Thu, 2019-02-28 at 22:40 +0200, Edward Haas via networkmanager-list
wrote:
> Thank you Gris.
> Comments in-line.
> 
> On Tue, Feb 26, 2019 at 8:56 AM Gris Ge  wrote:
> > Hi Guys,
> > 
> > Could you review below schema for routing in nmstate before we
> > start
> > add routing support in nmstate?
> > 
> > ```
> 
> What is the root level key? `routing`?
> 
> > {
> > "ipv4-routes": [# Sorted with 'table-id' then
> > 'destination'
> 
>  
> ipv4 and ipv6 look identical to me here.
> It makes sense then to have `route` as the subtree and a `family`
> entry inside.
> > {
> > "table-name": "main",   # Empty if no name attached
> > "table-id": 254,
> > "protocol": "dhcp", # "static" or "dhcp"
> > "metric": 100,
> > "destination": "0.0.0.0/0",
> > "next-hop-iface": "eth0",   # Mandatory
> 
> This is not mandatory on `iproute2`, it is usually resolved based on
> the address next hop.
> I think it is mandatory for p2p links only.

I think it should be mandatory. Kernel or iproute2 may detect certain
next-hop-interfaces by looking at whether there is a direct route to
the next hop (on an interface). But that seems fragile to me, and
something you can do ad-hoc (at the moment when issuing the iproute2
command), but not so well in a description of the state (which, is
kinda timeless).

Also, it is mandatory *for a lot* of cases. It's effort to pin down
exactly when it's mandatory and when not.

Also, a mandatory paramter can later always be relaxed for bing not
mandatory. But making it mandatory later is an API break.


best,
Thomas



signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-02-28 Thread Edward Haas via networkmanager-list
On Fri, Mar 1, 2019 at 4:34 AM Gris Ge  wrote:

> On Thu, Feb 28, 2019 at 10:40:48PM +0200, Edward Haas wrote:
> >
> > What is the root level key? `routing`?
> The root level is 'ipv4-routes' and 'ipv6-routes'.
>
> Try to save a layer for user to type comparing to ['routing']['routes']
>
> The ip version is a detail, I do not think it should be exposed at the
root.
Please also note that the api users are mostly other applications,
so we need a balance between a good programmatic structure and human
ease of use.

> ipv4 and ipv6 look identical to me here.
> > It makes sense then to have `route` as the subtree and a `family`
> > entry inside.
> OK. And we could auto detect the family if user does not specify it when
> applying.
>

Ahh... in the morning I realized that this is problematic when we need to
represent it
in a json schema. Usually one key has a single type (and a format is a type
I guess).
I do not know if we can overcome this.
(think of a user that uses a typed language, how will it be described there
(type)?)

> "next-hop-iface": "eth0",   # Mandatory
> >
> >
> > This is not mandatory on `iproute2`, it is usually resolved based on
> > the address next hop.
> Will remove the mandatory thing.
>
> > "ipv6-routes": [# Sorted with 'table-id' then
> 'destination'
> > "protocol": "auto", # "static" or "auto"[1]
> > I prefer a more meaningful name, `auto` is problematic.
> How about 'ipv6-ra' for router advertisement?
>

If we will be under an ipv6 subtree, `ra` should be enough (or the full
name, router-advertisement).
If not, and we have here protocols for both, then +1.

>  * For future source routing support, we could add top entry as
> >'route-rules' or other name to be decided.
> >
> > routing-->rule will be nice.
> Same reason above, save some typing.
> > What about adding or deleting an entry.
> > Can we use `state` to express existence and absent?
> > For cases where there are hundreds of routes, asking the user to
> > specify all will not work well.
> User could just remove the entry from what he/she got from
> `libnmstate.show()`. I don't know why that's hard for user.
> Can you elaborate the use case?
>

We support it explicitly with interfaces.
Using show and the apply is valid, but with a large number of routes, it is
very traffic and process consuming.
But perhaps the main disadvantage is the assumption that the user is
reading the state. There are several
users which we know today that handle things in one direction only.
As a reminder, for the nmstate api we have taken an explicit decision to
allow applying snippet configurations.


> Thank you very much.
> Best regards.
>
> --
> Gris Ge
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-02-28 Thread Gris Ge via networkmanager-list
On Thu, Feb 28, 2019 at 10:40:48PM +0200, Edward Haas wrote:
>
> What is the root level key? `routing`?
The root level is 'ipv4-routes' and 'ipv6-routes'.

Try to save a layer for user to type comparing to ['routing']['routes']

> ipv4 and ipv6 look identical to me here.
> It makes sense then to have `route` as the subtree and a `family`
> entry inside.
OK. And we could auto detect the family if user does not specify it when
applying.
>                 "next-hop-iface": "eth0",       # Mandatory
>
>
> This is not mandatory on `iproute2`, it is usually resolved based on
> the address next hop.
Will remove the mandatory thing.

>         "ipv6-routes": [    # Sorted with 'table-id' then 'destination'
>                 "protocol": "auto",     # "static" or "auto"[1]
> I prefer a more meaningful name, `auto` is problematic.
How about 'ipv6-ra' for router advertisement?
>  * For future source routing support, we could add top entry as
>    'route-rules' or other name to be decided.
>
> routing-->rule will be nice.
Same reason above, save some typing.
> What about adding or deleting an entry.
> Can we use `state` to express existence and absent?
> For cases where there are hundreds of routes, asking the user to
> specify all will not work well.
User could just remove the entry from what he/she got from
`libnmstate.show()`. I don't know why that's hard for user.
Can you elaborate the use case?

Thank you very much.
Best regards.

-- 
Gris Ge


signature.asc
Description: PGP signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [RFC] [nmstate] Linux routing in nmstate

2019-02-28 Thread Edward Haas via networkmanager-list
Thank you Gris.
Comments in-line.

On Tue, Feb 26, 2019 at 8:56 AM Gris Ge  wrote:

> Hi Guys,
>
> Could you review below schema for routing in nmstate before we start
> add routing support in nmstate?
>
> ```
>
What is the root level key? `routing`?

{
> "ipv4-routes": [# Sorted with 'table-id' then 'destination'
>

ipv4 and ipv6 look identical to me here.
It makes sense then to have `route` as the subtree and a `family` entry
inside.

> {
> "table-name": "main",   # Empty if no name attached
> "table-id": 254,
> "protocol": "dhcp", # "static" or "dhcp"
> "metric": 100,
> "destination": "0.0.0.0/0",
> "next-hop-iface": "eth0",   # Mandatory
>

This is not mandatory on `iproute2`, it is usually resolved based on the
address next hop.
I think it is mandatory for p2p links only.

"next-hop-address": "192.0.2.1"
> # ^ Empty on point-to-point link
> },
> ],
> "ipv6-routes": [# Sorted with 'table-id' then 'destination'
> {
> "table-name": "main",   # Empty if no name attached
> "table-id": 254,
> "protocol": "auto", # "static" or "auto"[1]
>

I prefer a more meaningful name, `auto` is problematic.

"metric": 100,
> "destination": "::/0",
> "next-hop-iface": "eth0",   # Mandatory
>

Same, I do not think it is mandatory.

> "next-hop-address": "fe80::1"
> },
> ],
> }
> ```
>
> Notes:
>  * The 'auto' or 'dhcp' route entry will be ignored when applying via
>nmstate.
>  * For single route entry with multiple next-hops, nmstate will show it
>as multiple route entries with the same destination.
>  * Regarding YANG(RFC-8022) compatibility, we will create a translator
>when we adding YANG support.
>  * For future source routing support, we could add top entry as
>'route-rules' or other name to be decided.
>
routing-->rule will be nice.

>  * For future support of OSPF, BGP, we could add top entry as 'ospf'
>or 'bgp' to hold their configuration and extend the 'protocol' types
>in above schema.
>
> Any comments or suggestions will be appreciated.
>

What about adding or deleting an entry.
Can we use `state` to express existence and absent?
For cases where there are hundreds of routes, asking the user to specify
all will not work well.


> Thank you very much in advance.
> Best regards.
>
> [1]: The "auto" protocol in "ipv6-routes" means IPv6 Router
>  Advertisement.
>
> --
> Gris Ge
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


[RFC] [nmstate] Linux routing in nmstate

2019-02-25 Thread Gris Ge via networkmanager-list
Hi Guys,

Could you review below schema for routing in nmstate before we start
add routing support in nmstate?

```
{
"ipv4-routes": [# Sorted with 'table-id' then 'destination'
{
"table-name": "main",   # Empty if no name attached
"table-id": 254,
"protocol": "dhcp", # "static" or "dhcp"
"metric": 100,
"destination": "0.0.0.0/0",
"next-hop-iface": "eth0",   # Mandatory
"next-hop-address": "192.0.2.1"
# ^ Empty on point-to-point link
},
],
"ipv6-routes": [# Sorted with 'table-id' then 'destination'
{
"table-name": "main",   # Empty if no name attached
"table-id": 254,
"protocol": "auto", # "static" or "auto"[1]
"metric": 100,
"destination": "::/0",
"next-hop-iface": "eth0",   # Mandatory
"next-hop-address": "fe80::1"
},
],
}
```

Notes:
 * The 'auto' or 'dhcp' route entry will be ignored when applying via
   nmstate.
 * For single route entry with multiple next-hops, nmstate will show it
   as multiple route entries with the same destination.
 * Regarding YANG(RFC-8022) compatibility, we will create a translator
   when we adding YANG support.
 * For future source routing support, we could add top entry as
   'route-rules' or other name to be decided.
 * For future support of OSPF, BGP, we could add top entry as 'ospf'
   or 'bgp' to hold their configuration and extend the 'protocol' types
   in above schema.

Any comments or suggestions will be appreciated.

Thank you very much in advance.
Best regards.

[1]: The "auto" protocol in "ipv6-routes" means IPv6 Router
 Advertisement.

-- 
Gris Ge


signature.asc
Description: PGP signature
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list