Improving net test tools and scenarios.

Change-Id: I2b53fa7b28e1135d2356ae58d4ee8ac35184d9b8
diff --git a/tools/test/topos/att-onos b/tools/test/topos/att-onos
index e473359..9ad918a 100755
--- a/tools/test/topos/att-onos
+++ b/tools/test/topos/att-onos
@@ -1,3 +1,7 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Starts ATT ONOS topology in mininet.
+# -----------------------------------------------------------------------------
 cd $(dirname $0)
 if [ -n "$1" ]; then
     sudo python att-onos.py "$@"
diff --git a/tools/test/topos/rftest.py b/tools/test/topos/rftest.py
new file mode 100644
index 0000000..7aba54f
--- /dev/null
+++ b/tools/test/topos/rftest.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import sys
+
+from mininet.net import Mininet
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.node import RemoteController
+
+from rftesttopo import ReactiveForwardingTestTopo
+
+setLogLevel( 'info' )
+
+def pingloop( net ):
+    setLogLevel( 'error' )
+    try:
+        while True:
+            net.ping()
+    finally:
+        setLogLevel( 'info' )
+
+def run(controllers=[ '127.0.0.1' ]):
+    Mininet.pingloop = pingloop
+    net = Mininet( topo=ReactiveForwardingTestTopo(), build=False, autoSetMacs=True )
+    ctrl_count = 0
+    for controllerIP in controllers:
+        net.addController( 'c%d' % ctrl_count, RemoteController, ip=controllerIP )
+	ctrl_count = ctrl_count + 1
+    net.build()
+    net.start()
+    CLI( net )
+    net.stop()
+
+if __name__ == '__main__':
+    if len( sys.argv ) > 1:
+        controllers = sys.argv[ 1: ]
+    else:
+        print 'Usage: rf-test.py <c0 IP> <c1 IP> ...'
+        exit( 1 )
+    run( controllers )
diff --git a/tools/test/topos/rftesttopo.py b/tools/test/topos/rftesttopo.py
new file mode 100644
index 0000000..9b97578
--- /dev/null
+++ b/tools/test/topos/rftesttopo.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+"""
+"""
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import RemoteController
+from mininet.node import Node
+from mininet.node import CPULimitedHost
+from mininet.link import TCLink
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.util import dumpNodeConnections
+
+class ReactiveForwardingTestTopo( Topo ):
+    "Internet Topology Zoo Specimen."
+
+    def __init__( self ):
+        "Create a topology."
+
+        # Initialize Topology
+        Topo.__init__( self )
+
+        # add nodes, switches first...
+        s1 = self.addSwitch( 's1' )
+        s2 = self.addSwitch( 's2' )
+        s3 = self.addSwitch( 's3' )
+        s4 = self.addSwitch( 's4' )
+        s5 = self.addSwitch( 's5' )
+        s6 = self.addSwitch( 's6' )
+        s7 = self.addSwitch( 's7' )
+        s8 = self.addSwitch( 's8' )
+        s9 = self.addSwitch( 's9' )
+
+        # ... and now hosts
+        h1 = self.addHost( 'h1' )
+        h2 = self.addHost( 'h2' )
+        h3 = self.addHost( 'h3' )
+        h4 = self.addHost( 'h4' )
+
+        # add edges between switch and corresponding host
+        self.addLink( s1 , h1 )
+        self.addLink( s2 , h2 )
+        self.addLink( s3 , h3 )
+        self.addLink( s4 , h4 )
+
+        # add edges between switches
+        self.addLink( s1 , s5 )
+        self.addLink( s2 , s5 )
+        self.addLink( s2 , s8 )
+        self.addLink( s3 , s4 )
+        self.addLink( s3 , s7 )
+        self.addLink( s4 , s5 )
+        self.addLink( s6 , s8 )
+        self.addLink( s6 , s7 )
+        self.addLink( s5 , s9 )
+        self.addLink( s6 , s9 )
+
+topos = { 'att': ( lambda: ReactiveForwardingTestTopo() ) }
diff --git a/tools/test/topos/topo b/tools/test/topos/topo
new file mode 100755
index 0000000..854de50
--- /dev/null
+++ b/tools/test/topos/topo
@@ -0,0 +1,10 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Starts the specified mininet topology.
+# -----------------------------------------------------------------------------
+cd $(dirname $0)
+
+topo=${1:-att-onos.py}
+
+[ -n "$1" ] && shift
+sudo python $topo "$@"