blob: 2299d9eaad2a8c27b8389f47a982579aaae563b5 [file] [log] [blame]
GlennRCa5391372015-10-14 17:28:15 -07001#!/usr/bin/python
2
3"""
4Custom topology for Mininet
5"""
6from mininet.topo import Topo
7from mininet.net import Mininet
8from mininet.node import Host, RemoteController
9from mininet.node import Node
10from mininet.node import CPULimitedHost
11from mininet.link import TCLink
12from mininet.cli import CLI
13from mininet.log import setLogLevel
14from mininet.util import dumpNodeConnections
15from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
16
17class MyTopo( Topo ):
18
19 def __init__( self ):
20 # Initialize topology
21 Topo.__init__( self )
22 # Switch S5 Hosts
23 host1=self.addHost( 'h1', ip='10.1.0.1/24' )
24 host2=self.addHost( 'h2', ip='10.1.0.2/24' )
25 #host3=self.addHost( 'h3', ip='10.1.0.3/24', v6Addr='1000::3/64' )
26 #host4=self.addHost( 'h4', ip='10.1.0.4/24', v6Addr='1000::4/64' )
27
28 s1 = self.addSwitch( 's1' )
29 #s2 = self.addSwitch( 's2' )
30
31 self.addLink(s1, host1)
32 self.addLink(s1, host2)
33 #self.addLink(s1, host3)
34 #self.addLink(s1, host4)
35
36
37 topos = { 'mytopo': ( lambda: MyTopo() ) }
38
39def setupNetwork():
40 "Create network"
41 topo = MyTopo()
42 network = Mininet(topo=topo, autoSetMacs=True, controller=None)
43 network.start()
44 CLI( network )
45 network.stop()
46
47if __name__ == '__main__':
48 setLogLevel('info')
49 #setLogLevel('debug')
50 setupNetwork()