Thomas Vachuska
Committed by Gerrit Code Review

Adding a basic mininet-based test to STC scenarios.

Change-Id: I193013608e8fcdaede8987536e754da6d1a185bf
......@@ -100,12 +100,12 @@ function cell {
if [ -n "$1" ]; then
[ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \
echo "No such cell: $1" >&2 && return 1
unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES ONOS_USER ONOS_GROUP
unset OCI OCN OCT
unset ONOS_FEATURES # deprecated
unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES
unset OCI OCN OCT ONOS_INSTANCES ONOS_USER ONOS_GROUP ONOS_FEATURES
unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p')
export ONOS_CELL=$1
. $ONOS_ROOT/tools/test/cells/$1
export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2)
setPrimaryInstance 1 >/dev/null
cell
else
......@@ -113,7 +113,7 @@ function cell {
env | egrep "OCI"
env | egrep "OC[0-9]+" | sort
env | egrep "OC[NT]"
env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL'
env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES'
fi
}
......
#!/bin/bash
# -----------------------------------------------------------------------------
# Starts or interacts with mininet in a remote screen session.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
cmd="$1" && shift
log="screenlog.0"
remote="$ONOS_USER@$OCN"
mininet="ssh -t -t $remote screen -L -S mininet"
case $cmd in
send)
$mininet -X "stuff \"$@\\n\"" 2>/dev/null
;;
sendAndExpect)
$mininet -X "stuff \"$1\\n\"" 2>/dev/null
shift
onos-mininet expect "$@"
;;
wait)
ssh $remote "
sleep 1 && while test ! -f $log; do sleep 1; done
while ! (tail -n1 $log | egrep -q '^mininet>'); do sleep 1; done
sleep ${1-:1}
"
;;
expect)
aux=/tmp/mininet.$$.log
ssh $remote "
sleep 1 && while ! (tail -n1 $log | egrep -q '^mininet>'); do sleep 1; done
tac $log | awk '{ print \$0; } /^mininet>/ { if (on) { exit 0; } on=1; }' | tac > $aux
cat $aux
set -x
egrep \"$@\" $aux
"
;;
start)
ssh $remote rm -f $log
$mininet "$@"
scp $remote:$log /tmp/mininet.log
ssh $remote rm -f $log
;;
stop)
$mininet -X "stuff \"^C\\n\"" 2>/dev/null && \
$mininet -X "stuff \"^C\\n\"" 2>/dev/null && \
$mininet -X "stuff \"exit\\n\"" 2>/dev/null
;;
esac
#!/bin/bash
# -----------------------------------------------------------------------------
# Remotely pushes test topologies a remote mininet test machine.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
node=${1:-$OCN}
scp -qr $ONOS_ROOT/tools/test/topos $ONOS_USER@$node:
......@@ -15,17 +15,41 @@
-->
<scenario name="basic-net" description="Basic network functionality test">
<group name="Basic-Net">
<step name="Push-Topos" exec="onos-push-topos ${OCN}"/>
<step name="Install-Apps"
exec="onos ${OC1} app activate org.onosproject.proxyarp org.onosproject.fwd"/>
exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/>
<step name="Check-Apps" requires="Install-Apps"
exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/>
<step name="Config-Topo"
<step name="Wipe-Out-Data" requires="~Check-Apps"
exec="onos ${OC1} wipe-out please"/>
<step name="Check-Summary" requires="~Wipe-Out-Data"
exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/>
<step name="Start-Mininet" requires="Install-Apps,Check-Summary,Push-Topos"
exec="onos-mininet start topos/att-onos ${ONOS_INSTANCES}"/>
<step name="Wait-For-Mininet" requires="Install-Apps,Check-Summary"
exec="onos-mininet wait 15"/>
<step name="Check-Summary-Again" requires="Wait-For-Mininet"
exec="onos-check-summary ${OC1} [0-9]* 25 112 0"/>
<step name="Config-Topo" requires="Check-Summary-Again"
exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/>
<step name="Check-Summary" requires="Config-Topo"
exec="onos-check-summary ${OC1} [0-9]* 25 0 25"/>
<step name="Start-Mininet" requires="Install-Apps,Check-Summary"
exec="echo onos-start-mininet not implemented yet"/>
<step name="Check-Summary-Yet-Again" requires="~Config-Topo"
exec="onos-check-summary ${OC1} [0-9]* 25 112 25"/>
<step name="Ping-All" requires="Wait-For-Mininet,~Check-Summary-Again"
exec="onos-mininet send py net.pingAll(1)"/>
<step name="Verify-Ping-All" requires="~Ping-All"
exec="onos-mininet expect Results: .* dropped"/>
<step name="Stop-Mininet" requires="~Verify-Ping-All"
exec="onos-mininet stop"/>
</group>
</scenario>
\ No newline at end of file
......
......@@ -19,9 +19,12 @@
<import file="${ONOS_ROOT}/tools/test/scenarios/setup.xml"/>
<dependency name="Setup" requires="Prerequisites"/>
<import file="${ONOS_ROOT}/tools/test/scenarios/basic-net.xml"/>
<dependency name="Basic-Net" requires="Setup"/>
<import file="${ONOS_ROOT}/tools/test/scenarios/archetypes.xml"/>
<dependency name="Archetypes" requires="Setup"/>
<dependency name="Archetypes" requires="~Basic-Net,Setup"/>
<import file="${ONOS_ROOT}/tools/test/scenarios/wrapup.xml"/>
<dependency name="Wrapup" requires="~Archetypes,~Setup"/>
<dependency name="Wrapup" requires="~Archetypes,~Setup,~Basic-Net"/>
</scenario>
......
cd $(dirname $0)
if [ -n "$1" ]; then
sudo python att-onos.py "$@"
else
sudo python att-onos.py 10.128.11.1 10.128.11.2 10.128.11.3
fi
......@@ -26,7 +26,7 @@ def run(controllers=[ '127.0.0.1' ]):
ctrl_count = 0
for controllerIP in controllers:
net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP )
ctrl_count = ctrl_count + 1
ctrl_count = ctrl_count + 1
net.build()
net.start()
CLI( net )
......
#!/bin/bash
cd ~/topos && sudo mn --custom att-mpls.py --topo att --link tc --controller remote,${1:-192.168.56.101} --mac \
--switch ovsk,protocols=OpenFlow10
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.