Esempio n. 1
0
    def test_03_skip(self):
        """
        Test case: test_03_skip
        """
        def func():
            pass

        run(test=func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 2
0
    def test_06_skip_this(self):
        """
        Test case: test_06_skip_this
        Skip this test.
        """
        def func():
            raise SkipTest("not ready")

        run(test=func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 3
0
    def test_01_verify_environment(self):
        """
        Test case: test_01_verify_environment
        """
        def func():
            assert helpers.bigrobot_path() != None
            assert helpers.bigrobot_log_path_exec_instance() != None
            assert helpers.bigrobot_suite() != None
            helpers.print_bigrobot_env(minimum=True)

        run(test=func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 4
0
    def test_04_run_until_keyword_succeeds(self):
        """
        Test case: test_04_run_until_keyword_succeeds
        """
        def kw():
            self.val += 1
            assert self.val == 3

        def func():
            wait_until_keyword_succeeds(10, 2, kw)

        run(test=func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 5
0
    def test_02_run_additional_keywords_on_fail(self):
        """
        Test case: test_02_run_additional_keywords_on_fail
        """
        def func():
            try:
                assert 1 == 1
            except:
                # Run additional keywords on fail
                log_to_console("keyword #1:  1 + 2 + 3 = %s" % (1 + 2 + 3))
                log_to_console("keyword #2:  A + B + C = %s" %
                               ('A' + 'B' + 'C'))
                # Still raise it as a test failure
                raise

        run(test=func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 6
0
    def test_00_suite_setup(self):
        """
        Test case: test_00_suite_setup
        Suite setup should be the first test in suite. Raise critical error
        if setup fails.
        """
        def func():
            BsnCommon().base_suite_setup()

            spines = BsnCommon().params_global('spine_list')
            leafs = BsnCommon().params_global('leaf_list')

            if not spines:
                spines = T5Torture().rest_get_spine_switch_names()
                BsnCommon().params_global('spine_list', spines)
            if not leafs:
                leafs = T5Torture().rest_get_leaf_switch_names()
                BsnCommon().params_global('leaf_list', leafs)

            helpers.log("spine list: %s" %
                        BsnCommon().params_global('spine_list'))
            helpers.log("leaf list: %s" %
                        BsnCommon().params_global('leaf_list'))

        return run(func, critical_failure=True)
Esempio n. 7
0
    def test_05_data_link_down_up_event_between_leaf_and_spine(self):  # T27
        """
        Test case:      test_05_data_link_down_up_event_between_leaf_and_spine
        Description:    Link between spine switch and leaf switch is flapped by calling API to controller
                        to disable and enable the interface. The flap is executed at both spine side and leaf side.
                        The event is repeated self.LOOP times. The event runs at the gap of self.INEVENT seconds
                        self.SPINE_LIST- spines in the list is rebooted one by one.  SPINE_LIST can be modified by .....
                        self.LEAF_LIST- spines in the list is rebooted one by one.  LEAF_LIST can be modified by .....
        Output:         Links are flapped.
        Requirement:    More than 1 spines or 2 leafs in a rack or 2 links between spine and leaf
        Pass criteria:  Link is removed from fabric when it is disabled, and link appears in fabric when it is enabled.         """
        def func():
            for i in range(0, self.loop):
                log_to_console(
                    "\n******* data link down/up event between leaf and spine: %s ********"
                    % i)

                T5Torture().randomize_spines_and_leafs()
                T5Torture().cli_event_link_flap(
                    BsnCommon().params_global('spine_list'),
                    BsnCommon().params_global('leaf_list'),
                    interval=self.link_flap_sleep)
                T5Torture().randomize_spines_and_leafs()
                T5Torture().cli_event_link_flap(
                    BsnCommon().params_global('leaf_list'),
                    BsnCommon().params_global('spine_list'),
                    interval=self.link_flap_sleep)

                sleep(self.in_event_sleep)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 8
0
    def test_99_suite_teardown(self):
        """
        Test case: test_00_suite_teardown
        Suite teardown should be the last test in suite.
        """
        def func():
            BsnCommon().base_suite_teardown()

        return run(func)
Esempio n. 9
0
    def test_03_verify_tenant_creation(self):
        """
        Test case: test_03_verify_tenant_creation
        """
        def func():
            T5().rest_add_tenant('ABC')
            T5().rest_show_tenant('ABC')

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 10
0
    def test_04_force_failure(self):
        """
        Test case: test_04_force_failure
        An example of a logic error.
        """
        def func():
            assert 1 == 0

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 11
0
    def test_05_force_error(self):
        """
        Test case: test_05_force_error
        An example of a runtime error.
        """
        def func():
            assert 1 / 0

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 12
0
    def test_01_get_switch_aliases(self):  # T23
        """
        Test case: test_01_get_switch_aliases
        """
        def func():
            # raise SkipTest("removed from regression")
            # switch_names = T5().rest_get_switch_names()
            # helpers.log("switch_names: %s" % switch_names)

            helpers.log("spine_list: %s" % self.spine_list)
            helpers.log("leaf_list: %s" % self.leaf_list)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 13
0
    def test_02_verify_cloud_fabric_version(self):
        """
        Test case: test_02_verify_cloud_fabric_version
        """
        def func():
            result = BsnCommon().cli('c1', 'show version')
            content = result['content']
            match = re.search(r'^Name\s+:\s+(.*)$', content, re.M)
            assert match, "Version string not found"
            version = match.group(1)
            helpers.log("version: %s" % version)
            match = re.match(r'.*Big Cloud Fabric.*', version)
            assert match, "Big Cloud Fabric not found"

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 14
0
    def test_01_controller_node_event_failover(self):  # T23
        """
        Test case:      test_01_controller_node_event_failover
        Description:    Failover for controller node is performed by issuing 'system failover' in standby controller.
                        The event is repeated self.LOOP times. The event runs at the gap of self.INEVENT seconds
        Output:         Previous active controller becomes standby controller, standby controller becomes active controller.
        Requirement:    2 controller nodes
        Pass criteria:  Controller nodes switch roles.
        """
        def func():
            for i in range(0, self.loop):
                log_to_console(
                    "\n******* controller node failover: %s *******" % i)
                T5Torture().controller_node_event_ha_failover()
                sleep(self.in_event_sleep)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 15
0
    def test_00_suite_setup(self):
        """
        Test case: test_00_suite_setup
        Suite setup should be the first test in suite. Raise critical error
        if setup fails.
        """
        def func():
            BsnCommon().base_suite_setup()

            self.spine_list = T5Torture().rest_get_spine_switch_names()
            self.leaf_list = T5Torture().rest_get_leaf_switch_names()

            helpers.log("spine_list: %s" % self.spine_list)
            helpers.log("leaf_list: %s" % self.leaf_list)

        return run(func,
                   setup=self.tc_setup,
                   teardown=self.tc_teardown,
                   critical_failure=True)
Esempio n. 16
0
    def test_09_continues_event(self):  # T51
        """
        Test case:      test_09_continues_event
        Description:    This test executes a combination of all the test cases.
                        A random number is generated and based on the random number, a testcase event is executed.
                        Total of self.REPEAT random numbers are generated. The event runs at the gap of self.BETWEENEVENT seconds
        Input:          self.REPEAT -  the times random number to be generated.  self.TFLAPNUM can be modified by .....
                        self.BETWEENEVENT - idle timer between events - this can be modified by .....
        Output:         None
        Requirement:    More than 1 spines or 2 leafs in a rack or 2 links between spine and leaf
        Pass criteria:  Multiple success behaviors (depending on which test cases are executed).
        """
        def func():
            helpers.log("randomize execution of all the event test cases"
                        )  # from T23 to T30
            for i in range(0, self.repeat):
                log_to_console(
                    "\n========******* in continues event loop: %s out of %s ******======"
                    % (i, self.repeat))
                tc_index = random.randint(1, 6)
                log_to_console("--------random number is %s --------" %
                               tc_index)
                if tc_index == 1:
                    self.test_02_controller_node_event_master_reload()
                elif tc_index == 2:
                    self.test_03_spine_switch_node_down_up_event()
                # elif tc_index = 3:
                #    test_04_leaf_switch_node_down_up_event()
                elif tc_index == 3:
                    self.test_05_data_link_down_up_event_between_leaf_and_spine(
                    )
                elif tc_index == 4:
                    self.test_06_data_link_down_up_event_between_leafs()
                elif tc_index == 5:
                    self.test_07_big_configuration_changes_tenants()
                elif tc_index == 6:
                    self.test_08_big_configuration_changes_vns()
                elif tc_index == 7:
                    self.test_01_controller_node_event_failover()
                sleep(self.between_event_sleep)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 17
0
    def test_03_spine_switch_node_down_up_event(self):  # T21
        """
        Test case:      test_03_spine_switch_node_down_up_event
        Description:    Spine nodes is rebooted by issuing 'system reboot switch SWITCH' in active controller.
                        The event is repeated self.LOOP times. The event runs at the gap of self.INEVENT seconds
        Input:          self.SPINE_LIST- spines in the list is rebooted one by one.  SPINE_LIST can be modified by .....
        Output:         spine switches reboot.
        Requirement:    2 or more spines to guarantee at any time at least 1 spine is function
        Pass criteria:  Spine joins the fabric after it comes back
        """
        def func():
            T5Torture().randomize_spines()
            for i in range(0, self.loop):
                log_to_console(
                    "\n******* spine switch node down/up event: %s ********" %
                    i)
                for spine in BsnCommon().params_global('spine_list'):
                    T5Torture().switch_node_down_up_event(spine)
                    sleep(self.in_event_sleep)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 18
0
    def test_02_controller_node_event_master_reload(self):  # new test case
        """
        Test case:      test_02_controller_node_event_master_reload
        Description:    Failover for controllers nodes is performed by issuing 'system reload controller' in active controller.
                        The event is repeated self.LOOP times. The event runs at the gap of self.INEVENT seconds
        Output:         Active controller vm get rebooted, previous active controller becomes standby controller, standby
                        controller becomes active controller.
        Requirement:    2 controller nodes
        Pass criteria:  Controller nodes switch roles.

        """
        def func():
            # raise SkipTest("removed from regression")

            for i in range(0, self.loop):
                log_to_console(
                    "\n******* controller node failover: %s *******" % i)
                T5Torture().controller_node_event_reload_active()
                sleep(self.in_event_sleep)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 19
0
    def test_08_big_configuration_changes_vns(self):  # T25
        """
        Test case:      test_08_big_configuration_changes_vns
        Description:    Segments are created and deleted by calling API to controller
                        The event is repeated self.LOOP times. The event runs at the gap of self.INEVENT seconds
        Input:          self.VFLAPNUM -  the number of segments to be created and deleted.  self.TFLAPNUM can be modified by .....
        Output:         None
        Requirement:    More than 1 spines or 2 leafs in a rack or 2 links between spine and leaf
        Pass criteria:  Segments are created and deleted successfully.
        """
        def func():
            for i in range(0, self.loop):
                log_to_console(
                    "\n******* big configuration changes vns %s*******" % i)
                T5Torture().vns_configuration_add_remove(
                    self.vflapnum,
                    sw_dut=BsnCommon().params_global('switch_dut'),
                    sw_intf_dut=BsnCommon().params_global(
                        'switch_interface_dut'))
                sleep(self.big_config_sleep)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)
Esempio n. 20
0
    def test_04_leaf_switch_node_down_up_event(self):  # T22
        """
        Test case:      test_04_leaf_switch_node_down_up_event
        Description:    Leaf switch is rebooted by issuing 'system reboot switch SWITCH' in active controller.
                        The event is repeated self.LOOP times. The event runs at the gap of self.INEVENT seconds
        Input:          self.LEAF_LIST- leafs in the list is rebooted one by one.  LEAF_LIST can be modified by .....
        Output:         leaf switch reboots.
        Requirement:    2 leafs in a rack
                        Host is connected to leaf switches through port group
        Pass criteria:  Leaf joins the fabric after it comes back
        """
        def func():
            for i in range(0, self.loop):
                log_to_console(
                    "\n******* leaf switch node down/up event: %s ********" %
                    i)
                T5Torture().randomize_leafs()
                for leaf in BsnCommon().params_global('leaf_list'):
                    T5Torture().switch_node_down_up_event(leaf)
                    sleep(self.in_event_sleep)

        return run(func, setup=self.tc_setup, teardown=self.tc_teardown)