}
run_xterm() {
- run xterm -e "$@" &
+ title=$1;
+ shift
+ run xterm -T "$title" -e "$@" &
}
rungdb() {
# Use "DISPLAY" variable to determine out if X is supported
if $under_gdb && [ "$DISPLAY" ]; then
args=`echo $@ |sed s/--detach//g | sed s/--vconsole:off//g`
- run_xterm gdb --args $args
+ xterm_title=$1
+ run_xterm $xterm_title gdb --args $args
else
run $@
fi
}
-gdb_vswitchd=false;
+gdb_vswitchd=false
+gdb_ovsdb=false
+gdb_ovn_nbd=false
builddir=
srcdir=
schema=
installed=false
built=false
+ovn=false
+ovnsb_schema=
+ovnnb_schema=
for option; do
# This option-parsing mechanism borrowed from a Autoconf-generated
These options force ovs-sandbox to use an installed Open vSwitch:
-i, --installed use installed Open vSwitch
-g, --gdb-vswitchd run ovs-vswitchd under gdb
+ -d, --gdb-ovsdb run ovsdb-server under gdb
+ --gdb-ovn-nbd run ovn-nbd under gdb
-S, --schema=FILE use FILE as vswitch.ovsschema
+ -o, --ovn enable OVN
Other options:
-h, --help Print this usage message.
-g|--gdb-v*)
gdb_vswitchd=true
;;
+ -d|--gdb-ovsdb)
+ gdb_ovsdb=true
+ ;;
+ --gdb-ovn-nbd)
+ gdb_ovn_nbd=true
+ ;;
+ -o|--ovn)
+ ovn=true
+ ;;
-*)
echo "unrecognized option $option (use --help for help)" >&2
exit 1
echo >&2 'source directory not found, please use --srcdir'
exit 1
fi
+ if $ovn; then
+ ovnsb_schema=$srcdir/ovn/ovn-sb.ovsschema
+ if test ! -e "$ovnsb_schema"; then
+ echo >&2 'source directory not found, please use --srcdir'
+ exit 1
+ fi
+ ovnnb_schema=$srcdir/ovn/ovn-nb.ovsschema
+ if test ! -e "$ovnnb_schema"; 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
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
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.
# Create database and start ovsdb-server.
touch "$sandbox"/.conf.db.~lock~
run ovsdb-tool create conf.db "$schema"
-run ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file \
- --remote=punix:"$sandbox"/db.sock
+ovsdb_server_args=
+if $ovn; then
+ touch "$sandbox"/.ovnsb.db.~lock~
+ touch "$sandbox"/.ovnnb.db.~lock~
+ run ovsdb-tool create ovnsb.db "$ovnsb_schema"
+ run ovsdb-tool create ovnnb.db "$ovnnb_schema"
+ ovsdb_server_args="ovnsb.db ovnnb.db conf.db"
+fi
+rungdb $gdb_ovsdb ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file \
+ --remote=punix:"$sandbox"/db.sock $ovsdb_server_args
# Start ovs-vswitchd.
rungdb $gdb_vswitchd ovs-vswitchd --detach --no-chdir --pidfile -vconsole:off --log-file \
--enable-dummy=override -vvconn -vnetdev_dummy
+if $ovn; then
+ rungdb $gdb_ovn_nbd ovn-nbd --detach --no-chdir --pidfile -vconsole:off --log-file
+fi
+
cat <<EOF