Brian O'Connor

Adding fractal mininet topo and domain config json

Change-Id: I26bb6f2351e11d28a4cbfb141e98958be1d4c90b
1 +{
2 + "domains" : {
3 + "domain1" : {
4 + "basic" : {
5 + "name" : "Domain 1",
6 + "applicationName" : "org.onosproject.meshdomain",
7 + "internalDevices" : [ "of:0000000000001001", "of:0000000000001002", "of:0000000000001003" ],
8 + "edgePorts" : [ "of:0000000000010000/1", "of:0000000003010000/2", "of:0000000002010000/1" ]
9 + }
10 + },
11 + "domain2" : {
12 + "basic" : {
13 + "name" : "Domain 2",
14 + "applicationName" : "org.onosproject.meshdomain",
15 + "internalDevices" : [ "of:0000000000002001", "of:0000000000002002", "of:0000000000002003" ],
16 + "edgePorts" : [ "of:0000000000020000/1", "of:0000000003020000/1", "of:0000000002010000/2" ]
17 + }
18 + },
19 + "domain3" : {
20 + "basic" : {
21 + "name" : "Domain 3",
22 + "applicationName" : "org.onosproject.meshdomain",
23 + "internalDevices" : [ "of:0000000000003001", "of:0000000000003002", "of:0000000000003003" ],
24 + "edgePorts" : [ "of:0000000000030000/1", "of:0000000003010000/1", "of:0000000003020000/2" ]
25 + }
26 + }
27 + }
28 +}
...\ No newline at end of file ...\ No newline at end of file
1 +#!/usr/bin/env python
2 +
3 +from mininet.topo import Topo
4 +
5 +class FractalTopo( Topo ):
6 + def build( self, n=3, h=2 ):
7 +
8 + clusters = []
9 + for i in range( 1, n+1 ):
10 + clusterSws = []
11 + # create switches in cluster
12 + for j in range( 1, n+1 ):
13 + id = i * 1000 + j
14 + sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
15 + [ self.addLink(s, sw) for s in clusterSws ]
16 + clusterSws.append(sw)
17 + clusters.append(clusterSws)
18 +
19 + for i in range( 1, n+1 ):
20 + # create the edge switch
21 + id = i * 10000
22 + sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
23 + self.addLink(clusters[i-1].pop(0), sw)
24 + for j in range( 1, h+1 ):
25 + id = i * 1000 + j
26 + host = self.addHost( 'h%d' % id )
27 + self.addLink( host, sw )
28 +
29 + for i in range( 1, n+1 ):
30 + # connect the clusters
31 + if i == n:
32 + id = n * 1000000 + 10000
33 + sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
34 + self.addLink(clusters[i-1].pop(0), sw)
35 + self.addLink(clusters[0].pop(0), sw)
36 +
37 + else:
38 + id = (i+1) * 1000000 + i * 10000
39 + sw = self.addSwitch('s%d' % id, dpid=str(id).zfill(16))
40 + self.addLink(clusters[i-1].pop(0), sw)
41 + self.addLink(clusters[i].pop(0), sw)
42 +
43 +
44 +topos = { 'fractal': FractalTopo }
45 +
46 +def run():
47 + topo = FractalTopo()
48 + net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True )
49 + net.start()
50 + CLI( net )
51 + net.stop()
52 +
53 +if __name__ == '__main__':
54 + setLogLevel( 'info' )
55 + run()
56 +