Example #1
0
    def CASE200( self, main ):
        """
        Bring down 1 switch at a time and test connectivity
        """
        assert vpls, "vpls not defined"

        main.case( "Bring down one switch at a time and test connectivity." )
        links = main.Mininet1.getLinks()  # Obtain links here
        result = main.TRUE

        for i in range( 5, hosts + 1 ):

            stri = str( i )

            # Bring switch down
            main.step( "Delete s" + stri + "." )
            delSwitchResult = main.Mininet1.delSwitch( sw="s" + stri )

            # Check if switch was deleted
            utilities.assert_equals( expect=main.TRUE, actual=delSwitchResult,
                                     onpass="******",
                                     onfail="Failed to delete switch." )
            result = result and delSwitchResult

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls( main, blacklist=[ "h" + stri ] )
            result = result and connectivityResult

            # Bring switch up
            main.step( "Add s" + stri + "." )
            addSwitchResult = main.Mininet1.addSwitch( sw="s" + stri )

            # Check if switch was added
            utilities.assert_equals( expect=main.TRUE, actual=addSwitchResult,
                                     onpass="******",
                                     onfail="Failed to add switch." )
            result = result and addSwitchResult

            # Reconnect links
            main.step( "Reconnecting links on s" + stri + "." )
            for j in links:
                if ( j[ 'node1' ] == "s" + stri and j[ 'node2' ][ 0 ] == "s" ) or \
                   ( j[ 'node2' ] == "s" + stri and j[ 'node1' ][ 0 ] == "s" ):
                    main.Mininet1.addLink( str( j[ 'node1' ] ), str( j[ 'node2' ] ) )

            # Discover host using ping
            main.Mininet1.pingHost( SRC="h" + stri, TARGET="h" + str( ( i % hosts ) + 1 ) )

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls( main )
            result = result and connectivityResult

            if not result:
                break

        utilities.assert_equals( expect=main.TRUE,
                                 actual=result,
                                 onpass="******",
                                 onfail="Connectivity is NOT as expected." )
Example #2
0
    def CASE400( self, main ):
        """
        Bring down 1 link at a time and test connectivity
        """
        assert vpls, "vpls not defined"

        main.case( "Bring down one link at a time and test connectivity." )

        result = main.TRUE

        for link in main.Mininet1.getLinks():
            nodes = [ link[ 'node1' ], link[ 'node2' ] ]

            # Bring down a link
            main.step( "Bring down link: " + nodes[ 0 ] + " to " + nodes[ 1 ] )
            delLinkResult = main.Mininet1.link( END1=nodes[ 0 ], END2=nodes[ 1 ], OPTION="down" )

            # Check if the link has successfully been brought down
            utilities.assert_equals( expect=main.TRUE, actual=delLinkResult,
                                     onpass="******",
                                     onfail="Failed to delete link." )
            result = result and delLinkResult

            # Add removed host to blacklist if necessary
            blacklist = []
            for l in nodes:
                if l[ 0 ] == 'h':
                    blacklist.append( l )

            # Check intent states, then connectivity
            connectivityResult = vpls.testConnectivityVpls( main, blacklist )
            result = result and connectivityResult

            # Re-add the link
            main.step( "Adding link: " + nodes[ 0 ] + " to " + nodes[ 1 ] + "." )
            addLinkResult = main.Mininet1.link( END1=nodes[ 0 ], END2=nodes[ 1 ], OPTION="up" )

            # Check if the link has successfully been added
            utilities.assert_equals( expect=main.TRUE, actual=addLinkResult,
                                     onpass="******",
                                     onfail="Failed to delete link." )
            result = result and addLinkResult

            main.log.debug( main.timeSleep )
            time.sleep( main.timeSleep )

            # Check intent states, then connectivity
            connectivityResult = vpls.testConnectivityVpls( main )
            result = result and connectivityResult

            if not result:
                break

        utilities.assert_equals( expect=main.TRUE,
                                 actual=result,
                                 onpass="******",
                                 onfail="Connectivity is NOT as expected." )
