[ovs-dev] [code] OFTest for OVS

Ben Pfaff blp at nicira.com
Fri Oct 26 00:12:21 UTC 2012


It's somewhat difficult to use OFTest, in my opinion, because you need
to be root, work with OS network devices, and so on.  Today I played
around with some code to avoid those two needs.

First, I have a patch series starting here:
        http://openvswitch.org/pipermail/dev/2012-October/022300.html
that adds an ability for OVS to use Unix domain sockets as simulated
network devices.

Second, I'm attaching a file meant to be put in platforms/dummy.py in
the OFTest tree to use these simulated network devices.

Finally, I'm attaching a shell script that starts OVS in a sandboxed
mode using these dummy devices.

It passes a few tests; I've only tried a few.

Now that I look at it, there are some bugs here that will prevent
traffic from actually passing through, but they are not fundamental to
the approach.  I'm mostly passing this along in case anyone wants to
comment on the idea; I've already spent more time on it than I should
have.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dummy.py
Type: text/x-python
Size: 6480 bytes
Desc: not available
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20121025/47350a44/attachment-0005.py>
-------------- next part --------------
#! /bin/sh

set -ex

srcdir=$HOME/ovs
builddir=$srcdir/_build
PATH=$builddir/ovsdb:$builddir/vswitchd:$builddir/utilities:$PATH

cd $builddir
rm -rf sandbox
mkdir sandbox
cd sandbox

OVS_RUNDIR=`pwd`; export OVS_RUNDIR
OVS_LOGDIR=`pwd`; export OVS_LOGDIR
OVS_DBDIR=`pwd`; export OVS_DBDIR
OVS_SYSCONFDIR=`pwd`; export OVS_SYSCONFDIR

trap 'kill `cat *.pid`' 0

touch .conf.db.~lock~
rm -f conf.db
ovsdb-tool create conf.db $srcdir/vswitchd/vswitch.ovsschema

ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock
ovs-vsctl --no-wait init

ovs-vswitchd --detach --no-chdir --pidfile --enable-dummy --disable-system -vvconn -vofproto_dpif

ovs-vsctl \
    -- add-br br0 \
    -- set bridge br0 datapath-type=dummy fail-mode=secure \
    -- add-port br0 p1 -- set interface p1 type=dummy \
    -- add-port br0 p2 -- set interface p2 type=dummy \
    -- add-port br0 p3 -- set interface p3 type=dummy \
    -- add-port br0 p4 -- set interface p4 type=dummy \
    -- set-controller br0 tcp:127.0.0.1

read line


More information about the dev mailing list