Esempio n. 1
0
def setupTest(main, test_idx, onosNodes):
    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
    import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator

    try:
        skipPackage = False
        init = False
        if not hasattr(main, "apps"):
            init = True
            lib.initTest(main)
        # Skip onos packaging if the cluster size stays the same
        if not init and onosNodes == main.Cluster.numCtrls:
            skipPackage = True

        main.resultFileName = "CASE%03d" % test_idx
        main.Cluster.setRunningNode(onosNodes)
        lib.installOnos(main, skipPackage=skipPackage, cliSleep=5)
        # Load configuration files
        main.step("Load configurations")
        main.cfgName = "TEST_CONFIG_ipv4=1_ipv6=1" if hasattr(
            main, "Mininet1") else main.params["DEPENDENCY"]["confName"]
        if main.useBmv2:
            # Translate configuration file from OVS-OFDPA to BMv2 driver
            translator.bmv2ToOfdpa(
                main)  # Try to cleanup if switching between switch types
            switchPrefix = main.params['DEPENDENCY'].get(
                'switchPrefix', "bmv2")
            translator.ofdpaToBmv2(main, switchPrefix=switchPrefix)
        else:
            translator.bmv2ToOfdpa(main)
        lib.loadJson(main)
        time.sleep(float(main.params["timers"]["loadNetcfgSleep"]))
        main.cfgName = "common" if hasattr(
            main, "Mininet1") else main.params["DEPENDENCY"]["confName"]
        lib.loadMulticastConfig(main)
        lib.loadHost(main)

        if hasattr(main, "Mininet1"):
            # Run the test with Mininet
            mininet_args = " --dhcp=1 --routers=1 --ipv6=1 --ipv4=1"
            if main.useBmv2:
                mininet_args += ' --switch %s' % main.switchType
                main.log.info("Using %s switch" % main.switchType)
            lib.startMininet(main,
                             main.params["DEPENDENCY"]["topology"],
                             args=mininet_args)
            time.sleep(float(main.params["timers"]["startMininetSleep"]))
        else:
            # Run the test with physical devices
            lib.connectToPhysicalNetwork(main)

        # Create scapy components
        lib.startScapyHosts(main)
        # Verify host IP assignment
        lib.verifyOnosHostIp(main)
        lib.verifyNetworkHostIp(main)
    except Exception as e:
        main.log.exception("Error in setupTest")
        main.skipCase(result="FAIL", msg=e)
Esempio n. 2
0
    def runTest( main, testIndex, onosNodes, description, dhcpRelay=False, remoteServer=False, multipleServer=False, ipv6=False, vlan=[], dualHomed=False ):
        skipPackage = False
        init = False
        if not hasattr( main, 'apps' ):
            init = True
            run.initTest( main )
        # Skip onos packaging if the clusrer size stays the same
        if not init and onosNodes == main.Cluster.numCtrls:
            skipPackage = True

        main.case( '%s, with %d ONOS instance%s' %
                   ( description, onosNodes, 's' if onosNodes > 1 else '' ) )

        main.cfgName = 'CASE%02d' % testIndex
        main.resultFileName = 'CASE%02d' % testIndex
        main.Cluster.setRunningNode( onosNodes )
        run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
        if main.useBmv2:
            # Translate configuration file from OVS-OFDPA to BMv2 driver
            translator.ofdpaToBmv2( main )
        else:
            translator.bmv2ToOfdpa( main )
        run.loadJson( main )
        run.loadHost( main )
        if hasattr( main, 'Mininet1' ):
            # Run the test with Mininet
            if dualHomed:
                mininet_args = ' --spine=2 --leaf=4 --dual-homed'
            else:
                mininet_args = ' --spine=2 --leaf=2'
            mininet_args += ' --dhcp-client'
            if dhcpRelay:
                mininet_args += ' --dhcp-relay'
                if multipleServer:
                    mininet_args += ' --multiple-dhcp-server'
            if remoteServer:
                mininet_args += ' --remote-dhcp-server'
            if ipv6:
                mininet_args += ' --ipv6'
            if len( vlan ) > 0 :
                mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
            if main.useBmv2:
                mininet_args += ' --switch bmv2'
                main.log.info( "Using BMv2 switch" )

            run.startMininet( main, 'trellis_fabric.py', args=mininet_args )
        else:
            # Run the test with physical devices
            # TODO: connect TestON to the physical network
            pass
        run.verifyOnosHostIp( main )
        run.verifyNetworkHostIp( main )

        run.cleanup( main )