Example #3
0
    def CASE100( self, main ):
        """
        Bring down 1 host at a time and test connectivity
        """
        assert vpls, "vpls not defined"

        main.case( "Bring down one host at a time and test connectivity." )
        result = main.TRUE

        for i in range( 1, hosts + 1 ):

            stri = str( i )

            # Bring host down
            main.step( "Kill link between s" + stri + " and h" + stri + "." )
            linkDownResult = main.Mininet1.link( END1="s" + stri, END2="h" + stri, OPTION="down" )

            # Check if link was successfully down'd
            utilities.assert_equals( expect=main.TRUE, actual=linkDownResult,
                                     onpass="******",
                                     onfail="Failed to bring link down." )
            result = result and linkDownResult

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls( main, blacklist=[ "h" + stri ] )
            result = result and connectivityResult

            # Bring host up
            main.step( "Re-adding link between s" + stri + " and h" + stri + "." )
            linkUpResult = main.Mininet1.link( END1="s" + stri, END2="h" + stri, OPTION="up" )

            # Check if link was successfully re-added
            utilities.assert_equals( expect=main.TRUE, actual=linkUpResult,
                                     onpass="******",
                                     onfail="Failed to bring link up." )
            result = result and linkUpResult

            # Discover host using ping
            main.step( "Discover h" + stri + " using ping." )
            main.Mininet1.pingHost( SRC="h" + stri, TARGET="h" + str( ( i % hosts ) + 1 ) )

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls( main )
            result = result and connectivityResult

            if not result:
                break

        utilities.assert_equals( expect=main.TRUE, actual=result,
                                 onpass="******",
                                 onfail="Connectivity is NOT as expected." )
Example #4
0
    def CASE310(self, main):
        """
        Kill 1 ONOS node at a time and test connectivity
        """
        assert vpls, "vpls not defined"

        main.case("Kill one ONOS node at a time and test connectivity.")
        killSleep = int(main.params['SLEEP']['killnode'])
        result = main.TRUE

        for i in range(0, main.Cluster.numCtrls):

            # Kill an ONOS node
            main.step("Killing ONOS node " + str(i + 1) + ".")
            killresult = main.ONOSbench.onosKill(
                main.Cluster.active(i).ipAddress)

            # Check if ONOS node has been successfully killed
            utilities.assert_equals(
                expect=main.TRUE,
                actual=killresult,
                onpass="******",
                onfail="ONOS node NOT successfully killed.")

            main.step("Waiting for ONOS to restart.")
            main.log.info("Sleeping for " + str(killSleep) + " seconds...")
            time.sleep(killSleep)

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls(main)
            result = result and connectivityResult

            if not result:
                break

        utilities.assert_equals(expect=main.TRUE,
                                actual=result,
                                onpass="******",
                                onfail="Connectivity is NOT as expected.")
Example #5
0
    def CASE310( self, main ):
        """
        Kill 1 ONOS node at a time and test connectivity
        """
        assert vpls, "vpls not defined"

        main.case( "Kill one ONOS node at a time and test connectivity." )
        killSleep = int( main.params[ 'SLEEP' ][ 'killnode' ] )
        result = main.TRUE

        for i in range( 0, main.Cluster.numCtrls ):

            # Kill an ONOS node
            main.step( "Killing ONOS node " + str( i + 1 ) + "." )
            killresult = main.ONOSbench.onosKill( main.Cluster.active( i ).ipAddress )

            # Check if ONOS node has been successfully killed
            utilities.assert_equals( expect=main.TRUE, actual=killresult,
                                     onpass="******",
                                     onfail="ONOS node NOT successfully killed." )

            main.step( "Waiting for ONOS to restart." )
            main.log.info( "Sleeping for " + str( killSleep ) + " seconds..." )
            time.sleep( killSleep )

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls( main )
            result = result and connectivityResult

            if not result:
                break

        utilities.assert_equals( expect=main.TRUE,
                                 actual=result,
                                 onpass="******",
                                 onfail="Connectivity is NOT as expected." )
