[ovs-dev] ovn-nbctl:What are router commands like?

Russell Bryant russell at ovn.org
Thu Dec 3 14:24:01 UTC 2015


On 12/03/2015 03:54 AM, Wei Li wrote:
> ovn-nbctl -h
> General commands:
>   show                      print overview of database contents
>   show LSWITCH              print overview of database contents for LSWITCH
> 
> How to show LROUTER?

ovn-nbctl supports the same general database commands as ovs-vsctl,
though it's missing from the help text.

ovn-nbctl list Logical_Router
ovn-nbctl get Logical_Router ...

I think it'd be nice to list logical routers along with the logical
switches in "ovn-nbctl show".

> Add a keywork like "ovn-nbctl show /router /LROUTER"?

Since you can do "show LSWITCH", we could make it also accept "show
LROUTER" by checking the name or uuid against both tables.  I'm tempted
to just drop "show LSWITCH" instead, though.

> and "lport-add LSWITCH LPORT" has same problem, it looks like not scalabel
> 
> I think
> "ovn-nbctl lrouter-show"
> "ovn-nbctl lswitch-show"
> "ovn-nbctl lrouter-add-port"
> "ovn-nbctl lswtich-add-port"
> is better.
> 
> or any better idear?

Most things, including the above, can be done with the general database
commands.  We should at least fix the help text to document those
commands.  Including examples for really common use cases in the help
text would be nice, too.

If there are cases where the general db commands become painful or
friendly output is helpful, we can add new commands.

Some example commands for creating a logical router with 2 logical
switches with 1 logical port on each switch.  This originally came from
Justin on IRC one day.

> ovn-nbctl lswitch-add sw0
> ovn-nbctl lport-add sw0 sw0-port1
> ovn-nbctl lport-set-addresses sw0-port1 "50:54:00:00:00:01 192.168.0.2"
> ovn-nbctl lswitch-add sw1
> ovn-nbctl lport-add sw1 sw1-port1
> ovn-nbctl lport-set-addresses sw1-port1 "50:54:00:00:00:03 11.0.0.2"
> ovn-nbctl create Logical_Router name=lr0
> lrp_uuid=`ovn-nbctl \
>  -- --id=@lrp create Logical_Router_port name=lrp0 \
>  network=192.168.0.1/24 mac='"00:00:00:00:ff:01"' \
>  -- add Logical_Router lr0 ports @lrp \
>  -- lport-add sw0 lrp0-attachment`
> ovn-nbctl set Logical_port lrp0-attachment type=router \
>  options:router-port=$lrp_uuid \
>  addresses='"00:00:00:00:ff:01"'
> lrp_uuid=`ovn-nbctl \
>  -- --id=@lrp create Logical_Router_port name=lrp1 \
>  network=11.0.0.1/24 mac='"00:00:00:00:ff:02"' \
>  -- add Logical_Router lr0 ports @lrp \
>  -- lport-add sw1 lrp1-attachment`
> ovn-nbctl set Logical_port lrp1-attachment type=router \
>  options:router-port=$lrp_uuid \
>  addresses='"00:00:00:00:ff:02"'

-- 
Russell Bryant



More information about the dev mailing list