Beispiel #1
0
    def __init__(self, linkopts1, linkopts2, linkopts3, fanout=2, **opts):
        # Initialize topology and default options
        Topo.__init__(self, **opts)
        aggregation = []
        edge = []
        host = []

        self.linkopts = [ linkopts1, linkopts2, linkopts3 ]

        # Create core switch
        core = self.addSwitch('c1')

        # Aggregation switches
        for i in irange(1, fanout):
            aggregation.append(self.addSwitch('a%s' % (len(aggregation) + 1)))
            self.addLink(core, aggregation[-1], **linkopts1)

            # Edge switches
            for j in irange(1, fanout):
                edge.append(self.addSwitch('e%s' % (len(edge) + 1)))
                self.addLink(aggregation[-1], edge[-1], **linkopts2)

                # Hosts
                for k in irange(1, fanout):
                    host.append(self.addHost('h%s' % (len(host) + 1)))
                    self.addLink(host[-1], edge[-1], **linkopts3)
Beispiel #2
0
    def __init__(self, **opts):
	Topo.__init__(self, **opts)
		#make switchs
	self.Iot_1 = self.addSwitch('Iot1')
	self.Iot_2 = self.addSwitch('IoT2')
	self.Iot_3 = self.addSwitch('IoT3')
	self.Iot_left = self.addSwitch('Iot4')
	self.Iot_right = self.addSwitch('Iot5')
	#make host
	self.H_1 = self.addHost('H1')
	self.H_2 = self.addHost('H2')
		#make link
		#self.addLink(self.Iot_1,self.H_1,0,0)
		#self.addLink(self.Iot_1,self.Iot_2,1,0)
		#self.addLink(self.Iot_2,self.H_2,1,0)
		#self.addLink(self.Iot_3,self.H_2,1,1)
		#self.addLink(self.Iot_3,self.H_1,0,1)
		
	self.addLink(self.Iot_left,self.H_1)
	self.addLink(self.Iot_1,self.Iot_left)
	self.addLink(self.Iot_1,self.Iot_2)
	self.addLink(self.Iot_2,self.Iot_right)
	self.addLink(self.Iot_3,self.Iot_right)
	self.addLink(self.Iot_3,self.Iot_left)
	self.addLink(self.Iot_right,self.H_2)
Beispiel #3
0
    def __init__(self):

        # Initialize topology
        Topo.__init__(self)

        # Create template host, switch, and link
        hconfig = {'inNamespace': True}
        link_config = {'bw': 100}
        host_link_config = {}

        # Create switch nodes
        self.addSwitch('s1')
        self.addSwitch('s2')

        # Create host nodes
        self.addHost('h1', **hconfig)
        self.addHost('h2', **hconfig)
        self.addHost('h3', **hconfig)

        # Add switch links
        self.addLink('s1', 's2', **link_config)

        # Add host links
        self.addLink('h1', 's1', **link_config)
        self.addLink('h2', 's1', **link_config)
        self.addLink('h3', 's2', **link_config)
 def __init__( self ): 
     "Create custom topo." 
     # Initialize topology 
     Topo.__init__( self ) 
     # Add hosts and switches 
     Switch1 = self.addSwitch( 's1' ) 
     Switch2 = self.addSwitch( 's2' ) 
     Switch3 = self.addSwitch( 's3' ) 
     Switch4 = self.addSwitch( 's4' ) 
     Host11 = self.addHost( 'h1' ) 
     Host12 = self.addHost( 'h2' ) 
     Host21 = self.addHost( 'h3' ) 
     Host22 = self.addHost( 'h4' ) 
     Host23 = self.addHost( 'h5' ) 
     Service1 = self.addHost( 'srvc1' ) 
     # Add links 
     self.addLink( Host11, Switch1 ) 
     self.addLink( Host12, Switch1 ) 
     self.addLink( Host21, Switch2 ) 
     self.addLink( Host22, Switch2 ) 
     self.addLink( Host23, Switch2 ) 
     self.addLink( Switch1, Switch2 ) 
     self.addLink( Switch2, Switch4 ) 
     self.addLink( Switch4, Switch3 ) 
     self.addLink( Switch3, Switch1 ) 
     self.addLink( Switch3, Service1 ) 
     self.addLink( Switch4, Service1 ) 
Beispiel #5
0
    def __init__( self, *args, **kwargs ):
        Topo.__init__( self, *args, **kwargs )
        # Describe Code
        # Set up data plane switch - this is the emulated router dataplane
        # Note: The controller needs to be configured with the specific driver that
        # will be attached to this switch.

        # IXP fabric
	main_switch = self.addSwitch( 's1' )

        # Add node for central Route Server"
        route_server = self.addHost('x1', ip = '172.0.255.254/16', mac='08:00:27:89:3b:ff', inNamespace = False)
        self.addLink(main_switch, route_server, 1)
        
        # Add node for ARP Proxy"
        arp_proxy = self.addHost('x2', ip = '172.0.255.253/16', mac='08:00:27:89:33:ff', inNamespace = False)
        self.addLink(main_switch, arp_proxy, 2)
        
        # Add Participants to the IXP
        # Each participant consists of 1 quagga router PLUS
        # 1 host per network advertised behind quagga
        self.addParticipant(fabric=main_switch, name = 'a1', port = 3, mac = '08:00:27:89:3b:9f', 
           ip = '172.0.0.01/16', networks = ['100.0.0.0/24', '110.0.0.0/24'], AS = 100)

        self.addParticipant(fabric=main_switch, name = 'b1', port = 4, mac = '08:00:27:92:18:1f', 
           ip = '172.0.0.11/16', networks = ['140.0.0.0/24', '150.0.0.0/24'], AS = 200)
        
        self.addParticipant(fabric=main_switch, name = 'c1', port = 5, mac='08:00:27:54:56:ea',
           ip = '172.0.0.21/16', networks = ['140.0.0.0/24', '150.0.0.0/24'], AS = 300)
        
        self.addParticipant(fabric=main_switch, name = 'c2', port = 6, mac = '08:00:27:bd:f8:b2',
           ip = '172.0.0.22/16', networks = ['140.0.0.0/24', '150.0.0.0/24'], AS = 300)
    def __init__( self):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        host1 = self.addHost( 'h1', ip="10.0.1.2", defaultRoute = "via 10.0.1.1/24" )
        host2 = self.addHost( 'h2', ip="10.0.1.3", defaultRoute = "via 10.0.1.1/24" )
        host3 = self.addHost( 'h3', ip="10.0.2.2", defaultRoute = "via 10.0.2.1/24" )

	host4 = self.addHost( 'h4', ip="10.0.2.3", defaultRoute = "via 10.0.2.1/24" )
        host5 = self.addHost( 'h5', ip="10.0.2.4", defaultRoute = "via 10.0.2.1/24" )

        switch1 = self.addSwitch( 's1')
	switch2 = self.addSwitch( 's2')


        # Add links
        self.addLink( host1, switch1 )
        self.addLink( host2, switch1 )
        self.addLink( host3, switch2 )
	self.addLink( host4, switch2 )
	self.addLink( host5, switch2 )
	self.addLink( switch1, switch2 )
Beispiel #7
0
    def __init__( self ):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        host1 = self.addHost( 'h1' )
        host2 = self.addHost( 'h2' )
	host3 = self.addHost( 'h3' )
	host4 = self.addHost( 'h4' )
	host5 = self.addHost( 'h5' )
	host6 = self.addHost( 'h6' )
        switch1 = self.addSwitch( 's1' )
	switch2 = self.addSwitch( 's2' )
	switch3 = self.addSwitch( 's3' )

        # Add links
        self.addLink( host1, switch1, bw=100, delay='5ms' )
        self.addLink( host2, switch1, bw=100, delay='5ms' )
	self.addLink( host3, switch1, bw=100, delay='5ms' )
	self.addLink( host4, switch1, bw=5, delay='10ms' )
	self.addLink( host5, switch1, bw=5, delay='10ms' )
	self.addLink( host6, switch1, bw=5, delay='10ms' )
	self.addLink( switch1, switch2, delay='40ms' )
	self.addLink( switch2, switch3, delay='40ms' )
Beispiel #8
0
    def __init__( self ):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        leftHost = self.addHost( 'h1' )
        leftHost1 = self.addHost( 'h2' )
        centerHost = self.addHost( 'h3' )
        centerHost1 = self.addHost( 'h4' )
        rightHost = self.addHost( 'h5' )
        rightHost1 = self.addHost( 'h6' )
        leftSwitch = self.addSwitch( 's1' )
        centerSwitch = self.addSwitch( 's2' )
        rightSwitch = self.addSwitch( 's3' )

        # Add links
        self.addLink( leftHost, leftSwitch )
        self.addLink( leftHost1, leftSwitch )
        self.addLink( centerHost, centerSwitch)
        self.addLink( centerHost1, centerSwitch)
        self.addLink( rightHost, rightSwitch)
        self.addLink( rightHost1, rightSwitch)
        self.addLink( leftSwitch, centerSwitch )
        self.addLink( rightSwitch, centerSwitch )
Beispiel #9
0
 def __init__(self,**opts):
     Topo.__init__(self, **opts)
     host1 = self.addHost('h1')
     host2 = self.addHost('h2')
     host3 = self.addHost('h3')
     host4 = self.addHost('h4')
     host5 = self.addHost('h5')
     host6 = self.addHost('h6')
     host7 = self.addHost('h7')
     host8 = self.addHost('h8')
     host9 = self.addHost('h9')
     host10 = self.addHost('h10')
 
     self.switch = {}
     for s in range(1,6):
         self.switch[s-1] = self.addSwitch('s%s' %(s))
     self.addLink(self.switch[0], self.switch[1])
     self.addLink(self.switch[0], self.switch[2])
     self.addLink(self.switch[0], self.switch[3])
     self.addLink(self.switch[4], self.switch[1])
     self.addLink(self.switch[4], self.switch[2])
     self.addLink(self.switch[4], self.switch[3])
         #Adding host
     self.addLink(self.switch[0], host1)
     self.addLink(self.switch[4], host2)
     self.addLink(self.switch[4], host3)
     self.addLink(self.switch[4], host4)
     self.addLink(self.switch[4], host5)
     self.addLink(self.switch[4], host6)
     self.addLink(self.switch[4], host7)
     self.addLink(self.switch[4], host8)
     self.addLink(self.switch[4], host9)
     self.addLink(self.switch[4], host10)
 def __init__(self, **opts):
     Topo.__init__(self, **opts)
     h1 = self.addHost('h1')
     h2 = self.addHost('h2')
     h3 = self.addHost('h3')
     h4 = self.addHost('h4')
     h5 = self.addHost('h5')
     h6 = self.addHost('h6')
     h7 = self.addHost('h7')
     h8 = self.addHost('h8')
     h9 = self.addHost('h9')
     h10 = self.addHost('h10')
     s1 = self.addSwitch('s1')
     s2 = self.addSwitch('s2')
     s3 = self.addSwitch('s3')
     s4 = self.addSwitch('s4')
     s5 = self.addSwitch('s5')
     s6 = self.addSwitch('s6')
     self.addLink(h1, s1)
     self.addLink(h7, s1)
     self.addLink(h8, s1)
     self.addLink(h2, s2)
     self.addLink(h3, s3)
     self.addLink(h4, s4)
     self.addLink(h9, s4)
     self.addLink(h10, s4)
     self.addLink(h5, s5)
     self.addLink(h6, s6)
     self.addLink(s1, s2, bw=20, delay='40ms')
     self.addLink(s2, s3, bw=40, delay='10ms')
     self.addLink(s3, s4, bw=30, delay='30ms')
     self.addLink(s2, s5, bw=25, delay='5ms')
     self.addLink(s3, s6, bw=25, delay='5ms')
    def  CreatTopo(self,Da,Di,**params):
         Topo.__init__(self,**params)
         inters = [self.addSwitch('inter%x' % k,dpid='%x' %(k+10))
                   for k in range(1,Da/2+1)  ]
         aggs = [self.addSwitch('agg%x' % k,dpid='%x' %(k+20))
                  for k in range(1,Di+1)  ]
         tors = [self.addSwitch('tor%x' % k,dpid='%x' %(k+30))
                  for k in range(1,Da*Di/4+1)  ]
         hosts = [ self.addHost( 'vm%d' % i,ip='10.0.0.%d' %i )
                    for i in range(1,(Da*Di/4)*3+1)  ]

# creat links between instances
         for a in aggs:
            for i in inters:
               self.addLink(a,i)
            
         for i in range(0,Di/2):
            for j in range(0,Da*Di/8):       
               self.addLink(aggs[i],tors[j])

         for i in range(Di/2,Di):
            for j in range(Da*Di/8,Da*Di/4):
               self.addLink(aggs[i],tors[j])

         for i in range(0,Da*Di/4):
             self.addLink(hosts[i*3],tors[i])
	     self.addLink(hosts[i*3+1],tors[i])
             self.addLink(hosts[i*3+2],tors[i])
         print self.ports
Beispiel #12
0
    def __init__( self, enable_all = True ):
        "Create custom topo."

        Topo.__init__( self )
#        h1 = self.addHost("h1")                                                                                                                                                                                   
#        h2 = self.addHost("h2")                                                                                                                                                                                   
#        h3 = self.addHost("h3",                                                                                                                                                                                  
#                          ip="172.31.3.100/24",                                                                                                                                                                  
#                          defaultRoute="gw 172.31.3.1")                                                                                                                                                           
#        h4 = self.addHost("h4",                                                                                                                                                                                  
#                          ip="172.31.4.100/24",                                                                                                                                                                   
#                          defaultRoute="gw 172.31.4.1")                                                                                                                                                           

        sA = self.addSwitch("s21")
        sB = self.addSwitch("s22")
        sC = self.addSwitch("s23")
        sD = self.addSwitch("s24")
        sE = self.addSwitch("s25")
        sF = self.addSwitch("s26")

#        self.addLink(h1, sA)                                                                                                                                                                                     
#        self.addLink(h2, sB)                                                                                                                                                                                     
#        self.addLink(h3, sC)                                                                                                                                                                                     
#        self.addLink(h4, sD)                                                                                                                                                                                       

        self.addLink(sA, sB)
        self.addLink(sA, sC)
        self.addLink(sB, sD)
        self.addLink(sC, sE)
        self.addLink(sD, sF)
        self.addLink(sE, sF)
