From ff358c710ca54769cd8956bdf57567231db122b4 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 12 Mar 2015 16:57:18 -0400 Subject: ovs-sandbox: add initial support for ovn This patch adds initial support for OVN to ovs-sandbox. If you pass "-o/--ovn" to ovs-sandbox, it will create a db from the ovn and ovn-nb schemas and tell ovsdb-server to use them. It also adds ovn/ to $PATH so that as ovn executables are added, they will be available in the sandbox. Signed-off-by: Russell Bryant Signed-off-by: Ben Pfaff --- tutorial/ovs-sandbox | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'tutorial') diff --git a/tutorial/ovs-sandbox b/tutorial/ovs-sandbox index 1504ea9f8..5c89ef6e3 100755 --- a/tutorial/ovs-sandbox +++ b/tutorial/ovs-sandbox @@ -49,6 +49,9 @@ srcdir= schema= installed=false built=false +ovn=false +ovnschema= +ovnnbschema= for option; do # This option-parsing mechanism borrowed from a Autoconf-generated @@ -90,6 +93,7 @@ These options force ovs-sandbox to use an installed Open vSwitch: -g, --gdb-vswitchd run ovs-vswitchd under gdb -d, --gdb-ovsdb run ovsdb-server under gdb -S, --schema=FILE use FILE as vswitch.ovsschema + -o, --ovn enable OVN Other options: -h, --help Print this usage message. @@ -130,6 +134,9 @@ EOF -d|--gdb-o*) gdb_ovsdb=true ;; + -o|--ovn) + ovn=true + ;; -*) echo "unrecognized option $option (use --help for help)" >&2 exit 1 @@ -180,6 +187,18 @@ if $built; then echo >&2 'source directory not found, please use --srcdir' exit 1 fi + if $ovn; then + ovnschema=$srcdir/ovn/ovn.ovsschema + if test ! -e "$ovnschema"; then + echo >&2 'source directory not found, please use --srcdir' + exit 1 + fi + ovnnbschema=$srcdir/ovn/ovn-nb.ovsschema + if test ! -e "$ovnnbschema"; then + echo >&2 'source directory not found, please use --srcdir' + exit 1 + fi + fi # Put built tools early in $PATH. if test ! -e $builddir/vswitchd/ovs-vswitchd; then @@ -187,6 +206,9 @@ if $built; then exit 1 fi PATH=$builddir/ovsdb:$builddir/vswitchd:$builddir/utilities:$PATH + if $ovn; then + PATH=$builddir/ovn:$PATH + fi export PATH else case $schema in @@ -207,6 +229,10 @@ else echo "can't find vswitch.ovsschema, please specify --schema" >&2 exit 1 fi + if $ovn; then + echo "running with ovn is only supported from the build dir." >&2 + exit 1 + fi fi # Create sandbox. @@ -232,8 +258,16 @@ trap 'kill `cat "$sandbox"/*.pid`' 0 1 2 3 13 14 15 # Create database and start ovsdb-server. touch "$sandbox"/.conf.db.~lock~ run ovsdb-tool create conf.db "$schema" +ovsdb_server_args= +if $ovn; then + touch "$sandbox"/.ovn.db.~lock~ + touch "$sandbox"/.ovnnb.db.~lock~ + run ovsdb-tool create ovn.db "$ovnschema" + run ovsdb-tool create ovnnb.db "$ovnnbschema" + ovsdb_server_args="ovn.db ovnnb.db conf.db" +fi rungdb $gdb_ovsdb ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file \ - --remote=punix:"$sandbox"/db.sock + --remote=punix:"$sandbox"/db.sock $ovsdb_server_args # Start ovs-vswitchd. rungdb $gdb_vswitchd ovs-vswitchd --detach --no-chdir --pidfile -vconsole:off --log-file \ -- cgit v1.2.1