Esempio n. 3
0
def setupTest( main, test_idx, onosNodes ):
    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
    import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator

    skipPackage = False
    init = False
    if not hasattr( main, "apps" ):
        init = True
        lib.initTest( main )
    # Skip onos packaging if the cluster size stays the same
    if not init and onosNodes == main.Cluster.numCtrls:
        skipPackage = True

    main.resultFileName = "CASE%03d" % test_idx
    main.Cluster.setRunningNode( onosNodes )
    lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
    # Load configuration files
    main.step( "Load configurations" )
    main.cfgName = "TEST_CONFIG_ipv4=1_ipv6=1" if hasattr( main, "Mininet1" ) else main.params[ "DEPENDENCY" ][ "confName" ]
    if main.useBmv2:
        # Translate configuration file from OVS-OFDPA to BMv2 driver
        translator.ofdpaToBmv2( main )
    else:
        translator.bmv2ToOfdpa( main )
    lib.loadJson( main )
    time.sleep( float( main.params[ "timers" ][ "loadNetcfgSleep" ] ) )
    main.cfgName = "common" if hasattr( main, "Mininet1" ) else main.params[ "DEPENDENCY" ][ "confName" ]
    lib.loadMulticastConfig( main )
    lib.loadHost( main )

    if hasattr( main, "Mininet1" ):
        # Run the test with Mininet
        mininet_args = " --dhcp=1 --routers=1 --ipv6=1 --ipv4=1"
        if main.useBmv2:
            mininet_args += ' --switch bmv2'
            main.log.info( "Using BMv2 switch" )
        lib.startMininet( main, main.params[ "DEPENDENCY" ][ "topology" ], args=mininet_args )
        time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
    else:
        # Run the test with physical devices
        lib.connectToPhysicalNetwork( main )

    # Create scapy components
    lib.startScapyHosts( main )
    # Verify host IP assignment
    lib.verifyOnosHostIp( main )
    lib.verifyNetworkHostIp( main )
Esempio n. 4
0
    def runTest(self,
                main,
                test_idx,
                topology,
                onosNodes,
                description,
                vlan=[]):
        skipPackage = False
        init = False
        if not hasattr(main, 'apps'):
            init = True
            run.initTest(main)
        # Skip onos packaging if the clusrer size stays the same
        if not init and onosNodes == main.Cluster.numCtrls:
            skipPackage = True

        main.case('%s, with %s and %d ONOS instance%s' %
                  (description, self.topo[topology][3], onosNodes,
                   's' if onosNodes > 1 else ''))

        main.cfgName = 'CASE%01d%01d' % (test_idx / 10,
                                         ((test_idx - 1) % 10) % 4 + 1)
        main.Cluster.setRunningNode(onosNodes)
        run.installOnos(main, skipPackage=skipPackage, cliSleep=5)
        if main.useBmv2:
            # Translate configuration file from OVS-OFDPA to BMv2 driver
            translator.ofdpaToBmv2(main)
        else:
            translator.bmv2ToOfdpa(main)
        run.loadJson(main)
        run.loadChart(main)
        if hasattr(main, 'Mininet1'):
            # Run the test with Mininet
            mininet_args = ' --spine=%d --leaf=%d' % (self.topo[topology][0],
                                                      self.topo[topology][1])
            if self.topo[topology][2]:
                mininet_args += ' --dual-homed'
            if len(vlan) > 0:
                mininet_args += ' --vlan=%s' % (','.join(
                    ['%d' % vlanId for vlanId in vlan]))
            if main.useBmv2:
                mininet_args += ' --switch bmv2'
                main.log.info("Using BMv2 switch")

            run.startMininet(main, 'trellis_fabric.py', args=mininet_args)
        else:
            # Run the test with physical devices
            run.connectToPhysicalNetwork(main, self.switchNames[topology])

        run.checkFlows(
            main,
            minFlowCount=self.topo[topology][5 if main.useBmv2 else 4] *
            self.topo[topology][1],
            sleep=5)
        if main.useBmv2:
            leaf_dpid = [
                "device:bmv2:leaf%d" % (ls + 1)
                for ls in range(self.topo[topology][1])
            ]
        else:
            leaf_dpid = [
                "of:%016d" % (ls + 1) for ls in range(self.topo[topology][1])
            ]
        for dpid in leaf_dpid:
            run.checkFlowsByDpid(main,
                                 dpid,
                                 self.topo[topology][5 if main.useBmv2 else 4],
                                 sleep=5)
        run.pingAll(main)

        run.cleanup(main)
Esempio n. 5
0
    def runTest(main,
                testIndex,
                onosNodes,
                description,
                dhcpRelay=False,
                remoteServer=False,
                multipleServer=False,
                ipv6=False,
                vlan=[],
                dualHomed=False):
        skipPackage = False
        init = False
        if not hasattr(main, 'apps'):
            init = True
            run.initTest(main)
        # Skip onos packaging if the clusrer size stays the same
        if not init and onosNodes == main.Cluster.numCtrls:
            skipPackage = True

        main.case('%s, with %d ONOS instance%s' %
                  (description, onosNodes, 's' if onosNodes > 1 else ''))

        main.cfgName = 'CASE%02d' % testIndex
        main.resultFileName = 'CASE%02d' % testIndex
        main.Cluster.setRunningNode(onosNodes)
        run.installOnos(main, skipPackage=skipPackage, cliSleep=5)
        if main.useBmv2:
            # Translate configuration file from OVS-OFDPA to BMv2 driver
            translator.ofdpaToBmv2(main)
        else:
            translator.bmv2ToOfdpa(main)
        run.loadJson(main)
        run.loadHost(main)
        if hasattr(main, 'Mininet1'):
            # Run the test with Mininet
            if dualHomed:
                mininet_args = ' --spine=2 --leaf=4 --dual-homed'
            else:
                mininet_args = ' --spine=2 --leaf=2'
            mininet_args += ' --dhcp-client'
            if dhcpRelay:
                mininet_args += ' --dhcp-relay'
                if multipleServer:
                    mininet_args += ' --multiple-dhcp-server'
            if remoteServer:
                mininet_args += ' --remote-dhcp-server'
            if ipv6:
                mininet_args += ' --ipv6'
            if len(vlan) > 0:
                mininet_args += ' --vlan=%s' % (','.join(
                    ['%d' % vlanId for vlanId in vlan]))
            if main.useBmv2:
                mininet_args += ' --switch bmv2'
                main.log.info("Using BMv2 switch")

            run.startMininet(main, 'trellis_fabric.py', args=mininet_args)
        else:
            # Run the test with physical devices
            # TODO: connect TestON to the physical network
            pass
        run.verifyOnosHostIp(main)
        run.verifyNetworkHostIp(main)

        run.cleanup(main)
