示例#1
0
    def CASE5(self, main):
        """
        Deletion of  links
        """
        import json
        import time
        import os
        main.case("Testcase 5: Deletion of Link in existing topology")

        main.Cluster.active(0).CLI.log("\"testcase5 start\"")
        try:
            from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
        except ImportError:
            main.log.exception(
                "Something wrong with import file or code error.")
            main.log.info("Import Error, please check!")
            main.cleanAndExit()

        bgplsConfig = BgpLs()
        app = bgplsConfig.apps()
        bgplsConfig.ipValue(main.ipList, main.scapy_ip)

        bgplsConfig.Comments()
        main.log.info("Sending BGPLS Delete Link Packet ")
        bgplsConfig.Comments()

        main.Scapy1.handle.sendline(
            "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py"
        )
        bgplsConfig.Comments()
        main.log.info("Enable BGPlS plugin in ONOS ")
        bgplsConfig.Comments()

        main.step("UnInstall onos-app-bgp")
        installResults = main.Cluster.active(0).CLI.deactivateApp(app[0])
        utilities.assert_equals(expect=main.TRUE,
                                actual=installResults,
                                onpass="******",
                                onfail="Uninstall  onos-app-bgp failed")

        installResults = main.Cluster.active(0).CLI.activateApp(app[0])
        main.step("Install onos-app-bgp")
        utilities.assert_equals(expect=main.TRUE,
                                actual=installResults,
                                onpass="******",
                                onfail="Install onos-app-bgp failed")
        bgplsConfig.Comments()
        main.step("Checking whether the links is deleted")
        bgplsConfig.Comments()
        time.sleep(120)  # Time taken to discovery the links
        response = main.Cluster.active(0).CLI.links()
        linksResp = json.loads(response)
        check_link = bgplsConfig.checkLinks(linksResp)
        reply_Check_Link = main.FALSE
        if not check_link:
            reply_Check_Link = main.TRUE
        utilities.assert_equals(expect=main.TRUE,
                                actual=reply_Check_Link,
                                onpass="******",
                                onfail="Link is Deletion Failed.")
        main.Cluster.active(0).CLI.log("\"testcase5 end\"")

        main.step("Check for Errors or Exception in testcase5")
        startStr = "testcase5 start"
        endStr = "testcase5 end"
        errorLog = main.ONOSbench.logReport(
            main.Cluster.active(0).ipAddress, ["ERROR", "EXCEPT"], "s",
            startStr, endStr)
        utilities.assert_equals(
            expect=0,
            actual=errorLog,
            onpass="******",
            onfail="Exception or Error occured in testcase5")
        bgplsConfig.Comments()
        main.log.info("Kill Scapy process")
        bgplsConfig.Comments()
        main.Scapy1.handle.send("\x03")
        time.sleep(90)
