blob: 581084c3659b2cb4e0c57ca3a839c53ee3733a8a [file] [log] [blame]
Adminc0ed1192015-10-10 14:18:26 -07001#!/usr/bin/python
2
3from mininet.topo import Topo
4from mininet.node import RemoteController
5from mininet.net import Mininet
6from mininet.util import irange
7from mininet.cli import CLI
8from mininet.log import setLogLevel
9
10class OltTopo( Topo ):
11 "Single switch with OLT port 129 and configurable number of ONU ports"
12
13 def build( self, k=1, **_opts ):
14 "k: number of onu"
15 self.k = k
16 switch = self.addSwitch( 's1' )
17 for h in irange( 1, k ):
18 host = self.addHost( 'h%s' % h, inNamespace=False )
19 self.addLink( host, switch )
20
21 olt_port = self.addHost( 'h129', inNamespace=False )
22 self.addLink( olt_port, switch, port2=129 )
23
24if __name__ == '__main__':
25 setLogLevel('debug')
Jonathan Hartf65e1812015-10-05 15:15:37 -070026 topo = OltTopo(k=2)
Adminc0ed1192015-10-10 14:18:26 -070027
28 net = Mininet( topo=topo, controller=RemoteController )
29
30 net.start()
31
32 CLI( net )
33
34 net.stop()