Brian O'Connor

Adding fractal mininet topo and domain config json

Change-Id: I26bb6f2351e11d28a4cbfb141e98958be1d4c90b
{
"domains" : {
"domain1" : {
"basic" : {
"name" : "Domain 1",
"applicationName" : "org.onosproject.meshdomain",
"internalDevices" : [ "of:0000000000001001", "of:0000000000001002", "of:0000000000001003" ],
"edgePorts" : [ "of:0000000000010000/1", "of:0000000003010000/2", "of:0000000002010000/1" ]
}
},
"domain2" : {
"basic" : {
"name" : "Domain 2",
"applicationName" : "org.onosproject.meshdomain",
"internalDevices" : [ "of:0000000000002001", "of:0000000000002002", "of:0000000000002003" ],
"edgePorts" : [ "of:0000000000020000/1", "of:0000000003020000/1", "of:0000000002010000/2" ]
}
},
"domain3" : {
"basic" : {
"name" : "Domain 3",
"applicationName" : "org.onosproject.meshdomain",
"internalDevices" : [ "of:0000000000003001", "of:0000000000003002", "of:0000000000003003" ],
"edgePorts" : [ "of:0000000000030000/1", "of:0000000003010000/1", "of:0000000003020000/2" ]
}
}
}
}
\ No newline at end of file
#!/usr/bin/env python
from mininet.topo import Topo
class FractalTopo( Topo ):
def build( self, n=3, h=2 ):
clusters = []
for i in range( 1, n+1 ):
clusterSws = []
# create switches in cluster
for j in range( 1, n+1 ):
id = i * 1000 + j
sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
[ self.addLink(s, sw) for s in clusterSws ]
clusterSws.append(sw)
clusters.append(clusterSws)
for i in range( 1, n+1 ):
# create the edge switch
id = i * 10000
sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
self.addLink(clusters[i-1].pop(0), sw)
for j in range( 1, h+1 ):
id = i * 1000 + j
host = self.addHost( 'h%d' % id )
self.addLink( host, sw )
for i in range( 1, n+1 ):
# connect the clusters
if i == n:
id = n * 1000000 + 10000
sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
self.addLink(clusters[i-1].pop(0), sw)
self.addLink(clusters[0].pop(0), sw)
else:
id = (i+1) * 1000000 + i * 10000
sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
self.addLink(clusters[i-1].pop(0), sw)
self.addLink(clusters[i].pop(0), sw)
topos = { 'fractal': FractalTopo }
def run():
topo = FractalTopo()
net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True )
net.start()
CLI( net )
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
run()