Esempio n. 6
0
    def runTest(main,
                testIndex,
                onosNodes,
                description,
                dhcpRelay=False,
                remoteServer=False,
                multipleServer=False,
                ipv6=False,
                vlan=[],
                dualHomed=False):
        try:
            skipPackage = False
            init = False
            if not hasattr(main, 'apps'):
                init = True
                run.initTest(main)
            # Skip onos packaging if the clusrer size stays the same
            if not init and onosNodes == main.Cluster.numCtrls:
                skipPackage = True

            main.case('%s, with %d ONOS instance%s' %
                      (description, onosNodes, 's' if onosNodes > 1 else ''))

            main.cfgName = 'CASE%02d' % testIndex
            main.resultFileName = 'CASE%02d' % testIndex
            main.Cluster.setRunningNode(onosNodes)
            run.installOnos(main, skipPackage=skipPackage, cliSleep=5)
            if main.useBmv2:
                # Translate configuration file from OVS-OFDPA to BMv2 driver
                translator.bmv2ToOfdpa(
                    main)  # Try to cleanup if switching between switch types
                switchPrefix = main.params['DEPENDENCY'].get(
                    'switchPrefix', "bmv2")
                translator.ofdpaToBmv2(main, switchPrefix=switchPrefix)
            else:
                translator.bmv2ToOfdpa(main)
            run.loadJson(main)
            run.loadHost(main)
            if hasattr(main, 'Mininet1'):
                run.mnDockerSetup(main)
                # Run the test with Mininet
                if dualHomed:
                    mininet_args = ' --spine=2 --leaf=4 --dual-homed'
                else:
                    mininet_args = ' --spine=2 --leaf=2'
                mininet_args += ' --dhcp-client'
                if dhcpRelay:
                    mininet_args += ' --dhcp-relay'
                    if multipleServer:
                        mininet_args += ' --multiple-dhcp-server'
                if remoteServer:
                    mininet_args += ' --remote-dhcp-server'
                if ipv6:
                    mininet_args += ' --ipv6'
                if len(vlan) > 0:
                    mininet_args += ' --vlan=%s' % (','.join(
                        ['%d' % vlanId for vlanId in vlan]))
                if main.useBmv2:
                    mininet_args += ' --switch %s' % main.switchType
                    main.log.info("Using %s switch" % main.switchType)

                run.startMininet(main, 'trellis_fabric.py', args=mininet_args)
            else:
                # Run the test with physical devices
                # TODO: connect TestON to the physical network
                pass
            run.verifyOnosHostIp(main, skipOnFail=False)
            run.verifyNetworkHostIp(main)
        except Exception as e:
            main.log.exception("Error in runTest")
            main.skipCase(result="FAIL", msg=e)
        finally:
            run.cleanup(main)
