def setUp(config): topo = SFOTopology(bw=config.bw, delay=config.delay, loss=config.loss, bg=config.bg) net = Mininet(topo=topo, controller=RemoteController('onos'), link=TCLink, autoSetMacs=True) server = net.get('server') h1 = net.get('h1') h2 = net.get('h2') server.intfs[1].setIP('10.0.1.3/24') server.cmd('ip rule add from 10.0.1.3 table 2') server.cmd('ip route add default dev server-eth1 table 2') # configure additional interfaces h1.intfs[0].setIP('10.0.0.1/24') h1.intfs[1].setIP('10.0.1.1/24') h1.cmd('ip rule add from 10.0.1.1 table 2') h1.cmd('ip route add default dev h1-eth1 table 2') h2.intfs[0].setIP('10.0.0.2/24') h2.intfs[1].setIP('10.0.1.2/24') h2.cmd('ip rule add from 10.0.1.2 table 2') h2.cmd('ip route add default dev h2-eth1 table 2') net.start() net.interact() net.stop()
def runAndInteractTopology(): "Create network and run simple performance test" topo = SpecialTopo(100, 10) net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink, controller=RemoteController) net.start() net.interact() net.stop()
def topoTest(): "Create network and run simple performance test" topo = ITATopo() # topo = ITATopo(12, 10) net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink) net.interact()
def main(): topo = PyRouterTopo(args) net = Mininet(topo=topo, link=TCLink, autoSetMacs=True, cleanup=True, listenPort=10001, controller=RemoteController) mb = net.get('mb') mb.setIP('0.0.0.0') # don't set an IP address on middlebox net.staticArp() start_webservers(net) net.interact()
def main(): topo = PyRouterTopo(args) net = Mininet(topo=topo, link=TCLink, cleanup=True, autoSetMacs=True, controller=None) setup_addressing(net) net.staticArp() net.interact()
def treeTopo(): #make Tree Topology tree_topo = TreeTopo() #Add remote controller and topology to network net = Mininet(topo=tree_topo, controller=RemoteController) #start network, start CLI and stop mininet network net.interact()
def mobilityTest(): info('* creating mobility Network\n') global net info('* Starting network:\n') net = Mininet(topo=MyTopo(), switch=MobilitySwitch, controller=RemoteController) net.start() info('* Get IP-Addresses for hosts..\n') startDHCPclient(net.get("ha")) startDHCPclient(net.get("hb")) startDHCPclient(net.get("hc")) net.interact()
def StartScripts(): topo = RoundRobinTopo() net = Mininet(topo, controller=lambda name:RemoteController(name, deafultIP='127.0.0.1'), listenPort=6633) net.start() h1, h2, h3 = net.get('h1', 'h2', 'h3') #h1.cmd('./wget.sh') h1.cmd('python -m SimpleHTTPServer 80 &') h2.cmd('python -m SimpleHTTPServer 80 &') h3.cmd('python -m SimpleHTTPServer 80 &') sleep(5) h4, h5, h6 = net.get('h4', 'h5', 'h6') h4.cmd('wget -O - 10.0.0.1') h4.cmd('wget -O - 10.0.0.2') h4.cmd('wget -O - 10.0.0.3') h4.cmd('./randomConnect.sh &') h5.cmd('./randomConnect.sh &') h6.cmd('./randomConnect.sh &') net.interact() net.stop()
def StartScripts(): topo = RoundRobinTopo() net = Mininet( topo, controller=lambda name: RemoteController(name, deafultIP='127.0.0.1'), listenPort=6633) net.start() h1, h2, h3 = net.get('h1', 'h2', 'h3') #h1.cmd('./wget.sh') h1.cmd('python -m SimpleHTTPServer 80 &') h2.cmd('python -m SimpleHTTPServer 80 &') h3.cmd('python -m SimpleHTTPServer 80 &') sleep(5) h4, h5, h6 = net.get('h4', 'h5', 'h6') h4.cmd('wget -O - 10.0.0.1') h4.cmd('wget -O - 10.0.0.2') h4.cmd('wget -O - 10.0.0.3') h4.cmd('./randomConnect.sh &') h5.cmd('./randomConnect.sh &') h6.cmd('./randomConnect.sh &') net.interact() net.stop()
def main(): topo = MyTopo(args) net = Mininet(topo=topo, link=TCLink, cleanup=True) net.interact()
build_prox(args.prox) wait_on_controller() mn = Mininet( topo=MyTopo(), autoSetMacs=True, autoStaticArp=True, controller=RemoteController, switch=OVSKernelSwitch ) mn.start() sleep(2) # yuk for src in mn.hosts: for dst in mn.hosts: if src != dst: # This is to work around a bug in the version of mininet on the VM src.setARP(ip=dst.IP(), mac=dst.intf(None).MAC()) # Magic for floodlight to map MAC addresses to switch ports src.setARP(ip=MAGIC_IP, mac=MAGIC_MAC) src.cmd("ping", "-c1", "-W1", MAGIC_IP) px = Prox(mn.getNodeByName("prox"), args.plog) px.start() mn.interact() # TODO cleanup threads # vim: set noet ts=4 sw=4 :
def StartScripts(): topo = SimpleTopo() net = Mininet(topo) net.start() net.interact() net.stop()
def main(): topo = PyRouterTopo(args) net = Mininet(topo=topo, link=TCLink, cleanup=True, autoSetMacs=True) setup_addressing(net) net.staticArp() net.interact()
def main(): topo = PyRouterTopo(args) net = Mininet(topo=topo, link=TCLink, cleanup=True, controller=None) setup_addressing(net) disable_ipv6(net) net.interact()
def main(): topo = PySwitchTopo(args) net = Mininet(controller=None, topo=topo, link=TCLink, cleanup=True) setup_addressing(net) net.interact()
def __init__( self ): # Initialize topology Topo.__init__( self ) # Add hosts h1 = self.addHost( 'h1' ) # Valid user h2 = self.addHost( 'h2' ) # Invalid malicious user h3 = self.addHost( 'h3' ) # Invalid DDoS user s1 = self.addSwitch( 's1', protocols='OpenFlow13') # Add links between switches and hosts self.addLink( h1, s1 ) self.addLink( h2, s1 ) self.addLink( h3, s1 ) if __name__ == '__main__': testTopo = TestTopo() remoteCtrl = RemoteController( 'ctrl', ip='127.0.0.1', port=6653 ) net = Mininet( topo=testTopo, controller=remoteCtrl, switch=OVSKernelSwitch, autoSetMacs=True ) # Connect real interfaces to switch Intf( 'brApache', node=net.switches[0] ) # Apache server # Intf( 'enp0s3 ', node=net.switches[0] ) # Internet net.start() net.interact()
def main(): topo = PyRouterTopo(args) net = Mininet(topo=topo, link=TCLink, cleanup=True) net.build() setup_addressing(net) net.interact()
def main(): topo = PyRouterTopo(args) net = Mininet(topo=topo, link=TCLink, cleanup=True) setup_addressing(net) net.interact()
def Client(): h2 = net.get("h2") result = h2.cmd("sudo python ~/Desktop/pythonClient.py") print(result) try: thread1 = Thread(target=Server) thread2 = Thread(target=Client) print("starting thread 1") thread1.start() time.sleep(3) print("starting thread 2") thread2.start() except: print("could not start threads") #let client and server run for a bit time.sleep(3) net.interact() h1 = net.get("h1") h1.terminate h2 = net.get("h2") h2.terminate time.sleep(3) net.stop() #always do cleanup of mininet os.system("sudo mn -c")
def StartScripts(): topo = MassSetupTopo(300) net = Mininet(topo) net.start net.interact() net.stop()