示例#2
0
    def CASE4(self, main):
        """
        Verification of Links in existing topology
        """
        import json
        import time
        import os
        main.case("Testcase 4: Verification of Links thats is discovered")
        main.ONOScli1.log("\"testcase4 start\"")
        try:
            from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
        except ImportError:
            main.log.exception(
                "Something wrong with import file or code error.")
            main.log.info("Import Error, please check!")
            main.cleanup()
            main.exit()

        bgplsConfig = BgpLs()
        app = bgplsConfig.apps()
        main.CLIs = []
        main.nodes = []
        main.numCtrls = 1
        ipList = os.getenv(main.params['CTRL']['ip1'])
        scapy_ip = os.getenv(main.params['SCAPY']['HOSTNAMES'])
        bgplsConfig.ipValue(ipList, scapy_ip)

        for i in range(1, main.numCtrls + 1):
            try:
                main.CLIs.append(getattr(main, 'ONOScli' + str(i)))
                main.nodes.append(getattr(main, 'ONOS' + str(i)))
                ipList.append(main.nodes[-1].ip_address)
            except AttributeError:
                break

        bgplsConfig.Comments()
        main.log.info("Sending BGPLS Link information Packet ")
        bgplsConfig.Comments()

        main.Scapy1.handle.sendline(
            "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Link_Update_Node.py"
        )
        bgplsConfig.Comments()
        main.log.info("Enable BGPlS plugin in ONOS")
        bgplsConfig.Comments()

        main.step("UnInstall onos-app-bgp")
        installResults = main.ONOScli1.deactivateApp(app[0])
        utilities.assert_equals(expect=main.TRUE,
                                actual=installResults,
                                onpass="******",
                                onfail="Uninstall  onos-app-bgp failed")

        installResults = main.ONOScli1.activateApp(app[0])
        main.step("Install onos-app-bgp")
        utilities.assert_equals(expect=main.TRUE,
                                actual=installResults,
                                onpass="******",
                                onfail="Install onos-app-bgp failed")
        bgplsConfig.Comments()
        main.step("Checking the Link Discovery Status")
        bgplsConfig.Comments()
        time.sleep(120)  # Time taken to discovery the links
        response = main.ONOScli1.links()
        linksResp = json.loads(response)
        check_link = bgplsConfig.checkLinks(linksResp)

        if check_link == True:
            reply_Check_Link = main.TRUE
        utilities.assert_equals(expect=main.TRUE,
                                actual=reply_Check_Link,
                                onpass="******",
                                onfail="Link Discovery Failed.")
        main.ONOScli1.log("\"testcase4 end\"")

        main.step("Check for Errors or Exception in testcase4 ")
        startStr = "testcase4 start"
        endStr = "testcase4 end"
        errorLog = main.ONOSbench.logReport(main.nodes[0].ip_address,
                                            ["ERROR", "EXCEPT"], "s", startStr,
                                            endStr)
        utilities.assert_equals(
            expect=0,
            actual=errorLog,
            onpass="******",
            onfail="Exception or Error occured in testcase4")
        bgplsConfig.Comments()
        main.log.info("Kill Scapy process")
        bgplsConfig.Comments()
        main.Scapy1.handle.sendline("\x03")
        time.sleep(90)
    def CASE5(self, main):
        """
        Deletion of  links
        """
        import json
        import time
        import os
        main.case("Testcase 5: Deletion of Link in existing topology")
        try:
            from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
        except ImportError:
            main.log.exception(
                "Something wrong with import file or code error.")
            main.log.info("Import Error, please check!")
            main.cleanup()
            main.exit()

        bgplsConfig = BgpLs()
        app = bgplsConfig.apps()
        main.CLIs = []
        main.nodes = []
        main.numCtrls = 1
        ipList = os.getenv(main.params['CTRL']['ip1'])
        scapy_ip = os.getenv(main.params['SCAPY']['HOSTNAMES'])
        bgplsConfig.ipValue(ipList, scapy_ip)

        for i in range(1, main.numCtrls + 1):
            try:
                main.CLIs.append(getattr(main, 'ONOScli' + str(i)))
                main.nodes.append(getattr(main, 'ONOS' + str(i)))
                ipList.append(main.nodes[-1].ip_address)
            except AttributeError:
                break

        bgplsConfig.Comments()
        main.log.info("Sending BGPLS Delete Link Packet ")
        bgplsConfig.Comments()

        main.Scapy1.handle.sendline(
            "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py"
        )
        bgplsConfig.Comments()
        main.log.info("Enable BGPlS plugin in ONOS")
        bgplsConfig.Comments()

        main.step("UnInstall onos-app-bgp")
        installResults = main.ONOScli1.deactivateApp(app[0])
        utilities.assert_equals(expect=main.TRUE,
                                actual=installResults,
                                onpass="******",
                                onfail="Uninstall  onos-app-bgp failed")

        installResults = main.ONOScli1.activateApp(app[0])
        main.step("Install onos-app-bgp")
        utilities.assert_equals(expect=main.TRUE,
                                actual=installResults,
                                onpass="******",
                                onfail="Install onos-app-bgp failed")
        bgplsConfig.Comments()
        main.log.info("Checking whether the links is deleted")
        bgplsConfig.Comments()
        time.sleep(120)  # Time taken to discovery the links
        response = main.ONOScli1.links()
        linksResp = json.loads(response)
        check_link = bgplsConfig.checkLinks(linksResp)
        if check_link == False:
            reply_Check_Link = main.TRUE
        utilities.assert_equals(expect=main.TRUE,
                                actual=reply_Check_Link,
                                onpass="******",
                                onfail="Link  is Deletion Failed.")
        bgplsConfig.Comments()
        main.log.info("Kill Scapy process")
        bgplsConfig.Comments()
        main.Scapy1.handle.sendline("\x03")
        time.sleep(90)
    def CASE5( self, main ):
        """
        Deletion of  links
        """
        import json
        import time
        import os
        main.case( "Testcase 5: Deletion of Link in existing topology" )

        main.Cluster.active( 0 ).CLI.log( "\"testcase5 start\"" )
        try:
            from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
        except ImportError:
            main.log.exception( "Something wrong with import file or code error." )
            main.log.info( "Import Error, please check!" )
            main.cleanAndExit()

        bgplsConfig = BgpLs()
        app = bgplsConfig.apps()
        bgplsConfig.ipValue( main.ipList, main.scapy_ip )

        bgplsConfig.Comments()
        main.log.info( "Sending BGPLS Delete Link Packet " )
        bgplsConfig.Comments()

        main.Scapy1.handle.sendline( "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py" )
        bgplsConfig.Comments()
        main.log.info( "Enable BGPlS plugin in ONOS " )
        bgplsConfig.Comments()

        main.step( "UnInstall onos-app-bgp" )
        installResults = main.Cluster.active( 0 ).CLI.deactivateApp( app[ 0 ] )
        utilities.assert_equals( expect=main.TRUE, actual=installResults,
                                 onpass="******",
                                 onfail="Uninstall  onos-app-bgp failed" )

        installResults = main.Cluster.active( 0 ).CLI.activateApp( app[ 0 ] )
        main.step( "Install onos-app-bgp" )
        utilities.assert_equals( expect=main.TRUE, actual=installResults,
                                 onpass="******",
                                 onfail="Install onos-app-bgp failed" )
        bgplsConfig.Comments()
        main.step( "Checking whether the links is deleted" )
        bgplsConfig.Comments()
        time.sleep( 120 )  # Time taken to discovery the links
        response = main.Cluster.active( 0 ).CLI.links()
        linksResp = json.loads( response )
        check_link = bgplsConfig.checkLinks( linksResp )
        reply_Check_Link = main.FALSE
        if not check_link:
            reply_Check_Link = main.TRUE
        utilities.assert_equals( expect=main.TRUE, actual=reply_Check_Link,
                                 onpass="******",
                                 onfail="Link is Deletion Failed." )
        main.Cluster.active( 0 ).CLI.log( "\"testcase5 end\"" )

        main.step( "Check for Errors or Exception in testcase5" )
        startStr = "testcase5 start"
        endStr = "testcase5 end"
        errorLog = main.ONOSbench.logReport( main.Cluster.active( 0 ).ipAddress,
                                             [ "ERROR", "EXCEPT" ], "s",
                                             startStr, endStr )
        utilities.assert_equals( expect=0, actual=errorLog,
                                 onpass="******",
                                 onfail="Exception or Error occured in testcase5" )
        bgplsConfig.Comments()
        main.log.info( "Kill Scapy process" )
        bgplsConfig.Comments()
        main.Scapy1.handle.send( "\x03" )
        time.sleep( 90 )