Example #6
0
    def CASE300(self, main):
        """
        Stop 1 ONOS node at a time and test connectivity
        """
        from tests.USECASE.VPLS.dependencies import vpls
        from tests.HA.dependencies.HA import HA
        assert vpls, "vpls not defined"

        main.HA = HA()
        main.case("Stop one ONOS node at a time and test connectivity.")

        result = main.TRUE

        for i in range(0, main.Cluster.numCtrls):

            stri = str(i)

            ip_address = main.Cluster.active(i).ipAddress

            # Stop an ONOS node: i
            main.step("Stop ONOS node " + stri + ".")
            stopResult = main.ONOSbench.onosStop(ip_address)
            main.Cluster.runningNodes[i].active = False

            utilities.assert_equals(
                expect=main.TRUE,
                actual=stopResult,
                onpass="******",
                onfail="ONOS nodes NOT successfully stopped.")

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls(main,
                                                           isNodeUp=False)
            result = result and connectivityResult

            # Restart ONOS node
            main.step("Restart ONOS node " + stri +
                      " and checking status of restart.")
            startResult = main.ONOSbench.onosStart(ip_address)

            utilities.assert_equals(
                expect=main.TRUE,
                actual=startResult,
                onpass="******",
                onfail="ONOS nodes NOT successfully started.")
            result = result and startResult

            # Check if ONOS is up yet
            main.log.info("Checking if ONOS node " + stri + " is up.")
            upResult = main.ONOSbench.isup(ip_address)

            utilities.assert_equals(
                expect=main.TRUE,
                actual=upResult,
                onpass="******",
                onfail="ONOS did NOT successfully restart.")

            # Restart CLI
            main.log.info("Restarting ONOS node " + stri + "'s main.CLI.")
            cliResults = main.Cluster.active(0).CLI.startOnosCli(ip_address)
            main.Cluster.runningNodes[i].active = True

            utilities.assert_equals(
                expect=main.TRUE,
                actual=cliResults,
                onpass="******",
                onfail="ONOS CLI did NOT successfully restart.")

            # Run some basic checks to see if ONOS node truly has succesfully restarted:

            # Checking if all nodes appear with status READY using 'nodes' command
            main.step("Checking ONOS nodes.")
            nodeResults = utilities.retry(main.Cluster.nodesCheck,
                                          False,
                                          sleep=main.timeSleep,
                                          attempts=main.numAttempts)

            utilities.assert_equals(expect=True,
                                    actual=nodeResults,
                                    onpass="******",
                                    onfail="Nodes check NOT successful.")

            # All apps that are present are active
            main.log.info("Checking if apps are active.")
            compareAppsResult = vpls.compareApps(main)
            utilities.assert_equals(
                expect=main.TRUE,
                actual=compareAppsResult,
                onpass="******",
                onfail="Apps are NOT the same across all nodes.")
            result = result and compareAppsResult

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls(main)
            result = result and connectivityResult

            if not result:
                break

        utilities.assert_equals(expect=main.TRUE,
                                actual=result,
                                onpass="******",
                                onfail="Connectivity is NOT as expected.")
Example #7
0
    def CASE300( self, main ):
        """
        Stop 1 ONOS node at a time and test connectivity
        """
        from tests.USECASE.VPLS.dependencies import vpls
        from tests.HA.dependencies.HA import HA
        assert vpls, "vpls not defined"

        main.HA = HA()
        main.case( "Stop one ONOS node at a time and test connectivity." )

        result = main.TRUE

        for i in range( 0, main.Cluster.numCtrls ):

            stri = str( i )

            ip_address = main.Cluster.active( i ).ipAddress

            # Stop an ONOS node: i
            main.step( "Stop ONOS node " + stri + "." )
            stopResult = main.ONOSbench.onosStop( ip_address )
            main.Cluster.runningNodes[ i ].active = False

            utilities.assert_equals( expect=main.TRUE, actual=stopResult,
                                     onpass="******",
                                     onfail="ONOS nodes NOT successfully stopped." )

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls( main, isNodeUp=False )
            result = result and connectivityResult

            # Restart ONOS node
            main.step( "Restart ONOS node " + stri + " and checking status of restart." )
            startResult = main.ONOSbench.onosStart( ip_address )

            utilities.assert_equals( expect=main.TRUE, actual=startResult,
                                     onpass="******",
                                     onfail="ONOS nodes NOT successfully started." )
            result = result and startResult

            # Check if ONOS is up yet
            main.log.info( "Checking if ONOS node " + stri + " is up." )
            upResult = main.ONOSbench.isup( ip_address )

            utilities.assert_equals( expect=main.TRUE, actual=upResult,
                                     onpass="******",
                                     onfail="ONOS did NOT successfully restart." )

            # Restart CLI
            main.log.info( "Restarting ONOS node " + stri + "'s main.CLI." )
            cliResults = main.Cluster.active( 0 ).CLI.startOnosCli( ip_address )
            main.Cluster.runningNodes[ i ].active = True

            utilities.assert_equals( expect=main.TRUE, actual=cliResults,
                                     onpass="******",
                                     onfail="ONOS CLI did NOT successfully restart." )

            # Run some basic checks to see if ONOS node truly has succesfully restarted:

            # Checking if all nodes appear with status READY using 'nodes' command
            main.testSetUp.checkOnosNodes( main.Cluster )

            # All apps that are present are active
            main.log.info( "Checking if apps are active." )
            compareAppsResult = vpls.compareApps( main )
            utilities.assert_equals( expect=main.TRUE,
                                     actual=compareAppsResult,
                                     onpass="******",
                                     onfail="Apps are NOT the same across all nodes." )
            result = result and compareAppsResult

            # Check connectivity
            connectivityResult = vpls.testConnectivityVpls( main )
            result = result and connectivityResult

            if not result:
                break

        utilities.assert_equals( expect=main.TRUE,
                                 actual=result,
                                 onpass="******",
                                 onfail="Connectivity is NOT as expected." )