Beispiel #13
0
    def __init__(self, linkopts1, linkopts2, linkopts3, fanout=2, **opts):
        # Initialize topology and default options
        Topo.__init__(self, **opts)

        # Add your logic here ...

        core_sw = []
        agg_sw = []
        edge_sw = []
        hosts = []

        # creating core switch (root of the tree)
        core_sw.append(self.addSwitch("c1"))

        # creating aggregation switches
        for x in range(1, len(core_sw) * fanout + 1):
            print x
            agg_sw.append(self.addSwitch("a%s" % x))
            self.addLink(agg_sw[x - 1], core_sw[x // fanout - 1], **linkopts1)

        # creating edge switches
        for x in range(1, len(agg_sw) * fanout + 1):
            edge_sw.append(self.addSwitch("e%s" % x))
            self.addLink(edge_sw[x - 1], agg_sw[x // fanout - 1], **linkopts2)

        for x in range(1, len(edge_sw) * fanout + 1):
            hosts.append(self.addHost("h%s" % x))
            self.addLink(hosts[x - 1], edge_sw[x // fanout - 1], **linkopts3)
    def __init__( self, **opts ):
        "Create a topology."

        # Initialize Topology
        Topo.__init__( self, **opts )

        # add nodes, switches first...
        NewYork = self.addSwitch( 's0' )
        Chicago = self.addSwitch( 's1' )
        WashingtonDC = self.addSwitch( 's2' )
        Seattle = self.addSwitch( 's3' )
        Sunnyvale = self.addSwitch( 's4' )
        LosAngeles = self.addSwitch( 's5' )
        Denver = self.addSwitch( 's6' )
        KansasCity = self.addSwitch( 's7' )
        Houston = self.addSwitch( 's8' )
        Atlanta = self.addSwitch( 's9' )
        Indianapolis = self.addSwitch( 's10' )

        # ... and now hosts
        NewYork_host = self.addHost( 'h0' )
        Chicago_host = self.addHost( 'h1' )
        WashingtonDC_host = self.addHost( 'h2' )
        Seattle_host = self.addHost( 'h3' )
        Sunnyvale_host = self.addHost( 'h4' )
        LosAngeles_host = self.addHost( 'h5' )
        Denver_host = self.addHost( 'h6' )
        KansasCity_host = self.addHost( 'h7' )
        Houston_host = self.addHost( 'h8' )
        Atlanta_host = self.addHost( 'h9' )
        Indianapolis_host = self.addHost( 'h10' )

        # add edges between switch and corresponding host
        self.addLink( NewYork , NewYork_host )
        self.addLink( Chicago , Chicago_host )
        self.addLink( WashingtonDC , WashingtonDC_host )
        self.addLink( Seattle , Seattle_host )
        self.addLink( Sunnyvale , Sunnyvale_host )
        self.addLink( LosAngeles , LosAngeles_host )
        self.addLink( Denver , Denver_host )
        self.addLink( KansasCity , KansasCity_host )
        self.addLink( Houston , Houston_host )
        self.addLink( Atlanta , Atlanta_host )
        self.addLink( Indianapolis , Indianapolis_host )

        # add edges between switches
        self.addLink( NewYork , Chicago, bw=10, delay='5.82294818601ms')
        self.addLink( NewYork , WashingtonDC, bw=10, delay='1.66933354639ms')
        self.addLink( Chicago , Indianapolis, bw=10, delay='1.33817152535ms')
        self.addLink( WashingtonDC , Atlanta, bw=10, delay='4.43098085052ms')
        self.addLink( Seattle , Sunnyvale, bw=10, delay='5.78617273178ms')
        self.addLink( Seattle , Denver, bw=10, delay='8.33987030826ms')
        self.addLink( Sunnyvale , LosAngeles, bw=10, delay='2.55695492867ms')
        self.addLink( Sunnyvale , Denver, bw=10, delay='7.64100479966ms')
        self.addLink( LosAngeles , Houston, bw=10, delay='11.2143737889ms')
        self.addLink( Denver , KansasCity, bw=10, delay='4.53199947571ms')
        self.addLink( KansasCity , Houston, bw=10, delay='5.29499644815ms')
        self.addLink( KansasCity , Indianapolis, bw=10, delay='3.7130222434ms')
        self.addLink( Houston , Atlanta, bw=10, delay='5.73005892826ms')
        self.addLink( Atlanta , Indianapolis, bw=10, delay='3.49428237002ms')
Beispiel #15
0
    def __init__( self ):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        host1 = self.addHost( 'h1' )
        host2 = self.addHost( 'h2' )
        host3 = self.addHost( 'h3' )
        host4 = self.addHost( 'h4' )
        host5 = self.addHost( 'h5' )
        switch1 = self.addSwitch( 's12' )
        switch2 = self.addSwitch( 's11' )
        switch3 = self.addSwitch( 's22' )
        switch4 = self.addSwitch( 's34' )
        switch5 = self.addSwitch( 's33' )
        switch6 = self.addSwitch( 's44' )
        switch7 = self.addSwitch( 's55' )

        # Add links
        self.addLink( host1, switch1 )
        self.addLink( host2, switch1 )
        self.addLink( host3, switch4 )
        self.addLink( host4, switch4 )
        self.addLink( host5, switch7 )
        self.addLink( switch1, switch2 )
        self.addLink( switch1, switch3 )
        self.addLink( switch4, switch2 )
        self.addLink( switch4, switch3 )
        self.addLink( switch5, switch2 )
        self.addLink( switch5, switch3 )
        self.addLink( switch5, switch6 )
        self.addLink( switch6, switch7 )
    def __init__( self, snum, hnum ):
        Topo.__init__( self )
        swi = {}
        hos = {} 
    #    print "reached 1"
        snum = int(snum)
        hnum = int(hnum)
        for x in xrange(snum):
            s = self.addSwitch("s" +str(x+1))
            swi[x+1]= s
    #    print "reached 2 " 

        for x in xrange(hnum):
            h = self.addHost("h" +str(x+1))
            hos[x+1]= h
    #    print "reached 3"

        for x in xrange(snum):
            for y in xrange(x):
                self.addLink(swi[x+1],swi[y+1])
#        print "reached 4"

        sph = hnum/snum
        sin = swi.keys()
        skey = sin*int(hnum/snum)
   #     print skey
        tmp = sin[:(hnum%snum)]
    #    print tmp
        skey = skey + tmp
        skey.sort()
    #   print skey
        i = 1
        for x in skey:
            self.addLink(swi[x], hos[i])
            i = i+1
Beispiel #17
0
    def __init__(self, hosts=2, bwlimit=10, lat=0.1, workers=2, bottleneck = 1000, **params):
        print "    * __init__ Dumbbell topo"
        assert workers==2, "!Assertion Error: Dumbbell may formed of two workers! Asked:"+str(workers)
        Topo.__init__(self, **params)
        tor = []
        bw = bwlimit
        s = 1
        #bw = 10a
        #Note: if we send 10, partition is 5/5, if we send 11, partition is 5/6 or 5/11
        host = 1
        assert hosts%workers==0, "!Assertion Error: MaxiNet Tools-Dumbbell, host partition unequal"
        #hostsperworker = hosts/worker

        print "    * Adding hosts and switches to dumbbell topology. Link BW =",bwlimit
        for i in xrange(workers):
           #1 switch per worker
           print '     s'+str(s), 
           sw = self.addSwitch('s' + str(s), dpid=self.makeDPID(s),
                                **dict(listenPort=(13000 + s - 1)))
           s = s + 1
           tor.append(sw)
           #equal percentage host 
           for j in xrange(hosts/workers):
              print " h"+str(host),

              h = self.addHost('h' + str(host), mac=self.makeMAC(host-1),
                            ip="10.0.0." + str(host))
              host =  host+1
              self.addLink(h, sw, bw=bw, delay=str(lat) + "ms")
           print "\n"

        #toDo = tor  # nodes that have to be integrated into the tree
        print "    * Adding dumbbell bottleneck link. BW =",bottleneck
        assert len(tor)==2, "Dumbbell link requested with more than two links"
        self.addLink(tor[0], tor[1], bw=bottleneck, delay=str(lat) + "ms")
Beispiel #18
0
 def __init__(self, hosts=2, bwlimit=10, lat=0.1, **opts):
     Topo.__init__(self, **opts)
     tor = []
     numLeafes = hosts
     bw = bwlimit
     s = 1
     #bw = 10
     for i in range(numLeafes):
         h = self.addHost('h' + str(i + 1), mac=self.makeMAC(i),
                         ip="10.0.0." + str(i + 1))
         sw = self.addSwitch('s' + str(s), dpid=self.makeDPID(s),
                             **dict(listenPort=(13000 + s - 1)))
         s = s + 1
         self.addLink(h, sw, bw=bw, delay=str(lat) + "ms")
         tor.append(sw)
     toDo = tor  # nodes that have to be integrated into the tree
     while len(toDo) > 1:
         newToDo = []
         for i in range(0, len(toDo), 2):
             sw = self.addSwitch('s' + str(s), dpid=self.makeDPID(s),
                                 **dict(listenPort=(13000 + s - 1)))
             s = s + 1
             newToDo.append(sw)
             self.addLink(toDo[i], sw, bw=bw, delay=str(lat) + "ms")
             if len(toDo) > (i + 1):
                 self.addLink(toDo[i + 1], sw, bw=bw, delay=str(lat) + "ms")
         toDo = newToDo
         bw = 1.0 * bw
Beispiel #19
0
    def __init__( self ):
        # Initialize topology
        Topo.__init__( self )

        #add switches
        s1 = self.addSwitch('s1', dpid="1")
        s2 = self.addSwitch('s2', dpid="2")

        #add hosts
        vm1 = self.addHost('vm1', ip="10.0.0.1", mac="00:00:00:00:00:01")
        vm2 = self.addHost('vm2', ip="10.0.0.2", mac="00:00:00:00:00:02")
        vm3 = self.addHost('vm3', ip="10.0.0.3", mac="00:00:00:00:00:03")
        vm4 = self.addHost('vm4', ip="10.0.0.4", mac="00:00:00:00:00:04")
        vm5 = self.addHost('vm5', ip="10.0.0.11", mac="00:00:00:00:01:01")
        vm6 = self.addHost('vm6', ip="10.0.0.12", mac="00:00:00:00:01:02")
        vm7 = self.addHost('vm7', ip="10.0.0.13", mac="00:00:00:00:01:03")                
        vm8 = self.addHost('vm8', ip="10.0.0.14", mac="00:00:00:00:01:04")
        vmx = self.addHost('vmx', ip="10.0.0.128", mac="00:00:00:00:02:01")

        # Add links
        self.addLink(s1, s2, port1 = 5, port2 = 5)
        
        self.addLink(vm1, s1, port2 = 1)
        self.addLink(vm2, s1, port2 = 2)
        self.addLink(vm3, s1, port2 = 3)
        self.addLink(vm4, s1, port2 = 4)

        self.addLink(vm5, s2, port2 = 1)
        self.addLink(vm6, s2, port2 = 2)
        self.addLink(vm7, s2, port2 = 3)
        self.addLink(vm8, s2, port2 = 4)

        self.addLink(vmx, s1, port2 = 6)
    def __init__( self ):
        "Create custom topo."
        
        # Initialize topology
        Topo.__init__( self )
        
        # Add hosts and switches
        emissor1 = self.addHost( 'h1' )
        exibidor1000 = self.addHost( 'h2' )
	servidor = self.addHost( 'h3' )
	emissor2 = self.addHost( 'h4' )
        exibidor1001 = self.addHost( 'h5' )

        switch1 = self.addSwitch( 's1' )
	switch2 = self.addSwitch( 's2' )
	switch3 = self.addSwitch( 's3' )
	switch4 = self.addSwitch( 's4' )
        
        # Add links
        self.addLink(emissor1, switch1)
        self.addLink(exibidor1000, switch1)
        self.addLink(switch1, switch4)
        self.addLink(switch4, switch2)
        self.addLink(switch2, servidor)
        self.addLink(switch4, switch3)
        self.addLink(switch3, emissor2)
        self.addLink(exibidor1001, switch3)
  def __init__( self ):
    "Create custom topo."

    # Initialize topology
    Topo.__init__( self )

    # Add hosts and switches
    host1 = self.addHost( 'h1' )
    host2 = self.addHost( 'h2' )
    host3 = self.addHost( 'h3' )
    host4 = self.addHost( 'h4' )
    host5 = self.addHost( 'h5' )
    edge_switch1 = self.addSwitch( 'es1' )
    edge_switch2 = self.addSwitch( 'es2' )
    core_switch1 = self.addSwitch('cs1')
    core_switch2 = self.addSwitch('cs2')
    core_switch3 = self.addSwitch('cs3')

    # Add links
    self.addLink( host1, edge_switch1 )
    self.addLink( host2, edge_switch1 )
    self.addLink( edge_switch1, core_switch1 )
    self.addLink( core_switch1, core_switch2 )
    self.addLink( core_switch2, edge_switch2 )
    self.addLink( host3, edge_switch2 )
    self.addLink( core_switch3, core_switch2 )
    self.addLink( host4, core_switch3)
    self.addLink( host5, core_switch3)
    def __init__(self, n=2, **opts):
        Topo.__init__(self, **opts)
	# Add hosts and switches
	h1 = self.addHost('h1')
	h2 = self.addHost('h2')
	I1 = self.addSwitch('I1', dpid=toID('00:00:00:00:00:01'))
	s2 = self.addSwitch('s2', dpid=toID('00:00:00:00:00:02'))
	s3 = self.addSwitch('s3', dpid=toID('00:00:00:00:00:03'))
	s4 = self.addSwitch('s4', dpid=toID('00:00:00:00:00:04'))
	s5 = self.addSwitch('s5', dpid=toID('00:00:00:00:00:05'))
	s6 = self.addSwitch('s6', dpid=toID('00:00:00:00:00:06'))
	s7 = self.addSwitch('s7', dpid=toID('00:00:00:00:00:07'))
	s8 = self.addSwitch('s8', dpid=toID('00:00:00:00:00:09'))
	s9 = self.addSwitch('s9', dpid=toID('00:00:00:00:00:09'))
	E2 = self.addSwitch('E2', dpid=toID('00:00:00:00:00:10'))

	# links Add
	self.addLink(I1, h1)#, 2, 1, intfName1 = 'eth0-h1')
	self.addLink(E2, h2)#, 2, 1, intfName1 = 'eth0-h2')
	self.addLink(I1, s2)
	self.addLink(s2, s3)
	self.addLink(s3, s4)
	self.addLink(s4, s5)
	self.addLink(s5, s6)
	self.addLink(s6, s7)
	self.addLink(s7, s8)
	self.addLink(s8, s9)
	self.addLink(s9, E2)
Beispiel #23
0
    def __init__( self ):

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        Host1 = self.addHost( 'h1' )
        Host2 = self.addHost( 'h2' )
        Host3 = self.addHost( 'h3' )
        Host4 = self.addHost( 'h4' )
        Host5 = self.addHost( 'h5' )

	
        Switch1 = self.addSwitch( 's1' )
        Switch2 = self.addSwitch( 's2' )
        Switch3 = self.addSwitch( 's3' )

        # Add links
        self.addLink( Host1, Switch1 )
        self.addLink( Host2, Switch1 )
        self.addLink( Switch1, Switch2 )
        self.addLink( Switch2, Switch3 )
        self.addLink( Host3, Switch3 )
        self.addLink( Host4, Switch3 )
        self.addLink( Host5, Switch3 )
    def __init__(self):
        """Create custom topo."""

        # Initialize topology
        Topo.__init__(self)

        # Add hosts and switches
        host1 = self.addHost('h1', cls=VLANHost, vlan=200)
        host2 = self.addHost('h2', cls=VLANHost, vlan=300)
        host3 = self.addHost('h3', cls=VLANHost, vlan=200)
        host4 = self.addHost('h4', cls=VLANHost, vlan=300)
        host5 = self.addHost('h5', cls=VLANHost, vlan=200)
        host6 = self.addHost('h6', cls=VLANHost, vlan=300)

        s1 = self.addSwitch('s1')
        s2 = self.addSwitch('s2')
        s3 = self.addSwitch('s3')

        self.addLink(s1, s2)
        self.addLink(s2, host1)
        self.addLink(s2, host2)
        self.addLink(s2, host3)
        self.addLink(s1, s3)
        self.addLink(s3, host4)
        self.addLink(s3, host5)
        self.addLink(s3, host6)
Beispiel #25
0
    def __init__(self, **opts):
        # Initialize topology and default options
        Topo.__init__(self, **opts)
		# Add switch
        s1 = self.addSwitch('s1')
	s2 = self.addSwitch('s2')
        s31 = self.addSwitch('s31')
	s32 = self.addSwitch('s32')
        s4 = self.addSwitch('s4')
	s5 = self.addSwitch('s5')
	s6 = self.addSwitch('s6')
	s7 = self.addSwitch('s7')
        # Add hosts
        h1 = self.addHost('h1', mac='00:00:00:00:01:01', ip='10.0.1.1')
	h5 = self.addHost('h5', mac='00:00:00:00:05:01', ip='10.0.5.1')
        # Add link
        self.addLink(s1, h1)
	self.addLink(s5, h5)
	self.addLink(s1, s2)
	self.addLink(s2, s31)
	self.addLink(s2, s32)
	self.addLink(s31, s4)
	self.addLink(s32, s4)
	self.addLink(s4,s5)
	self.addLink(s5,s6)
	self.addLink(s4,s6)
	self.addLink(s5,s7)
	self.addLink(s7,s1)
    def __init__( self ):
        "Creating topology."
        Topo.__init__( self )

        
        h1 = self.addHost( 'h1' )
        h2 = self.addHost( 'h2' )
        h3 = self.addHost( 'h3' )
	h4 = self.addHost( 'h4' )
	h5 = self.addHost( 'h5' )
	h6 = self.addHost( 'h6' )
        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')        
        self.addLink(s1,h1,port1=1)
        self.addLink(s2,h2,port1=1)
        self.addLink(s3,h3,port1=1)
	self.addLink(s4,h4,port1=1)
	self.addLink(s5,h5,port1=1)
	self.addLink(s6,h6,port1=1)
	self.addLink(h1,s7,port1=1)
        self.addLink(s1,s2)
        self.addLink(s2,s3) 
	self.addLink(s3,s4)
	self.addLink(s4,s5)
	self.addLink(s5,s6)
        self.addLink(s6,s7)
Beispiel #27
0
    def __init__( self ):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        leftHost_1 = self.addHost( 'h1' )
     
	midHost_1 = self.addHost( 'h2' )
        midHost_2 = self.addHost( 'h3' )
	
        rightHost_1 = self.addHost( 'h4' )
	rightHost_2 = self.addHost( 'h5' )
	rightHost_3 = self.addHost( 'h6' )

        leftSwitch = self.addSwitch( 's1' )
        midSwitch = self.addSwitch( 's2' )
        rightSwitch = self.addSwitch( 's3' )

        # Add links
        self.addLink( leftHost_1, leftSwitch )
	
	self.addLink( midHost_1, midSwitch )
	self.addLink( midHost_2, midSwitch )
        
        self.addLink( rightHost_1, rightSwitch )
	self.addLink( rightHost_2, rightSwitch )
	self.addLink( rightHost_3, rightSwitch )
	self.addLink( leftSwitch, midSwitch )
	self.addLink( midSwitch, rightSwitch )
Beispiel #28
0
    def __init__( self ):
        """Create custom topo."""

        Topo.__init__( self )

        # Set Node IDs for hosts and switches

        # Add Nodes
        switches = [
                self.addSwitch('s1'),
                self.addSwitch('s2')
            ]
        hosts = [
                self.addHost('h3'),
                self.addHost('h4'),
                self.addHost('h5'),
                self.addHost('h6')
            ]

        # Add Edges
        edges = [   Edge(hosts[0],      switches[0]), 
                    Edge(hosts[1],      switches[0]), 
                    Edge(switches[0],   switches[1]), 
                    Edge(hosts[2],      switches[1]), 
                    Edge(hosts[3],      switches[1]) 
            ]

        for edge in edges:
            self.addLink( edge.left, edge.right )
 def __init__(self, n=2, **opts):
     # Initialize topology and default options
     Topo.__init__(self, **opts)
     switch = self.addSwitch('s1')
     for h in range(n):
         host = self.addHost('h%s' % (h + 1))
         self.addLink(host, switch)
Beispiel #30
0
    def __init__(self, conf_arq, workDir, **opts):
        Topo.__init__(self, **opts)

        global hosts_conf
        global links_conf
        hosts_conf = parse_hosts(conf_arq)
        switches_conf = parse_switches(conf_arq)
        links_conf = parse_links(conf_arq)

        self.isTCLink = False
        self.isLimited = False

        for host in hosts_conf:
            if host.cpu != None and self.isLimited != True:
                self.isLimited = True
            self.addHost(host.name, app=host.app, params=host.uri_tuples, cpu=host.cpu,cores=host.cores,cache=host.cache, workdir=workDir)

        for switch in switches_conf:
            self.addSwitch(switch.name)

        for link in links_conf:
            if len(link.linkDict) == 0:
                self.addLink(link.h1, link.h2)
            else:
                self.addLink(link.h1, link.h2, **link.linkDict)
                self.isTCLink = True

        info('Parse of ' + conf_arq + ' done.\n')
Beispiel #31
0
    def __init__(self, *args, **kwargs):
        global numHost101
        global numHost200
        numHost101 = 101
        numHost200 = 200

        Topo.__init__(self, *args, **kwargs)
        sw1 = self.addSwitch('sw1', dpid='00000000000000a1')
        sw2 = self.addSwitch('sw2', dpid='00000000000000a2')
        sw3 = self.addSwitch('sw3', dpid='00000000000000a3')
        sw4 = self.addSwitch('sw4', dpid='00000000000000a4')
        sw5 = self.addSwitch('sw5', dpid='00000000000000a5')
        sw6 = self.addSwitch('sw6', dpid='00000000000000a6')
        # add a switch for 100 quagga hosts
        sw100 = self.addSwitch('sw100', dpid='0000000000000100')
        swTestOn = self.addSwitch('swTestOn', dpid='0000000000000102')
        # Note this switch isn't part of the SDN topology
        # We'll use the ovs-controller to turn this into a learning switch
        as6sw = self.addSwitch('as6sw', dpid='00000000000000a7')

        host1 = self.addHost('host1')
        host2 = self.addHost('host2')
        root1 = self.addHost('root1', inNamespace=False, ip='0')
        root2 = self.addHost('root2', inNamespace=False, ip='0')
        rootTestOn = self.addHost('rootTestOn', inNamespace=False, ip='0')

        # AS2 host
        host3 = self.addHost('host3')
        as2host = self.addHost('as2host')
        # AS3 host
        host4 = self.addHost('host4')
        as3host = self.addHost('as3host')
        # AS4 host
        for i in range(numHost101, numHost200 + 1):
            self.addHost('host%s' % (i))
        '''as4host = self.addHost( 'as4host' )
        for i in range(numHost101, numHost200 + 1):
            self.addHost('as4host%s' %(i))
        '''
        # AS6 host
        as6rs = self.addHost('as6rs')
        host5 = self.addHost('host5')
        as6host = self.addHost('as6host')

        self.addLink(host1, sw1)
        self.addLink(host2, sw1)
        # Links to the multihomed AS
        self.addLink(host3, sw3)
        self.addLink(host3, sw5)
        self.addLink(as2host, host3)
        # Single links to the remaining two ASes
        self.addLink(host4, sw2)
        self.addLink(sw100, sw6)
        self.addLink(as3host, host4)
        for i in range(numHost101, numHost200 + 1):
            self.addLink('host%s' % (i), sw100)
        '''
        for i in range(numHost101, numHost200 + 1):
            self.addLink('host%s' % (i), 'as4host%s' % (i))
        '''
        # AS3-AS4 link
        # self.addLink( host4, host5)
        # Add new AS6 to its bridge
        self.addLink(as6rs, as6sw)
        self.addLink(host5, as6sw)
        self.addLink(as6host, host5)
        # test the host behind the router(behind the router server)
        '''
        for i in range(1, 10):
            host = self.addHost('as6host%d' % i)
            self.addLink(host, as6router)
        '''
        # Internal Connection To Hosts
        self.addLink(root1, host1)
        self.addLink(root2, host2)

        self.addLink(sw1, sw2)
        self.addLink(sw1, sw3)
        self.addLink(sw2, sw4)
        self.addLink(sw3, sw4)
        self.addLink(sw3, sw5)
        self.addLink(sw4, sw6)
        self.addLink(sw5, sw6)
        self.addLink(as6sw, sw4)

        self.addLink(swTestOn, rootTestOn)
        self.addLink(swTestOn, host3)
        self.addLink(swTestOn, host4)
        self.addLink(swTestOn, host5)
        self.addLink(swTestOn, as2host)

        for i in range(numHost101, numHost200 + 1):
            self.addLink(swTestOn, 'host' + str(i))
Beispiel #32
0
    def __init__(self):
        "Create custom topo."
		# Initialize topology
        Topo.__init__(self)
		# Add hosts and switches

        #h1 = self.addHost( 'h1', ip='192.168.1.0/28' )
        #h2 = self.addHost( 'h2', ip='192.168.1.16/28' )
        #h3 = self.addHost( 'h3', ip='192.168.1.32/28' )
        #h4 = self.addHost( 'h4', ip='192.168.1.48/28' )
        hosts = []
        ips = '/28'
        i = 0
        j = 0
        k = 1
        ipi = 1
        while i < 4:
            while j < 10:
                host = 'h'
                ip='192.168.1.'
                ip = ip + str(ipi) + ips
                hosts.append(self.addHost(host + str(k), ip=ip))
                ipi = ipi+1
                k = k+1
                j = j+1
            j = 0
            i = i+1
            if i == 1:
                ipi = 17
            if i == 2:
                ipi = 33
            if i == 3:
                ipi = 49

        #h5 = self.addHost( 'h5', ip='192.168.1.64/29' )
        #h6= self.addHost( 'h6', ip='192.168.1.72/29' )
        #h7 = self.addHost( 'h7', ip='192.168.1.80/29' )
        #h8 = self.addHost( 'h8', ip='192.168.1.88/29' )
        ips = '/29'
        i = 0
        j = 0
        ipi = 65
        while i < 4:
            while j < 6:
                host = 'h'
                ip='192.168.1.'
                ip = ip + str(ipi) + ips
                hosts.append(self.addHost(host + str(k), ip=ip))
                ipi = ipi+1
                k = k+1
                j = j+1
            j = 0
            i = i+1
            if i == 1:
                ipi = 73
            if i == 2:
                ipi = 81
            if i == 3:
                ipi = 89


        Switch_1 = self.addSwitch( 's1', ip='192.168.1.100/30')
        Switch_2 = self.addSwitch( 's2', ip='192.168.1.112/30')
        Switch_3 = self.addSwitch( 's3', ip='192.168.1.128/30')
        Switch_4 = self.addSwitch( 's4', ip='192.168.1.140/30')
        Switch_5 = self.addSwitch( 's5', ip='192.168.1.96/30')
        Switch_6 = self.addSwitch( 's6', ip='192.168.1.124/30')
        Switch_7 = self.addSwitch( 's7' )

		# Add links
        #self.addLink( h1, Switch_1 )
        #self.addLink( h2, Switch_1 )
        #self.addLink( h3, Switch_2 )
        #self.addLink( h4, Switch_2 )
        #self.addLink( h5, Switch_3 )
        #self.addLink( h6, Switch_3 )
        #self.addLink( h7, Switch_4 )
        #self.addLink( h8, Switch_4 )
        i = 0
        while i <= len(hosts):
            if i < 20:
                self.addLink( hosts[i], Switch_1 )
            if i > 19 and i <40:
                self.addLink( hosts[i], Switch_2 )
            if i > 39 and i <53:
                self.addLink( hosts[i], Switch_3 )
            if i > 52 and i <len(hosts):
                self.addLink( hosts[i], Switch_4 )
            i=i+1

        self.addLink( Switch_1, Switch_5 )
        self.addLink( Switch_2, Switch_5 )
        self.addLink( Switch_3, Switch_6 )
        self.addLink( Switch_4, Switch_6 )
        self.addLink( Switch_5, Switch_7 )
        self.addLink( Switch_6, Switch_7 )
Beispiel #33
0
    def __init__(self, *args, **kwargs):
        Topo.__init__(self, *args, **kwargs)

        # Spines
        s226 = self.addSwitch('s226', dpid='226')
        s227 = self.addSwitch('s227', dpid='227')

        # Leaves
        s203 = self.addSwitch('s203', dpid='203')
        s204 = self.addSwitch('s204', dpid='204')
        s205 = self.addSwitch('s205', dpid='205')
        s206 = self.addSwitch('s206', dpid='206')

        # Leaf-Spine Links
        self.addLink(s226, s203)
        self.addLink(s226, s203)
        self.addLink(s226, s204)
        self.addLink(s226, s204)
        self.addLink(s226, s205)
        self.addLink(s226, s205)
        self.addLink(s226, s206)
        self.addLink(s226, s206)
        self.addLink(s227, s203)
        self.addLink(s227, s203)
        self.addLink(s227, s204)
        self.addLink(s227, s204)
        self.addLink(s227, s205)
        self.addLink(s227, s205)
        self.addLink(s227, s206)
        self.addLink(s227, s206)

        # Leaf-Leaf Links
        self.addLink(s203, s204)
        self.addLink(s205, s206)

        # NOTE avoid using 10.0.1.0/24 which is the default subnet of quaggas
        # NOTE avoid using 00:00:00:00:00:xx which is the default mac of host behind upstream router
        # IPv4 Hosts
        h1 = self.addHost('h1', cls=DhcpClient, mac='00:aa:00:00:00:01')
        h2 = self.addHost('h2', cls=DhcpClient, mac='00:aa:00:00:00:02')
        h3 = self.addHost('h3', cls=DhcpClient, mac='00:aa:00:00:00:03')
        h4 = self.addHost('h4', cls=DhcpClient, mac='00:aa:00:00:00:04')
        h5 = self.addHost('h5', cls=DhcpClient, mac='00:aa:00:00:00:05')
        self.addLink(h1, s204)
        self.addLink(h2, s204)
        self.addLink(h3, s205)
        self.addLink(h4, s205)
        self.addLink(h5, s203)

        # IPv6 Hosts
        h1v6 = self.addHost('h1v6', cls=Dhcp6Client, mac='00:bb:00:00:00:01')
        h2v6 = self.addHost('h2v6', cls=Dhcp6Client, mac='00:bb:00:00:00:02')
        h3v6 = self.addHost('h3v6', cls=Dhcp6Client, mac='00:bb:00:00:00:03')
        h4v6 = self.addHost('h4v6', cls=Dhcp6Client, mac='00:bb:00:00:00:04')
        h5v6 = self.addHost('h5v6', cls=Dhcp6Client, mac='00:bb:00:00:00:05')
        self.addLink(h1v6, s204)
        self.addLink(h2v6, s204)
        self.addLink(h3v6, s205)
        self.addLink(h4v6, s205)
        self.addLink(h5v6, s203)

        # Dual-homed IPv4 and IPv6 Host on 203-204
        dh1 = self.addHost('dh1',
                           cls=DualHomedDhcp4and6Client,
                           mac='00:cc:00:00:00:01')
        self.addLink(dh1, s204)
        self.addLink(dh1, s203)

        # DHCP server
        dhcp = self.addHost('dhcp',
                            cls=DhcpServer,
                            mac='00:99:00:00:00:01',
                            ips=['10.0.3.253/24'],
                            gateway='10.0.3.254')

        # DHCPv6 server
        dhcp6 = self.addHost('dhcp6',
                             cls=Dhcp6Server,
                             mac='00:99:66:00:00:01',
                             ips=['2000::3fd/120'],
                             gateway='2000::3ff')

        # Dataplane L2 plane switch (for DHCP servers)
        cs1 = self.addSwitch('cs1', cls=OVSBridge, datapath='user')
        self.addLink(cs1, s205)
        self.addLink(dhcp, cs1)
        self.addLink(dhcp6, cs1)

        # Control plane switch (for quagga fpm)
        cs0 = self.addSwitch('cs0', cls=OVSBridge, datapath='user')

        # Control plane NAT (for quagga fpm)
        nat = self.addHost('nat',
                           cls=UserNAT,
                           ip='172.16.0.1/24',
                           subnet=str(ip_network(u'172.16.0.0/24')),
                           inNamespace=False)
        self.addLink(cs0, nat)

        # Internal Quagga bgp1
        """
        intfs = {'bgp1-eth0': [{'ipAddrs': ['10.0.1.2/24', '2000::102/120'], 'mac': '00:88:00:00:00:03', 'vlan': '110'},
                               {'ipAddrs': ['10.0.7.2/24', '2000::702/120'], 'mac': '00:88:00:00:00:03', 'vlan': '170'}],
                 'bgp1-eth1': {'ipAddrs': ['172.16.0.3/24']}}
        """
        intfs = {
            'bgp1-eth0': {
                'ipAddrs': ['10.0.1.2/24', '2000::102/120'],
                'mac': '00:88:00:00:00:03',
                'vlan': '110'
            },
            'bgp1-eth1': {
                'ipAddrs': ['172.16.0.3/24']
            }
        }
        bgp1 = self.addHost('bgp1',
                            cls=BgpRouter,
                            interfaces=intfs,
                            quaggaConfFile='./bgpdbgp1.conf',
                            zebraConfFile='./zebradbgp1.conf')
        self.addLink(bgp1, s205)
        self.addLink(bgp1, cs0)

        # Internal Quagga bgp2
        """
        intfs = {'bgp2-eth0': [{'ipAddrs': ['10.0.5.2/24', '2000::502/120'], 'mac': '00:88:00:00:00:04', 'vlan': '150'},
                               {'ipAddrs': ['10.0.6.2/24', '2000::602/120'], 'mac': '00:88:00:00:00:04', 'vlan': '160'}],
                 'bgp2-eth1': {'ipAddrs': ['172.16.0.4/24']}}
        """
        intfs = {
            'bgp2-eth0': {
                'ipAddrs': ['10.0.6.2/24', '2000::602/120'],
                'mac': '00:88:00:00:00:04',
                'vlan': '160'
            },
            'bgp2-eth1': {
                'ipAddrs': ['172.16.0.4/24']
            }
        }
        bgp2 = self.addHost('bgp2',
                            cls=BgpRouter,
                            interfaces=intfs,
                            quaggaConfFile='./bgpdbgp2.conf',
                            zebraConfFile='./zebradbgp2.conf')
        self.addLink(bgp2, s206)
        self.addLink(bgp2, cs0)

        # External Quagga r1
        intfs = {
            'r1-eth0': {
                'ipAddrs': ['10.0.1.1/24', '2000::101/120'],
                'mac': '00:88:00:00:00:01'
            },
            #'r1-eth1': {'ipAddrs': ['10.0.5.1/24', '2000::501/120'], 'mac': '00:88:00:00:00:11'},
            'r1-eth1': {
                'ipAddrs': ['10.0.99.1/16']
            },
            'r1-eth2': {
                'ipAddrs': ['2000::9901/120']
            },
            'r1-eth3': {
                'ipAddrs': ['2000::7701/120']
            }
        }
        r1 = self.addHost('r1',
                          cls=BgpRouter,
                          interfaces=intfs,
                          quaggaConfFile='./bgpdr1.conf')
        self.addLink(r1, s205)
        #self.addLink(r1, s206)

        # External IPv4 Host behind r1
        rh1 = self.addHost('rh1',
                           cls=RoutedHost,
                           ips=['10.0.99.2/24'],
                           gateway='10.0.99.1')
        self.addLink(r1, rh1)

        # External IPv6 Host behind r1
        rh1v6 = self.addHost('rh1v6',
                             cls=RoutedHost,
                             ips=['2000::9902/120'],
                             gateway='2000::9901')
        self.addLink(r1, rh1v6)

        # Another external IPv6 Host behind r1
        rh11v6 = self.addHost('rh11v6',
                              cls=RoutedHost,
                              ips=['2000::7702/120'],
                              gateway='2000::7701')
        self.addLink(r1, rh11v6)

        # External Quagga r2
        intfs = {
            'r2-eth0': {
                'ipAddrs': ['10.0.6.1/24', '2000::601/120'],
                'mac': '00:88:00:00:00:02'
            },
            #'r2-eth1': {'ipAddrs': ['10.0.7.1/24', '2000::701/120'], 'mac': '00:88:00:00:00:22'},
            'r2-eth1': {
                'ipAddrs': ['10.0.99.1/16']
            },
            'r2-eth2': {
                'ipAddrs': ['2000::9901/120']
            },
            'r2-eth3': {
                'ipAddrs': ['2000::8801/120']
            }
        }
        r2 = self.addHost('r2',
                          cls=BgpRouter,
                          interfaces=intfs,
                          quaggaConfFile='./bgpdr2.conf')
        self.addLink(r2, s206)
        #self.addLink(r2, s205)

        # External IPv4 Host behind r2
        rh2 = self.addHost('rh2',
                           cls=RoutedHost,
                           ips=['10.0.99.2/24'],
                           gateway='10.0.99.1')
        self.addLink(r2, rh2)

        # External IPv6 Host behind r2
        rh2v6 = self.addHost('rh126',
                             cls=RoutedHost,
                             ips=['2000::9902/120'],
                             gateway='2000::9901')
        self.addLink(r2, rh2v6)

        # Another external IPv6 Host behind r1
        rh22v6 = self.addHost('rh22v6',
                              cls=RoutedHost,
                              ips=['2000::8802/120'],
                              gateway='2000::8801')
        self.addLink(r2, rh22v6)

        # Dual-homed IPv4 Host for 205-206
        dh2 = self.addHost('dh2',
                           cls=DualHomedDhcpClient,
                           mac='00:cc:00:00:00:02')
        self.addLink(dh2, s205)
        self.addLink(dh2, s206)

        # ----- Secondary fabric -----

        # Spines(HAG)
        s246 = self.addSwitch('s246', dpid='246')
        s247 = self.addSwitch('s247', dpid='247')

        # Leaves(DAAS)
        s207 = self.addSwitch('s207', dpid='207')
        s208 = self.addSwitch('s208', dpid='208')

        # HAG-DAAS Links
        self.addLink(s246, s207)
        self.addLink(s246, s208)
        self.addLink(s247, s207)
        self.addLink(s247, s208)

        # HAG - Spine Links
        self.addLink(s246, s226)
        self.addLink(s247, s227)

        # IPv4 Hosts - RPDs
        rpd5 = self.addHost('rpd5', cls=DhcpClient, mac='00:dd:00:00:00:01')
        rpd6 = self.addHost('rpd6', cls=DhcpClient, mac='00:dd:00:00:00:02')
        self.addLink(rpd5, s207)
        self.addLink(rpd6, s208)

        # IPv6 Hosts - RPDs
        rpd5v6 = self.addHost('rpd5v6',
                              cls=Dhcp6Client,
                              mac='00:ee:00:00:00:01')
        rpd6v6 = self.addHost('rpd6v6',
                              cls=Dhcp6Client,
                              mac='00:ee:00:00:00:02')
        self.addLink(rpd5v6, s207)
        self.addLink(rpd6v6, s208)
Beispiel #34
0
    def __init__(self):
        # Initialize topology
        Topo.__init__(self)
        # Switch S5 Hosts
        # IPv4 only Host
        host1 = self.addHost('h1', ip='10.1.0.2/24')
        # IPv6 only Host
        host2 = self.addHost('h2', cls=IPv6Host, v6Addr='1000::2/64')
        # Dual Stack Host
        host3 = self.addHost('h3',
                             ip='10.1.0.3/24',
                             cls=dualStackHost,
                             v6Addr='2000::2/64')
        # VLAN hosts
        host4 = self.addHost('h4',
                             ip='100.1.0.2/24',
                             cls=VLANHost,
                             vlan=100,
                             v6Addr='3000::2/64')
        host5 = self.addHost('h5',
                             ip='200.1.0.2/24',
                             cls=VLANHost,
                             vlan=200,
                             v6Addr='4000::2/64')
        # VPN-1 and VPN-2 Hosts
        host6 = self.addHost('h6', ip='11.1.0.2/24')
        host7 = self.addHost('h7', ip='12.1.0.2/24')
        # Multicast Sender
        host8 = self.addHost('h8', ip='10.1.0.4/24')

        # Switch S6 Hosts
        # IPv4 only Host
        host9 = self.addHost('h9', ip='10.1.0.5/24')
        # IPv6 only Host
        host10 = self.addHost('h10', cls=IPv6Host, v6Addr='1000::3/64')
        # Dual Stack Host
        host11 = self.addHost('h11',
                              ip='10.1.0.6/24',
                              cls=dualStackHost,
                              v6Addr='2000::3/64')
        # VLAN hosts
        host12 = self.addHost('h12',
                              ip='100.1.0.3/24',
                              cls=VLANHost,
                              vlan=100,
                              v6Addr='3000::3/64')
        host13 = self.addHost('h13',
                              ip='200.1.0.3/24',
                              cls=VLANHost,
                              vlan=200,
                              v6Addr='4000::3/64')
        # VPN-1 and VPN-2 Hosts
        host14 = self.addHost('h14', ip='11.1.0.3/24')
        host15 = self.addHost('h15', ip='12.1.0.3/24')
        # Multicast Receiver
        host16 = self.addHost('h16', ip='10.1.0.7/24')

        # Switch S7 Hosts
        # IPv4 only Host
        host17 = self.addHost('h17', ip='10.1.0.8/24')
        # IPv6 only Host
        host18 = self.addHost('h18', cls=IPv6Host, v6Addr='1000::4/64')
        # Dual Stack Host
        host19 = self.addHost('h19',
                              ip='10.1.0.9/24',
                              cls=dualStackHost,
                              v6Addr='2000::4/64')
        # VLAN hosts
        host20 = self.addHost('h20',
                              ip='100.1.0.4/24',
                              cls=VLANHost,
                              vlan=100,
                              v6Addr='3000::4/64')
        host21 = self.addHost('h21',
                              ip='200.1.0.4/24',
                              cls=VLANHost,
                              vlan=200,
                              v6Addr='4000::4/64')
        # VPN-1 and VPN-2 Hosts
        host22 = self.addHost('h22', ip='11.1.0.4/24')
        host23 = self.addHost('h23', ip='12.1.0.4/24')
        # Multicast Receiver
        host24 = self.addHost('h24', ip='10.1.0.10/24')

        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')

        self.addLink(s5, host1)
        self.addLink(s5, host2)
        self.addLink(s5, host3)
        self.addLink(s5, host4)
        self.addLink(s5, host5)
        self.addLink(s5, host6)
        self.addLink(s5, host7)
        self.addLink(s5, host8)

        self.addLink(s6, host9)
        self.addLink(s6, host10)
        self.addLink(s6, host11)
        self.addLink(s6, host12)
        self.addLink(s6, host13)
        self.addLink(s6, host14)
        self.addLink(s6, host15)
        self.addLink(s6, host16)

        self.addLink(s7, host17)
        self.addLink(s7, host18)
        self.addLink(s7, host19)
        self.addLink(s7, host20)
        self.addLink(s7, host21)
        self.addLink(s7, host22)
        self.addLink(s7, host23)
        self.addLink(s7, host24)

        self.addLink(s1, s2)
        self.addLink(s1, s3)
        self.addLink(s1, s4)
        self.addLink(s1, s5)
        self.addLink(s2, s3)
        self.addLink(s2, s5)
        self.addLink(s2, s6)
        self.addLink(s3, s4)
        self.addLink(s3, s6)
        self.addLink(s4, s7)
        topos = {'mytopo': (lambda: MyTopo())}
  def __init__(self):
    Topo.__init__(self)
    
    self.host = {}
    for h in range(1,231):
      self.host[h] = self.addHost('h%s' %(h))

    self.switch = {}
    for s in range(1,12):
      self.switch[s] = self.addSwitch('s%s' %(s))
    
    # S1-links to hosts
    for i in range(1,11):
      self.addLink(self.switch[1], self.host[i], cls=TCLink, bw=100)
    
    # S1-links to switches
    self.addLink(self.switch[1], self.switch[2], cls=TCLink, bw=100)
    self.addLink(self.switch[1], self.switch[3], cls=TCLink, bw=100)
    self.addLink(self.switch[1], self.switch[7], cls=TCLink, bw=100)
    self.addLink(self.switch[1], self.switch[11], cls=TCLink, bw=100)
    
    # S2-links to hosts
    for i in range(11,51):   
      self.addLink(self.switch[2], self.host[i], cls=TCLink, bw=100)
   
    # S3-links to hosts
    for i in range(51,71):
      self.addLink(self.switch[3], self.host[i], cls=TCLink, bw=100)

    # S3-links to switches
    self.addLink(self.switch[3], self.switch[4], cls=TCLink, bw=100)
    self.addLink(self.switch[3], self.switch[5], cls=TCLink, bw=100)

    # S4-links to hosts
    for i in range(71,81):
      self.addLink(self.switch[4], self.host[i], cls=TCLink, bw=100)

    # S5-links to hosts
    for i in range(81,111):
      self.addLink(self.switch[5], self.host[i], cls=TCLink, bw=100)
 
    # S6-links to hosts
    for i in range(111,121):
      self.addLink(self.switch[6], self.host[i], cls=TCLink, bw=100)
  
    # S6-links to switches
    self.addLink(self.switch[6], self.switch[7], cls=TCLink, bw=100)

    # S7-links to hosts
    for i in range(121,141):
      self.addLink(self.switch[7], self.host[i], cls=TCLink, bw=100)
 
    # S7-links to switches
    self.addLink(self.switch[7], self.switch[8], cls=TCLink, bw=100)
    self.addLink(self.switch[7], self.switch[9], cls=TCLink, bw=100)

    # S8-links to hosts
    for i in range(141,151):
      self.addLink(self.switch[8], self.host[i], cls=TCLink, bw=100)

    # S9-links to hosts
    for i in range(151,171):
      self.addLink(self.switch[9], self.host[i], cls=TCLink, bw=100)
   
    # S10-links to hosts
    for i in range(171,211):
      self.addLink(self.switch[10], self.host[i], cls=TCLink, bw=100)

    # S11-links to hosts
    for i in range(211,231):
      self.addLink(self.switch[11], self.host[i], cls=TCLink, bw=100)
    
    # S11-links to switches
    self.addLink(self.switch[11], self.switch[10], cls=TCLink, bw=100)
    def __init__(self):

        Topo.__init__(self)
        s = 's'
        fourfirstbits = []

        for x in map(''.join, itertools.product('01', repeat=8)):
            fourfirstbits.append(x)
        # Switchesh13= self.addHost( 'h13' )
        allrouters = []
        allrouters.append(2)

        j = 1
        while j < 32:
            s = 's%s' % (j)
            allrouters.append('s%s' % (j))
            vars()[s] = self.addSwitch('s%s' % (j))
            j = j + 1

        ins = open(os.getcwd() + "/netrocketbig", "r")
        array = []
        for line in ins:

            line2 = line.split(' ')

            temp = []
            temp2 = []
            fromr = line2[0]
            tor = line2[1]
            temp.append(fromr)
            temp.append(tor)
            temp2.append(tor)
            temp2.append(fromr)

            if (temp2 not in array):
                array.append(temp)

        ins.close()

        for l in array:
            #print "l",l
            #print "l[0]",l[0]
            self.addLink(allrouters[int(l[0])], allrouters[int(l[1])])

            #numberofHosts=100
        numberofHostsPerRouter = 11
        # Initialize topology
        counter = 1
        #switches=[1,2,3,4,5,7,8,9,10,12,13,14,15]
        k = 32
        hostscounter = 1
        j = 0
        while counter < k:

            i = 1
            fourflastbits = []
            for x1 in map(''.join, itertools.product('01', repeat=8)):
                fourflastbits.append(x1)
            while i < numberofHostsPerRouter:

                self.addLink(
                    self.addHost(
                        'h%s' % (hostscounter),
                        ip='10.0.' + format(int(format(fourfirstbits[j]), 2)) +
                        '.' + format(int(format(fourflastbits[i]), 2))),
                    's' + str(counter))
                i = i + 1
                hostscounter = hostscounter + 1
            j = j + 1
            counter = counter + 1
Beispiel #37
0
    def __init__(self, hosts, switches, external, links, log_dir, **opts):
        Topo.__init__(self, **opts)
        self.sw_port_mapping = {}

        for sw_name, sw in switches.items():
            dpid = self.__int_to_dpid(sw['id'])
            self.addSwitch(sw['name'], dpid=dpid,
                           log_file="%s/%s.log" % (log_dir, sw))

        for link in links:
            np = link.get('north_facing_port')
            sp = link.get('south_facing_port')

            # Two switches
            if np and sp:
                s_switch = switches.get(link.get('south_node'))
                n_switch = switches.get(link.get('north_node'))

                self.addLink(s_switch['name'], n_switch['name'],
                             delay=link['latency'], bw=link['bandwidth'],
                             addr1=s_switch['mac'],
                             addr2=n_switch['mac'])
                self.__add_switch_port(s_switch['name'],
                                       n_switch['name'],
                                       link['north_facing_port'])
                self.__add_switch_port(n_switch['name'],
                                       s_switch['name'],
                                       link['south_facing_port'])
                logger.info('Adding Switch Link %s %s port:%d <--> port:%d' % (
                    link['south_node'], link['north_node'],
                    link['north_facing_port'], link['south_facing_port']))

            # South switch has a north facing port
            elif np:
                s_switch = switches.get(link.get('south_node'))
                n_host = hosts.get(link.get('north_node'))
                if n_host is None:
                    n_host = external.get(link.get('north_node'))
                # ignore externals
                if n_host is not None:
                    self.addHost(n_host['name'],
                                 ip=n_host['ip'] + '/24',
                                 mac=n_host['mac'])
                    self.addLink(n_host['name'], s_switch['name'],
                                 delay=link['latency'], bw=link['bandwidth'],
                                 addr1=n_host['mac'],
                                 addr2=s_switch['mac'])
                    self.__add_switch_port(s_switch['name'],
                                           n_host['name'], np)
                    logger.info(
                        "Adding host %s link %s %s to switch %s %s on port %s",
                        n_host.get('name'), n_host.get('ip'),
                        n_host.get('mac'), s_switch.get('name'),
                        s_switch.get('mac'), np)
            # North switch has a south facing port to the host
            elif sp is not None:
                n_switch = switches.get(link.get('north_node'))
                s_host = hosts.get(link.get('south_node'))

                # ignore externals
                if s_host is not None:
                    self.addHost(s_host['name'],
                                 ip=s_host['ip'] + '/30',
                                 mac=s_host['mac'])
                    if link.get('south_facing_mac'):
                        self.addLink(s_host['name'], n_switch['name'],
                                     delay=link['latency'], bw=link['bandwidth'],
                                     addr1=s_host['mac'],
                                     addr2=link.get('south_facing_mac'))
                        self.__add_switch_port(n_switch['name'],
                                               s_host['name'], sp)
                        logger.info("Adding host %s link %s %s to switch %s %s on "
                                    "port %d",
                                    s_host.get('name'), s_host.get('ip'),
                                    s_host.get('mac'), n_switch.get('name'),
                                    link.get('south_facing_port'), sp,)
                    else:
                        self.addLink(s_host['name'], n_switch['name'],
                                     delay=link['latency'], bw=link['bandwidth'],
                                     addr1=s_host['mac'],
                                     addr2=n_switch['mac'])
                        self.__add_switch_port(n_switch['name'],
                                               s_host['name'], sp)
                        logger.info("Adding host %s link %s %s to switch %s %s on "
                                    "port %d",
                                    s_host.get('name'), s_host.get('ip'),
                                    s_host.get('mac'), n_switch.get('name'),
                                    n_switch['mac'], sp,)
            else:
                logger.info('Error in link.  At least one port must be '
                            'defined %s', link)

            self.__print_port_mapping()
Beispiel #38
0
    def __init__(self):
        "Create custom topo."

        # Initialize topology
        Topo.__init__(self)

        self.bw_c2ag = 100
        self.bw_ag2ac = 10
        self.bw_ac2h = 1

        # Add core switches
        logger.debug("Add Core")
        for i in range(1, 3):
            self.CoreSwitches.append(self.addSwitch('c{}'.format(i)))

# Add aggregate and access switches
        logger.debug("Add Aggregate and Access")
        for i in range(1, 11):
            self.AggregateSwitches.append(self.addSwitch('ag{}'.format(i)))
            self.AccessSwitches.append(self.addSwitch('ac{}'.format(i)))

# Add hosts
        logger.debug("Add Host")
        for i in range(1, 101):
            #self.Hosts.append(self.addHost( 'h{}'.format(i), ip="10.0.{}.100/24".format(i), defaultRoute = "via 10.0.1.1" ))
            self.Hosts.append(self.addHost('h{}'.format(i)))

        logger.debug("Finished topology creation!")

        # Add links core <-> aggregate
        logger.debug("Add link: Core <--> Aggregate")
        #linkopts = dict(bw=self.bw_c2ag)
        linkopts1 = {'bw': 50, 'delay': '5ms'}
        #for k in range(0,5):
        self.addLink(self.CoreSwitches[0], self.CoreSwitches[1], **linkopts1)
        self.addLink(self.CoreSwitches[0], self.AggregateSwitches[0],
                     **linkopts1)
        self.addLink(self.CoreSwitches[1], self.AggregateSwitches[1],
                     **linkopts1)
        self.addLink(self.CoreSwitches[0], self.AggregateSwitches[2],
                     **linkopts1)
        self.addLink(self.CoreSwitches[1], self.AggregateSwitches[3],
                     **linkopts1)
        self.addLink(self.CoreSwitches[0], self.AggregateSwitches[4],
                     **linkopts1)
        self.addLink(self.CoreSwitches[1], self.AggregateSwitches[5],
                     **linkopts1)
        self.addLink(self.CoreSwitches[0], self.AggregateSwitches[6],
                     **linkopts1)
        self.addLink(self.CoreSwitches[1], self.AggregateSwitches[7],
                     **linkopts1)
        self.addLink(self.CoreSwitches[0], self.AggregateSwitches[8],
                     **linkopts1)
        self.addLink(self.CoreSwitches[1], self.AggregateSwitches[9],
                     **linkopts1)

        #self.addLink( self.CoreSwitches[1], self.AggregateSwitches[k*2+1], **linkopts )

        # Add links aggregate <-> access
        logger.debug("Add link: Aggregate <--> Access")
        #linkopts = dict(bw=self.bw_ag2ac)
        linkopts2 = {'bw': 30, 'delay': '10ms'}
        #for k in range(0,10):
        #if(k % 2 == 0):
        self.addLink(self.AggregateSwitches[0], self.AccessSwitches[0],
                     **linkopts2)
        #self.addLink( self.AggregateSwitches[0], self.AccessSwitches[1], **linkopts2 )
        self.addLink(self.AggregateSwitches[1], self.AccessSwitches[1],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[2], self.AccessSwitches[2],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[3], self.AccessSwitches[3],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[4], self.AccessSwitches[4],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[5], self.AccessSwitches[5],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[6], self.AccessSwitches[6],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[7], self.AccessSwitches[7],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[8], self.AccessSwitches[8],
                     **linkopts2)
        self.addLink(self.AggregateSwitches[9], self.AccessSwitches[9],
                     **linkopts2)
        #else:
        #self.addLink( self.AggregateSwitches[1], self.AccessSwitches[0], **linkopts2 )
        #self.addLink( self.AggregateSwitches[1], self.AccessSwitches[1], **linkopts2 )

        # Add links access <-> hosts
        #import pdb; pdb.set_trace()
        logger.debug("Add link: Access <--> Host")
        #linkopts = dict(bw=self.bw_ac2h)
        linkopts = {'bw': 10, 'delay': '15ms'}
        # for k in range(0,100):
        #     tensPlace = int(floor(k/10))
        #     onesPlace = k%10
        self.addLink(self.AccessSwitches[0], self.Hosts[0], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[1], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[2], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[3], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[4], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[5], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[6], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[7], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[8], **linkopts)
        self.addLink(self.AccessSwitches[0], self.Hosts[9], **linkopts)

        self.addLink(self.AccessSwitches[1], self.Hosts[10], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[11], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[12], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[13], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[14], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[15], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[16], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[17], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[18], **linkopts)
        self.addLink(self.AccessSwitches[1], self.Hosts[19], **linkopts)

        self.addLink(self.AccessSwitches[2], self.Hosts[20], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[21], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[22], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[23], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[24], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[25], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[26], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[27], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[28], **linkopts)
        self.addLink(self.AccessSwitches[2], self.Hosts[29], **linkopts)

        self.addLink(self.AccessSwitches[3], self.Hosts[30], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[31], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[32], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[33], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[34], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[35], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[36], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[37], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[38], **linkopts)
        self.addLink(self.AccessSwitches[3], self.Hosts[39], **linkopts)

        self.addLink(self.AccessSwitches[4], self.Hosts[40], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[41], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[42], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[43], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[44], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[45], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[46], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[47], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[48], **linkopts)
        self.addLink(self.AccessSwitches[4], self.Hosts[49], **linkopts)

        self.addLink(self.AccessSwitches[5], self.Hosts[50], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[51], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[52], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[53], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[54], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[55], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[56], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[57], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[58], **linkopts)
        self.addLink(self.AccessSwitches[5], self.Hosts[59], **linkopts)

        self.addLink(self.AccessSwitches[6], self.Hosts[60], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[61], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[62], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[63], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[64], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[65], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[66], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[67], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[68], **linkopts)
        self.addLink(self.AccessSwitches[6], self.Hosts[69], **linkopts)

        self.addLink(self.AccessSwitches[7], self.Hosts[70], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[71], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[72], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[73], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[74], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[75], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[76], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[77], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[78], **linkopts)
        self.addLink(self.AccessSwitches[7], self.Hosts[79], **linkopts)

        self.addLink(self.AccessSwitches[8], self.Hosts[80], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[81], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[82], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[83], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[84], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[85], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[86], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[87], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[88], **linkopts)
        self.addLink(self.AccessSwitches[8], self.Hosts[89], **linkopts)

        self.addLink(self.AccessSwitches[9], self.Hosts[90], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[91], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[92], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[93], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[94], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[95], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[96], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[97], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[98], **linkopts)
        self.addLink(self.AccessSwitches[9], self.Hosts[99], **linkopts)

        logger.debug("Finished adding links!")
Beispiel #39
0
    def __init__(self):
        Topo.__init__(self)

        # Hosts
        h0 = self.addHost('h0',
                          ips=['10.0.1.2/24'],
                          gw='10.0.1.1',
                          cls=RAUHost)
        h1 = self.addHost('h1',
                          ips=['10.1.1.2/24'],
                          gw='10.1.1.1',
                          cls=RAUHost)
        h2 = self.addHost('h2',
                          ips=['10.2.1.2/24'],
                          gw='10.2.1.1',
                          cls=RAUHost)
        h3 = self.addHost('h3',
                          ips=['10.3.1.2/24'],
                          gw='10.3.1.1',
                          cls=RAUHost)
        h4 = self.addHost('h4',
                          ips=['10.4.1.2/24'],
                          gw='10.4.1.1',
                          cls=RAUHost)
        h5 = self.addHost('h5',
                          ips=['10.5.1.2/24'],
                          gw='10.5.1.1',
                          cls=RAUHost)
        h6 = self.addHost('h6',
                          ips=['10.6.1.2/24'],
                          gw='10.6.1.1',
                          cls=RAUHost)
        h7 = self.addHost('h7',
                          ips=['10.7.1.2/24'],
                          gw='10.7.1.1',
                          cls=RAUHost)
        h8 = self.addHost('h8',
                          ips=['10.8.1.2/24'],
                          gw='10.8.1.1',
                          cls=RAUHost)
        h9 = self.addHost('h9',
                          ips=['10.9.1.2/24'],
                          gw='10.9.1.1',
                          cls=RAUHost)

        routerLan1 = self.addHost('routerLan1',
                                  ips=['10.0.0.1/24', '10.0.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:01',
                                  gw='10.0.0.2',
                                  cls=QuaggaRouter)

        routerLan2 = self.addHost('routerLan2',
                                  ips=['10.1.0.1/24', '10.1.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:02',
                                  gw='10.1.0.2',
                                  cls=QuaggaRouter)

        routerLan3 = self.addHost('routerLan3',
                                  ips=['10.50.0.1/24', '10.2.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:03',
                                  gw='10.50.0.2',
                                  cls=QuaggaRouter)

        routerLan4 = self.addHost('routerLan4',
                                  ips=['10.50.1.1/24', '10.3.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:04',
                                  gw='10.50.1.2',
                                  cls=QuaggaRouter)

        routerLan5 = self.addHost('routerLan5',
                                  ips=['10.50.2.1/24', '10.4.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:05',
                                  gw='10.50.2.2',
                                  cls=QuaggaRouter)

        routerLan6 = self.addHost('routerLan6',
                                  ips=['10.50.3.1/24', '10.5.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:06',
                                  gw='10.50.3.2',
                                  cls=QuaggaRouter)

        routerLan7 = self.addHost('routerLan7',
                                  ips=['10.50.4.1/24', '10.6.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:07',
                                  gw='10.50.4.2',
                                  cls=QuaggaRouter)

        routerLan8 = self.addHost('routerLan8',
                                  ips=['10.50.5.1/24', '10.7.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:08',
                                  gw='10.50.5.2',
                                  cls=QuaggaRouter)

        routerLan9 = self.addHost(
            'routerLan9',
            ips=['10.50.6.1/24', '10.8.1.1/24', '10.9.1.1/24'],
            ce_mac_address='00:00:00:00:00:09',
            gw='10.50.6.2',
            cls=QuaggaRouter)

        switch1 = self.addHost('switch1',
                               ips=['192.168.1.11/24', '10.10.1.1/24'],
                               dpid='0000000000000101',
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch2 = self.addHost(
            'switch2',
            ips=['192.168.1.12/24', '10.10.1.2/24', '10.10.2.1/24'],
            dpid='0000000000000102',
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch3 = self.addHost('switch3',
                               ips=[
                                   '192.168.1.13/24', '10.10.3.1/24',
                                   '10.10.8.1/24', '10.10.9.1/24'
                               ],
                               dpid='0000000000000103',
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch4 = self.addHost('switch4',
                               ips=[
                                   '192.168.1.14/24', '10.10.2.2/24',
                                   '10.10.3.2/24', '10.10.4.1/24',
                                   '10.10.6.1/24'
                               ],
                               dpid='0000000000000104',
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch5 = self.addHost(
            'switch5',
            ips=['192.168.1.15/24', '10.10.4.2/24', '10.10.5.1/24'],
            dpid='0000000000000105',
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch6 = self.addHost('switch6',
                               ips=[
                                   '192.168.1.16/24', '10.10.5.2/24',
                                   '10.10.7.1/24', '10.47.47.1/24'
                               ],
                               dpid='0000000000000106',
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch7 = self.addHost('switch7',
                               ips=[
                                   '192.168.1.17/24', '10.10.6.2/24',
                                   '10.10.7.2/24', '10.10.25.1/24'
                               ],
                               dpid='0000000000000107',
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch8 = self.addHost('switch8',
                               ips=[
                                   '192.168.1.18/24', '10.10.8.2/24',
                                   '10.10.10.1/24', '10.10.14.1/24'
                               ],
                               dpid='0000000000000108',
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch9 = self.addHost('switch9',
                               ips=[
                                   '192.168.1.19/24', '10.10.10.2/24',
                                   '10.10.11.1/24', '10.49.49.1/24'
                               ],
                               dpid='0000000000000109',
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch10 = self.addHost(
            'switch10',
            ips=['192.168.1.20/24', '10.10.11.2/24', '10.10.12.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch11 = self.addHost('switch11',
                                ips=[
                                    '192.168.1.21/24', '10.10.12.2/24',
                                    '10.10.13.1/24', '10.88.88.1/24',
                                    '10.48.48.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch12 = self.addHost(
            'switch12',
            ips=['192.168.1.22/24', '10.10.19.2/24', '10.88.88.2/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch13 = self.addHost('switch13',
                                ips=[
                                    '192.168.1.23/24', '10.10.14.2/24',
                                    '10.10.13.2/24', '10.10.19.1/24',
                                    '10.10.20.1/24', '10.10.18.1/24',
                                    '10.10.21.1/24', '10.1.0.2/24'
                                ],
                                dpid='0000000000000002',
                                controller_ip="192.168.1.10",
                                border=1,
                                ce_ip_address='10.1.0.1',
                                ce_mac_address='00:00:00:00:00:02',
                                cls=RAUSwitch)

        switch14 = self.addHost('switch14',
                                ips=['192.168.1.24/24', '10.10.20.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch15 = self.addHost(
            'switch15',
            ips=['192.168.1.25/24', '10.10.18.2/24', '10.10.17.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch16 = self.addHost('switch16',
                                ips=[
                                    '192.168.1.26/24', '10.10.9.2/24',
                                    '10.10.17.2/24', '10.10.15.1/24',
                                    '10.10.16.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch17 = self.addHost('switch17',
                                ips=['192.168.1.27/24', '10.10.15.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch18 = self.addHost(
            'switch18',
            ips=['192.168.1.28/24', '10.10.16.2/24', '10.10.22.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch19 = self.addHost(
            'switch19',
            ips=['192.168.1.29/24', '10.10.21.2/24', '10.10.23.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch20 = self.addHost(
            'switch20',
            ips=['192.168.1.30/24', '10.10.22.2/24', '10.10.24.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch21 = self.addHost('switch21',
                                ips=[
                                    '192.168.1.31/24', '10.10.23.2/24',
                                    '10.10.24.2/24', '10.10.29.1/24',
                                    '10.10.31.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch22 = self.addHost('switch22',
                                ips=[
                                    '192.168.1.32/24', '10.10.29.2/24',
                                    '10.10.26.1/24', '10.10.30.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch23 = self.addHost(
            'switch23',
            ips=['192.168.1.33/24', '10.10.26.2/24', '10.10.27.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch24 = self.addHost(
            'switch24',
            ips=['192.168.1.34/24', '10.10.27.2/24', '10.10.28.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch25 = self.addHost(
            'switch25',
            ips=['192.168.1.35/24', '10.10.31.2/24', '10.10.32.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch26 = self.addHost('switch26',
                                ips=[
                                    '192.168.1.36/24', '10.10.32.2/24',
                                    '10.10.33.1/24', '10.50.50.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch27 = self.addHost('switch27',
                                ips=[
                                    '192.168.1.37/24', '10.10.30.2/24',
                                    '10.10.33.2/24', '10.10.34.1/24',
                                    '10.10.35.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch28 = self.addHost(
            'switch28',
            ips=['192.168.1.38/24', '10.10.34.2/24', '10.10.36.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch29 = self.addHost('switch29',
                                ips=[
                                    '192.168.1.39/24', '10.10.25.2/24',
                                    '10.10.28.2/24', '10.10.37.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch30 = self.addHost(
            'switch30',
            ips=['192.168.1.40/24', '10.10.35.2/24', '10.10.39.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch31 = self.addHost('switch31',
                                ips=[
                                    '192.168.1.41/24', '10.10.36.2/24',
                                    '10.10.37.2/24', '10.10.38.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch32 = self.addHost('switch32',
                                ips=[
                                    '192.168.1.42/24', '10.10.39.2/24',
                                    '10.10.38.2/24', '10.10.41.1/24',
                                    '10.10.40.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch33 = self.addHost(
            'switch33',
            ips=['192.168.1.43/24', '10.10.41.2/24', '10.10.42.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch34 = self.addHost('switch34',
                                ips=[
                                    '192.168.1.44/24', '10.10.40.2/24',
                                    '10.10.42.2/24', '10.10.43.1/24',
                                    '10.10.45.1/24', '10.10.44.1/24',
                                    '10.51.51.1/24', '10.52.52.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch35 = self.addHost(
            'switch35',
            ips=['192.168.1.45/24', '10.10.43.2/24', '10.10.46.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch36 = self.addHost(
            'switch36',
            ips=['192.168.1.46/24', '10.10.46.2/24', '10.10.47.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch37 = self.addHost(
            'switch37',
            ips=['192.168.1.47/24', '10.10.47.2/24', '10.10.48.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch38 = self.addHost(
            'switch38',
            ips=['192.168.1.48/24', '10.10.48.2/24', '10.0.0.2/24'],
            dpid='0000000000000001',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.0.0.1',
            ce_mac_address='00:00:00:00:00:01',
            cls=RAUSwitch)

        switch39 = self.addHost(
            'switch39',
            ips=['192.168.1.49/24', '10.10.45.2/24', '10.10.49.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch40 = self.addHost('switch40',
                                ips=[
                                    '192.168.1.50/24', '10.10.49.2/24',
                                    '10.10.50.1/24', '10.10.51.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch41 = self.addHost('switch41',
                                ips=[
                                    '192.168.1.51/24', '10.10.44.2/24',
                                    '10.10.50.2/24', '10.10.53.1/24',
                                    '10.10.52.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch42 = self.addHost(
            'switch42',
            ips=['192.168.1.52/24', '10.10.53.2/24', '10.10.54.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch43 = self.addHost('switch43',
                                ips=[
                                    '192.168.1.53/24', '10.10.52.2/24',
                                    '10.10.54.2/24', '10.10.55.1/24',
                                    '10.10.56.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch44 = self.addHost('switch44',
                                ips=[
                                    '192.168.1.54/24', '10.10.51.2/24',
                                    '10.10.55.2/24', '10.10.57.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch45 = self.addHost('switch45',
                                ips=[
                                    '192.168.1.55/24', '10.10.56.2/24',
                                    '10.10.57.2/24', '10.24.48.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch46 = self.addHost(
            'switch46',
            ips=['192.168.1.56/24', '10.24.48.2/24', '10.50.0.2/24'],
            dpid='0000000000000003',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.50.0.1',
            ce_mac_address='00:00:00:00:00:03',
            cls=RAUSwitch)

        switch47 = self.addHost(
            'switch47',
            ips=['192.168.1.57/24', '10.47.47.2/24', '10.50.1.2/24'],
            dpid='0000000000000004',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.50.1.1',
            ce_mac_address='00:00:00:00:00:04',
            cls=RAUSwitch)

        switch48 = self.addHost(
            'switch48',
            ips=['192.168.1.58/24', '10.48.48.2/24', '10.50.2.2/24'],
            dpid='0000000000000005',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.50.2.1',
            ce_mac_address='00:00:00:00:00:05',
            cls=RAUSwitch)

        switch49 = self.addHost(
            'switch49',
            ips=['192.168.1.59/24', '10.49.49.2/24', '10.50.3.2/24'],
            dpid='0000000000000006',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.50.3.1',
            ce_mac_address='00:00:00:00:00:06',
            cls=RAUSwitch)

        switch50 = self.addHost(
            'switch50',
            ips=['192.168.1.60/24', '10.50.50.2/24', '10.50.4.2/24'],
            dpid='0000000000000007',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.50.4.1',
            ce_mac_address='00:00:00:00:00:07',
            cls=RAUSwitch)

        switch51 = self.addHost(
            'switch51',
            ips=['192.168.1.61/24', '10.51.51.2/24', '10.50.5.2/24'],
            dpid='0000000000000008',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.50.5.1',
            ce_mac_address='00:00:00:00:00:08',
            cls=RAUSwitch)

        switch52 = self.addHost(
            'switch52',
            ips=['192.168.1.62/24', '10.52.52.2/24', '10.50.6.2/24'],
            dpid='0000000000000009',
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.50.6.1',
            ce_mac_address='00:00:00:00:00:09',
            cls=RAUSwitch)

        # Controlador
        controller = self.addHost('0c',
                                  cls=RAUController,
                                  ips=['192.168.1.10/24', '192.168.56.101/24'])

        # Switch de la red de gestion
        man_switch = self.addSwitch('s1',
                                    protocols='OpenFlow13',
                                    failMode='standalone')

        # Enlaces
        self.addLink(man_switch, switch1, 2, 0)
        self.addLink(man_switch, switch2, 3, 0)
        self.addLink(man_switch, switch3, 4, 0)
        self.addLink(man_switch, switch4, 5, 0)
        self.addLink(man_switch, switch5, 6, 0)
        self.addLink(man_switch, switch6, 7, 0)
        self.addLink(man_switch, switch7, 8, 0)
        self.addLink(man_switch, switch8, 9, 0)
        self.addLink(man_switch, switch9, 10, 0)
        self.addLink(man_switch, switch10, 11, 0)
        self.addLink(man_switch, switch11, 12, 0)
        self.addLink(man_switch, switch12, 13, 0)
        self.addLink(man_switch, switch13, 14, 0)
        self.addLink(man_switch, switch14, 15, 0)
        self.addLink(man_switch, switch15, 16, 0)
        self.addLink(man_switch, switch16, 17, 0)
        self.addLink(man_switch, switch17, 18, 0)
        self.addLink(man_switch, switch18, 19, 0)
        self.addLink(man_switch, switch19, 20, 0)
        self.addLink(man_switch, switch20, 21, 0)
        self.addLink(man_switch, switch21, 22, 0)
        self.addLink(man_switch, switch22, 23, 0)
        self.addLink(man_switch, switch23, 24, 0)
        self.addLink(man_switch, switch24, 25, 0)
        self.addLink(man_switch, switch25, 26, 0)
        self.addLink(man_switch, switch26, 27, 0)
        self.addLink(man_switch, switch27, 28, 0)
        self.addLink(man_switch, switch28, 29, 0)
        self.addLink(man_switch, switch29, 30, 0)
        self.addLink(man_switch, switch30, 31, 0)
        self.addLink(man_switch, switch31, 32, 0)
        self.addLink(man_switch, switch32, 33, 0)
        self.addLink(man_switch, switch33, 34, 0)
        self.addLink(man_switch, switch34, 35, 0)
        self.addLink(man_switch, switch35, 36, 0)
        self.addLink(man_switch, switch36, 37, 0)
        self.addLink(man_switch, switch37, 38, 0)
        self.addLink(man_switch, switch38, 39, 0)
        self.addLink(man_switch, switch39, 40, 0)
        self.addLink(man_switch, switch40, 41, 0)
        self.addLink(man_switch, switch41, 42, 0)
        self.addLink(man_switch, switch42, 43, 0)
        self.addLink(man_switch, switch43, 44, 0)
        self.addLink(man_switch, switch44, 45, 0)
        self.addLink(man_switch, switch45, 46, 0)
        self.addLink(man_switch, switch46, 47, 0)
        self.addLink(man_switch, switch47, 48, 0)
        self.addLink(man_switch, switch48, 49, 0)
        self.addLink(man_switch, switch49, 50, 0)
        self.addLink(man_switch, switch50, 51, 0)
        self.addLink(man_switch, switch51, 52, 0)
        self.addLink(man_switch, switch52, 53, 0)
        self.addLink(man_switch, controller, 1, 0)

        self.addLink(switch1, switch2, 1, 1)
        self.addLink(switch2, switch4, 2, 1)
        self.addLink(switch3, switch4, 1, 2)
        self.addLink(switch3, switch8, 2, 1)
        self.addLink(switch3, switch16, 3, 1)
        self.addLink(switch4, switch5, 3, 1)
        self.addLink(switch4, switch7, 4, 1)
        self.addLink(switch5, switch6, 2, 1)
        self.addLink(switch7, switch29, 3, 1)
        self.addLink(switch8, switch9, 2, 1)
        self.addLink(switch8, switch13, 3, 1)
        self.addLink(switch9, switch10, 2, 1)
        self.addLink(switch10, switch11, 2, 1)
        self.addLink(switch11, switch13, 2, 2)
        self.addLink(switch11, switch12, 3, 2)
        self.addLink(switch13, switch12, 3, 1)
        self.addLink(switch13, switch14, 4, 1)
        self.addLink(switch13, switch15, 5, 1)
        self.addLink(switch13, switch19, 6, 1)
        self.addLink(switch15, switch16, 2, 2)
        self.addLink(switch16, switch17, 3, 1)
        self.addLink(switch16, switch18, 4, 1)
        self.addLink(switch6, switch7, 2, 2)
        self.addLink(switch18, switch20, 2, 1)
        self.addLink(switch19, switch21, 2, 1)
        self.addLink(switch20, switch21, 2, 2)
        self.addLink(switch21, switch22, 3, 1)
        self.addLink(switch21, switch25, 4, 1)
        self.addLink(switch22, switch23, 2, 1)
        self.addLink(switch22, switch27, 3, 1)
        self.addLink(switch23, switch24, 2, 1)
        self.addLink(switch24, switch29, 2, 2)
        self.addLink(switch25, switch26, 2, 1)
        self.addLink(switch26, switch27, 2, 2)
        self.addLink(switch27, switch28, 3, 1)
        self.addLink(switch27, switch30, 4, 1)
        self.addLink(switch28, switch31, 2, 1)
        self.addLink(switch29, switch31, 3, 2)
        self.addLink(switch30, switch32, 2, 1)
        self.addLink(switch31, switch32, 3, 2)
        self.addLink(switch32, switch33, 3, 1)
        self.addLink(switch32, switch34, 4, 1)
        self.addLink(switch33, switch34, 2, 2)
        self.addLink(switch34, switch35, 3, 1)
        self.addLink(switch34, switch39, 4, 1)
        self.addLink(switch34, switch41, 5, 1)
        self.addLink(switch35, switch36, 2, 1)
        self.addLink(switch36, switch37, 2, 1)
        self.addLink(switch37, switch38, 2, 1)
        self.addLink(switch39, switch40, 2, 1)
        self.addLink(switch40, switch41, 2, 2)
        self.addLink(switch40, switch44, 3, 1)
        self.addLink(switch41, switch42, 3, 1)
        self.addLink(switch41, switch43, 4, 1)
        self.addLink(switch42, switch43, 2, 2)
        self.addLink(switch43, switch44, 3, 2)
        self.addLink(switch43, switch45, 4, 1)
        self.addLink(switch44, switch45, 3, 2)
        self.addLink(switch46, switch45, 1, 3)
        self.addLink(switch47, switch6, 1, 3)
        self.addLink(switch48, switch11, 1, 4)
        self.addLink(switch49, switch9, 1, 4)
        self.addLink(switch50, switch26, 1, 3)
        self.addLink(switch51, switch34, 1, 6)
        self.addLink(switch52, switch34, 1, 7)

        ## Enlaces CE
        self.addLink(switch38, routerLan1, 2, 0)
        self.addLink(switch13, routerLan2, 7, 0)
        self.addLink(switch46, routerLan3, 2, 0)
        self.addLink(switch47, routerLan4, 2, 0)
        self.addLink(switch48, routerLan5, 2, 0)
        self.addLink(switch49, routerLan6, 2, 0)
        self.addLink(switch50, routerLan7, 2, 0)
        self.addLink(switch51, routerLan8, 2, 0)
        self.addLink(switch52, routerLan9, 2, 0)
        self.addLink(h0, routerLan1, 0, 1)
        self.addLink(h1, routerLan2, 0, 1)
        self.addLink(h2, routerLan3, 0, 1)
        self.addLink(h3, routerLan4, 0, 1)
        self.addLink(h4, routerLan5, 0, 1)
        self.addLink(h5, routerLan6, 0, 1)
        self.addLink(h6, routerLan7, 0, 1)
        self.addLink(h7, routerLan8, 0, 1)
        self.addLink(h8, routerLan9, 0, 1)
        self.addLink(h9, routerLan9, 0, 2)
Beispiel #40
0
    def __init__(self, fanout, cores, **opts):

        # Initialize topology and default options

        Topo.__init__(self, **opts)

        "Set up Core and Aggregate level, Connection Core - Aggregation level"

        corelist = []

        aggrlist = []

        core = cores

        aggr = core * fanout

        for i in range(core):

            corelist.append("c" + str(i + 1))

        for k in range(len(corelist)):

            self.addSwitch(corelist[k])

        for j in range(aggr):

            aggrlist.append("a" + str(j + 1))

        for y in range(len(aggrlist)):

            self.addSwitch(aggrlist[y])

        for i in range(len(corelist)):

            for j in range(len(aggrlist)):

                self.addLink(corelist[i], aggrlist[j])

        pass

        "Set up Edge level, Connection Aggregation - Edge level "

        edgelist = []

        edge = aggr * fanout

        for k in range(edge):

            edgelist.append("e" + str(k + 1))

        for f in range(len(edgelist)):

            self.addSwitch(edgelist[f])

        for i in range(len(aggrlist)):

            for j in range(len(edgelist)):

                self.addLink(aggrlist[i], edgelist[j])

        pass

        "Set up Host level, Connection Edge - Host level "

        hostlist = []

        host = edge * fanout

        for q in range(host):

            hostlist.append("h" + str(q + 1))

        for g in range(len(hostlist)):

            self.addHost(hostlist[g])

        count = 0

        m = 0

        for i in range(len(hostlist)):

            self.addLink(hostlist[i], edgelist[m])

            count = count + 1

            if count == fanout:

                m = m + 1

                count = 0

        pass
Beispiel #41
0
    def __init__(self):
        "Create a topology."

        # Initialize Topology
        Topo.__init__(self)

        # add nodes, switches first...
        NY54 = self.addSwitch('s25',
                              protocols='OpenFlow13')  # 40.728270, -73.994483
        CMBR = self.addSwitch('s1',
                              protocols='OpenFlow13')  # 42.373730, -71.109734
        CHCG = self.addSwitch('s2',
                              protocols='OpenFlow13')  # 41.877461, -87.642892
        CLEV = self.addSwitch('s3',
                              protocols='OpenFlow13')  # 41.498928, -81.695217
        RLGH = self.addSwitch('s4',
                              protocols='OpenFlow13')  # 35.780150, -78.644026
        ATLN = self.addSwitch('s5',
                              protocols='OpenFlow13')  # 33.749017, -84.394168
        PHLA = self.addSwitch('s6',
                              protocols='OpenFlow13')  # 39.952906, -75.172278
        WASH = self.addSwitch('s7',
                              protocols='OpenFlow13')  # 38.906696, -77.035509
        NSVL = self.addSwitch('s8',
                              protocols='OpenFlow13')  # 36.166410, -86.787305
        STLS = self.addSwitch('s9',
                              protocols='OpenFlow13')  # 38.626418, -90.198143
        NWOR = self.addSwitch('s10',
                              protocols='OpenFlow13')  # 29.951475, -90.078434
        HSTN = self.addSwitch('s11',
                              protocols='OpenFlow13')  # 29.763249, -95.368332
        SNAN = self.addSwitch('s12',
                              protocols='OpenFlow13')  # 29.424331, -98.491745
        DLLS = self.addSwitch('s13',
                              protocols='OpenFlow13')  # 32.777665, -96.802064
        ORLD = self.addSwitch('s14',
                              protocols='OpenFlow13')  # 28.538641, -81.381110
        DNVR = self.addSwitch('s15',
                              protocols='OpenFlow13')  # 39.736623, -104.984887
        KSCY = self.addSwitch('s16',
                              protocols='OpenFlow13')  # 39.100725, -94.581228
        SNFN = self.addSwitch('s17',
                              protocols='OpenFlow13')  # 37.779751, -122.409791
        SCRM = self.addSwitch('s18',
                              protocols='OpenFlow13')  # 38.581001, -121.497844
        PTLD = self.addSwitch('s19',
                              protocols='OpenFlow13')  # 45.523317, -122.677768
        STTL = self.addSwitch('s20',
                              protocols='OpenFlow13')  # 47.607326, -122.331786
        SLKC = self.addSwitch('s21',
                              protocols='OpenFlow13')  # 40.759577, -111.895079
        LA03 = self.addSwitch('s22',
                              protocols='OpenFlow13')  # 34.056346, -118.235951
        SNDG = self.addSwitch('s23',
                              protocols='OpenFlow13')  # 32.714564, -117.153528
        PHNX = self.addSwitch('s24',
                              protocols='OpenFlow13')  # 33.448289, -112.076299

        # ... and now hosts
        NY54_host = self.addHost('h25')
        CMBR_host = self.addHost('h1')
        CHCG_host = self.addHost('h2')
        CLEV_host = self.addHost('h3')
        RLGH_host = self.addHost('h4')
        ATLN_host = self.addHost('h5')
        PHLA_host = self.addHost('h6')
        WASH_host = self.addHost('h7')
        NSVL_host = self.addHost('h8')
        STLS_host = self.addHost('h9')
        NWOR_host = self.addHost('h10')
        HSTN_host = self.addHost('h11')
        SNAN_host = self.addHost('h12')
        DLLS_host = self.addHost('h13')
        ORLD_host = self.addHost('h14')
        DNVR_host = self.addHost('h15')
        KSCY_host = self.addHost('h16')
        SNFN_host = self.addHost('h17')
        SCRM_host = self.addHost('h18')
        PTLD_host = self.addHost('h19')
        STTL_host = self.addHost('h20')
        SLKC_host = self.addHost('h21')
        LA03_host = self.addHost('h22')
        SNDG_host = self.addHost('h23')
        PHNX_host = self.addHost('h24')

        # add edges between switch and corresponding host
        self.addLink(NY54, NY54_host)
        self.addLink(CMBR, CMBR_host)
        self.addLink(CHCG, CHCG_host)
        self.addLink(CLEV, CLEV_host)
        self.addLink(RLGH, RLGH_host)
        self.addLink(ATLN, ATLN_host)
        self.addLink(PHLA, PHLA_host)
        self.addLink(WASH, WASH_host)
        self.addLink(NSVL, NSVL_host)
        self.addLink(STLS, STLS_host)
        self.addLink(NWOR, NWOR_host)
        self.addLink(HSTN, HSTN_host)
        self.addLink(SNAN, SNAN_host)
        self.addLink(DLLS, DLLS_host)
        self.addLink(ORLD, ORLD_host)
        self.addLink(DNVR, DNVR_host)
        self.addLink(KSCY, KSCY_host)
        self.addLink(SNFN, SNFN_host)
        self.addLink(SCRM, SCRM_host)
        self.addLink(PTLD, PTLD_host)
        self.addLink(STTL, STTL_host)
        self.addLink(SLKC, SLKC_host)
        self.addLink(LA03, LA03_host)
        self.addLink(SNDG, SNDG_host)
        self.addLink(PHNX, PHNX_host)

        # add edges between switches
        self.addLink(NY54, CMBR, bw=10, delay='0.979030824185ms')
        self.addLink(NY54, CMBR, bw=10, delay='0.979030824185ms')
        self.addLink(NY54, CMBR, bw=10, delay='0.979030824185ms')
        self.addLink(NY54, CHCG, bw=10, delay='0.806374975652ms')
        self.addLink(NY54, PHLA, bw=10, delay='0.686192970166ms')
        self.addLink(NY54, PHLA, bw=10, delay='0.686192970166ms')
        self.addLink(NY54, WASH, bw=10, delay='0.605826192092ms')
        self.addLink(CMBR, PHLA, bw=10, delay='1.4018238197ms')
        self.addLink(CHCG, CLEV, bw=10, delay='0.232315346482ms')
        self.addLink(CHCG, PHLA, bw=10, delay='1.07297714274ms')
        self.addLink(CHCG, STLS, bw=10, delay='1.12827896944ms')
        self.addLink(CHCG, DNVR, bw=10, delay='1.35964770335ms')
        self.addLink(CHCG, KSCY, bw=10, delay='1.5199778541ms')
        self.addLink(CHCG, KSCY, bw=10, delay='1.5199778541ms')
        self.addLink(CHCG, SNFN, bw=10, delay='0.620743405435ms')
        self.addLink(CHCG, STTL, bw=10, delay='0.93027212534ms')
        self.addLink(CHCG, SLKC, bw=10, delay='0.735621751348ms')
        self.addLink(CLEV, NSVL, bw=10, delay='0.523419372248ms')
        self.addLink(CLEV, STLS, bw=10, delay='1.00360290845ms')
        self.addLink(CLEV, PHLA, bw=10, delay='0.882912133249ms')
        self.addLink(RLGH, ATLN, bw=10, delay='1.1644489729ms')
        self.addLink(RLGH, WASH, bw=10, delay='1.48176810502ms')
        self.addLink(ATLN, WASH, bw=10, delay='0.557636936322ms')
        self.addLink(ATLN, NSVL, bw=10, delay='1.32869749865ms')
        self.addLink(ATLN, STLS, bw=10, delay='0.767705554748ms')
        self.addLink(ATLN, DLLS, bw=10, delay='0.544782086448ms')
        self.addLink(ATLN, DLLS, bw=10, delay='0.544782086448ms')
        self.addLink(ATLN, DLLS, bw=10, delay='0.544782086448ms')
        self.addLink(ATLN, ORLD, bw=10, delay='1.46119152532ms')
        self.addLink(PHLA, WASH, bw=10, delay='0.372209320106ms')
        self.addLink(NSVL, STLS, bw=10, delay='1.43250491305ms')
        self.addLink(NSVL, DLLS, bw=10, delay='1.67698215288ms')
        self.addLink(STLS, DLLS, bw=10, delay='0.256389964194ms')
        self.addLink(STLS, KSCY, bw=10, delay='0.395511571791ms')
        self.addLink(STLS, LA03, bw=10, delay='0.257085227363ms')
        self.addLink(NWOR, HSTN, bw=10, delay='0.0952906633914ms')
        self.addLink(NWOR, DLLS, bw=10, delay='1.60231329739ms')
        self.addLink(NWOR, ORLD, bw=10, delay='0.692731063896ms')
        self.addLink(HSTN, SNAN, bw=10, delay='0.284150653798ms')
        self.addLink(HSTN, DLLS, bw=10, delay='1.65690128332ms')
        self.addLink(HSTN, ORLD, bw=10, delay='0.731886304782ms')
        self.addLink(SNAN, PHNX, bw=10, delay='1.34258627257ms')
        self.addLink(SNAN, DLLS, bw=10, delay='1.50063532341ms')
        self.addLink(DLLS, DNVR, bw=10, delay='0.251471593235ms')
        self.addLink(DLLS, DNVR, bw=10, delay='0.251471593235ms')
        self.addLink(DLLS, KSCY, bw=10, delay='0.18026026737ms')
        self.addLink(DLLS, KSCY, bw=10, delay='0.18026026737ms')
        self.addLink(DLLS, SNFN, bw=10, delay='0.74304274592ms')
        self.addLink(DLLS, LA03, bw=10, delay='0.506439293357ms')
        self.addLink(DLLS, LA03, bw=10, delay='0.506439293357ms')
        self.addLink(DNVR, KSCY, bw=10, delay='0.223328790403ms')
        self.addLink(DNVR, SNFN, bw=10, delay='0.889017541903ms')
        self.addLink(DNVR, SNFN, bw=10, delay='0.889017541903ms')
        self.addLink(DNVR, SLKC, bw=10, delay='0.631898982721ms')
        self.addLink(KSCY, SNFN, bw=10, delay='0.922778522233ms')
        self.addLink(SNFN, SCRM, bw=10, delay='0.630352278097ms')
        self.addLink(SNFN, PTLD, bw=10, delay='0.828572513655ms')
        self.addLink(SNFN, STTL, bw=10, delay='1.54076081649ms')
        self.addLink(SNFN, SLKC, bw=10, delay='0.621507502625ms')
        self.addLink(SNFN, LA03, bw=10, delay='0.602936230151ms')
        self.addLink(SNFN, LA03, bw=10, delay='0.602936230151ms')
        self.addLink(SNFN, LA03, bw=10, delay='0.602936230151ms')
        self.addLink(SCRM, SLKC, bw=10, delay='0.461350343644ms')
        self.addLink(PTLD, STTL, bw=10, delay='1.17591515181ms')
        self.addLink(SLKC, LA03, bw=10, delay='0.243225267023ms')
        self.addLink(LA03, SNDG, bw=10, delay='0.681264950821ms')
        self.addLink(LA03, SNDG, bw=10, delay='0.681264950821ms')
        self.addLink(LA03, PHNX, bw=10, delay='0.343709457969ms')
        self.addLink(LA03, PHNX, bw=10, delay='0.343709457969ms')
        self.addLink(SNDG, PHNX, bw=10, delay='0.345064487693ms')
Beispiel #42
0
    def __init__(self, *args, **kwargs):
        Topo.__init__(self, *args, **kwargs)

        # Set up the SDN router's quagga BGP instance i.e the BGP speaker
        # first set the AS number for the SDN router
        sdnAs = 65000

        # Quagga Host (qh) interfaces
        # eth0 interface is used to communicate with ONOS
        qheth0 = {'ipAddrs': ['1.1.1.11/24']}
        # eth1 interface is used to communicate with peers
        qheth1 = [
            # tagged interface
            {
                'vlan': 100,
                'mac': '00:00:00:00:00:01',
                'ipAddrs': ['192.168.10.101/24']
            },
            # untagged interface
            {
                'mac': '00:00:00:00:00:02',
                'ipAddrs': ['192.168.20.101/24']
            }
        ]

        qhIntfs = {'qh-eth0': qheth0, 'qh-eth1': qheth1}
        # bgp peer config
        neighbors = [{
            'address': '192.168.10.1',
            'as': 65001
        }, {
            'address': '192.168.20.1',
            'as': 65002
        }]

        # create the quagga linux host and instantiate quagga BGP
        qh = self.addHost("qh",
                          intfDict=qhIntfs,
                          asNum=sdnAs,
                          sdnRouter=True,
                          onosIpAddr='1.1.1.1',
                          neighbors=neighbors,
                          routes=[],
                          cls=BgpRouter)

        # Set up control plane connectivity between qh and onos
        root1 = self.addHost('root1', ip='1.1.1.1/24', inNamespace=False)
        self.addLink(qh, root1)

        # Set up data plane switch - this is the emulated router dataplane
        # Note: The controller needs to be configured with the specific driver that
        # will be attached to this switch.

        router = self.addSwitch('router', dpid='000000000001', cls=UserSwitch)

        # Set up BGP peer1 and host1 in AS65001
        # host1 connects to peer1 and represents multiple ip-addrs within AS65001 reachable via peer1
        peer1As = 65001

        peer1eth0 = [{
            'vlan': 100,
            'mac': '00:00:00:00:10:01',
            'ipAddrs': ['192.168.10.1/24']
        }]
        peer1eth1 = {'ipAddrs': ['1.0.0.254/16']}
        peer1Intfs = {'peer1-eth0': peer1eth0, 'peer1-eth1': peer1eth1}
        peer1networks = ['1.0.0.0/16']
        neighborsOfP1 = [{'address': '192.168.10.101', 'as': 65000}]
        peer1 = self.addHost("peer1",
                             intfDict=peer1Intfs,
                             asNum=peer1As,
                             neighbors=neighborsOfP1,
                             routes=peer1networks,
                             cls=BgpRouter)

        ips1 = ['1.0.%s.1/24' % ip for ip in range(0, 11)]
        host1 = self.addHost('host1',
                             cls=SdnipHost,
                             ips=ips1,
                             gateway='1.0.0.254')

        # Set up BGP peer2 and host2 in AS65002
        # host2 connects to peer2 and represents multiple ip-addrs within AS65002 reachable via peer2
        peer2As = 65002

        peer2eth0 = [{
            'mac': '00:00:00:00:20:01',
            'ipAddrs': ['192.168.20.1/24']
        }]
        peer2eth1 = {'ipAddrs': ['2.0.0.254/16']}
        peer2Intfs = {'peer2-eth0': peer2eth0, 'peer2-eth1': peer2eth1}
        peer2networks = ['2.0.0.0/16']
        neighborsOfP2 = [{'address': '192.168.20.101', 'as': 65000}]

        peer2 = self.addHost("peer2",
                             intfDict=peer2Intfs,
                             asNum=peer2As,
                             neighbors=neighborsOfP2,
                             routes=peer2networks,
                             cls=BgpRouter)

        ips2 = ['2.0.%s.1/24' % ip for ip in range(0, 11)]
        host2 = self.addHost('host2',
                             cls=SdnipHost,
                             ips=ips2,
                             gateway='2.0.0.254')

        # Set up data plane connectivity
        self.addLink(router, peer1)
        self.addLink(router, peer2)
        self.addLink(
            router, qh
        )  # required for redirecting protocol (eg. BGP, OSPF etc.) traffic to Quagga
        self.addLink(peer1, host1)
        self.addLink(peer2, host2)
Beispiel #43
0
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.link import TCLink  # So we can rate limit links
from mininet.cli import CLI  # So we can bring up the Mininet CLI
topo = Topo()  # Create an empty topology
topo.addSwitch("s1")  # Add switches and hosts to the topology
topo.addSwitch("s2")
topo.addHost("h1")
topo.addHost("h2")
topo.addHost("h3")
# Wire the switches and hosts together, links now have bandwidth and delay limits
topo.addLink("h1", "s1", bw=20.0, delay='10ms', use_htb=True)
topo.addLink("h2", "s1", bw=25.0, delay='10ms', use_htb=True)
topo.addLink("s1", "s2", bw=11.0, delay='40ms', use_htb=True)
topo.addLink("h3", "s2", bw=15.0, delay='7ms', use_htb=True)
net = Mininet(topo=topo, link=TCLink)
net.start()
CLI(net)  # Bring up the mininet CLI
net.stop()
    def __init__(self, cpu=.1, max_queue_size=None, **params):

        # Initialize topo
        Topo.__init__(self, **params)
Beispiel #45
0
    def __init__(self):
        Topo.__init__(self)

        # Hosts
        h0 = self.addHost('h0',
                          ips=['10.0.1.2/24'],
                          gw='10.0.1.1',
                          cls=RAUHost)
        h1 = self.addHost('h1',
                          ips=['10.1.1.2/24'],
                          gw='10.1.1.1',
                          cls=RAUHost)

        routerLan1 = self.addHost('routerLan1',
                                  ips=['10.0.0.1/24', '10.0.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:01',
                                  gw='10.0.0.2',
                                  cls=QuaggaRouter)

        routerLan2 = self.addHost('routerLan2',
                                  ips=['10.1.0.1/24', '10.1.1.1/24'],
                                  ce_mac_address='00:00:00:00:00:02',
                                  gw='10.1.0.2',
                                  cls=QuaggaRouter)

        switch1 = self.addHost(
            'switch1',
            ips=['192.168.1.11/24', '10.10.1.1/24', '10.10.2.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch2 = self.addHost('switch2',
                               ips=[
                                   '192.168.1.12/24', '10.10.1.2/24',
                                   '10.10.3.1/24', '10.10.4.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch3 = self.addHost('switch3',
                               ips=[
                                   '192.168.1.13/24', '10.10.2.2/24',
                                   '10.10.5.1/24', '10.10.6.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch4 = self.addHost('switch4',
                               ips=[
                                   '192.168.1.14/24', '10.10.3.2/24',
                                   '10.10.7.1/24', '10.10.8.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch5 = self.addHost('switch5',
                               ips=[
                                   '192.168.1.15/24', '10.10.4.2/24',
                                   '10.10.9.1/24', '10.10.10.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch6 = self.addHost('switch6',
                               ips=[
                                   '192.168.1.16/24', '10.10.5.2/24',
                                   '10.10.11.1/24', '10.10.12.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch7 = self.addHost('switch7',
                               ips=[
                                   '192.168.1.17/24', '10.10.6.2/24',
                                   '10.10.13.1/24', '10.10.14.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch8 = self.addHost('switch8',
                               ips=[
                                   '192.168.1.18/24', '10.10.7.2/24',
                                   '10.10.15.1/24', '10.10.16.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch9 = self.addHost('switch9',
                               ips=[
                                   '192.168.1.19/24', '10.10.8.2/24',
                                   '10.10.17.1/24', '10.10.18.1/24'
                               ],
                               controller_ip="192.168.1.10",
                               cls=RAUSwitch)

        switch10 = self.addHost('switch10',
                                ips=[
                                    '192.168.1.20/24', '10.10.9.2/24',
                                    '10.10.19.1/24', '10.10.20.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch11 = self.addHost('switch11',
                                ips=[
                                    '192.168.1.21/24', '10.10.10.2/24',
                                    '10.10.21.1/24', '10.10.22.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch12 = self.addHost('switch12',
                                ips=[
                                    '192.168.1.22/24', '10.10.11.2/24',
                                    '10.10.23.1/24', '10.10.24.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch13 = self.addHost('switch13',
                                ips=[
                                    '192.168.1.23/24', '10.10.12.2/24',
                                    '10.10.25.1/24', '10.10.26.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch14 = self.addHost('switch14',
                                ips=[
                                    '192.168.1.24/24', '10.10.13.2/24',
                                    '10.10.27.1/24', '10.10.28.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch15 = self.addHost('switch15',
                                ips=[
                                    '192.168.1.25/24', '10.10.14.2/24',
                                    '10.10.29.1/24', '10.10.30.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch16 = self.addHost('switch16',
                                ips=[
                                    '192.168.1.26/24', '10.10.15.2/24',
                                    '10.10.31.1/24', '10.10.32.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch17 = self.addHost('switch17',
                                ips=[
                                    '192.168.1.27/24', '10.10.16.2/24',
                                    '10.10.33.1/24', '10.10.34.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch18 = self.addHost('switch18',
                                ips=[
                                    '192.168.1.28/24', '10.10.17.2/24',
                                    '10.10.35.1/24', '10.10.36.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch19 = self.addHost('switch19',
                                ips=[
                                    '192.168.1.29/24', '10.10.18.2/24',
                                    '10.10.37.1/24', '10.10.38.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch20 = self.addHost('switch20',
                                ips=[
                                    '192.168.1.30/24', '10.10.19.2/24',
                                    '10.10.39.1/24', '10.10.40.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch21 = self.addHost('switch21',
                                ips=[
                                    '192.168.1.31/24', '10.10.20.2/24',
                                    '10.10.41.1/24', '10.10.42.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch22 = self.addHost('switch22',
                                ips=[
                                    '192.168.1.32/24', '10.10.21.2/24',
                                    '10.10.43.1/24', '10.10.44.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch23 = self.addHost('switch23',
                                ips=[
                                    '192.168.1.33/24', '10.10.22.2/24',
                                    '10.10.45.1/24', '10.10.46.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch24 = self.addHost('switch24',
                                ips=[
                                    '192.168.1.34/24', '10.10.23.2/24',
                                    '10.10.47.1/24', '10.10.48.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch25 = self.addHost('switch25',
                                ips=[
                                    '192.168.1.35/24', '10.10.24.2/24',
                                    '10.10.49.1/24', '10.10.50.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch26 = self.addHost('switch26',
                                ips=[
                                    '192.168.1.36/24', '10.10.25.2/24',
                                    '10.10.51.1/24', '10.10.52.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch27 = self.addHost('switch27',
                                ips=[
                                    '192.168.1.37/24', '10.10.26.2/24',
                                    '10.10.53.1/24', '10.10.54.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch28 = self.addHost('switch28',
                                ips=[
                                    '192.168.1.38/24', '10.10.27.2/24',
                                    '10.10.55.1/24', '10.10.56.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch29 = self.addHost('switch29',
                                ips=[
                                    '192.168.1.39/24', '10.10.28.2/24',
                                    '10.10.57.1/24', '10.10.58.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch30 = self.addHost('switch30',
                                ips=[
                                    '192.168.1.40/24', '10.10.29.2/24',
                                    '10.10.59.1/24', '10.10.60.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch31 = self.addHost('switch31',
                                ips=[
                                    '192.168.1.41/24', '10.10.30.2/24',
                                    '10.10.61.1/24', '10.10.62.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch32 = self.addHost('switch32',
                                ips=[
                                    '192.168.1.42/24', '10.10.31.2/24',
                                    '10.10.63.1/24', '10.10.64.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch33 = self.addHost(
            'switch33',
            ips=['192.168.1.43/24', '10.10.32.2/24', '10.10.65.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch34 = self.addHost(
            'switch34',
            ips=['192.168.1.44/24', '10.10.33.2/24', '10.10.66.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch35 = self.addHost('switch35',
                                ips=[
                                    '192.168.1.45/24', '10.10.34.2/24',
                                    '10.10.67.1/24', '10.10.68.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch36 = self.addHost('switch36',
                                ips=[
                                    '192.168.1.46/24', '10.10.35.2/24',
                                    '10.10.69.1/24', '10.10.70.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch37 = self.addHost(
            'switch37',
            ips=['192.168.1.47/24', '10.10.36.2/24', '10.10.71.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch38 = self.addHost(
            'switch38',
            ips=['192.168.1.48/24', '10.10.37.2/24', '10.10.72.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch39 = self.addHost(
            'switch39',
            ips=['192.168.1.49/24', '10.10.38.2/24', '10.10.73.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch40 = self.addHost(
            'switch40',
            ips=['192.168.1.50/24', '10.10.39.2/24', '10.10.74.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch41 = self.addHost(
            'switch41',
            ips=['192.168.1.51/24', '10.10.40.2/24', '10.10.75.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch42 = self.addHost(
            'switch42',
            ips=['192.168.1.52/24', '10.10.41.2/24', '10.10.76.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch43 = self.addHost('switch43',
                                ips=[
                                    '192.168.1.53/24', '10.10.42.2/24',
                                    '10.10.77.1/24', '10.10.78.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch44 = self.addHost('switch44',
                                ips=['192.168.1.54/24', '10.10.43.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch45 = self.addHost('switch45',
                                ips=[
                                    '192.168.1.55/24', '10.10.44.2/24',
                                    '10.10.79.1/24', '10.10.80.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch46 = self.addHost(
            'switch46',
            ips=['192.168.1.56/24', '10.10.45.2/24', '10.10.81.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch47 = self.addHost(
            'switch47',
            ips=['192.168.1.57/24', '10.10.46.2/24', '10.10.82.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch48 = self.addHost(
            'switch48',
            ips=['192.168.1.58/24', '10.10.47.2/24', '10.10.83.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch49 = self.addHost('switch49',
                                ips=['192.168.1.59/24', '10.10.48.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch50 = self.addHost('switch50',
                                ips=[
                                    '192.168.1.60/24', '10.10.49.2/24',
                                    '10.10.84.1/24', '10.10.85.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch51 = self.addHost(
            'switch51',
            ips=['192.168.1.61/24', '10.10.50.2/24', '10.10.86.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch52 = self.addHost('switch52',
                                ips=[
                                    '192.168.1.62/24', '10.10.51.2/24',
                                    '10.10.87.1/24', '10.10.88.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch53 = self.addHost(
            'switch53',
            ips=['192.168.1.63/24', '10.10.52.2/24', '10.10.89.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch54 = self.addHost('switch54',
                                ips=['192.168.1.64/24', '10.10.53.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch55 = self.addHost('switch55',
                                ips=[
                                    '192.168.1.65/24', '10.10.54.2/24',
                                    '10.10.90.1/24', '10.10.91.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch56 = self.addHost('switch56',
                                ips=[
                                    '192.168.1.66/24', '10.10.55.2/24',
                                    '10.10.92.1/24', '10.10.93.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch57 = self.addHost(
            'switch57',
            ips=['192.168.1.67/24', '10.10.56.2/24', '10.10.94.1/24'],
            controller_ip="192.168.1.10",
            cls=RAUSwitch)

        switch58 = self.addHost('switch58',
                                ips=[
                                    '192.168.1.68/24', '10.10.57.2/24',
                                    '10.10.95.1/24', '10.10.96.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch59 = self.addHost('switch59',
                                ips=['192.168.1.69/24', '10.10.58.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch60 = self.addHost('switch60',
                                ips=[
                                    '192.168.1.70/24', '10.10.59.2/24',
                                    '10.10.97.1/24', '10.10.98.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch61 = self.addHost('switch61',
                                ips=[
                                    '192.168.1.71/24', '10.10.60.2/24',
                                    '10.10.99.1/24', '10.10.100.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch62 = self.addHost('switch62',
                                ips=[
                                    '192.168.1.72/24', '10.10.61.2/24',
                                    '10.10.101.1/24', '10.10.102.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch63 = self.addHost('switch63',
                                ips=[
                                    '192.168.1.73/24', '10.10.62.2/24',
                                    '10.10.103.1/24', '10.10.104.1/24'
                                ],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch64 = self.addHost('switch64',
                                ips=['192.168.1.74/24', '10.10.63.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch65 = self.addHost('switch65',
                                ips=['192.168.1.75/24', '10.10.64.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch66 = self.addHost('switch66',
                                ips=['192.168.1.76/24', '10.10.65.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch67 = self.addHost('switch67',
                                ips=['192.168.1.77/24', '10.10.66.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch68 = self.addHost('switch68',
                                ips=['192.168.1.78/24', '10.10.67.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch69 = self.addHost('switch69',
                                ips=['192.168.1.79/24', '10.10.68.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch70 = self.addHost('switch70',
                                ips=['192.168.1.80/24', '10.10.69.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch71 = self.addHost('switch71',
                                ips=['192.168.1.81/24', '10.10.70.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch72 = self.addHost('switch72',
                                ips=['192.168.1.82/24', '10.10.71.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch73 = self.addHost('switch73',
                                ips=['192.168.1.83/24', '10.10.72.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch74 = self.addHost('switch74',
                                ips=['192.168.1.84/24', '10.10.73.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch75 = self.addHost('switch75',
                                ips=['192.168.1.85/24', '10.10.74.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch76 = self.addHost('switch76',
                                ips=['192.168.1.86/24', '10.10.75.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch77 = self.addHost(
            'switch77',
            ips=['192.168.1.87/24', '10.10.76.2/24', '10.0.0.2/24'],
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.0.0.1',
            ce_mac_address='00:00:00:00:00:01',
            cls=RAUSwitch)

        switch78 = self.addHost('switch78',
                                ips=['192.168.1.88/24', '10.10.77.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch79 = self.addHost('switch79',
                                ips=['192.168.1.89/24', '10.10.78.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch80 = self.addHost('switch80',
                                ips=['192.168.1.90/24', '10.10.79.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch81 = self.addHost('switch81',
                                ips=['192.168.1.91/24', '10.10.80.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch82 = self.addHost('switch82',
                                ips=['192.168.1.92/24', '10.10.81.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch83 = self.addHost('switch83',
                                ips=['192.168.1.93/24', '10.10.82.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch84 = self.addHost('switch84',
                                ips=['192.168.1.94/24', '10.10.83.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch85 = self.addHost('switch85',
                                ips=['192.168.1.95/24', '10.10.84.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch86 = self.addHost('switch86',
                                ips=['192.168.1.96/24', '10.10.85.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch87 = self.addHost('switch87',
                                ips=['192.168.1.97/24', '10.10.86.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch88 = self.addHost('switch88',
                                ips=['192.168.1.98/24', '10.10.87.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch89 = self.addHost('switch89',
                                ips=['192.168.1.99/24', '10.10.88.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch90 = self.addHost('switch90',
                                ips=['192.168.1.100/24', '10.10.89.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch91 = self.addHost('switch91',
                                ips=['192.168.1.101/24', '10.10.90.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch92 = self.addHost('switch92',
                                ips=['192.168.1.102/24', '10.10.91.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch93 = self.addHost('switch93',
                                ips=['192.168.1.103/24', '10.10.92.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch94 = self.addHost('switch94',
                                ips=['192.168.1.104/24', '10.10.93.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch95 = self.addHost('switch95',
                                ips=['192.168.1.105/24', '10.10.94.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch96 = self.addHost('switch96',
                                ips=['192.168.1.106/24', '10.10.95.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch97 = self.addHost('switch97',
                                ips=['192.168.1.107/24', '10.10.96.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch98 = self.addHost('switch98',
                                ips=['192.168.1.108/24', '10.10.97.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch99 = self.addHost('switch99',
                                ips=['192.168.1.109/24', '10.10.98.2/24'],
                                controller_ip="192.168.1.10",
                                cls=RAUSwitch)

        switch100 = self.addHost(
            'switch100',
            ips=['192.168.1.110/24', '10.10.99.2/24', '10.1.0.2/24'],
            controller_ip="192.168.1.10",
            border=1,
            ce_ip_address='10.1.0.1',
            ce_mac_address='00:00:00:00:00:02',
            cls=RAUSwitch)

        switch101 = self.addHost('switch101',
                                 ips=['192.168.1.111/24', '10.10.100.2/24'],
                                 controller_ip="192.168.1.10",
                                 cls=RAUSwitch)

        switch102 = self.addHost('switch102',
                                 ips=['192.168.1.112/24', '10.10.101.2/24'],
                                 controller_ip="192.168.1.10",
                                 cls=RAUSwitch)

        switch103 = self.addHost('switch103',
                                 ips=['192.168.1.113/24', '10.10.102.2/24'],
                                 controller_ip="192.168.1.10",
                                 cls=RAUSwitch)

        switch104 = self.addHost('switch104',
                                 ips=['192.168.1.114/24', '10.10.103.2/24'],
                                 controller_ip="192.168.1.10",
                                 cls=RAUSwitch)

        switch105 = self.addHost('switch105',
                                 ips=['192.168.1.115/24', '10.10.104.2/24'],
                                 controller_ip="192.168.1.10",
                                 cls=RAUSwitch)

        # Controlador
        controller = self.addHost('controller',
                                  cls=RAUController,
                                  ips=['192.168.1.10/24'])

        # Switch de la red de gestion
        man_switch = self.addSwitch('s1',
                                    protocols='OpenFlow13',
                                    failMode='standalone')

        # Enlaces
        self.addLink(man_switch, switch1, 2, 0)
        self.addLink(man_switch, switch2, 3, 0)
        self.addLink(man_switch, switch3, 4, 0)
        self.addLink(man_switch, switch4, 5, 0)
        self.addLink(man_switch, switch5, 6, 0)
        self.addLink(man_switch, switch6, 7, 0)
        self.addLink(man_switch, switch7, 8, 0)
        self.addLink(man_switch, switch8, 9, 0)
        self.addLink(man_switch, switch9, 10, 0)
        self.addLink(man_switch, switch10, 11, 0)
        self.addLink(man_switch, switch11, 12, 0)
        self.addLink(man_switch, switch12, 13, 0)
        self.addLink(man_switch, switch13, 14, 0)
        self.addLink(man_switch, switch14, 15, 0)
        self.addLink(man_switch, switch15, 16, 0)
        self.addLink(man_switch, switch16, 17, 0)
        self.addLink(man_switch, switch17, 18, 0)
        self.addLink(man_switch, switch18, 19, 0)
        self.addLink(man_switch, switch19, 20, 0)
        self.addLink(man_switch, switch20, 21, 0)
        self.addLink(man_switch, switch21, 22, 0)
        self.addLink(man_switch, switch22, 23, 0)
        self.addLink(man_switch, switch23, 24, 0)
        self.addLink(man_switch, switch24, 25, 0)
        self.addLink(man_switch, switch25, 26, 0)
        self.addLink(man_switch, switch26, 27, 0)
        self.addLink(man_switch, switch27, 28, 0)
        self.addLink(man_switch, switch28, 29, 0)
        self.addLink(man_switch, switch29, 30, 0)
        self.addLink(man_switch, switch30, 31, 0)
        self.addLink(man_switch, switch31, 32, 0)
        self.addLink(man_switch, switch32, 33, 0)
        self.addLink(man_switch, switch33, 34, 0)
        self.addLink(man_switch, switch34, 35, 0)
        self.addLink(man_switch, switch35, 36, 0)
        self.addLink(man_switch, switch36, 37, 0)
        self.addLink(man_switch, switch37, 38, 0)
        self.addLink(man_switch, switch38, 39, 0)
        self.addLink(man_switch, switch39, 40, 0)
        self.addLink(man_switch, switch40, 41, 0)
        self.addLink(man_switch, switch41, 42, 0)
        self.addLink(man_switch, switch42, 43, 0)
        self.addLink(man_switch, switch43, 44, 0)
        self.addLink(man_switch, switch44, 45, 0)
        self.addLink(man_switch, switch45, 46, 0)
        self.addLink(man_switch, switch46, 47, 0)
        self.addLink(man_switch, switch47, 48, 0)
        self.addLink(man_switch, switch48, 49, 0)
        self.addLink(man_switch, switch49, 50, 0)
        self.addLink(man_switch, switch50, 51, 0)
        self.addLink(man_switch, switch51, 52, 0)
        self.addLink(man_switch, switch52, 53, 0)
        self.addLink(man_switch, switch53, 54, 0)
        self.addLink(man_switch, switch54, 55, 0)
        self.addLink(man_switch, switch55, 56, 0)
        self.addLink(man_switch, switch56, 57, 0)
        self.addLink(man_switch, switch57, 58, 0)
        self.addLink(man_switch, switch58, 59, 0)
        self.addLink(man_switch, switch59, 60, 0)
        self.addLink(man_switch, switch60, 61, 0)
        self.addLink(man_switch, switch61, 62, 0)
        self.addLink(man_switch, switch62, 63, 0)
        self.addLink(man_switch, switch63, 64, 0)
        self.addLink(man_switch, switch64, 65, 0)
        self.addLink(man_switch, switch65, 66, 0)
        self.addLink(man_switch, switch66, 67, 0)
        self.addLink(man_switch, switch67, 68, 0)
        self.addLink(man_switch, switch68, 69, 0)
        self.addLink(man_switch, switch69, 70, 0)
        self.addLink(man_switch, switch70, 71, 0)
        self.addLink(man_switch, switch71, 72, 0)
        self.addLink(man_switch, switch72, 73, 0)
        self.addLink(man_switch, switch73, 74, 0)
        self.addLink(man_switch, switch74, 75, 0)
        self.addLink(man_switch, switch75, 76, 0)
        self.addLink(man_switch, switch76, 77, 0)
        self.addLink(man_switch, switch77, 78, 0)
        self.addLink(man_switch, switch78, 79, 0)
        self.addLink(man_switch, switch79, 80, 0)
        self.addLink(man_switch, switch80, 81, 0)
        self.addLink(man_switch, switch81, 82, 0)
        self.addLink(man_switch, switch82, 83, 0)
        self.addLink(man_switch, switch83, 84, 0)
        self.addLink(man_switch, switch84, 85, 0)
        self.addLink(man_switch, switch85, 86, 0)
        self.addLink(man_switch, switch86, 87, 0)
        self.addLink(man_switch, switch87, 88, 0)
        self.addLink(man_switch, switch88, 89, 0)
        self.addLink(man_switch, switch89, 90, 0)
        self.addLink(man_switch, switch90, 91, 0)
        self.addLink(man_switch, switch91, 92, 0)
        self.addLink(man_switch, switch92, 93, 0)
        self.addLink(man_switch, switch93, 94, 0)
        self.addLink(man_switch, switch94, 95, 0)
        self.addLink(man_switch, switch95, 96, 0)
        self.addLink(man_switch, switch96, 97, 0)
        self.addLink(man_switch, switch97, 98, 0)
        self.addLink(man_switch, switch98, 99, 0)
        self.addLink(man_switch, switch99, 100, 0)
        self.addLink(man_switch, switch100, 101, 0)
        self.addLink(man_switch, switch101, 102, 0)
        self.addLink(man_switch, switch102, 103, 0)
        self.addLink(man_switch, switch103, 104, 0)
        self.addLink(man_switch, switch104, 105, 0)
        self.addLink(man_switch, switch105, 106, 0)
        self.addLink(man_switch, controller, 1, 0)

        self.addLink(switch1, switch2, 1, 1)
        self.addLink(switch1, switch3, 2, 1)
        self.addLink(switch2, switch4, 2, 1)
        self.addLink(switch2, switch5, 3, 1)
        self.addLink(switch3, switch6, 2, 1)
        self.addLink(switch3, switch7, 3, 1)
        self.addLink(switch4, switch8, 2, 1)
        self.addLink(switch4, switch9, 3, 1)
        self.addLink(switch5, switch10, 2, 1)
        self.addLink(switch5, switch11, 3, 1)
        self.addLink(switch6, switch12, 2, 1)
        self.addLink(switch6, switch13, 3, 1)
        self.addLink(switch7, switch14, 2, 1)
        self.addLink(switch7, switch15, 3, 1)
        self.addLink(switch8, switch16, 2, 1)
        self.addLink(switch8, switch17, 3, 1)
        self.addLink(switch9, switch18, 2, 1)
        self.addLink(switch9, switch19, 3, 1)
        self.addLink(switch10, switch20, 2, 1)
        self.addLink(switch10, switch21, 3, 1)
        self.addLink(switch11, switch22, 2, 1)
        self.addLink(switch11, switch23, 3, 1)
        self.addLink(switch12, switch24, 2, 1)
        self.addLink(switch12, switch25, 3, 1)
        self.addLink(switch13, switch26, 2, 1)
        self.addLink(switch13, switch27, 3, 1)
        self.addLink(switch14, switch28, 2, 1)
        self.addLink(switch14, switch29, 3, 1)
        self.addLink(switch15, switch30, 2, 1)
        self.addLink(switch15, switch31, 3, 1)
        self.addLink(switch16, switch32, 2, 1)
        self.addLink(switch16, switch33, 3, 1)
        self.addLink(switch17, switch34, 2, 1)
        self.addLink(switch17, switch35, 3, 1)
        self.addLink(switch18, switch36, 2, 1)
        self.addLink(switch18, switch37, 3, 1)
        self.addLink(switch19, switch38, 2, 1)
        self.addLink(switch19, switch39, 3, 1)
        self.addLink(switch20, switch40, 2, 1)
        self.addLink(switch20, switch41, 3, 1)
        self.addLink(switch21, switch42, 2, 1)
        self.addLink(switch21, switch43, 3, 1)
        self.addLink(switch22, switch44, 2, 1)
        self.addLink(switch22, switch45, 3, 1)
        self.addLink(switch23, switch46, 2, 1)
        self.addLink(switch23, switch47, 3, 1)
        self.addLink(switch24, switch48, 2, 1)
        self.addLink(switch24, switch49, 3, 1)
        self.addLink(switch25, switch50, 2, 1)
        self.addLink(switch25, switch51, 3, 1)
        self.addLink(switch26, switch52, 2, 1)
        self.addLink(switch26, switch53, 3, 1)
        self.addLink(switch27, switch54, 2, 1)
        self.addLink(switch27, switch55, 3, 1)
        self.addLink(switch28, switch56, 2, 1)
        self.addLink(switch28, switch57, 3, 1)
        self.addLink(switch29, switch58, 2, 1)
        self.addLink(switch29, switch59, 3, 1)
        self.addLink(switch30, switch60, 2, 1)
        self.addLink(switch30, switch61, 3, 1)
        self.addLink(switch31, switch62, 2, 1)
        self.addLink(switch31, switch63, 3, 1)
        self.addLink(switch32, switch64, 2, 1)
        self.addLink(switch32, switch65, 3, 1)
        self.addLink(switch33, switch66, 2, 1)
        self.addLink(switch34, switch67, 2, 1)
        self.addLink(switch35, switch68, 2, 1)
        self.addLink(switch35, switch69, 3, 1)
        self.addLink(switch36, switch70, 2, 1)
        self.addLink(switch36, switch71, 3, 1)
        self.addLink(switch37, switch72, 2, 1)
        self.addLink(switch38, switch73, 2, 1)
        self.addLink(switch39, switch74, 2, 1)
        self.addLink(switch40, switch75, 2, 1)
        self.addLink(switch41, switch76, 2, 1)
        self.addLink(switch42, switch77, 2, 1)
        self.addLink(switch43, switch78, 2, 1)
        self.addLink(switch43, switch79, 3, 1)
        self.addLink(switch45, switch80, 2, 1)
        self.addLink(switch45, switch81, 3, 1)
        self.addLink(switch46, switch82, 2, 1)
        self.addLink(switch47, switch83, 2, 1)
        self.addLink(switch48, switch84, 2, 1)
        self.addLink(switch50, switch85, 2, 1)
        self.addLink(switch50, switch86, 3, 1)
        self.addLink(switch51, switch87, 2, 1)
        self.addLink(switch52, switch88, 2, 1)
        self.addLink(switch52, switch89, 3, 1)
        self.addLink(switch53, switch90, 2, 1)
        self.addLink(switch55, switch91, 2, 1)
        self.addLink(switch55, switch92, 3, 1)
        self.addLink(switch56, switch93, 2, 1)
        self.addLink(switch56, switch94, 3, 1)
        self.addLink(switch57, switch95, 2, 1)
        self.addLink(switch58, switch96, 2, 1)
        self.addLink(switch58, switch97, 3, 1)
        self.addLink(switch60, switch98, 2, 1)
        self.addLink(switch60, switch99, 3, 1)
        self.addLink(switch61, switch100, 2, 1)
        self.addLink(switch61, switch101, 3, 1)
        self.addLink(switch62, switch102, 2, 1)
        self.addLink(switch62, switch103, 3, 1)
        self.addLink(switch63, switch104, 2, 1)
        self.addLink(switch63, switch105, 3, 1)

        ## Enlaces CE
        self.addLink(switch77, routerLan1, 2, 0)
        self.addLink(switch100, routerLan2, 2, 0)
        self.addLink(h0, routerLan1, 0, 1)
        self.addLink(h1, routerLan2, 0, 1)
Beispiel #46
0
    def __init__(self, n=2, **opts):
        Topo.__init__(self, **opts)
        switch = self.addSwitch('s1')
        for h in range(n):
			host = self.addHost('h%s' % (h + 1))
            self.addLink(host, switch, MyNSLink())
Beispiel #47
0
 def __init__(self, **opts):
     Topo.__init__(self, **opts)
     h1 = self.addHost('h1')
     h2 = self.addHost('h2')
     self.addLink(h1, h2, bw=10)
Beispiel #48
0
    def __init__(self):
        "Create Topology"

        # Initialize topology
        Topo.__init__(self)

        # Add hosts
        h0 = self.addHost('h0')
        h1 = self.addHost('h1')
        h2 = self.addHost('h2')
        h3 = self.addHost('h3')
        h4 = self.addHost('h4')
        h5 = self.addHost('h5')
        h6 = self.addHost('h6')
        h7 = self.addHost('h7')
        h8 = self.addHost('h8')
        h9 = self.addHost('h9')

        # Add switches
        s0 = self.addSwitch('s0', listenPort=6634)
        s1 = self.addSwitch('s1', listenPort=6635)
        s2 = self.addSwitch('s2', listenPort=6636)
        s3 = self.addSwitch('s3', listenPort=6637)
        s4 = self.addSwitch('s4', listenPort=6638)
        s5 = self.addSwitch('s5', listenPort=6639)
        s6 = self.addSwitch('s6', listenPort=6640)
        s7 = self.addSwitch('s7', listenPort=6641)
        s8 = self.addSwitch('s8', listenPort=6642)
        s9 = self.addSwitch('s9', listenPort=6643)

        # Add links between hosts and switches
        self.addLink(h0, s0)  # h0-eth0 <-> s0-eth1
        self.addLink(h1, s1)  # h1-eth0 <-> s1-eth1
        self.addLink(h2, s2)  # h2-eth0 <-> s2-eth1
        self.addLink(h3, s3)  # h3-eth0 <-> s3-eth1
        self.addLink(h4, s4)  # h4-eth0 <-> s4-eth1
        self.addLink(h5, s5)  # h5-eth0 <-> s5-eth1
        self.addLink(h6, s6)  # h6-eth0 <-> s6-eth1
        self.addLink(h7, s7)  # h7-eth0 <-> s7-eth1
        self.addLink(h8, s8)  # h8-eth0 <-> s8-eth1
        self.addLink(h9, s9)  # h9-eth0 <-> s9-eth1

        # Add links between switches, with bandwidth 100Mbps
        self.addLink(s0, s1,
                     bw=100)  # s0-eth2 <-> s1-eth2, Bandwidth = 100Mbps
        self.addLink(s0, s2,
                     bw=100)  # s0-eth3 <-> s2-eth2, Bandwidth = 100Mbps
        self.addLink(s1, s2,
                     bw=100)  # s1-eth3 <-> s2-eth3, Bandwidth = 100Mbps
        self.addLink(s2, s3,
                     bw=100)  # s2-eth4 <-> s3-eth2, Bandwidth = 100Mbps
        self.addLink(s3, s4,
                     bw=100)  # s3-eth3 <-> s4-eth2, Bandwidth = 100Mbps
        self.addLink(s3, s6,
                     bw=100)  # s3-eth4 <-> s6-eth2, Bandwidth = 100Mbps
        self.addLink(s4, s5,
                     bw=100)  # s4-eth3 <-> s5-eth2, Bandwidth = 100Mbps
        self.addLink(s5, s7,
                     bw=100)  # s5-eth3 <-> s7-eth2, Bandwidth = 100Mbps
        self.addLink(s6, s7,
                     bw=100)  # s6-eth3 <-> s7-eth3, Bandwidth = 100Mbps
        self.addLink(s7, s8,
                     bw=100)  # s7-eth4 <-> s8-eth2, Bandwidth = 100Mbps
        self.addLink(s7, s9,
                     bw=100)  # s7-eth5 <-> s9-eth2, Bandwidth = 100Mbps
        self.addLink(s8, s9,
                     bw=100)  # s8-eth3 <-> s9-eth3, Bandwidth = 100Mbps
Beispiel #49
0
    def __init__(self):
        "Create a topology."

        # Initialize Topology
        Topo.__init__(self)

        # add nodes, switches first...
        NY54 = self.addSwitch('s25')  # 40.728270, -73.994483
        CMBR = self.addSwitch('s1')  # 42.373730, -71.109734
        CHCG = self.addSwitch('s2')  # 41.877461, -87.642892
        CLEV = self.addSwitch('s3')  # 41.498928, -81.695217
        RLGH = self.addSwitch('s4')  # 35.780150, -78.644026
        ATLN = self.addSwitch('s5')  # 33.749017, -84.394168
        PHLA = self.addSwitch('s6')  # 39.952906, -75.172278
        WASH = self.addSwitch('s7')  # 38.906696, -77.035509
        NSVL = self.addSwitch('s8')  # 36.166410, -86.787305
        STLS = self.addSwitch('s9')  # 38.626418, -90.198143
        NWOR = self.addSwitch('s10')  # 29.951475, -90.078434
        HSTN = self.addSwitch('s11')  # 29.763249, -95.368332
        SNAN = self.addSwitch('s12')  # 29.424331, -98.491745
        DLLS = self.addSwitch('s13')  # 32.777665, -96.802064
        ORLD = self.addSwitch('s14')  # 28.538641, -81.381110
        DNVR = self.addSwitch('s15')  # 39.736623, -104.984887
        KSCY = self.addSwitch('s16')  # 39.100725, -94.581228
        SNFN = self.addSwitch('s17')  # 37.779751, -122.409791
        SCRM = self.addSwitch('s18')  # 38.581001, -121.497844
        PTLD = self.addSwitch('s19')  # 45.523317, -122.677768
        STTL = self.addSwitch('s20')  # 47.607326, -122.331786
        SLKC = self.addSwitch('s21')  # 40.759577, -111.895079
        LA03 = self.addSwitch('s22')  # 34.056346, -118.235951
        SNDG = self.addSwitch('s23')  # 32.714564, -117.153528
        PHNX = self.addSwitch('s24')  # 33.448289, -112.076299

        # ... and now hosts
        NY54_host = self.addHost('h25')
        CMBR_host = self.addHost('h1')
        CHCG_host = self.addHost('h2')
        CLEV_host = self.addHost('h3')
        RLGH_host = self.addHost('h4')
        ATLN_host = self.addHost('h5')
        PHLA_host = self.addHost('h6')
        WASH_host = self.addHost('h7')
        NSVL_host = self.addHost('h8')
        STLS_host = self.addHost('h9')
        NWOR_host = self.addHost('h10')
        HSTN_host = self.addHost('h11')
        SNAN_host = self.addHost('h12')
        DLLS_host = self.addHost('h13')
        ORLD_host = self.addHost('h14')
        DNVR_host = self.addHost('h15')
        KSCY_host = self.addHost('h16')
        SNFN_host = self.addHost('h17')
        SCRM_host = self.addHost('h18')
        PTLD_host = self.addHost('h19')
        STTL_host = self.addHost('h20')
        SLKC_host = self.addHost('h21')
        LA03_host = self.addHost('h22')
        SNDG_host = self.addHost('h23')
        PHNX_host = self.addHost('h24')

        # add edges between switch and corresponding host
        self.addLink(NY54, NY54_host)
        self.addLink(CMBR, CMBR_host)
        self.addLink(CHCG, CHCG_host)
        self.addLink(CLEV, CLEV_host)
        self.addLink(RLGH, RLGH_host)
        self.addLink(ATLN, ATLN_host)
        self.addLink(PHLA, PHLA_host)
        self.addLink(WASH, WASH_host)
        self.addLink(NSVL, NSVL_host)
        self.addLink(STLS, STLS_host)
        self.addLink(NWOR, NWOR_host)
        self.addLink(HSTN, HSTN_host)
        self.addLink(SNAN, SNAN_host)
        self.addLink(DLLS, DLLS_host)
        self.addLink(ORLD, ORLD_host)
        self.addLink(DNVR, DNVR_host)
        self.addLink(KSCY, KSCY_host)
        self.addLink(SNFN, SNFN_host)
        self.addLink(SCRM, SCRM_host)
        self.addLink(PTLD, PTLD_host)
        self.addLink(STTL, STTL_host)
        self.addLink(SLKC, SLKC_host)
        self.addLink(LA03, LA03_host)
        self.addLink(SNDG, SNDG_host)
        self.addLink(PHNX, PHNX_host)

        # add edges between switches
        self.addLink(NY54, CMBR)
        self.addLink(NY54, CMBR)
        self.addLink(NY54, CMBR)
        self.addLink(NY54, CHCG)
        self.addLink(NY54, PHLA)
        self.addLink(NY54, PHLA)
        self.addLink(NY54, WASH)
        self.addLink(CMBR, PHLA)
        self.addLink(CHCG, CLEV)
        self.addLink(CHCG, PHLA)
        self.addLink(CHCG, STLS)
        self.addLink(CHCG, DNVR)
        self.addLink(CHCG, KSCY)
        self.addLink(CHCG, KSCY)
        self.addLink(CHCG, SNFN)
        self.addLink(CHCG, STTL)
        self.addLink(CHCG, SLKC)
        self.addLink(CLEV, NSVL)
        self.addLink(CLEV, STLS)
        self.addLink(CLEV, PHLA)
        self.addLink(RLGH, ATLN)
        self.addLink(RLGH, WASH)
        self.addLink(ATLN, WASH)
        self.addLink(ATLN, NSVL)
        self.addLink(ATLN, STLS)
        self.addLink(ATLN, DLLS)
        self.addLink(ATLN, DLLS)
        self.addLink(ATLN, DLLS)
        self.addLink(ATLN, ORLD)
        self.addLink(PHLA, WASH)
        self.addLink(NSVL, STLS)
        self.addLink(NSVL, DLLS)
        self.addLink(STLS, DLLS)
        self.addLink(STLS, KSCY)
        self.addLink(STLS, LA03)
        self.addLink(NWOR, HSTN)
        self.addLink(NWOR, DLLS)
        self.addLink(NWOR, ORLD)
        self.addLink(HSTN, SNAN)
        self.addLink(HSTN, DLLS)
        self.addLink(HSTN, ORLD)
        self.addLink(SNAN, PHNX)
        self.addLink(SNAN, DLLS)
        self.addLink(DLLS, DNVR)
        self.addLink(DLLS, DNVR)
        self.addLink(DLLS, KSCY)
        self.addLink(DLLS, KSCY)
        self.addLink(DLLS, SNFN)
        self.addLink(DLLS, LA03)
        self.addLink(DLLS, LA03)
        self.addLink(DNVR, KSCY)
        self.addLink(DNVR, SNFN)
        self.addLink(DNVR, SNFN)
        self.addLink(DNVR, SLKC)
        self.addLink(KSCY, SNFN)
        self.addLink(SNFN, SCRM)
        self.addLink(SNFN, PTLD)
        self.addLink(SNFN, STTL)
        self.addLink(SNFN, SLKC)
        self.addLink(SNFN, LA03)
        self.addLink(SNFN, LA03)
        self.addLink(SNFN, LA03)
        self.addLink(SCRM, SLKC)
        self.addLink(PTLD, STTL)
        self.addLink(SLKC, LA03)
        self.addLink(LA03, SNDG)
        self.addLink(LA03, SNDG)
        self.addLink(LA03, PHNX)
        self.addLink(LA03, PHNX)
        self.addLink(SNDG, PHNX)
Beispiel #50
0
def createTopo():
    topo = Topo()
    #Create Nodes
    topo.addHost("h1")
    topo.addHost("h2")
    topo.addHost("h3")
    topo.addHost("h4")
    topo.addSwitch('s1')
    topo.addSwitch('s2')
    topo.addSwitch('s3')
    #Create links
    topo.addLink('s1', 's2')
    topo.addLink('s1', 's3')
    topo.addLink('h1', 's2')
    topo.addLink('h2', 's2')
    topo.addLink('h3', 's3')
    topo.addLink('h4', 's3')
    return topo
Beispiel #51
0
 def __init__(self):
     Topo.__init__(self)
     _init(self)
Beispiel #52
0
 def __init__(self, k):
     self.pod = k
     self.iCoreLayerSwitch = 1
     self.iHost = k**3 / 4
     # Topo initiation
     Topo.__init__(self)
Beispiel #53
0
    def __init__(self,
                 n=1,
                 delay='1ms',
                 z=1,
                 bw=1,
                 cpu=.1,
                 max_queue_size=None,
                 **params):
        """Ring topology with z zones.
        n: number of hosts per zone
        cpu: system fraction for each host
        bw: link bandwidth in Mb/s
        delay: link latency (e.g. 10ms)"""
        self.z = z
        self.n = n
        self.cpu = cpu
        self.bw = bw
        self.delay = delay

        self.max_queue_size = max_queue_size
        self.params = params

        # Initialize topo
        Topo.__init__(self, **params)

        # Host and link configuration
        hostConfig = {'cpu': self.cpu}
        linkConfig = {
            'bw': self.bw,
            'delay': self.delay,
            'loss': 0,
            'max_queue_size': self.max_queue_size
        }

        #TODO: Create your Dynamic Mininet Topology here!
        #NOTE: You MUST label switches as s1, s2, ... sz
        #NOTE: You MUST label hosts as h1-1, h1-2, ... hz-n
        #HINT: Use a loop to construct the topology in pieces.

        # Store switches and nodes in a dict
        switches = {}
        hosts = {}

        # construct hosts, switches, add links between hosts and switches
        for zone in range(1, self.z + 1):  # for 1-indexing

            # Construct switch
            switchname = 's' + str(zone)
            switches[switchname] = self.addSwitch(switchname)

            switch_port = 1
            for node in range(1, n + 1):  # for 1-indexing

                # Construct host
                hostname = 'h' + str(zone) + '-' + str(node)
                #hostname = 'h' + str(zone) + str(node) # no dash
                hosts[hostname] = self.addHost(hostname, **hostConfig)

                # Link host to switch
                self.addLink(hosts[hostname],
                             switches[switchname],
                             port1=0,
                             port2=switch_port,
                             **linkConfig)
                switch_port += 1

        # add links between zone switches
        for zone in range(1, self.z + 1):  # for 1-indexing
            if zone != z:
                current_switch = 's' + str(zone)
                next_switch = 's' + str(zone + 1)
            else:
                current_switch = 's' + str(zone)
                next_switch = 's' + str(1)
            self.addLink(switches[current_switch],
                         switches[next_switch],
                         port1=switch_port,
                         port2=switch_port + 1,
                         **linkConfig)
Beispiel #54
0
Create TUN interface on two hosts
"""

from mininet.topo import Topo
from mininet.net import Mininet
from mininet.link import TCLink
from mininet.log import setLogLevel

from mininet_test import TestMonitor
from mininet_test import TestMonitorHost


if __name__ == '__main__':
    setLogLevel('info')

    topo = Topo()
    topo.addHost('host')


    # TCLink is needed to set the bandwidth, delay and loss constraints
    # on the link
    net = Mininet(topo=topo,
                  link=TCLink,
                  waitConnected=True,
                  host=TestMonitorHost)
    net.start()

    test_monitor = TestMonitor()

    host = net.getNodeByName('host')
Beispiel #55
0
    def __init__(self):
        Topo.__init__(self)
        
        #deklaracja 4 hostów
        host1 = self.addHost('h1') #source of traffic 1
        host2 = self.addHost('h2') #source of traffic 2

        host3 = self.addHost('h3') #DHCP Server
        host4 = self.addHost('h4') #DHCP Client
        host5 = self.addHost('h5') #attacker

        #pierwszy switch
        switch1 = self.addSwitch('s1')
        self.addLink(host1, switch1)
        self.addLink(host2, switch1)

        #ostatni switch
        switch4 = self.addSwitch('s4')
        self.addLink(host3,switch4)
        self.addLink(host4,switch4)
        self.addLink(host5,switch4)

        #pierwsza warstwa switchy
        switch11 = self.addSwitch('s11')
        switch12 = self.addSwitch('s12')
        switch13 = self.addSwitch('s13')
        switch14 = self.addSwitch('s14')

        #polaczenie pierwszej warstwy ze switchem1
        self.addLink(switch1, switch11)
        self.addLink(switch1, switch12)
        self.addLink(switch1, switch13)
        self.addLink(switch1, switch14)
        
        #druga warstwa switch
        switch22 = self.addSwitch('s22')
        switch23 = self.addSwitch('s23')
        switch24 = self.addSwitch('s24')

        #trzecia warstwa switchy
        switch33 = self.addSwitch('s33')
        switch34 = self.addSwitch('s34')

        #czwarta warstwa switchy
        switch44 = self.addSwitch('s44')
       
        #laczenie warst
        self.addLink(switch12, switch22)
        self.addLink(switch13, switch23)
        self.addLink(switch14, switch24)
        
        self.addLink(switch23, switch33)
        self.addLink(switch24, switch34)

        self.addLink(switch34, switch44)

        #podlaczenie switcha4 ze switchami
        self.addLink(switch4, switch11)
        self.addLink(switch4, switch22)
        self.addLink(switch4, switch33)
        self.addLink(switch4, switch44)
Beispiel #56
0
    def __init__(self):
        #   "Create custom topo."

        Topo.__init__(self)
        self.bw_core = 5.0
        self.bw_agg = 0.5
        self.bw_edge = 0.05

        # Add hosts and switches
        leftHost = self.addHost('h1')
        rightHost = self.addHost('h2')

        Core1 = self.addSwitch('c1')
        Core2 = self.addSwitch('c2')

        Agg1 = self.addSwitch('a1')
        Agg2 = self.addSwitch('a2')
        Agg3 = self.addSwitch('a3')
        Agg4 = self.addSwitch('a4')

        logger.debug("Add Edges")
        for h in range(0, 10):
            self.EdgeSwitches.append(self.addSwitch('e{}'.format(h)))

        logger.debug("Add Host BANANAS")
        print("Adding hosts")
        for i in range(0, 100):
            self.Hosts.append(self.addHost('h{}'.format(i)))
        # Add links
        print("added hosts")
        #Connect cores to each other, then all 4 aggregators to each:
        #ALL 10 GB CONNECTIONS:
        linkopts = dict(bw=self.bw_core)
        self.addLink(Core1, Core2, **linkopts)
        self.addLink(Core1, Agg1, **linkopts)
        self.addLink(Core2, Agg1, **linkopts)
        self.addLink(Core1, Agg2, **linkopts)
        self.addLink(Core2, Agg2, **linkopts)
        self.addLink(Core1, Agg3, **linkopts)
        self.addLink(Core2, Agg3, **linkopts)
        self.addLink(Core1, Agg4, **linkopts)
        self.addLink(Core2, Agg4, **linkopts)
        #connect each aggregator to one peer, 1 GB connections:
        linkopts = dict(bw=self.bw_agg)
        self.addLink(Agg1, Agg2, **linkopts)
        self.addLink(Agg2, Agg3, **linkopts)
        self.addLink(Agg3, Agg4, **linkopts)
        #Connect each aggregator to an edge, all 1 GB connections:
        logger.debug("adding ag to edge links")
        for j in range(0, 5):
            self.addLink(Agg1, self.EdgeSwitches[j], **linkopts)
            self.addLink(Agg2, self.EdgeSwitches[j], **linkopts)
        print("added forst 5hosts")
        for k in range(5, 10):
            self.addLink(Agg3, self.EdgeSwitches[k], **linkopts)
            self.addLink(Agg4, self.EdgeSwitches[k], **linkopts)
        print("Added second 5 hosts")
        #connect each edge switch to one peer
        print("adding 10 edge switch links")
        for m in range(0, 9):
            self.addLink(self.EdgeSwitches[m], self.EdgeSwitches[m + 1],
                         **linkopts)
        #Connect each edge switch to 10 hosts
        logger.debug("adding edge to host links")
        linkopts = dict(bw=self.bw_edge)
        counter = 0
        for l in range(0, 10):
            for m in range(0, 10):
                self.addLink(self.EdgeSwitches[l], self.Hosts[counter],
                             **linkopts)
                counter = counter + 1
Beispiel #57
0
    def __init__(self):
        "Create Fat tree Topology"

        Topo.__init__(self)

#Add hosts
        h1 = self.addHost('h1', cls=Host, ip='10.0.1.1', defaultRoute=None)
        h2 = self.addHost('h2', cls=Host, ip='10.0.1.2', defaultRoute=None)
        h3 = self.addHost('h3', cls=Host, ip='10.0.1.3', defaultRoute=None)
        h4 = self.addHost('h4', cls=Host, ip='10.0.1.4', defaultRoute=None)
        
        h5 = self.addHost('h5', cls=Host, ip='10.0.2.5', defaultRoute=None)
        h6 = self.addHost('h6', cls=Host, ip='10.0.2.6', defaultRoute=None)
        h7 = self.addHost('h7', cls=Host, ip='10.0.2.7', defaultRoute=None)
        h8 = self.addHost('h8', cls=Host, ip='10.0.2.8', defaultRoute=None)
        
        h11 = self.addHost('h11', cls=Host, ip='10.0.3.1', defaultRoute=None)
        h12 = self.addHost('h12', cls=Host, ip='10.0.3.2', defaultRoute=None)
        h13 = self.addHost('h13', cls=Host, ip='10.0.3.3', defaultRoute=None)
        h14 = self.addHost('h14', cls=Host, ip='10.0.3.4', defaultRoute=None)
        
        h15 = self.addHost('h15', cls=Host, ip='10.0.4.5', defaultRoute=None)
        h16 = self.addHost('h16', cls=Host, ip='10.0.4.6', defaultRoute=None)
        h17 = self.addHost('h17', cls=Host, ip='10.0.4.7', defaultRoute=None)
        h18 = self.addHost('h18', cls=Host, ip='10.0.4.8', defaultRoute=None

#Add switches
    ### Edge Switches
        s1  = self.addSwitch('s1' , cls=OVSKernelSwitch)
        s2  = self.addSwitch('s2' , cls=OVSKernelSwitch)
        s3  = self.addSwitch('s3' , cls=OVSKernelSwitch)
        s4  = self.addSwitch('s4' , cls=OVSKernelSwitch)
        
        s5  = self.addSwitch('s5', cls=OVSKernelSwitch)
        s6  = self.addSwitch('s6', cls=OVSKernelSwitch)
        s7  = self.addSwitch('s7', cls=OVSKernelSwitch)
        s8  = self.addSwitch('s8', cls=OVSKernelSwitch)

    ### Aggregation Switch
        s9  = self.addSwitch('s9', cls=OVSKernelSwitch)
        s10 = self.addSwitch('s10', cls=OVSKernelSwitch)
        s11 = self.addSwitch('s11', cls=OVSKernelSwitch)
        s12 = self.addSwitch('s12', cls=OVSKernelSwitch)

        s13 = self.addSwitch('s13' , cls=OVSKernelSwitch)
        s14 = self.addSwitch('s14' , cls=OVSKernelSwitch)
        s15 = self.addSwitch('s15', cls=OVSKernelSwitch)
        s16 = self.addSwitch('s16', cls=OVSKernelSwitch)

    ### Core Switches
        s21  = self.addSwitch('s21' , cls=OVSKernelSwitch)
        s22  = self.addSwitch('s22' , cls=OVSKernelSwitch)
        s23  = self.addSwitch('s23' , cls=OVSKernelSwitch)
        s24  = self.addSwitch('s24' , cls=OVSKernelSwitch)
        
#Add links
    ### Add Edge
        self.addLink(h1, s1)
        self.addLink(h2, s1)
        self.addLink(h3, s2)
        self.addLink(h4, s2)

        self.addLink(h5, s3)
        self.addLink(h6, s3)
        self.addLink(h7, s4)
        self.addLink(h8, s4)

        self.addLink(h11, s5)
        self.addLink(h12, s5)
        self.addLink(h13, s6)
        self.addLink(h14, s6)

        self.addLink(h15, s7)
        self.addLink(h16, s7)
        self.addLink(h17, s8)
        self.addLink(h18, s8)

    ### Add Aggregation
        self.addLink(s1, s9)
        self.addLink(s1, s10)
        self.addLink(s2, s10)
        self.addLink(s2, s9)

        self.addLink(s3, s11)
        self.addLink(s4, s11)
        self.addLink(s3, s12)
        self.addLink(s4, s12)

        self.addLink(s5, s13)
        self.addLink(s6, s13)
        self.addLink(s5, s14)
        self.addLink(s6, s14)

        self.addLink(s7, s15)
        self.addLink(s8, s15)
        self.addLink(s7, s16)
        self.addLink(s8, s16)

    ### Add Core
        self.addLink(s7, s15)
        self.addLink(s8, s15)
        self.addLink(s7, s16)
        self.addLink(s8, s16)

        self.addLink(s21, s9)
        self.addLink(s21, s11)
        self.addLink(s21, s13)
        self.addLink(s21, s15)

        self.addLink(s22, s9)
        self.addLink(s22, s11)
        self.addLink(s22, s13)
        self.addLink(s22, s15)

        self.addLink(s23, s10)
        self.addLink(s23, s12)
        self.addLink(s23, s14)
        self.addLink(s23, s16)

        self.addLink(s24, s10)
        self.addLink(s24, s12)
        self.addLink(s24, s14)
        self.addLink(s24, s16)



topos = { 'mytopo': (lambda: fatTreeTopo() ) }
Beispiel #58
0
    def __init__(self):

        # initialize topology
        Topo.__init__(self)
        """ TODO: construct 2x2 leaf-spine topology """
Beispiel #59
0
    def __init__(self, cpu=.1, max_queue_size=None, **params):
        '''
        nat+--+              +-----------+h1
              |              +-----------+h2
              +-------+s1+---+-----------+h3
                             +-----------+NAT+---+---+h4
                                                 +---+h5

        '''
        # Initialize topo
        Topo.__init__(self, **params)
        ###Thanks to Sean Donivan for the NAT code####
        natIP = '10.0.0.222'
        rogueNAT = '192.168.1.1'
        # Host and link configuration
        hostConfig = {'cpu': cpu, 'defaultRoute': 'via ' + natIP}
        hostNat = {'defaultRoute': 'via ' + rogueNAT}
        LinkConfig = {
            'bw': 10,
            'delay': '1ms',
            'loss': 0,
            'max_queue_size': max_queue_size
        }
        #################################################
        print "Adding Switch"
        #add Single Switch
        s1 = self.addSwitch('s1', protocols='OpenFlow13')
        s2 = self.addSwitch('s2')

        print "Adding h1, h2, and h3; connecting to Switch"
        #add six hosts with IP assigned
        h1 = self.addHost('h1',
                          mac='00:00:00:00:00:01',
                          ip="10.0.0.1",
                          **hostConfig)
        self.addLink(s1, h1, 1, 1, **LinkConfig)

        h2 = self.addHost('h2',
                          mac='00:00:00:00:00:02',
                          ip="10.0.0.2",
                          **hostConfig)
        self.addLink(s1, h2, 2, 1, **LinkConfig)

        h3 = self.addHost('h3',
                          mac='00:00:00:00:00:03',
                          ip="10.0.0.3",
                          **hostConfig)
        self.addLink(s1, h3, 3, 1, **LinkConfig)

        # Create and add NAT
        print "Building NAT"
        self.nat = self.addNode('nat',
                                cls=NAT,
                                mac='00:00:00:00:0A:AC',
                                ip=natIP,
                                inNamespace=False)
        self.addLink(s1, self.nat, port1=8)

        # Create and add Rogue NAT

        self.nat1 = self.addNode('nat1',
                                 cls=NAT,
                                 mac='00:00:00:00:11:22',
                                 ip='10.0.0.14',
                                 subnet='192.168.1.0/24',
                                 inetIntf='nat1-eth0',
                                 localIntf='nat1-eth1',
                                 **hostConfig)
        self.addLink(s1, self.nat1, port1=4)
        natParams = {'ip': '192.168.1.1/24'}
        self.addLink(s2, self.nat1, intfName1='nat1-eth1', params1=natParams)

        print "Connecting h4 and h5 to Rogue NAT"
        # add host and connect to the Rogue NAT
        h4 = self.addHost('h4',
                          mac='00:00:00:00:11:00',
                          ip='192.168.1.100/24',
                          defaultRoute='via 192.168.1.1')
        h5 = self.addHost('h5',
                          mac='00:00:00:00:11:01',
                          ip='192.168.1.101/24',
                          defaultRoute='via 192.168.1.1')
        self.addLink(h4, s2)
        self.addLink(h5, s2)
Beispiel #60
0
    def __init__(self):
        "Create custom topo."

        # Initialize topology
        Topo.__init__(self)

        # Add nodes for domain 1
        d1rm = self.addHost('d1rm')
        d1pub1 = self.addHost('d1pub1')
        d1sub1 = self.addHost('d1sub1')
        d1br1 = self.addHost('d1br1')

        s1 = self.addSwitch('s1')

        # Add links for domain 1
        self.addLink(d1rm, s1, port1=1, port2=1)
        self.addLink(d1sub1, s1, port1=1, port2=2)
        self.addLink(d1pub1, s1, port1=1, port2=3)
        self.addLink(d1br1, s1, port1=2, port2=4)

        # Add nodes for domain 2
        d2rm = self.addHost('d2rm')
        d2pub1 = self.addHost('d2pub1')
        d2sub1 = self.addHost('d2sub1')
        d2br1 = self.addHost('d2br1')

        s2 = self.addSwitch('s2')

        # Add links for domain 2
        self.addLink(d2rm, s2, port1=1, port2=1)
        self.addLink(d2sub1, s2, port1=1, port2=2)
        self.addLink(d2pub1, s2, port1=1, port2=3)
        self.addLink(d2br1, s2, port1=2, port2=4)

        # Add nodes for domain 3
        d3rm = self.addHost('d3rm')
        d3pub1 = self.addHost('d3pub1')
        d3sub1 = self.addHost('d3sub1')
        d3br1 = self.addHost('d3br1')
        d3br2 = self.addHost('d3br2')
        d3br3 = self.addHost('d3br3')

        s3 = self.addSwitch('s3')

        # Add links for domain 3
        self.addLink(d3rm, s3, port1=1, port2=1)
        self.addLink(d3sub1, s3, port1=1, port2=2)
        self.addLink(d3pub1, s3, port1=1, port2=3)
        self.addLink(d3br1, s3, port1=2, port2=4)
        self.addLink(d3br2, s3, port1=2, port2=5)
        self.addLink(d3br3, s3, port1=2, port2=6)

        # Add nodes for domain 4
        d4rm = self.addHost('d4rm')
        d4pub1 = self.addHost('d4pub1')
        d4sub1 = self.addHost('d4sub1')
        d4br1 = self.addHost('d4br1')

        s4 = self.addSwitch('s4')

        # Add links for domain 4
        self.addLink(d4rm, s4, port1=1, port2=1)
        self.addLink(d4sub1, s4, port1=1, port2=2)
        self.addLink(d4pub1, s4, port1=1, port2=3)
        self.addLink(d4br1, s4, port1=2, port2=4)

        # Add nodes for domain 5
        d5rm = self.addHost('d5rm')
        d5pub1 = self.addHost('d5pub1')
        d5sub1 = self.addHost('d5sub1')
        d5cr2 = self.addHost('d5cr2')
        d5br1 = self.addHost('d5br1')
        d5br2 = self.addHost('d5br2')
        d5br3 = self.addHost('d5br3')

        s5 = self.addSwitch('s5')

        # Add links for domain 5
        self.addLink(s5, d5cr2, port1=1, port2=1)
        self.addLink(d5rm, d5cr2, port1=1, port2=2)
        self.addLink(d5sub1, s5, port1=1, port2=2)
        self.addLink(d5pub1, d5cr2, port1=1, port2=3)
        self.addLink(d5br1, s5, port1=2, port2=3)
        self.addLink(d5br3, s5, port1=2, port2=4)
        self.addLink(d5br2, d5cr2, port1=2, port2=4)

        # Add nodes for domain 6
        d6rm = self.addHost('d6rm')
        d6pub1 = self.addHost('d6pub1')
        d6sub1 = self.addHost('d6sub1')
        d6br1 = self.addHost('d6br1')
        d6br2 = self.addHost('d6br2')

        s6 = self.addSwitch('s6')

        # Add links for domain 6
        self.addLink(d6rm, s6, port1=1, port2=1)
        self.addLink(d6sub1, s6, port1=1, port2=2)
        self.addLink(d6pub1, s6, port1=1, port2=3)
        self.addLink(d6br1, s6, port1=2, port2=4)
        self.addLink(d6br2, s6, port1=3, port2=5)

        # Add nodes for inter domain path
        s13 = self.addSwitch('s13')
        s23 = self.addSwitch('s23')
        s36 = self.addSwitch('s36')
        s45 = self.addSwitch('s45')
        s56 = self.addSwitch('s56')