Esempio n. 7
0
def setupTest( main, test_idx, onosNodes=-1, ipv4=True, ipv6=True,
               external=True, static=False, countFlowsGroups=False ):
    """
    SRRouting test setup
    """
    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
    import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
    import time

    try:
        skipPackage = False
        init = False
        if not hasattr( main, 'apps' ):
            init = True
            lib.initTest( main )
        if onosNodes < 0:
            onosNodes = main.Cluster.numCtrls
        # Skip onos packaging if the cluster size stays the same
        if not init and onosNodes == main.Cluster.numCtrls:
            skipPackage = True

        main.internalIpv4Hosts = main.params[ 'TOPO' ][ 'internalIpv4Hosts' ].split( ',' )
        main.internalIpv6Hosts = main.params[ 'TOPO' ][ 'internalIpv6Hosts' ].split( ',' )
        main.externalIpv4Hosts = main.params[ 'TOPO' ][ 'externalIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv4Hosts') else []
        main.externalIpv6Hosts = main.params[ 'TOPO' ][ 'externalIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv6Hosts') else []
        main.staticIpv4Hosts = main.params[ 'TOPO' ][ 'staticIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv4Hosts') else []
        main.staticIpv6Hosts = main.params[ 'TOPO' ][ 'staticIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv6Hosts') else []
        main.disconnectedIpv4Hosts = []
        main.disconnectedIpv6Hosts = []
        main.disconnectedExternalIpv4Hosts = []
        main.disconnectedExternalIpv6Hosts = []
        main.disconnectedStaticIpv4Hosts = []
        main.disconnectedStaticIpv6Hosts = []
        main.resultFileName = 'CASE%03d' % test_idx
        main.Cluster.setRunningNode( onosNodes )

        lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )

        # Load configuration files
        if hasattr( main, "Mininet1" ):
            main.cfgName = 'TEST_CONFIG_ipv4={}_ipv6={}'.format( 1 if ipv4 else 0,
                                                                 1 if ipv6 else 0)
        else:
            main.cfgName = main.params[ "DEPENDENCY" ][ "confName" ]
        if main.useBmv2:
            # Translate configuration file from OVS-OFDPA to BMv2 driver
            translator.bmv2ToOfdpa( main )  # Try to cleanup if switching between switch types
            switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
            translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
        else:
            translator.bmv2ToOfdpa( main )
        lib.loadJson( main )
        main.log.debug( "sleeping %i seconds" % float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
        time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
        lib.loadHost( main )

        # if static route flag add routes
        # these routes are topology specific
        if static:
            if ipv4:
                lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
                lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.5.1")
            if ipv6:
                lib.addStaticOnosRoute( main, "2000::8700/120", "2000::101")
                lib.addStaticOnosRoute( main, "2000::8700/120", "2000::501")
        if countFlowsGroups:
            lib.loadCount( main )

        if hasattr( main, 'Mininet1' ):
            lib.mnDockerSetup( main )
            # Run the test with Mininet
            mininet_args = ' --dhcp=1 --routers=1 --ipv6={} --ipv4={}'.format( 1 if ipv6 else 0,
                                                                               1 if ipv4 else 0 )
            if main.useBmv2:
                mininet_args += ' --switch %s' % main.switchType
                main.log.info( "Using %s switch" % main.switchType )
            lib.startMininet( main, main.params[ 'DEPENDENCY' ][ 'topology' ], args=mininet_args )
            main.log.debug( "Waiting %i seconds for ONOS to discover dataplane" % float( main.params[ "timers" ][ "startMininetSleep" ] ))
            time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
        else:
            # Run the test with physical devices
            lib.connectToPhysicalNetwork( main )

        lib.saveOnosDiagnostics( main )
        # wait some time for onos to install the rules!
        main.log.info( "Waiting %i seconds for ONOS to program the dataplane" % float( main.params[ "timers" ][ "dhcpSleep" ] ))
        time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )
    except Exception as e:
        main.log.exception( "Error in setupTest" )
        main.skipCase( result="FAIL", msg=e )
    def runTest(main,
                testIndex,
                topology,
                onosNodes,
                description,
                vlan=(0, 0, 0, 0)):
        '''
        Tests connectivity for each test case.
        Configuration files:
        - (0x1, 0x2, 2x2, 2x4).json: device configuration, fed to ONOS before configuration change
        - CASE*.json: interface configuration, fed to ONOS before configuration change
        - CASE*0.chart: ping chart, used to check connectivity before configuration change.
                        Shared among same test scenario with different topology.
        - CASE*0_after.chart: ping chart, used to check connectivity after configuration change.
                        Shared among same test scenario with different topology.
                        Only used when ping chart is updated.
        '''
        try:
            topo = dict()
            # (number of spine switch, number of leaf switch, dual-homed, description, port number of h1)
            topo['0x1'] = (0, 1, False, 'single ToR', 1)
            topo['0x2'] = (0, 2, True, 'dual-homed ToR', 2)
            topo['2x2'] = (2, 2, False, '2x2 leaf-spine topology', 3)
            topo['2x4'] = (2, 4, True, '2x4 dual-homed leaf-spine topology', 6)
            fanout = 4
            switchNames = {}
            switchNames['2x2'] = ["leaf1", "leaf2", "spine101", "spine102"]

            TAG = 'CASE%d' % testIndex
            skipPackage = False
            init = False
            dualHomed = topo[topology][2]
            portNum = topo[topology][4]
            defaultIntf = 'bond0' if dualHomed else 'eth0'

            from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run
            if not hasattr(main, 'apps'):
                init = True
                run.initTest(main)
            # Skip onos packaging if the clusrer size stays the same
            if not init and onosNodes == main.Cluster.numCtrls:
                skipPackage = True

            main.case('%s, with %s and %d ONOS instance%s' %
                      (description, topo[topology][3], onosNodes,
                       's' if onosNodes > 1 else ''))
            main.cfgName = topology
            main.Cluster.setRunningNode(onosNodes)
            run.installOnos(main, skipPackage=skipPackage, cliSleep=5)

            # Provide common configuration
            # TODO: Generate json and chart dynamically, according to topologies and scenarios
            if main.useBmv2:
                # Translate configuration file from OVS-OFDPA to BMv2 driver
                translator.bmv2ToOfdpa(
                    main)  # Try to cleanup if switching between switch types
                switchPrefix = main.params['DEPENDENCY'].get(
                    'switchPrefix', "bmv2")
                translator.ofdpaToBmv2(main, switchPrefix=switchPrefix)
            else:
                translator.bmv2ToOfdpa(main)
            run.loadJson(main)
            run.loadChart(main)

            # Provide topology-specific interface configuration
            import json
            try:
                intfCfg = "%s%s%s.json" % (main.configPath, main.forJson, TAG)
                if main.useBmv2:
                    # Translate configuration file from OVS-OFDPA to BMv2 driver
                    translator.bmv2ToOfdpa(
                        main, intfCfg
                    )  # Try to cleanup if switching between switch types
                    switchPrefix = main.params['DEPENDENCY'].get(
                        'switchPrefix', "bmv2")
                    translator.ofdpaToBmv2(main,
                                           switchPrefix=switchPrefix,
                                           cfgFile=intfCfg)
                else:
                    translator.bmv2ToOfdpa(main, intfCfg)
                with open(intfCfg) as cfg:
                    main.Cluster.active(0).REST.setNetCfg(json.load(cfg))
            except IOError:
                # Load default interface configuration
                defaultIntfCfg = "%s%s%s_ports.json" % (main.configPath,
                                                        main.forJson, topology)
                if main.useBmv2:
                    # Translate configuration file from OVS-OFDPA to BMv2 driver
                    translator.bmv2ToOfdpa(
                        main, defaultIntfCfg
                    )  # Try to cleanup if switching between switch types
                    switchPrefix = main.params['DEPENDENCY'].get(
                        'switchPrefix', "bmv2")
                    translator.ofdpaToBmv2(main,
                                           switchPrefix=switchPrefix,
                                           cfgFile=defaultIntfCfg)
                else:
                    translator.bmv2ToOfdpa(main, defaultIntfCfg)
                with open(defaultIntfCfg) as cfg:
                    main.Cluster.active(0).REST.setNetCfg(json.load(cfg))

            try:
                with open("%s%sCASE%d.chart" % (main.configPath, main.forChart,
                                                testIndex / 10 * 10)) as chart:
                    main.pingChart = json.load(chart)
            except IOError:
                # Load default chart
                with open("%s%sdefault.chart" %
                          (main.configPath, main.forChart)) as chart:
                    main.pingChart = json.load(chart)

            # Set up topology
            if hasattr(main, 'Mininet1'):
                run.mnDockerSetup(main)
                # Run the test with mininet topology
                mininet_args = ' --spine=%d --leaf=%d --fanout=%d' \
                               % ( topo[ topology ][ 0 ], topo[ topology ][ 1 ], fanout )
                if len(vlan) > 0:
                    mininet_args += ' --vlan=%s' % (','.join(
                        ['%d' % vlanId for vlanId in vlan]))
                    if topo[topology][0] > 0:
                        mininet_args += ',0,0,0,0'
                if dualHomed:
                    mininet_args += ' --dual-homed'
                if main.useBmv2:
                    mininet_args += ' --switch %s' % main.switchType
                    main.log.info("Using %s switch" % main.switchType)

                run.startMininet(main, 'trellis_fabric.py', args=mininet_args)
            else:
                # Run the test with physical devices
                run.connectToPhysicalNetwork(main, switchNames[topology])

            # minFlowCountPerLeaf = 13 +  [# of ports] * 5 + [# of hosts] * 2 + [# of vlan ids]
            minFlowCountPerLeaf = 13 + (
                fanout + topo[topology][0]) * 5 + fanout * 2 + len(set(vlan))
            run.checkFlows(main,
                           minFlowCount=minFlowCountPerLeaf *
                           topo[topology][1],
                           sleep=5,
                           dumpflows=False)
            # Check connectivity before changing interface configuration
            run.pingAll(main, '%s_Before' % TAG, retryAttempts=2)

            if main.useBmv2:
                leaf_dpid = [
                    "device:bmv2:leaf%d" % (ls + 1)
                    for ls in range(topo[topology][1])
                ]
            else:
                leaf_dpid = [
                    "of:%016d" % (ls + 1) for ls in range(topo[topology][1])
                ]
            for dpid in leaf_dpid:
                run.checkFlowsByDpid(main, dpid, minFlowCountPerLeaf, sleep=5)

            # Testcase-specific interface configuration change
            if testIndex / 10 == 1:
                # CASE11-14
                if hasattr(main, 'Mininet1'):
                    # Assign vlan tag 10 to host h1
                    main.Mininet1.assignVLAN('h1', 'h1-%s' % defaultIntf, '10')
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        10,
                                                    ])
                else:
                    # TODO: update physical device configuration, same for all test cases
                    pass
            elif testIndex / 10 == 2:
                # CASE21-24
                if hasattr(main, 'Mininet1'):
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=20)
            elif testIndex / 10 == 3:
                # CASE31-34
                if hasattr(main, 'Mininet1'):
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=110)
                    # Update port configuration of port 2
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum + 1,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=110)
            elif testIndex / 10 == 4:
                # CASE41-44
                if hasattr(main, 'Mininet1'):
                    # Assign vlan tag 20 to host h1
                    main.Mininet1.assignVLAN('h1', 'h1-%s' % defaultIntf, '20')
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ])
            elif testIndex / 10 == 5:
                # CASE51-54
                if hasattr(main, 'Mininet1'):
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ],
                                                    native=10)
            elif testIndex / 10 == 6:
                # CASE61-64
                if hasattr(main, 'Mininet1'):
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        120,
                                                    ],
                                                    native=110)
                    # Update port configuration of port 2
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum + 1,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        120,
                                                    ],
                                                    native=110)
            elif testIndex / 10 == 7:
                # CASE71-74
                if hasattr(main, 'Mininet1'):
                    # Update host configuration of h1
                    main.Mininet1.removeVLAN('h1', 'h1-%s.10' % defaultIntf)
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=10)
            elif testIndex / 10 == 8:
                # CASE81-84
                if hasattr(main, 'Mininet1'):
                    # Update port configuration of port 1
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ],
                                                    native=10)
            elif testIndex / 10 == 9:
                # CASE91-94
                if hasattr(main, 'Mininet1'):
                    # Update host configuration
                    main.Mininet1.removeVLAN('h1', 'h1-%s.10' % defaultIntf)
                    main.Mininet1.removeVLAN('h2', 'h2-%s.10' % defaultIntf)

                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        120,
                                                    ],
                                                    native=110)
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum + 1,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        120,
                                                    ],
                                                    native=110)
            elif testIndex / 10 == 10:
                # CASE101-104
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=20)
            elif testIndex / 10 == 11:
                # CASE111-114
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ])
            elif testIndex / 10 == 12:
                # CASE121-124
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ],
                                                    native=110)
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum + 1,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ],
                                                    native=110)
            elif testIndex / 10 == 13:
                # CASE131-134
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        120,
                                                    ],
                                                    native=10)
            elif testIndex / 10 == 14:
                # CASE141-144
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ])
            elif testIndex / 10 == 15:
                # CASE151-154
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        120,
                                                    ])
            elif testIndex / 10 == 16:
                # CASE161-164
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ],
                                                    native=10)
            elif testIndex / 10 == 17:
                # CASE171-174
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        120,
                                                    ])
            elif testIndex / 10 == 18:
                # CASE181-184
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ],
                                                    native=10)
            elif testIndex / 10 == 19:
                # CASE191-194
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=20)
            elif testIndex / 10 == 20:
                # CASE201-204
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[20])
            elif testIndex / 10 == 21:
                # CASE211-214
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[20],
                                                    native=110)
            elif testIndex / 10 == 22:
                # CASE221-224
                if hasattr(main, 'Mininet1'):
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[120],
                                                    native=10)
            elif testIndex / 10 == 23:
                # CASE231-234
                if hasattr(main, "Mininet1"):
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        10,
                                                    ])
                    for dpid in leaf_dpid:
                        run.checkFlowsByDpid(main,
                                             dpid,
                                             minFlowCountPerLeaf,
                                             sleep=5)
                    main.pingChart['leaf1']['expect'] = False
                    run.pingAll(main, '%s_1' % TAG, retryAttempts=2)

                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=50)
                    for dpid in leaf_dpid:
                        run.checkFlowsByDpid(main,
                                             dpid,
                                             minFlowCountPerLeaf,
                                             sleep=5)
                    run.pingAll(main, '%s_2' % TAG, retryAttempts=2)

                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ])
                    for dpid in leaf_dpid:
                        run.checkFlowsByDpid(main,
                                             dpid,
                                             minFlowCountPerLeaf,
                                             sleep=5)
                    run.pingAll(main, '%s_3' % TAG, retryAttempts=2)

                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        40,
                                                    ],
                                                    native=10)
                    for dpid in leaf_dpid:
                        run.checkFlowsByDpid(main,
                                             dpid,
                                             minFlowCountPerLeaf,
                                             sleep=5)
                    main.pingChart['leaf1']['expect'] = True
                    run.pingAll(main, '%s_4' % TAG, retryAttempts=2)

                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    tagged=[
                                                        20,
                                                    ])
                    for dpid in leaf_dpid:
                        run.checkFlowsByDpid(main,
                                             dpid,
                                             minFlowCountPerLeaf,
                                             sleep=5)
                    main.pingChart['leaf1']['expect'] = False
                    run.pingAll(main, '%s_5' % TAG, retryAttempts=2)

                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=20)
                    for dpid in leaf_dpid:
                        run.checkFlowsByDpid(main,
                                             dpid,
                                             minFlowCountPerLeaf,
                                             sleep=5)
                    run.pingAll(main, '%s_6' % TAG, retryAttempts=2)

                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.2.254/24',
                                                    ],
                                                    untagged=10)
                    for dpid in leaf_dpid:
                        run.checkFlowsByDpid(main,
                                             dpid,
                                             minFlowCountPerLeaf,
                                             sleep=5)
                    main.pingChart['leaf1']['expect'] = True
            elif testIndex / 10 == 24:
                # CASE243-244
                # Only for 2x2 and 2x4 topology, to test reachability from other leaf
                if hasattr(main, "Mininet1"):
                    # Update host IP and default GW
                    main.Mininet1.changeIP('h1', 'h1-%s' % defaultIntf,
                                           '10.0.6.1', '255.255.255.0')
                    main.Mininet1.changeDefaultGateway('h1', '10.0.6.254')
                    # Update port configuration
                    SRDynamicConfTest.updateIntfCfg(main,
                                                    portNum,
                                                    dualHomed, [
                                                        '10.0.6.254/24',
                                                    ],
                                                    untagged=60)

            # Update ping chart in case it is changed
            try:
                with open("%s%sCASE%d_after.chart" %
                          (main.configPath, main.forChart,
                           testIndex / 10 * 10)) as chart:
                    main.pingChart = json.load(chart)
            except IOError:
                main.log.debug("Ping chart is not changed")

            # Check connectivity after changing interface configuration
            run.checkFlows(main,
                           minFlowCount=minFlowCountPerLeaf *
                           topo[topology][1],
                           sleep=5,
                           dumpflows=False)
            run.pingAll(main, '%s_After' % TAG, retryAttempts=2)

        except Exception as e:
            main.log.exception("Error in runTest")
            main.skipCase(result="FAIL", msg=e)
        finally:
            run.cleanup(main)
