Committed by
Gerrit Code Review
Adding a basic mininet-based test to STC scenarios.
Change-Id: I193013608e8fcdaede8987536e754da6d1a185bf
Showing
10 changed files
with
112 additions
and
15 deletions
... | @@ -100,12 +100,12 @@ function cell { | ... | @@ -100,12 +100,12 @@ function cell { |
100 | if [ -n "$1" ]; then | 100 | if [ -n "$1" ]; then |
101 | [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ | 101 | [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \ |
102 | echo "No such cell: $1" >&2 && return 1 | 102 | echo "No such cell: $1" >&2 && return 1 |
103 | - unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES ONOS_USER ONOS_GROUP | 103 | + unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES |
104 | - unset OCI OCN OCT | 104 | + unset OCI OCN OCT ONOS_INSTANCES ONOS_USER ONOS_GROUP ONOS_FEATURES |
105 | - unset ONOS_FEATURES # deprecated | ||
106 | unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') | 105 | unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') |
107 | export ONOS_CELL=$1 | 106 | export ONOS_CELL=$1 |
108 | . $ONOS_ROOT/tools/test/cells/$1 | 107 | . $ONOS_ROOT/tools/test/cells/$1 |
108 | + export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) | ||
109 | setPrimaryInstance 1 >/dev/null | 109 | setPrimaryInstance 1 >/dev/null |
110 | cell | 110 | cell |
111 | else | 111 | else |
... | @@ -113,7 +113,7 @@ function cell { | ... | @@ -113,7 +113,7 @@ function cell { |
113 | env | egrep "OCI" | 113 | env | egrep "OCI" |
114 | env | egrep "OC[0-9]+" | sort | 114 | env | egrep "OC[0-9]+" | sort |
115 | env | egrep "OC[NT]" | 115 | env | egrep "OC[NT]" |
116 | - env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL' | 116 | + env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES' |
117 | fi | 117 | fi |
118 | } | 118 | } |
119 | 119 | ... | ... |
tools/test/bin/onos-mininet
0 → 100755
1 | +#!/bin/bash | ||
2 | +# ----------------------------------------------------------------------------- | ||
3 | +# Starts or interacts with mininet in a remote screen session. | ||
4 | +# ----------------------------------------------------------------------------- | ||
5 | + | ||
6 | +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ||
7 | +. $ONOS_ROOT/tools/build/envDefaults | ||
8 | + | ||
9 | +cmd="$1" && shift | ||
10 | +log="screenlog.0" | ||
11 | +remote="$ONOS_USER@$OCN" | ||
12 | +mininet="ssh -t -t $remote screen -L -S mininet" | ||
13 | + | ||
14 | +case $cmd in | ||
15 | +send) | ||
16 | + $mininet -X "stuff \"$@\\n\"" 2>/dev/null | ||
17 | + ;; | ||
18 | + | ||
19 | +sendAndExpect) | ||
20 | + $mininet -X "stuff \"$1\\n\"" 2>/dev/null | ||
21 | + shift | ||
22 | + onos-mininet expect "$@" | ||
23 | + ;; | ||
24 | + | ||
25 | +wait) | ||
26 | + ssh $remote " | ||
27 | + sleep 1 && while test ! -f $log; do sleep 1; done | ||
28 | + while ! (tail -n1 $log | egrep -q '^mininet>'); do sleep 1; done | ||
29 | + sleep ${1-:1} | ||
30 | + " | ||
31 | + ;; | ||
32 | + | ||
33 | +expect) | ||
34 | + aux=/tmp/mininet.$$.log | ||
35 | + ssh $remote " | ||
36 | + sleep 1 && while ! (tail -n1 $log | egrep -q '^mininet>'); do sleep 1; done | ||
37 | + tac $log | awk '{ print \$0; } /^mininet>/ { if (on) { exit 0; } on=1; }' | tac > $aux | ||
38 | + cat $aux | ||
39 | + set -x | ||
40 | + egrep \"$@\" $aux | ||
41 | + " | ||
42 | + ;; | ||
43 | + | ||
44 | +start) | ||
45 | + ssh $remote rm -f $log | ||
46 | + $mininet "$@" | ||
47 | + scp $remote:$log /tmp/mininet.log | ||
48 | + ssh $remote rm -f $log | ||
49 | + ;; | ||
50 | + | ||
51 | +stop) | ||
52 | + $mininet -X "stuff \"^C\\n\"" 2>/dev/null && \ | ||
53 | + $mininet -X "stuff \"^C\\n\"" 2>/dev/null && \ | ||
54 | + $mininet -X "stuff \"exit\\n\"" 2>/dev/null | ||
55 | + ;; | ||
56 | +esac |
tools/test/bin/onos-push-topos
0 → 100755
1 | +#!/bin/bash | ||
2 | +# ----------------------------------------------------------------------------- | ||
3 | +# Remotely pushes test topologies a remote mininet test machine. | ||
4 | +# ----------------------------------------------------------------------------- | ||
5 | + | ||
6 | +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ||
7 | +. $ONOS_ROOT/tools/build/envDefaults | ||
8 | + | ||
9 | +node=${1:-$OCN} | ||
10 | + | ||
11 | +scp -qr $ONOS_ROOT/tools/test/topos $ONOS_USER@$node: |
... | @@ -15,17 +15,41 @@ | ... | @@ -15,17 +15,41 @@ |
15 | --> | 15 | --> |
16 | <scenario name="basic-net" description="Basic network functionality test"> | 16 | <scenario name="basic-net" description="Basic network functionality test"> |
17 | <group name="Basic-Net"> | 17 | <group name="Basic-Net"> |
18 | + <step name="Push-Topos" exec="onos-push-topos ${OCN}"/> | ||
19 | + | ||
18 | <step name="Install-Apps" | 20 | <step name="Install-Apps" |
19 | - exec="onos ${OC1} app activate org.onosproject.proxyarp org.onosproject.fwd"/> | 21 | + exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/> |
20 | <step name="Check-Apps" requires="Install-Apps" | 22 | <step name="Check-Apps" requires="Install-Apps" |
21 | exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/> | 23 | exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/> |
22 | 24 | ||
23 | - <step name="Config-Topo" | 25 | + <step name="Wipe-Out-Data" requires="~Check-Apps" |
26 | + exec="onos ${OC1} wipe-out please"/> | ||
27 | + | ||
28 | + <step name="Check-Summary" requires="~Wipe-Out-Data" | ||
29 | + exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/> | ||
30 | + | ||
31 | + <step name="Start-Mininet" requires="Install-Apps,Check-Summary,Push-Topos" | ||
32 | + exec="onos-mininet start topos/att-onos ${ONOS_INSTANCES}"/> | ||
33 | + | ||
34 | + <step name="Wait-For-Mininet" requires="Install-Apps,Check-Summary" | ||
35 | + exec="onos-mininet wait 15"/> | ||
36 | + | ||
37 | + <step name="Check-Summary-Again" requires="Wait-For-Mininet" | ||
38 | + exec="onos-check-summary ${OC1} [0-9]* 25 112 0"/> | ||
39 | + | ||
40 | + <step name="Config-Topo" requires="Check-Summary-Again" | ||
24 | exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/> | 41 | exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/> |
25 | - <step name="Check-Summary" requires="Config-Topo" | ||
26 | - exec="onos-check-summary ${OC1} [0-9]* 25 0 25"/> | ||
27 | 42 | ||
28 | - <step name="Start-Mininet" requires="Install-Apps,Check-Summary" | 43 | + <step name="Check-Summary-Yet-Again" requires="~Config-Topo" |
29 | - exec="echo onos-start-mininet not implemented yet"/> | 44 | + exec="onos-check-summary ${OC1} [0-9]* 25 112 25"/> |
45 | + | ||
46 | + <step name="Ping-All" requires="Wait-For-Mininet,~Check-Summary-Again" | ||
47 | + exec="onos-mininet send py net.pingAll(1)"/> | ||
48 | + | ||
49 | + <step name="Verify-Ping-All" requires="~Ping-All" | ||
50 | + exec="onos-mininet expect Results: .* dropped"/> | ||
51 | + | ||
52 | + <step name="Stop-Mininet" requires="~Verify-Ping-All" | ||
53 | + exec="onos-mininet stop"/> | ||
30 | </group> | 54 | </group> |
31 | </scenario> | 55 | </scenario> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -19,9 +19,12 @@ | ... | @@ -19,9 +19,12 @@ |
19 | <import file="${ONOS_ROOT}/tools/test/scenarios/setup.xml"/> | 19 | <import file="${ONOS_ROOT}/tools/test/scenarios/setup.xml"/> |
20 | <dependency name="Setup" requires="Prerequisites"/> | 20 | <dependency name="Setup" requires="Prerequisites"/> |
21 | 21 | ||
22 | + <import file="${ONOS_ROOT}/tools/test/scenarios/basic-net.xml"/> | ||
23 | + <dependency name="Basic-Net" requires="Setup"/> | ||
24 | + | ||
22 | <import file="${ONOS_ROOT}/tools/test/scenarios/archetypes.xml"/> | 25 | <import file="${ONOS_ROOT}/tools/test/scenarios/archetypes.xml"/> |
23 | - <dependency name="Archetypes" requires="Setup"/> | 26 | + <dependency name="Archetypes" requires="~Basic-Net,Setup"/> |
24 | 27 | ||
25 | <import file="${ONOS_ROOT}/tools/test/scenarios/wrapup.xml"/> | 28 | <import file="${ONOS_ROOT}/tools/test/scenarios/wrapup.xml"/> |
26 | - <dependency name="Wrapup" requires="~Archetypes,~Setup"/> | 29 | + <dependency name="Wrapup" requires="~Archetypes,~Setup,~Basic-Net"/> |
27 | </scenario> | 30 | </scenario> | ... | ... |
tools/test/topos/att-onos
0 → 100755
tools/test/topos/attmpls
deleted
100755 → 0
tools/test/topos/attmpls-sim.json
deleted
100644 → 0
This diff is collapsed. Click to expand it.
tools/test/topos/attmplsopt.json
deleted
100644 → 0
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment