diff --git a/Makefile b/Makefile index 58e7c55e0ac5ab7bc24def4decc07b4be0573ab3..56bca3e1c34c3604e41a73ee9b8058d4d3694d5a 100644 --- a/Makefile +++ b/Makefile @@ -17,3 +17,9 @@ codecheck: $(PYSRC) test: $(MININET) $(TEST) mininet/test/test_nets.py + +install: + python setup.py install + + + diff --git a/mininet/net.py b/mininet/net.py index 8f2addce260ff7f162749ea1e271330868e51a13..c8eb18c578e8e878d1ea6b3d77899e25a7e7ba93 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -1,7 +1,10 @@ #!/usr/bin/python -"""Mininet: A simple networking testbed for OpenFlow! -author: Bob Lantz ( rlantz@cs.stanford.edu ) -author: Brandon Heller ( brandonh@stanford.edu ) +""" + + Mininet: A simple networking testbed for OpenFlow! + +author: Bob Lantz (rlantz@cs.stanford.edu) +author: Brandon Heller (brandonh@stanford.edu) Mininet creates scalable OpenFlow test networks by using process-based virtualization and network namespaces. @@ -11,9 +14,9 @@ top of a single Linux kernel. Each host has: -A virtual console ( pipes to a shell ) -A virtual interfaces ( half of a veth pair ) -A parent shell ( and possibly some child processes ) in a namespace +A virtual console (pipes to a shell) +A virtual interfaces (half of a veth pair) +A parent shell (and possibly some child processes) in a namespace Hosts have a network interface which is configured via ifconfig/ip link/etc. @@ -24,24 +27,28 @@ In kernel datapath mode, the controller and switches are simply processes in the root namespace. -Kernel OpenFlow datapaths are instantiated using dpctl( 8 ), and are +Kernel OpenFlow datapaths are instantiated using dpctl(8), and are attached to the one side of a veth pair; the other side resides in the host namespace. In this mode, switch processes can simply connect to the controller via the loopback interface. In user datapath mode, the controller and switches are full-service nodes that live in their own network namespaces and have management -interfaces and IP addresses on a control network ( e.g. 10.0.123.1, -currently routed although it could be bridged. ) +interfaces and IP addresses on a control network (e.g. 10.0.123.1, +currently routed although it could be bridged.) In addition to a management interface, user mode switches also have several switch interfaces, halves of veth pairs whose other halves reside in the host nodes that the switches are connected to. Naming: -Host nodes are named h1-hN -Switch nodes are named s0-sN -Interfaces are named { nodename }-eth0 .. { nodename }-ethN,""" + + Host nodes are named h1-hN + Switch nodes are named s0-sN + Interfaces are named { nodename }-eth0 .. { nodename }-ethN + +""" + import os import re import signal @@ -79,7 +86,7 @@ def __init__( self, topo, switch, host, controller, cparams, autoSetMacs=False, autoStaticArp=False ): """Create Mininet object. topo: Topo object - switch: Switch class + switch: Switch class host: Host class controller: Controller class cparams: ControllerParams object @@ -219,7 +226,8 @@ def _configureRoutedControlNetwork( self ): lg.info( '\n' ) lg.info( '*** Testing control network\n' ) while not controller.intfIsUp( controller.intfs[ 0 ] ): - lg.info( '*** Waiting for %s to come up\n', controller.intfs[ 0 ] ) + lg.info( '*** Waiting for %s to come up\n', + controller.intfs[ 0 ] ) sleep( 1 ) for switchDpid in self.topo.switches(): switch = self.nodes[ switchDpid ] @@ -509,21 +517,21 @@ def __init__( self, mininet ): # Commands def help( self, args ): "Semi-useful help for CLI." - helpStr = ( 'Available commands are:' + str( self.cmds ) + '\n' + - 'You may also send a command to a node using:\n' + - ' <node> command {args}\n' + - 'For example:\n' + - ' mininet> h0 ifconfig\n' + - '\n' + - 'The interpreter automatically substitutes IP ' + - 'addresses\n' + - 'for node names, so commands like\n' + - ' mininet> h0 ping -c1 h1\n' + - 'should work.\n' + - '\n\n' + - 'Interactive commands are not really supported yet,\n' + - 'so please limit commands to ones that do not\n' + - 'require user interaction and will terminate\n' + + helpStr = ( 'Available commands are:' + str( self.cmds ) + '\n' + 'You may also send a command to a node using:\n' + ' <node> command {args}\n' + 'For example:\n' + ' mininet> h0 ifconfig\n' + '\n' + 'The interpreter automatically substitutes IP ' + 'addresses\n' + 'for node names, so commands like\n' + ' mininet> h0 ping -c1 h1\n' + 'should work.\n' + '\n\n' + 'Interactive commands are not really supported yet,\n' + 'so please limit commands to ones that do not\n' + 'require user interaction and will terminate\n' 'after a reasonable amount of time.\n' ) print( helpStr ) diff --git a/mininet/node.py b/mininet/node.py index 020ceefd9cdf6a7a521a59ae2b6b77207622867c..f8ff55dda860fe574bb2c1c6ee4ea6b6ff327dca 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -28,7 +28,7 @@ def __init__( self, name, inNamespace=True ): if self.inNamespace: cmd = [ 'netns' ] + cmd self.shell = Popen( cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT, - closeFds=closeFds ) + close_fds=closeFds ) self.stdin = self.shell.stdin self.stdout = self.shell.stdout self.pollOut = select.poll() diff --git a/mininet/util.py b/mininet/util.py index 4c0154b4c0248ad4ce65cded3ff551e5381da737..c12417cb6a1506b3a9b215a2ad71a3bff213e837 100644 --- a/mininet/util.py +++ b/mininet/util.py @@ -100,7 +100,7 @@ def moveIntf( intf, node, printError=False, retries=3, delaySecs=0.001 ): intf: string, interface node: Node object printError: if true, print error""" - retry( retries, delaySecs, moveIntf, intf, node, printError ) + retry( retries, delaySecs, moveIntfNoRetry, intf, node, printError ) def createLink( node1, node2, retries=10, delaySecs=0.001 ): """Create a link between nodes, making an interface for each.