Esempio n. 9
0
    def runTest(self, main, caseNum, numNodes, Topo, minFlow, killList=[0]):
        try:
            description = "ONOS Failure test with " + self.topo[Topo][3]
            main.case(description)
            if not hasattr(main, 'apps'):
                run.initTest(main)
            main.cfgName = Topo
            main.Cluster.setRunningNode(numNodes)
            run.installOnos(main)
            suf = main.params.get('jsonFileSuffix', '')
            xconnectFile = "%s%s-xconnects.json%s" % (
                main.configPath + main.forJson, main.cfgName, suf)
            if main.useBmv2:
                switchPrefix = main.params['DEPENDENCY'].get(
                    'switchPrefix', "bmv2")
                # Translate configuration file from OVS-OFDPA to BMv2 driver
                translator.bmv2ToOfdpa(
                    main)  # Try to cleanup if switching between switch types
                translator.ofdpaToBmv2(main, switchPrefix=switchPrefix)
                # translate xconnects
                translator.bmv2ToOfdpa(main, cfgFile=xconnectFile)
                translator.ofdpaToBmv2(main,
                                       cfgFile=xconnectFile,
                                       switchPrefix=switchPrefix)
            else:
                translator.bmv2ToOfdpa(main)
                translator.bmv2ToOfdpa(main, cfgFile=xconnectFile)
            if suf:
                run.loadJson(main, suffix=suf)
            else:
                run.loadJson(main)
            run.loadChart(main)
            if hasattr(main, 'Mininet1'):
                run.mnDockerSetup(
                    main)  # optionally create and setup docker image

                # Run the test with Mininet
                mininet_args = self.topo[Topo][2]
                if main.useBmv2:
                    mininet_args += ' --switch %s' % main.switchType
                    main.log.info("Using %s switch" % main.switchType)

                run.startMininet(main, 'cord_fabric.py', args=mininet_args)
            else:
                # Run the test with physical devices
                # TODO: connect TestON to the physical network
                pass
            # xconnects need to be loaded after topology
            run.loadXconnects(main)
            # pre-configured routing and bridging test
            run.checkFlows(main, minFlowCount=minFlow)
            run.pingAll(main, 'CASE{}'.format(caseNum))
            switch = '{}'.format(self.topo[Topo][0] + self.topo[Topo][1])
            link = '{}'.format(
                (self.topo[Topo][0] + self.topo[Topo][1]) * self.topo[Topo][0])
            run.killOnos(main, killList, switch, link,
                         '{}'.format(numNodes - 1))
            run.pingAll(main, 'CASE{}_Failure'.format(caseNum))
            run.recoverOnos(main, killList, switch, link,
                            '{}'.format(numNodes))
            run.checkFlows(main,
                           minFlowCount=minFlow,
                           tag='CASE{}_Recovery'.format(caseNum))
            run.pingAll(main, 'CASE{}_Recovery'.format(caseNum))
            # TODO Dynamic config of hosts in subnet
            # TODO Dynamic config of host not in subnet
            # TODO Dynamic config of vlan xconnect
            # TODO Vrouter integration
            # TODO Mcast integration
        except Exception as e:
            main.log.exception("Error in runTest")
            main.skipCase(result="FAIL", msg=e)
        finally:
            run.cleanup(main)
