Really like this patch~!
> + <h2>Interconnection Network Commands</h2> > + > + <p> > + When multiple sandboxed Open vSwitch instances exist, one will > inevitably > + want to connect them together. These commands allow for that. > + Conceptually, an interconnection network is a switch that > + <code>ovs-sim</code> makes it easy to plug into other switches in > other > + sandboxed Open vSwitch instances. Interconnection networks are > + implemented as bridges in the <code>main</code> switch that > + <code>ovs-sim</code> creates by default, so to use interconnection > + networks please avoid working with <code>main</code> directly. > + </p> > + > + <dl> > + <dt><code>net_add</code> <var>network</var></dt> > + <dd> > + Creates a new interconnection network named <var>network</var>. > + </dd> > + > + <dt><code>net_attach</code> <var>network</var> > <var>bridge</var></dt> > + <dd> > + Adds a new port to <var>bridge</var> in the default sandbox (as > set > + with <code>as</code>) that plugs it into the <var>network</var> > + interconnection network. <var>network</var> must already have > been > + created by a previous invocation of <code>net_add</code>. The > default > + sandbox must not be <code>main</code>. > + </dd> > First sentence of the description of 'net_attach' is confusing. do you mean 's/that/and/'? > diff --git a/utilities/ovs-sim.in b/utilities/ovs-sim.in > new file mode 100755 > index 0000000..96d664b > --- /dev/null > +++ b/utilities/ovs-sim.in > @@ -0,0 +1,368 @@ > ... ... > +set -e > + > +sim_builddir='@abs_builddir@'; export sim_builddir > +sim_srcdir='@abs_top_srcdir@'; export sim_srcdir > +interactive=false > +scripts= > + > +for option; do > + # This option-parsing mechanism borrowed from a Autoconf-generated > + # configure script under the following license: > + > + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, > + # 2002, 2003, 2004, 2005, 2006, 2009, 2013 Free Software Foundation, > Inc. > + # This configure script is free software; the Free Software Foundation > + # gives unlimited permission to copy, distribute and modify it. > + > + # If the previous option needs an argument, assign it. > + if test -n "$prev"; then > + eval $prev=\$option > + prev= > + continue > + fi > "prev" not used, i think the above code can be removed? > + case $option in > + *=*) optarg=`expr "X$option" : '[^=]*=\(.*\)'` ;; > + *) optarg=yes ;; > + esac > + > "optarg" also not used. > + case $dashdash$option in > + --) > + dashdash=yes ;; > Not sure what '$dashdash' does here. But do not see it useful > + -h|--help) > + cat <<EOF > +$0, for starting sandboxed dummy Open vSwitch environments > +usage: $0 [OPTION...] [SCRIPT...] > + > +Options: > + -i, --interactive Prompt for interactive input (default if no > SCRIPTs) > + -h, --help Print this usage message. > +EOF > + exit 0 > + ;; > + > + -i|--i*) > + interactive=: > + ;; > + > + -*) > + echo "unrecognized option $option (use --help for help)" >&2 > + exit 1 > + ;; > + *) > + case $option in > + /*) ;; > + *) option=`pwd`/$option ;; > + esac > + scripts="$scripts $option" > + ;; > + esac > + shift > +done > + > +if test -z "$scripts"; then > + interactive=: > +fi > + > +# Check that we've got proper builddir and srcdir. > +if test ! -e "$sim_builddir"/vswitchd/ovs-vswitchd; then > + echo "$sim_builddir/vswitchd/ovs-vswitchd does not exist (need to run > \"make\"?)" >&2 > + exit 1 > +fi > +if test ! -e "$sim_srcdir"/WHY-OVS.md; then > + echo "$sim_srcdir/WHY-OVS.md does not exist" >&2 > + exit 1 > +fi > + > Why WHY-OVS? ;D > +# Put built tools early in $PATH. > +if test ! -e $sim_builddir/vswitchd/ovs-vswitchd; then > + echo >&2 'build not found, please change set $sim_builddir or change > directory' > + exit 1 > +fi > Duplicated check? > > +PATH=$sim_builddir/ovsdb:$sim_builddir/vswitchd:$sim_builddir/utilities:$PATH > > +PATH=$sim_builddir/ovn:$sim_srcdir/ovn:$sim_builddir/ovn/controller:$sim_builddir/ovn/northd:$PATH > +export PATH > + > +rm -rf sandbox > +mkdir sandbox > +cd sandbox > +sim_base=`pwd`; export sim_base > +trap "cd '$sim_base' && kill \`cat */*.pid\`" 0 1 2 3 13 14 15 > + > +sim_setvars() { > + sandbox=$1 > + OVS_RUNDIR=$sim_base/$1; export OVS_RUNDIR > + OVS_LOGDIR=$sim_base/$1; export OVS_LOGDIR > + OVS_DBDIR=$sim_base/$1; export OVS_DBDIR > + OVS_SYSCONFDIR=$sim_base/$1; export OVS_SYSCONFDIR > + PS1="|$1: $sim_PS1" > +} > Do you want to add a space between for PS1? (i.e., PS1="| S1: $sim_PS1") > +export -f sim_setvars > + > +as() { > + case $# in > + 0) > + echo >&2 "$FUNCNAME: missing arguments (use --help for help)" > + return 1 > + ;; > + 1) > + if test "$1" != --help; then > + sim_setvars $1 > + else > + cat <<EOF > +$FUNCNAME: set the default sandbox for Open vSwitch commands > +usage: $FUNCNAME SANDBOX [COMMAND ARG...] > +where SANDBOX is the name of the desired sandbox. > + > +With COMMAND arguments, this command sets the default target for that > +single command, which it runs directly. Otherwise, it sets the default > +target for all following commands. > +EOF > Do you want to prefix all usage prints with '| '? To keep consistency? > + fi > + ;; > + *) > + (sim_setvars $1; shift; $@) > + ;; > + esac > +} > +export -f as > + > +sim_add() { > + if test "$1" == --help; then > + cat <<EOF > +$FUNCNAME: create a new sandboxed Open vSwitch instance > +usage: $FUNCNAME SANDBOX > + > +where SANDBOX is the name of the new sandbox, which will be created in > +a directory named $sim_base/SANDBOX. > +Afterward, use "as SANDBOX" to execute OVS commands in the sandbox's > +context. > +EOF > + return 0 > + fi > + if test $# != 1; then > + echo >&2 "$FUNCNAME: missing argument (use --help for help)" > + return 1 > + fi > + > + set X $1; shift > + if test $# != 1; then > + echo >&2 "$FUNCNAME: sandbox name must be a single word" > + return 1 > + fi > + > This is a cool check~ _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev