Committed by
Gerrit Code Review
Improving net test tools and scenarios.
Change-Id: I2b53fa7b28e1135d2356ae58d4ee8ac35184d9b8
Showing
15 changed files
with
279 additions
and
39 deletions
| ... | @@ -43,3 +43,4 @@ export OCI="${OCI:-192.168.56.101}" # ONOS Controller Instance | ... | @@ -43,3 +43,4 @@ export OCI="${OCI:-192.168.56.101}" # ONOS Controller Instance |
| 43 | export ONOS_USER="${ONOS_USER:-sdn}" # ONOS user on remote system | 43 | export ONOS_USER="${ONOS_USER:-sdn}" # ONOS user on remote system |
| 44 | export ONOS_GROUP="${ONOS_GROUP:-sdn}" # ONOS group on remote system | 44 | export ONOS_GROUP="${ONOS_GROUP:-sdn}" # ONOS group on remote system |
| 45 | export ONOS_PWD="rocks" # ONOS user password on remote system | 45 | export ONOS_PWD="rocks" # ONOS user password on remote system |
| 46 | +export ONOS_SCENARIOS=$ONOS_ROOT/tools/test/scenarios | ... | ... |
| ... | @@ -30,6 +30,8 @@ export PATH="$PATH:$MAVEN/bin:$KARAF_ROOT/bin" | ... | @@ -30,6 +30,8 @@ export PATH="$PATH:$MAVEN/bin:$KARAF_ROOT/bin" |
| 30 | # Setup cell enviroment | 30 | # Setup cell enviroment |
| 31 | export ONOS_CELL=${ONOS_CELL:-local} | 31 | export ONOS_CELL=${ONOS_CELL:-local} |
| 32 | 32 | ||
| 33 | +export ONOS_SCENARIOS=$ONOS_ROOT/tools/test/scenarios | ||
| 34 | + | ||
| 33 | # Convenience utility to warp to various ONOS source projects | 35 | # Convenience utility to warp to various ONOS source projects |
| 34 | # e.g. 'o api', 'o dev', 'o' | 36 | # e.g. 'o api', 'o dev', 'o' |
| 35 | function o { | 37 | function o { | ... | ... |
| ... | @@ -10,9 +10,11 @@ onos ${1:-$OCI} "onos:summary" > $aux | ... | @@ -10,9 +10,11 @@ onos ${1:-$OCI} "onos:summary" > $aux |
| 10 | cat $aux | 10 | cat $aux |
| 11 | 11 | ||
| 12 | let status=0 | 12 | let status=0 |
| 13 | -grep -q "nodes=$2" $aux || let status=status+1 | 13 | +grep -q "nodes=${2:-.*}" $aux || let status=status+1 |
| 14 | -grep -q "devices=$3" $aux || let status=status+1 | 14 | +grep -q "devices=${3:-.*}" $aux || let status=status+1 |
| 15 | -grep -q "links=$4" $aux || let status=status+1 | 15 | +grep -q "links=${4:-.*}" $aux || let status=status+1 |
| 16 | -grep -q "hosts=$5" $aux || let status=status+1 | 16 | +grep -q "hosts=${5:-.*}" $aux || let status=status+1 |
| 17 | +grep -q "flows=${6:-.*}" $aux || let status=status+1 | ||
| 18 | +grep -q "intents=${7:-.*}" $aux || let status=status+1 | ||
| 17 | 19 | ||
| 18 | exit $status | 20 | exit $status |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -17,8 +17,9 @@ send) | ... | @@ -17,8 +17,9 @@ send) |
| 17 | ;; | 17 | ;; |
| 18 | 18 | ||
| 19 | sendAndExpect) | 19 | sendAndExpect) |
| 20 | - $mininet -X "stuff \"$1\\n\"" 2>/dev/null | 20 | + cmd="" |
| 21 | - shift | 21 | + for a in $*; do shift; if [ "$a" = "--expect" ]; then break; fi; cmd="$cmd $a"; done |
| 22 | + $mininet -X "stuff \"$cmd\\n\"" 2>/dev/null | ||
| 22 | onos-mininet expect "$@" | 23 | onos-mininet expect "$@" |
| 23 | ;; | 24 | ;; |
| 24 | 25 | ||
| ... | @@ -33,7 +34,9 @@ wait) | ... | @@ -33,7 +34,9 @@ wait) |
| 33 | expect) | 34 | expect) |
| 34 | aux=/tmp/mininet.$$.log | 35 | aux=/tmp/mininet.$$.log |
| 35 | ssh $remote " | 36 | ssh $remote " |
| 36 | - sleep 1 && while ! (tail -n1 $log | egrep -q '^mininet>'); do sleep 1; done | 37 | + sleep 1 |
| 38 | + if [ ! -f $log ]; then exit 1; fi; | ||
| 39 | + 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 | 40 | tac $log | awk '{ print \$0; } /^mininet>/ { if (on) { exit 0; } on=1; }' | tac > $aux |
| 38 | cat $aux | 41 | cat $aux |
| 39 | set -x | 42 | set -x |
| ... | @@ -42,10 +45,12 @@ expect) | ... | @@ -42,10 +45,12 @@ expect) |
| 42 | ;; | 45 | ;; |
| 43 | 46 | ||
| 44 | start) | 47 | start) |
| 45 | - ssh $remote rm -f $log | 48 | + ssh $remote "rm -f $log; echo logfile flush 1 > ~/.screenrc" |
| 49 | + ( | ||
| 46 | $mininet "$@" | 50 | $mininet "$@" |
| 47 | scp $remote:$log /tmp/mininet.log | 51 | scp $remote:$log /tmp/mininet.log |
| 48 | ssh $remote rm -f $log | 52 | ssh $remote rm -f $log |
| 53 | + ) & | ||
| 49 | ;; | 54 | ;; |
| 50 | 55 | ||
| 51 | stop) | 56 | stop) | ... | ... |
tools/test/bin/onos-wipe-out
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +# ----------------------------------------------------------------------------- | ||
| 3 | +# Wipes out all data from the ONOS cluster. Temporary until wipe-out is fixed. | ||
| 4 | +# ----------------------------------------------------------------------------- | ||
| 5 | + | ||
| 6 | +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ||
| 7 | +. $ONOS_ROOT/tools/build/envDefaults | ||
| 8 | + | ||
| 9 | +while ! onos-check-summary $OCI '.*' 0 0 0 0 0; do | ||
| 10 | + onos $OCI wipe-out please | ||
| 11 | +done |
tools/test/scenarios/net-link-up-down.xml
0 → 100644
| 1 | +<!-- | ||
| 2 | + ~ Copyright 2015 Open Networking Laboratory | ||
| 3 | + ~ | ||
| 4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + ~ you may not use this file except in compliance with the License. | ||
| 6 | + ~ You may obtain a copy of the License at | ||
| 7 | + ~ | ||
| 8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + ~ | ||
| 10 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 11 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + ~ See the License for the specific language governing permissions and | ||
| 14 | + ~ limitations under the License. | ||
| 15 | + --> | ||
| 16 | +<scenario name="net-link-up-down" description="Network link up-down test"> | ||
| 17 | + <!-- TODO: parametrize this via recipes --> | ||
| 18 | + <group name="Net-Link-Up-Down"> | ||
| 19 | + <step name="Ping-1" | ||
| 20 | + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> | ||
| 21 | + <step name="Link-1-Down" requires="Ping-1" | ||
| 22 | + exec="onos-mininet sendAndExpect link s4 s5 down --expect ."/> | ||
| 23 | + <step name="Ping-2" requires="Link-1-Down" | ||
| 24 | + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> | ||
| 25 | + <step name="Link-2-Down" requires="Ping-2" | ||
| 26 | + exec="onos-mininet sendAndExpect link s4 s7 down --expect ."/> | ||
| 27 | + <step name="Ping-3" requires="Link-2-Down" | ||
| 28 | + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect 100% packet loss"/> | ||
| 29 | + <step name="Link-1-Up" requires="Ping-3" | ||
| 30 | + exec="onos-mininet sendAndExpect link s4 s7 up --expect ."/> | ||
| 31 | + <step name="Ping-4" requires="Link-1-Up" | ||
| 32 | + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> | ||
| 33 | + <step name="Link-2-Up" requires="Ping-4" | ||
| 34 | + exec="onos-mininet sendAndExpect link s4 s5 up --expect ."/> | ||
| 35 | + <step name="Ping-5" requires="Link-2-Up" | ||
| 36 | + exec="onos-mininet sendAndExpect h1 ping -c1 h4 --expect \ 0% packet loss"/> | ||
| 37 | + </group> | ||
| 38 | +</scenario> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
tools/test/scenarios/net-pingall.xml
0 → 100644
| 1 | +<!-- | ||
| 2 | + ~ Copyright 2015 Open Networking Laboratory | ||
| 3 | + ~ | ||
| 4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + ~ you may not use this file except in compliance with the License. | ||
| 6 | + ~ You may obtain a copy of the License at | ||
| 7 | + ~ | ||
| 8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + ~ | ||
| 10 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 11 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + ~ See the License for the specific language governing permissions and | ||
| 14 | + ~ limitations under the License. | ||
| 15 | + --> | ||
| 16 | +<scenario name="net-pingall" description="Network pingall test"> | ||
| 17 | + <!-- TODO: parametrize this via recipes --> | ||
| 18 | + <group name="Net-Pingall"> | ||
| 19 | + <step name="Ping-All-And-Verify" | ||
| 20 | + exec="onos-mininet sendAndExpect py net.pingAll(1) --expect Results: .* dropped"/> | ||
| 21 | + | ||
| 22 | + <step name="Check-Summary-For-Hosts" requires="~Ping-All-And-Verify" | ||
| 23 | + exec="onos-check-summary ${OC1} [0-9]* 25 112 25"/> | ||
| 24 | + | ||
| 25 | + <step name="Config-Topo" requires="Check-Summary-For-Hosts" | ||
| 26 | + exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/> | ||
| 27 | + </group> | ||
| 28 | +</scenario> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -13,43 +13,33 @@ | ... | @@ -13,43 +13,33 @@ |
| 13 | ~ See the License for the specific language governing permissions and | 13 | ~ See the License for the specific language governing permissions and |
| 14 | ~ limitations under the License. | 14 | ~ limitations under the License. |
| 15 | --> | 15 | --> |
| 16 | -<scenario name="basic-net" description="Basic network functionality test"> | 16 | +<scenario name="net-setup" description="Network setup steps"> |
| 17 | - <group name="Basic-Net"> | 17 | + <!-- TODO: parametrize this via recipes --> |
| 18 | + <group name="Net-Setup"> | ||
| 18 | <step name="Push-Topos" exec="onos-push-topos ${OCN}"/> | 19 | <step name="Push-Topos" exec="onos-push-topos ${OCN}"/> |
| 19 | 20 | ||
| 20 | <step name="Install-Apps" | 21 | <step name="Install-Apps" |
| 21 | exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/> | 22 | exec="onos ${OC1} app activate org.onosproject.openflow org.onosproject.proxyarp org.onosproject.fwd"/> |
| 23 | + | ||
| 22 | <step name="Check-Apps" requires="Install-Apps" | 24 | <step name="Check-Apps" requires="Install-Apps" |
| 23 | exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/> | 25 | exec="onos-check-apps ${OC1} drivers,openflow,proxyarp,fwd"/> |
| 24 | 26 | ||
| 25 | - <step name="Wipe-Out-Data" requires="~Check-Apps" | 27 | + <step name="Wipe-Out-Data-Before" requires="~Check-Apps" exec="onos-wipe-out"/> |
| 26 | - exec="onos ${OC1} wipe-out please"/> | ||
| 27 | 28 | ||
| 28 | - <step name="Check-Summary" requires="~Wipe-Out-Data" | 29 | + <step name="Initial-Summary-Check" requires="~Wipe-Out-Data-Before" |
| 29 | exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/> | 30 | exec="onos-check-summary ${OC1} [0-9]* 0 0 0"/> |
| 30 | 31 | ||
| 31 | - <step name="Start-Mininet" requires="Install-Apps,Check-Summary,Push-Topos" | 32 | + <step name="Start-Mininet" |
| 32 | - exec="onos-mininet start topos/att-onos ${ONOS_INSTANCES}"/> | 33 | + requires="Install-Apps,Initial-Summary-Check,Push-Topos" |
| 34 | + exec="onos-mininet start topos/topo att-onos.py ${ONOS_INSTANCES}"/> | ||
| 33 | 35 | ||
| 34 | - <step name="Wait-For-Mininet" requires="Install-Apps,Check-Summary" | 36 | + <step name="Wait-For-Mininet" requires="Start-Mininet" |
| 35 | exec="onos-mininet wait 15"/> | 37 | exec="onos-mininet wait 15"/> |
| 36 | 38 | ||
| 37 | - <step name="Check-Summary-Again" requires="Wait-For-Mininet" | 39 | + <step name="Check-Summary" requires="Wait-For-Mininet" |
| 38 | exec="onos-check-summary ${OC1} [0-9]* 25 112 0"/> | 40 | exec="onos-check-summary ${OC1} [0-9]* 25 112 0"/> |
| 39 | 41 | ||
| 40 | - <step name="Config-Topo" requires="Check-Summary-Again" | 42 | + <step name="Balance-Masters" requires="Check-Summary" |
| 41 | - exec="onos-topo-cfg ${OC1} ${ONOS_ROOT}/tools/test/topos/attmpls.json"/> | 43 | + exec="onos ${OC1} balance-masters"/> |
| 42 | - | ||
| 43 | - <step name="Check-Summary-Yet-Again" requires="~Config-Topo" | ||
| 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"/> | ||
| 54 | </group> | 44 | </group> |
| 55 | </scenario> | 45 | </scenario> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
tools/test/scenarios/net-smoke.xml
0 → 100644
| 1 | +<!-- | ||
| 2 | + ~ Copyright 2015 Open Networking Laboratory | ||
| 3 | + ~ | ||
| 4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + ~ you may not use this file except in compliance with the License. | ||
| 6 | + ~ You may obtain a copy of the License at | ||
| 7 | + ~ | ||
| 8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + ~ | ||
| 10 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 11 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + ~ See the License for the specific language governing permissions and | ||
| 14 | + ~ limitations under the License. | ||
| 15 | + --> | ||
| 16 | +<scenario name="net-smoke" description="Basic network functionality smoke test"> | ||
| 17 | + <group name="Net-Smoke"> | ||
| 18 | + <import file="${ONOS_SCENARIOS}/net-setup.xml"/> | ||
| 19 | + | ||
| 20 | + <import file="${ONOS_SCENARIOS}/net-pingall.xml"/> | ||
| 21 | + <dependency name="Net-Pingall" requires="Net-Setup"/> | ||
| 22 | + | ||
| 23 | + <import file="${ONOS_SCENARIOS}/net-link-up-down.xml"/> | ||
| 24 | + <dependency name="Net-Link-Up-Down" requires="~Net-Pingall"/> | ||
| 25 | + | ||
| 26 | + <import file="${ONOS_SCENARIOS}/net-teardown.xml"/> | ||
| 27 | + <dependency name="Net-Teardown" requires="~Net-Link-Up-Down"/> | ||
| 28 | + </group> | ||
| 29 | +</scenario> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
tools/test/scenarios/net-teardown.xml
0 → 100644
| 1 | +<!-- | ||
| 2 | + ~ Copyright 2015 Open Networking Laboratory | ||
| 3 | + ~ | ||
| 4 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + ~ you may not use this file except in compliance with the License. | ||
| 6 | + ~ You may obtain a copy of the License at | ||
| 7 | + ~ | ||
| 8 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + ~ | ||
| 10 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 11 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + ~ See the License for the specific language governing permissions and | ||
| 14 | + ~ limitations under the License. | ||
| 15 | + --> | ||
| 16 | +<scenario name="net-setup" description="Network teardown steps"> | ||
| 17 | + <group name="Net-Teardown"> | ||
| 18 | + <step name="Stop-Mininet" exec="onos-mininet stop"/> | ||
| 19 | + <step name="Wipe-Out-Data-After" requires="~Stop-Mininet" exec="onos-wipe-out"/> | ||
| 20 | + </group> | ||
| 21 | +</scenario> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -14,17 +14,17 @@ | ... | @@ -14,17 +14,17 @@ |
| 14 | ~ limitations under the License. | 14 | ~ limitations under the License. |
| 15 | --> | 15 | --> |
| 16 | <scenario name="smoke-test" description="ONOS smoke test"> | 16 | <scenario name="smoke-test" description="ONOS smoke test"> |
| 17 | - <import file="${ONOS_ROOT}/tools/test/scenarios/prerequisites.xml"/> | 17 | + <import file="${ONOS_SCENARIOS}/prerequisites.xml"/> |
| 18 | 18 | ||
| 19 | - <import file="${ONOS_ROOT}/tools/test/scenarios/setup.xml"/> | 19 | + <import file="${ONOS_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"/> | 22 | + <import file="${ONOS_SCENARIOS}/net-smoke.xml"/> |
| 23 | - <dependency name="Basic-Net" requires="Setup"/> | 23 | + <dependency name="Net-Smoke" requires="Setup"/> |
| 24 | 24 | ||
| 25 | - <import file="${ONOS_ROOT}/tools/test/scenarios/archetypes.xml"/> | 25 | + <import file="${ONOS_SCENARIOS}/archetypes.xml"/> |
| 26 | - <dependency name="Archetypes" requires="~Basic-Net,Setup"/> | 26 | + <dependency name="Archetypes" requires="~Net-Smoke,Setup"/> |
| 27 | 27 | ||
| 28 | - <import file="${ONOS_ROOT}/tools/test/scenarios/wrapup.xml"/> | 28 | + <import file="${ONOS_SCENARIOS}/wrapup.xml"/> |
| 29 | - <dependency name="Wrapup" requires="~Archetypes,~Setup,~Basic-Net"/> | 29 | + <dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Smoke"/> |
| 30 | </scenario> | 30 | </scenario> | ... | ... |
| 1 | +#!/bin/bash | ||
| 2 | +# ----------------------------------------------------------------------------- | ||
| 3 | +# Starts ATT ONOS topology in mininet. | ||
| 4 | +# ----------------------------------------------------------------------------- | ||
| 1 | cd $(dirname $0) | 5 | cd $(dirname $0) |
| 2 | if [ -n "$1" ]; then | 6 | if [ -n "$1" ]; then |
| 3 | sudo python att-onos.py "$@" | 7 | sudo python att-onos.py "$@" | ... | ... |
tools/test/topos/rftest.py
0 → 100644
| 1 | +#!/usr/bin/python | ||
| 2 | + | ||
| 3 | +import sys | ||
| 4 | + | ||
| 5 | +from mininet.net import Mininet | ||
| 6 | +from mininet.cli import CLI | ||
| 7 | +from mininet.log import setLogLevel | ||
| 8 | +from mininet.node import RemoteController | ||
| 9 | + | ||
| 10 | +from rftesttopo import ReactiveForwardingTestTopo | ||
| 11 | + | ||
| 12 | +setLogLevel( 'info' ) | ||
| 13 | + | ||
| 14 | +def pingloop( net ): | ||
| 15 | + setLogLevel( 'error' ) | ||
| 16 | + try: | ||
| 17 | + while True: | ||
| 18 | + net.ping() | ||
| 19 | + finally: | ||
| 20 | + setLogLevel( 'info' ) | ||
| 21 | + | ||
| 22 | +def run(controllers=[ '127.0.0.1' ]): | ||
| 23 | + Mininet.pingloop = pingloop | ||
| 24 | + net = Mininet( topo=ReactiveForwardingTestTopo(), build=False, autoSetMacs=True ) | ||
| 25 | + ctrl_count = 0 | ||
| 26 | + for controllerIP in controllers: | ||
| 27 | + net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP ) | ||
| 28 | + ctrl_count = ctrl_count + 1 | ||
| 29 | + net.build() | ||
| 30 | + net.start() | ||
| 31 | + CLI( net ) | ||
| 32 | + net.stop() | ||
| 33 | + | ||
| 34 | +if __name__ == '__main__': | ||
| 35 | + if len( sys.argv ) > 1: | ||
| 36 | + controllers = sys.argv[ 1: ] | ||
| 37 | + else: | ||
| 38 | + print 'Usage: rf-test.py <c0 IP> <c1 IP> ...' | ||
| 39 | + exit( 1 ) | ||
| 40 | + run( controllers ) |
tools/test/topos/rftesttopo.py
0 → 100644
| 1 | +#!/usr/bin/env python | ||
| 2 | + | ||
| 3 | +""" | ||
| 4 | +""" | ||
| 5 | +from mininet.topo import Topo | ||
| 6 | +from mininet.net import Mininet | ||
| 7 | +from mininet.node import RemoteController | ||
| 8 | +from mininet.node import Node | ||
| 9 | +from mininet.node import CPULimitedHost | ||
| 10 | +from mininet.link import TCLink | ||
| 11 | +from mininet.cli import CLI | ||
| 12 | +from mininet.log import setLogLevel | ||
| 13 | +from mininet.util import dumpNodeConnections | ||
| 14 | + | ||
| 15 | +class ReactiveForwardingTestTopo( Topo ): | ||
| 16 | + "Internet Topology Zoo Specimen." | ||
| 17 | + | ||
| 18 | + def __init__( self ): | ||
| 19 | + "Create a topology." | ||
| 20 | + | ||
| 21 | + # Initialize Topology | ||
| 22 | + Topo.__init__( self ) | ||
| 23 | + | ||
| 24 | + # add nodes, switches first... | ||
| 25 | + s1 = self.addSwitch( 's1' ) | ||
| 26 | + s2 = self.addSwitch( 's2' ) | ||
| 27 | + s3 = self.addSwitch( 's3' ) | ||
| 28 | + s4 = self.addSwitch( 's4' ) | ||
| 29 | + s5 = self.addSwitch( 's5' ) | ||
| 30 | + s6 = self.addSwitch( 's6' ) | ||
| 31 | + s7 = self.addSwitch( 's7' ) | ||
| 32 | + s8 = self.addSwitch( 's8' ) | ||
| 33 | + s9 = self.addSwitch( 's9' ) | ||
| 34 | + | ||
| 35 | + # ... and now hosts | ||
| 36 | + h1 = self.addHost( 'h1' ) | ||
| 37 | + h2 = self.addHost( 'h2' ) | ||
| 38 | + h3 = self.addHost( 'h3' ) | ||
| 39 | + h4 = self.addHost( 'h4' ) | ||
| 40 | + | ||
| 41 | + # add edges between switch and corresponding host | ||
| 42 | + self.addLink( s1 , h1 ) | ||
| 43 | + self.addLink( s2 , h2 ) | ||
| 44 | + self.addLink( s3 , h3 ) | ||
| 45 | + self.addLink( s4 , h4 ) | ||
| 46 | + | ||
| 47 | + # add edges between switches | ||
| 48 | + self.addLink( s1 , s5 ) | ||
| 49 | + self.addLink( s2 , s5 ) | ||
| 50 | + self.addLink( s2 , s8 ) | ||
| 51 | + self.addLink( s3 , s4 ) | ||
| 52 | + self.addLink( s3 , s7 ) | ||
| 53 | + self.addLink( s4 , s5 ) | ||
| 54 | + self.addLink( s6 , s8 ) | ||
| 55 | + self.addLink( s6 , s7 ) | ||
| 56 | + self.addLink( s5 , s9 ) | ||
| 57 | + self.addLink( s6 , s9 ) | ||
| 58 | + | ||
| 59 | +topos = { 'att': ( lambda: ReactiveForwardingTestTopo() ) } |
tools/test/topos/topo
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +# ----------------------------------------------------------------------------- | ||
| 3 | +# Starts the specified mininet topology. | ||
| 4 | +# ----------------------------------------------------------------------------- | ||
| 5 | +cd $(dirname $0) | ||
| 6 | + | ||
| 7 | +topo=${1:-att-onos.py} | ||
| 8 | + | ||
| 9 | +[ -n "$1" ] && shift | ||
| 10 | +sudo python $topo "$@" |
-
Please register or login to post a comment