Esempio n. 10
0
    def runTest( self, main, test_idx, topology, onosNodes, description, vlan = [] ):
        try:
            skipPackage = False
            init = False
            if not hasattr( main, 'apps' ):
                init = True
                run.initTest( main )
            # Skip onos packaging if the cluster size stays the same
            if not init and onosNodes == main.Cluster.numCtrls:
                skipPackage = True

            main.case( '%s, with %s, %s switches and %d ONOS instance%s' %
                       ( description, self.topo[ topology ][ 3 ], main.switchType, onosNodes, 's' if onosNodes > 1 else '' ) )

            main.cfgName = 'CASE%01d%01d' % ( test_idx / 10, ( ( test_idx - 1 ) % 10 ) % 4 + 1 )
            main.Cluster.setRunningNode( onosNodes )
            run.installOnos( main, skipPackage=skipPackage, cliSleep=5 )
            if main.useBmv2:
                switchPrefix = main.params[ 'DEPENDENCY' ].get( 'switchPrefix', "bmv2" )
                # Translate configuration file from OVS-OFDPA to BMv2 driver
                translator.bmv2ToOfdpa( main )  # Try to cleanup if switching between switch types
                translator.ofdpaToBmv2( main, switchPrefix=switchPrefix )
            else:
                translator.bmv2ToOfdpa( main )
            suf = main.params.get( 'jsonFileSuffix', None)
            if suf:
                run.loadJson( main, suffix=suf )
            else:
                run.loadJson( main )
            run.loadChart( main )
            if hasattr( main, 'Mininet1' ):
                run.mnDockerSetup( main )  # optionally create and setup docker image

                # Run the test with Mininet
                mininet_args = ' --spine=%d --leaf=%d' % ( self.topo[ topology ][ 0 ], self.topo[ topology ][ 1 ] )
                if self.topo[ topology ][ 2 ]:
                    mininet_args += ' --dual-homed'
                if len( vlan ) > 0 :
                    mininet_args += ' --vlan=%s' % ( ','.join( ['%d' % vlanId for vlanId in vlan ] ) )
                if main.useBmv2:
                    mininet_args += ' --switch %s' % main.switchType
                    main.log.info( "Using %s switch" % main.switchType )

                run.startMininet( main, 'trellis_fabric.py', args=mininet_args )

            else:
                # Run the test with physical devices
                run.connectToPhysicalNetwork( main )

            run.checkFlows( main, minFlowCount=self.topo[ topology ][ 5 if main.useBmv2 else 4 ] * self.topo[ topology ][ 1 ], sleep=5 )
            if main.useBmv2:
                leaf_dpid = [ "device:bmv2:leaf%d" % ( ls + 1 ) for ls in range( self.topo[ topology ][ 1 ]) ]
            else:
                leaf_dpid = [ "of:%016d" % ( ls + 1 ) for ls in range( self.topo[ topology ][ 1 ] ) ]
            for dpid in leaf_dpid:
                run.checkFlowsByDpid( main, dpid, self.topo[ topology ][ 5 if main.useBmv2 else 4 ], sleep=5 )
            run.pingAll( main )
        except Exception as e:
            main.log.exception( "Error in runTest" )
            main.skipCase( result="FAIL", msg=e )
        finally:
            run.cleanup( main )
