Guest User

Untitled

a guest
Oct 20th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. from mininet.net import Mininet
  4. from mininet.node import Controller, OVSKernelAP
  5. from mininet.cli import CLI
  6. from mininet.log import setLogLevel
  7. from mininet.link import TCLink
  8. import sys
  9.  
  10. def topology():
  11. "Create a network."
  12. net = Mininet(controller=Controller, link=TCLink)
  13.  
  14. print "*** Creating nodes"
  15. h1 = net.addHost('h1')
  16. h2 = net.addHost('h2')
  17. h3 = net.addHost('h3')
  18. h4 = net.addHost('h4')
  19. s1 = net.addSwitch('s1')
  20. s2 = net.addSwitch('s2')
  21. c0 = net.addController('c0', controller=Controller, ip='127.0.0.1', port=6633)
  22.  
  23. print "*** Configuring wifi nodes"
  24. net.configureWifiNodes()
  25.  
  26. print "*** Associating Stations"
  27. net.addLink(h1, s1)
  28. net.addLink(h2, s1)
  29. net.addLink(h3, s2)
  30. net.addLink(h4, s2)
  31.  
  32. print "*** Starting network"
  33. net.build()
  34. c0.start()
  35. s1.start([c0])
  36. s2.start([c0])
  37.  
  38. print "*** Running CLI"
  39. CLI(net)
  40.  
  41. print "*** Stopping network"
  42. net.stop()
  43.  
  44. if __name__ == '__main__':
  45. setLogLevel('info')
  46. topology()
Add Comment
Please, Sign In to add comment