Updating tower topology for the tutorial.
Change-Id: I5310d0fad33fe2dfbd4135fd350696c4d5a36458
diff --git a/tools/test/topos/tower b/tools/test/topos/tower
deleted file mode 100755
index 8244bae..0000000
--- a/tools/test/topos/tower
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-cd ~/topos && sudo mn --custom tower.py --topo tower --controller remote,${1:-192.168.56.101} --mac
diff --git a/tools/test/topos/tower.json b/tools/test/topos/tower.json
new file mode 100644
index 0000000..7f7d426
--- /dev/null
+++ b/tools/test/topos/tower.json
@@ -0,0 +1,13 @@
+{
+ "devices": {
+ "of:0000000000000001": { "basic": { "name": "Spine-1" }},
+ "of:0000000000000002": { "basic": { "name": "Spine-2" }},
+ "of:0000000000000003": { "basic": { "name": "Leaf-1" }},
+ "of:0000000000000004": { "basic": { "name": "Leaf-2" }},
+ "of:0000000000000005": { "basic": { "name": "Leaf-3" }},
+ "of:0000000000000006": { "basic": { "name": "Leaf-4" }}
+ },
+
+ "hosts": {
+ }
+}
diff --git a/tools/test/topos/tower.py b/tools/test/topos/tower.py
index b75bfe4..22d515b 100755
--- a/tools/test/topos/tower.py
+++ b/tools/test/topos/tower.py
@@ -1,55 +1,42 @@
#!/usr/bin/env python
+"""
+"""
from mininet.topo import Topo
-from mininet.cli import CLI
-from mininet.net import Mininet
-from mininet.node import RemoteController, OVSKernelSwitch
-from mininet.log import setLogLevel
+class Tower( Topo ):
+ "Internet Topology Zoo Specimen."
-class TowerTopo( Topo ):
- """Create a tower topology"""
+ def addSwitch( self, name, **opts ):
+ kwargs = { 'protocols' : 'OpenFlow13' }
+ kwargs.update( opts )
+ return super(Tower, self).addSwitch( name, **kwargs )
- def build( self, k=4, h=6 ):
+ def __init__( self ):
+ "Create a topology."
+
+ # Initialize Topology
+ Topo.__init__( self )
+
spines = []
- leaves = []
- hosts = []
# Create the two spine switches
- spines.append(self.addSwitch('s1'))
- spines.append(self.addSwitch('s2'))
+ spines.append(self.addSwitch( 's1' ))
+ spines.append(self.addSwitch( 's2' ))
- # Create two links between the spine switches
- self.addLink(spines[0], spines[1])
- #TODO add second link between spines when multi-link topos are supported
- #self.addLink(spines[0], spines[1])
-
# Now create the leaf switches, their hosts and connect them together
- i = 1
- c = 0
- while i <= k:
- leaves.append(self.addSwitch('s1%d' % i))
+ for i in range(4):
+ sn = i + 1
+ leaf = self.addSwitch( 's1%d' % sn )
for spine in spines:
- self.addLink(leaves[i-1], spine)
+ self.addLink(leaf, spine)
- j = 1
- while j <= h:
- hosts.append(self.addHost('h%d%d' % (i, j)))
- self.addLink(hosts[c], leaves[i-1])
- j+=1
- c+=1
+ for j in range(5):
+ host = self.addHost( 'h%d%d' % (sn, j + 1) )
+ self.addLink( host, leaf )
- i+=1
-
-topos = { 'tower': TowerTopo }
-
-def run():
- topo = TowerTopo()
- net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True )
- net.start()
- CLI( net )
- net.stop()
+topos = { 'tower': ( lambda: Tower() ) }
if __name__ == '__main__':
- setLogLevel( 'info' )
- run()
+ from onosnet import run
+ run( Tower() )
diff --git a/tools/test/topos/tower.recipe b/tools/test/topos/tower.recipe
new file mode 100644
index 0000000..d6ba508
--- /dev/null
+++ b/tools/test/topos/tower.recipe
@@ -0,0 +1,14 @@
+# Default US MPLS topology recipe
+export OTD=6
+export OTL=16
+export OTH=20
+
+
+# Variables for the pingall scenario.
+export OPALL=380
+
+# Variables for link-up-down-up scenario.
+export OPS=h11
+export OPD=h21
+export OPL1="s1 s12"
+export OPL2="s2 s12"
\ No newline at end of file