Esempio n. 11
0
def setupTest( main, test_idx, onosNodes=-1, ipv4=True, ipv6=True,
               external=True, static=False, countFlowsGroups=False ):
    """
    SRRouting test setup
    """
    from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as lib
    import tests.USECASE.SegmentRouting.dependencies.cfgtranslator as translator
    import time

    skipPackage = False
    init = False
    if not hasattr( main, 'apps' ):
        init = True
        lib.initTest( main )
    if onosNodes < 0:
        onosNodes = main.Cluster.numCtrls
    # Skip onos packaging if the cluster size stays the same
    if not init and onosNodes == main.Cluster.numCtrls:
        skipPackage = True

    main.internalIpv4Hosts = main.params[ 'TOPO' ][ 'internalIpv4Hosts' ].split( ',' )
    main.internalIpv6Hosts = main.params[ 'TOPO' ][ 'internalIpv6Hosts' ].split( ',' )
    main.externalIpv4Hosts = main.params[ 'TOPO' ][ 'externalIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv4Hosts') else []
    main.externalIpv6Hosts = main.params[ 'TOPO' ][ 'externalIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('externalIpv6Hosts') else []
    main.staticIpv4Hosts = main.params[ 'TOPO' ][ 'staticIpv4Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv4Hosts') else []
    main.staticIpv6Hosts = main.params[ 'TOPO' ][ 'staticIpv6Hosts' ].split( ',' ) if main.params[ 'TOPO' ].get('staticIpv6Hosts') else []
    main.disconnectedIpv4Hosts = []
    main.disconnectedIpv6Hosts = []
    main.disconnectedExternalIpv4Hosts = []
    main.disconnectedExternalIpv6Hosts = []
    main.disconnectedStaticIpv4Hosts = []
    main.disconnectedStaticIpv6Hosts = []
    main.resultFileName = 'CASE%03d' % test_idx
    main.Cluster.setRunningNode( onosNodes )

    lib.installOnos( main, skipPackage=skipPackage, cliSleep=5 )

    # Load configuration files
    if hasattr( main, "Mininet1" ):
        main.cfgName = 'TEST_CONFIG_ipv4={}_ipv6={}'.format( 1 if ipv4 else 0,
                                                             1 if ipv6 else 0)
    else:
        main.cfgName = main.params[ "DEPENDENCY" ][ "confName" ]
    if main.useBmv2:
        # Translate configuration file from OVS-OFDPA to BMv2 driver
        translator.ofdpaToBmv2( main )
    else:
        translator.bmv2ToOfdpa( main )
    lib.loadJson( main )
    time.sleep( float( main.params[ 'timers' ][ 'loadNetcfgSleep' ] ) )
    lib.loadHost( main )

    # if static route flag add routes
    # these routes are topology specific
    if static:
        if ipv4:
            lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.1.1")
            lib.addStaticOnosRoute( main, "10.0.88.0/24", "10.0.5.1")
        if ipv6:
            lib.addStaticOnosRoute( main, "2000::8700/120", "2000::101")
            lib.addStaticOnosRoute( main, "2000::8700/120", "2000::501")
    if countFlowsGroups:
        lib.loadCount( main )

    if hasattr( main, 'Mininet1' ):
        # Run the test with Mininet
        mininet_args = ' --dhcp=1 --routers=1 --ipv6={} --ipv4={}'.format( 1 if ipv6 else 0,
                                                                           1 if ipv4 else 0 )
        if main.useBmv2:
            mininet_args += ' --switch bmv2'
            main.log.info( "Using BMv2 switch" )
        lib.startMininet( main, main.params[ 'DEPENDENCY' ][ 'topology' ], args=mininet_args )
        time.sleep( float( main.params[ "timers" ][ "startMininetSleep" ] ) )
    else:
        # Run the test with physical devices
        lib.connectToPhysicalNetwork( main )

    # wait some time for onos to install the rules!
    time.sleep( float( main.params[ 'timers' ][ 'dhcpSleep' ] ) )