blob: 438a59f5e056e9dc8ba131f96ef6513468672e5a [file] [log] [blame]
#!/usr/bin/python
from mininet.topo import Topo
from mininet.node import RemoteController
from mininet.net import Mininet
from mininet.util import irange
from mininet.cli import CLI
from mininet.log import setLogLevel
class OltTopo( Topo ):
"Single switch with OLT port 129 and configurable number of ONU ports"
def build( self, k=1, **_opts ):
"k: number of onu"
self.k = k
switch = self.addSwitch( 's1' )
for h in irange( 1, k ):
host = self.addHost( 'h%s' % h, inNamespace=False )
self.addLink( host, switch )
olt_port = self.addHost( 'h129', inNamespace=False )
self.addLink( olt_port, switch, port2=129 )
if __name__ == '__main__':
setLogLevel('debug')
topo = OltTopo()
net = Mininet( topo=topo, controller=RemoteController )
net.start()
CLI( net )
net.stop()