blob: 438a59f5e056e9dc8ba131f96ef6513468672e5a [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')
26 topo = OltTopo()
27
28 net = Mininet( topo=topo, controller=RemoteController )
29
30 net.start()
31
32 CLI( net )
33
34 net.stop()