Beispiel #1
0
 def testMinimal(self):
     "Ping test with both datapaths on minimal topology"
     init()
     for switch in SWITCHES.values():
         controllerParams = ControllerParams('10.0.0.0', 8)
         mn = Mininet(SingleSwitchTopo(), switch, Host, Controller,
                      controllerParams)
         dropped = mn.run(mn.ping)
         self.assertEqual(dropped, 0)
Beispiel #2
0
 def testLinear5(self):
     "Ping test with both datapaths on a 5-switch topology"
     init()
     for switch in SWITCHES.values():
         controllerParams = ControllerParams('10.0.0.0', 8)
         mn = Mininet(LinearTopo(k=5), switch, Host, Controller,
                      controllerParams)
         dropped = mn.run(mn.ping)
         self.assertEqual(dropped, 0)
Beispiel #3
0
    def __init__( self, topo=None, switch=OVSKernelSwitch, host=Host,
                 controller=Controller,
                 cparams=ControllerParams( '10.0.0.0', 8 ),
                 build=True, xterms=False, cleanup=False,
                 inNamespace=False,
                 autoSetMacs=False, autoStaticArp=False, listenPort=None,
                 defVendor=False ):
        """Create Mininet object.
           topo: Topo (topology) object or None
           switch: Switch class
           host: Host class
           controller: Controller class
           cparams: ControllerParams object
           build: build now from topo?
           xterms: if build now, spawn xterms?
           cleanup: if build now, cleanup before creating?
           inNamespace: spawn switches and controller in net namespaces?
           autoSetMacs: set MAC addrs from topo?
           autoStaticArp: set all-pairs static MAC addrs?
           listenPort: base listening port to open; will be incremented for
               each additional switch in the net if inNamespace=False"""
        self.switch = switch
        self.host = host
        self.controller = controller
        self.cparams = cparams
        self.topo = topo
        self.inNamespace = inNamespace
        self.xterms = xterms
        self.cleanup = cleanup
        self.autoSetMacs = autoSetMacs
        self.autoStaticArp = autoStaticArp
        self.listenPort = listenPort
        self.defVendor = defVendor

        self.hosts = []
        self.switches = []
        self.controllers = []
        self.nameToNode = {}  # name to Node (Host/Switch) objects
        self.idToNode = {}  # dpid to Node (Host/Switch) objects
        self.dps = 0  # number of created kernel datapaths
        self.terms = []  # list of spawned xterm processes

        # current port to use for TCP testing. 
        # will be incremented for each test
        self.minTcpPort = 33000
        self.curTcpPort = self.minTcpPort 
        self.maxTcpPort = 39000

        init()
        switch.setup()

        self.built = False
        if topo and build:
            self.build()