Example #1
0
    def contrail_add_ha_analytics_db(self):
        """Verify that 2  Analytics DB nodes can be added to exist Analytics DB.

        Scenario:
            1. Create an environment
            2. Enable and configure Contrail plugin
            3. Add a node with controller and cinder role
            4. Add 2 nodes with compute role
            5. Add 3 nodes with contrail-controller
               and contrail-analytics roles
            6. Add a node with contrail-analytics-db role
            7. Deploy cluster
            8. Run OSTF tests
            9. Run contrail health check tests
            10. Add 2 nodes contrail-analytics-db role
            11. Deploy cluster
            12. Run OSTF tests
            13. Run contrail health check tests

        """
        conf_env = {
            'slave-01': ['controller', 'cinder'],
            'slave-02': ['compute'],
            'slave-03': ['compute'],
            'slave-04': ['contrail-controller',
                         'contrail-analytics'],
            'slave-05': ['contrail-controller',
                          'contrail-analytics'],
            'slave-06': ['contrail-controller',
                         'contrail-analytics'],
            'slave-07': ['contrail-analytics-db']
        }
        add_analytics_db = {
            'slave-08': ['contrail-analytics-db'],
            'slave-09': ['contrail-analytics-db']
        }

        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=9)

        self.show_step(2)
        plugin.activate_plugin(self)
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 10)
        openstack.update_deploy_check(self, conf_env,
                                      is_vsrx=vsrx_setup_result)

        self.show_step(10)
        TestContrailCheck(self).cloud_check(['contrail'])

        plugin.show_range(self, 11, 14)
        openstack.update_deploy_check(self, add_analytics_db,
                                      is_vsrx=vsrx_setup_result)

        self.show_step(14)
        TestContrailCheck(self).cloud_check(['contrail'])
Example #2
0
    def contrail_ostf_net_provisioning_disable(self):
        """Check gateway in private network for single nodegroup deployment

        Scenario:
            1. Create an environment
            2. Enable and configure Contrail plugin
            3. Create new netwotk between vSRX ana private network
            4. Deploy cluster with following node configuration:
               * 3 controller+ceph-osd
               * 2 compute
               * Contrail-controller + contrail-analytics
               * Contrail-analytics + contrail-analytics-db
            5. Run OSTF tests
            6. Run contrail health check tests

        """
        conf_contrail = {
            'contrail_single_gateway': '10.109.4.1',
            'contrail_gateways': '10.109.5.250'
        }

        conf_env = {
            'slave-01': ['controller', 'ceph-osd'],
            'slave-02': ['controller', 'ceph-osd'],
            'slave-03': ['controller', 'ceph-osd'],
            'slave-04': ['compute'],
            'slave-05': ['compute'],
            'slave-06': ['contrail-controller', 'contrail-analytics'],
            'slave-07': ['contrail-analytics', 'contrail-analytics-db'],
        }

        self.show_step(1)
        plugin.prepare_contrail_plugin(self,
                                       slaves=9,
                                       options={
                                           'images_ceph': True,
                                           'volumes_ceph': True,
                                           'ephemeral_ceph': True,
                                           'objects_ceph': True,
                                           'volumes_lvm': False
                                       })

        self.show_step(2)
        plugin.activate_plugin(self, **conf_contrail)

        self.show_step(3)
        vsrx_setup_result = vsrx.activate(separate_net=True)

        plugin.show_range(self, 4, 7)
        openstack.update_deploy_check(self,
                                      conf_env,
                                      is_vsrx=vsrx_setup_result)
Example #3
0
    def contrail_ostf_net_provisioning_off(self):
        """Verify that we can disable OSTF networks provisioning.

        Scenario:
            1. Create an environment
            2. Enable and configure Contrail plugin without
               OSTF network provisioning
            3. Add a controller and a compute+cinder nodes
            4. Add a node with "contrail-controller" role
            5. Add a "contrail-analytics-db"+"contrail-analytics" node
            6. Deploy cluster
            7. Run OSTF tests
            8. Check Controller and Contrail nodes status

        """
        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=5)

        self.show_step(2)

        # Disable OSTF networks provisioning
        opts = {
            'provision_networks': False,
        }
        plugin.activate_plugin(self, **opts)

        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 6)
        conf_nodes = {
            'slave-01': ['controller'],
            'slave-02': ['compute', 'cinder'],
            'slave-03': ['contrail-controller'],
            'slave-04': ['contrail-analytics-db',
                         'contrail-analytics']
        }

        plugin.show_range(self, 6, 8)
        should_fails = [
            'Create volume and boot instance from it',
            'Launch instance, create snapshot, launch instance from snapshot',
            'Launch instance with file injection',
            'Launch instance',
            'Create volume and attach it to instance',
            'Check network connectivity from instance via floating IP']
        openstack.update_deploy_check(
            self, conf_nodes,
            is_vsrx=vsrx_setup_result,
            ostf_fail_tests=should_fails)
Example #4
0
    def contrail_delete_analytics(self):
        """Verify that Contrail analytics role can be deleted after deploying.

        Scenario:
            1. Create an environment with "Neutron with tunneling segmentation"
               as a network configuration
            2. Enable and configure Contrail plugin
            3. Add a controller and a compute+cinder nodes
            4. Add a node with "contrail-controller" role
            5. Add a node with "contrail-analytics" and "contrail-analytics-db"
               roles
            6. Add a node with "contrail-analytics" role
            7. Deploy cluster
            8. Run OSTF tests
            9. Run contrail health check tests
            10. Delete one "contrail-analytics" role
            11. Deploy changes
            12. Run OSTF tests
            13. Run contrail health check tests

        """
        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=5)

        self.show_step(2)
        plugin.activate_plugin(self)

        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 7)
        conf_no_config = {
            'slave-01': ['controller'],
            'slave-02': ['compute', 'cinder'],
            'slave-03': ['contrail-controller'],
            # Here slave-4
            'slave-05': ['contrail-analytics', 'contrail-analytics-db'],
        }
        conf_config = {'slave-04': ['contrail-analytics']}

        plugin.show_range(self, 7, 10)
        openstack.update_deploy_check(self,
                                      dict(conf_no_config, **conf_config),
                                      is_vsrx=vsrx_setup_result)
        plugin.show_range(self, 10, 14)
        openstack.update_deploy_check(self,
                                      conf_config,
                                      delete=True,
                                      is_vsrx=vsrx_setup_result)
Example #5
0
    def contrail_add_analytics(self):
        """Verify that Contrail-Analytics role can be added after deploy.

        Scenario:
            1. Create an environment with "Neutron with tunneling segmentation"
               as a network configuration
            2. Enable and configure Contrail plugin
            3. Add a controller and a compute+cinder nodes
            4. Add a node with "contrail-controller" role
            5. Add a "contrail-analytics-db"+"contrail-analytics" node
            6. Deploy cluster
            7. Run OSTF tests
            8. Run contrail health check tests
            9. Add one node with "contrail-analytics" role
            10. Deploy changes
            11. Run OSTF tests
            12. Run contrail health check tests

        """
        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=5)

        self.show_step(2)
        plugin.activate_plugin(self)

        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 6)
        conf_nodes = {
            'slave-01': ['controller'],
            'slave-02': ['compute', 'cinder'],
            'slave-03': ['contrail-controller'],
            'slave-04': ['contrail-analytics-db', 'contrail-analytics'],
        }
        conf_config = {'slave-05': ['contrail-analytics']}

        plugin.show_range(self, 6, 9)
        openstack.update_deploy_check(self,
                                      conf_nodes,
                                      is_vsrx=vsrx_setup_result)

        plugin.show_range(self, 9, 13)
        openstack.update_deploy_check(self,
                                      conf_config,
                                      is_vsrx=vsrx_setup_result)
Example #6
0
    def contrail_add_config(self):
        """Verify that Contrail config role can be added after deploying

        Scenario:
            1. Create an environment with "Neutron with tunneling
               segmentation" as a network configuration
            2. Enable and configure Contrail plugin
            3. Add some controller, compute nodes
            4. Add 1 node with "contrail-control", "contrail-config"
               and "contrail-db" roles
            5. Deploy cluster
            6. Run OSTF tests
            7. Check Controller and Contrail nodes status
            8. Add one node with "contrail-config" role
            9. Deploy changes
            10. Run OSTF tests
            11. Check Controller and Contrail nodes status

        """
        plugin.prepare_contrail_plugin(self, slaves=5)

        # enable plugin in contrail settings
        plugin.activate_plugin(self)

        # activate vSRX image
        vsrx_setup_result = plugin.activate_vsrx()

        conf_nodes = {
            'slave-01': ['controller'],
            'slave-02': ['compute'],
            'slave-03': ['contrail-control', 'contrail-config', 'contrail-db'],
        }
        conf_config = {'slave-04': ['contrail-config']}

        openstack.update_deploy_check(self,
                                      conf_nodes,
                                      is_vsrx=vsrx_setup_result)

        openstack.update_deploy_check(self,
                                      conf_config,
                                      is_vsrx=vsrx_setup_result)
Example #7
0
    def contrail_add_delete_compute_ceph(self):
        """Verify that compute node can be added and deleted in env with Ceph.

        Scenario:
            1. Create an environment with "Neutron with tunneling segmentation"
               as a network configuration
            2. Enable and configure Contrail plugin
            3. Add a node with "controller" + "mongo" roles
            4. Add 3 nodes with "compute" + "ceph-osd" roles
            5. Add a node with all contrail-controller role
            6. Add a node with contrail-analytics and contrail-analytics-db
            7. Deploy cluster and run OSTF tests
            8. Run contrail health check tests
            9. Add node with "compute" role
            10. Deploy changes and run OSTF tests
            11. Run contrail health check tests
            12. Delete node with "compute" role
            13. Deploy changes and run OSTF tests
            14. Run contrail health check tests

        """
        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=9,
                                       options={
                                           'images_ceph': True,
                                           'volumes_ceph': True,
                                           'ephemeral_ceph': True,
                                           'objects_ceph': True,
                                           'ceilometer': True,
                                           'volumes_lvm': False})
        self.show_step(2)
        plugin.activate_plugin(self)
        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 7)
        conf_no_compute = {
            'slave-01': ['controller', 'mongo'],
            'slave-02': ['compute', 'ceph-osd'],
            'slave-03': ['compute', 'ceph-osd'],
            'slave-04': ['compute', 'ceph-osd'],
            'slave-05': ['contrail-controller'],
            'slave-06': ['contrail-analytics',
                         'contrail-analytics-db'],
            # Here slave-7
        }
        conf_compute = {'slave-07': ['compute']}

        plugin.show_range(self, 7, 9)
        openstack.update_deploy_check(self, conf_no_compute,
                                      is_vsrx=vsrx_setup_result)
        plugin.show_range(self, 9, 12)
        openstack.update_deploy_check(self, conf_compute,
                                      is_vsrx=vsrx_setup_result)
        plugin.show_range(self, 12, 15)
        openstack.update_deploy_check(
            self, conf_compute, delete=True,
            is_vsrx=vsrx_setup_result)
Example #8
0
    def contrail_plugin_add_delete_controller_node(self):
        """Verify that Controller node can be deleted and added after deploying.

        Scenario:
            1. Create an environment
            2. Enable and configure Contrail plugin
            3. Add 3 controllers, a compute and a storage nodes
            4. Add  node with "contrail-analytics" role
            5. Add a node with "contrail-controller" role
            6. Add a node with "contrail-analytics-db" role
            7. Deploy cluster
            8. Run OSTF tests
            9. Run contrail health check test
            10. Delete a Controller node and deploy changes
            11. Run OSTF tests
            12. Run contrail health check test
            13. Add a node with "Controller" role and deploy changes
            14. Run OSTF tests
            15. Run contrail health check test
        """
        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=9)

        self.show_step(2)
        plugin.activate_plugin(self)

        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 7)
        conf_no_controller = {
            'slave-01': ['controller'],
            'slave-02': ['controller'],
            # Here slave-03
            'slave-04': ['cinder'],
            'slave-05': ['compute'],
            'slave-06': ['contrail-controller'],
            'slave-07': ['contrail-analytics'],
            'slave-08': ['contrail-analytics-db'],
        }
        conf_ctrl = {'slave-03': ['controller']}

        plugin.show_range(self, 7, 10)
        openstack.update_deploy_check(self,
                                      dict(conf_no_controller, **conf_ctrl),
                                      is_vsrx=vsrx_setup_result)
        plugin.show_range(self, 10, 13)
        openstack.update_deploy_check(self,
                                      conf_ctrl,
                                      delete=True,
                                      is_vsrx=vsrx_setup_result)
        plugin.show_range(self, 13, 16)
        openstack.update_deploy_check(self,
                                      conf_ctrl,
                                      is_vsrx=vsrx_setup_result)
Example #9
0
    def contrail_plugin_add_delete_compute_node(self):
        """Verify that Compute node can be deleted and added after deploying

        Scenario:
            1. Create an environment with
               "Neutron with tunneling segmentation"
               as a network configuration and CEPH storage
            2. Enable and configure Contrail plugin
            3. Add some controller, compute + storage (at least 4) nodes
            4. Add a node with "contrail-db", "contarail-config" and
               "contrail-control" roles
            5. Deploy cluster
            6. Run OSTF tests
            7. Delete a compute node and deploy changes
            8. Run OSTF tests
            9. Add a node with "compute" role and deploy changes
            10. Run OSTF tests

        """
        plugin.prepare_contrail_plugin(self, slaves=9)

        # enable plugin in contrail settings
        plugin.activate_plugin(self)

        # activate vSRX image
        vsrx_setup_result = plugin.activate_vsrx()

        conf_no_controller = {
            'slave-01': ['controller'],
            'slave-02': ['controller'],
            'slave-03': ['controller'],
            'slave-04': ['controller'],
            'slave-05': ['compute', 'cinder'],
            'slave-06': ['compute', 'cinder'],
            'slave-07': ['compute', 'cinder'],
            # Here slave-8
            'slave-09': ['contrail-db', 'contrail-config', 'contrail-control'],
        }
        conf_compute = {'slave-08': ['compute', 'cinder']}

        openstack.update_deploy_check(self,
                                      dict(conf_no_controller, **conf_compute),
                                      is_vsrx=vsrx_setup_result)
        openstack.update_deploy_check(self,
                                      conf_compute,
                                      delete=True,
                                      is_vsrx=vsrx_setup_result)
        openstack.update_deploy_check(self,
                                      conf_compute,
                                      is_vsrx=vsrx_setup_result)
Example #10
0
    def contrail_plugin_add_delete_controller_node(self):
        """Verify that Controller node can be deleted
        and added after deploying

        Scenario:
            1. Create an environment with
               "Neutron with tunneling segmentation"
               as a network configuration
            2. Enable and configure Contrail plugin
            3. Add some controller (at least 3), compute and storage nodes
            4. Add 3 nodes with "contrail-db", "contarail-config" and
               "contrail-control" roles on all nodes
            5. Deploy cluster
            6. Run OSTF tests
            7. Delete a Controller node and deploy changes
            8. Run OSTF tests
            9. Add a node with "Controller" role and deploy changes
            10. Run OSTF tests. All steps must be completed successfully,
                without any errors.
        """
        plugin.prepare_contrail_plugin(self, slaves=9)

        # enable plugin in contrail settings
        plugin.activate_plugin(self)

        # activate vSRX image
        vsrx_setup_result = plugin.activate_vsrx()

        conf_no_controller = {
            'slave-01': ['controller'],
            'slave-02': ['controller'],
            # Here slave-03
            'slave-04': ['compute'],
            'slave-05': ['cinder'],
            'slave-06': ['contrail-db', 'contrail-config', 'contrail-control'],
            'slave-07': ['contrail-db', 'contrail-config', 'contrail-control'],
            'slave-08': ['contrail-db', 'contrail-config', 'contrail-control'],
        }
        conf_ctrl = {'slave-03': ['controller']}

        openstack.update_deploy_check(self,
                                      dict(conf_no_controller, **conf_ctrl),
                                      is_vsrx=vsrx_setup_result)
        openstack.update_deploy_check(self,
                                      conf_ctrl,
                                      delete=True,
                                      is_vsrx=vsrx_setup_result)
        openstack.update_deploy_check(self,
                                      conf_ctrl,
                                      is_vsrx=vsrx_setup_result)
Example #11
0
    def contrail_ha_with_shutdown_contrail_node(self):
        """Verify HA with deleting Contrail roles.

        Scenario:
            1. Create an environment
            2. Enable and configure Contrail plugin
            3. Add some controller, compute and storage nodes
            4. Add 3 nodes with "contrail-controller" and
               "contrail-analytics" roles
            5. Add a node with "contrail-analytics-db" role
            6. Deploy cluster
            7. Run OSTF tests
            8. Check Controller and Contrail nodes status
            9. Shutdown node with "contrail-controller" and
                "contrail-analytics" roles
            10. Run OSTF tests
            11. Check Controller and Contrail nodes status
        """
        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=9)
        self.show_step(2)
        plugin.activate_plugin(self)
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 6)
        conf_no_contrail = {
            'slave-01': ['controller'],
            'slave-02': ['controller'],
            'slave-03': ['controller'],
            'slave-04': ['compute'],
            'slave-05': ['cinder'],
            # Here slave-06 with contrail
            'slave-07': ['contrail-controller', 'contrail-analytics'],
            'slave-08': ['contrail-controller', 'contrail-analytics'],
            'slave-09': ['contrail-analytics-db'],
        }
        conf_contrail = {
            'slave-06': ['contrail-controller', 'contrail-analytics']
        }

        def check_node_state(cluster_id, node_name, node_state):
            """Check node state by it's name."""
            for node in self.fuel_web.client.list_cluster_nodes(cluster_id):
                if node_name in node['name']:
                    assert_equal(
                        node['status'], node_state,
                        'Nailgun node status is not %s but %s' %
                        (node_state, node['status']))

        plugin.show_range(self, 6, 8)
        openstack.update_deploy_check(self,
                                      dict(conf_no_contrail, **conf_contrail),
                                      is_vsrx=vsrx_setup_result,
                                      ostf_suites=['smoke', 'sanity', 'ha'])

        self.show_step(8)
        for node_name in dict(conf_no_contrail, **conf_contrail):
            check_node_state(self.cluster_id, node_name, 'ready')

        self.show_step(9)
        for node in self.fuel_web.client.list_cluster_nodes(self.cluster_id):
            if 'slave-06' in node['name']:
                logger.info('Shutdown node "%s"' % node['name'])
                self.fuel_web.warm_shutdown_nodes(
                    self.fuel_web.get_devops_nodes_by_nailgun_nodes([node]))
                break

        self.show_step(10)
        if vsrx_setup_result:
            self.fuel_web.run_ostf(
                cluster_id=self.cluster_id,
                test_sets=['smoke', 'sanity', 'ha'],
                should_fail=1,
                failed_test_name=[
                    'Check state of haproxy backends on controllers'
                ])

        self.show_step(11)
        node_roles = {'controller', 'contrail-config'}
        for node_name, roles in conf_no_contrail.items():
            if node_roles & set(roles):
                check_node_state(self.cluster_id, node_name, 'ready')
Example #12
0
    def contrail_plugin_add_delete_compute_node(self):
        """Verify that Compute node can be deleted and added after deploying.

        Scenario:
            1. Create an environment
            2. Enable and configure Contrail plugin
            3. Add a controller and 3 compute + storage nodes
            4. Add a node with "contrail-analytics" and
               "contrail-controller" roles
            5. Add a node with "contrail-analytics-db" role
            6. Add a node with "contrail-analytics" role
            7. Deploy cluster
            8. Run OSTF tests
            9. Run contrail health check test
            10. Delete a compute node and deploy changes
            11. Run OSTF tests
            12. Add a node with "compute" role and deploy changes
            13. Run OSTF tests

        """
        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=9)

        self.show_step(2)
        plugin.activate_plugin(self)

        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        plugin.show_range(self, 3, 7)
        conf_no_controller = {
            'slave-01': ['controller'],
            'slave-02': ['compute', 'cinder'],
            'slave-03': ['compute', 'cinder'],
            # Here slave-4
            'slave-05': ['contrail-controller', 'contrail-analytics'],
            'slave-06': ['contrail-analytics'],
            'slave-07': ['contrail-analytics-db'],
        }
        conf_compute = {'slave-04': ['compute', 'cinder']}

        plugin.show_range(self, 7, 10)
        openstack.update_deploy_check(self,
                                      dict(conf_no_controller, **conf_compute),
                                      is_vsrx=vsrx_setup_result)
        self.show_step(10)
        openstack.update_deploy_check(self,
                                      conf_compute,
                                      delete=True,
                                      is_vsrx=False)
        self.show_step(11)
        if vsrx_setup_result:
            self.fuel_web.run_ostf(
                cluster_id=self.cluster_id,
                test_sets=['smoke', 'sanity', 'ha'],
                timeout=settings.OSTF_RUN_TIMEOUT,
                should_fail=1,
                failed_test_name=['Check that required services are running'])
        self.show_step(12)
        openstack.update_deploy_check(self, conf_compute, is_vsrx=False)
        self.show_step(13)
        if vsrx_setup_result:
            self.fuel_web.run_ostf(cluster_id=self.cluster_id,
                                   test_sets=['smoke', 'ha'],
                                   timeout=settings.OSTF_RUN_TIMEOUT)
    def contrail_ha_with_network_problems(self):
        """Check Contrail HA using network problems

        Scenario:
            1. Deploy openstack with HA (at lest 3 controllers
               and 3 nodes with contrail`s roles)
            2. Run OSTF tests
            3. Run contrail health check tests
            4. Connect to a contrail controller host, stop the network
               interfaces connected to private and management networks
            5. Run OSTF tests
            6. Run contrail health check tests
        """

        self.show_step(1)
        plugin.prepare_contrail_plugin(self, slaves=9)

        plugin.activate_plugin(self)
        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        conf_env = {
            'slave-01': ['controller'],
            'slave-02': ['controller'],
            'slave-03': ['controller'],
            'slave-04': ['contrail-controller'],
            'slave-05': ['contrail-controller'],
            'slave-06': ['contrail-controller'],
            'slave-07': ['contrail-analytics', 'contrail-analytics-db'],
            'slave-08': ['contrail-analytics', 'contrail-analytics-db'],
            'slave-09': ['contrail-analytics', 'contrail-analytics-db'],
        }

        self.show_step(2)
        openstack.update_deploy_check(self,
                                      conf_env,
                                      is_vsrx=vsrx_setup_result)

        self.show_step(3)
        TestContrailCheck(self).cloud_check(['contrail'])

        self.show_step(4)

        def get_interface_name4role(cluster_id, node_name, role):
            logger.info('[get_interface_name4role] cluster_id: {0}, '
                        'node: {1}, '
                        'role:{2}'.format(cluster_id, node_name, role))
            nailgun_node = None
            for node in self.fuel_web.client.list_cluster_nodes(cluster_id):
                logger.info('Check node {0} for name: {1}'.format(
                    node['name'], node_name))
                if node_name in node['name']:
                    nailgun_node = node
                    break
            else:
                assert 'slave-01 node not found in cluster: {0}'.format(
                    self.cluster_id)

            interfaces = self.fuel_web.client.get_node_interfaces(
                nailgun_node['id'])
            for iface in interfaces:
                for net in iface['assigned_networks']:
                    logger.info('Check iface {0} for role {1}'.format(
                        iface['name'], role))
                    if role in net['name']:  # check role name for interface
                        logger.info('Found interface: {0}'.format(
                            iface['name']))
                        return iface['name']  # return interface name
            return ''

        cluster_id = self.cluster_id
        ifaces = [
            get_interface_name4role(cluster_id, 'slave-01', 'private'),
            get_interface_name4role(cluster_id, 'slave-01', 'management')
        ]
        for iface in ifaces:
            cmd = 'sudo ifconfig {0} down'.format(iface)
            with self.fuel_web.get_ssh_for_node("slave-01") as remote:
                res_pgrep = remote.execute(cmd)
                assert_equal(
                    0, res_pgrep['exit_code'],
                    'Failed with error code:{0}, {1}, out:{2}'.format(
                        res_pgrep['exit_code'], res_pgrep['stderr'],
                        res_pgrep['stdout']))
        self.show_step(5)
        if vsrx_setup_result:
            self.fuel_web.run_ostf(cluster_id=self.cluster_id,
                                   test_sets=['smoke', 'sanity', 'ha'],
                                   timeout=OSTF_RUN_TIMEOUT)
        self.show_step(6)
        TestContrailCheck(self).cloud_check(['contrail'])
    def contrail_ha_with_node_problems(self):
        """Check Contrail HA using node problems

        Scenario:
            1. Deploy openstack with HA (at lest 3 controllers
               and 3 nodes with contrail`s roles) and Ceph
            2. Run OSTF tests
            3. Run contrail health check tests
            4. Disable first contrail node via libvirt
            5. Run OSTF tests
            6. Run contrail health check tests
            7. Enable first contrail node and wait 6 minutes
            8. Disable second cotrail node
            9. Run OSTF test
            10. Run contrail health check tests
            11. Enable second contrail node and wait 6 minutes
            12. Disable third cotrail node
            13. Run OSTF tests
            14. Run contrail health check test
            15. Enable third node
            16. Run OSTF tests
            17. Run contrail health check test
        """

        self.show_step(1)
        plugin.prepare_contrail_plugin(self,
                                       slaves=9,
                                       options={
                                           'images_ceph': True,
                                           'volumes_ceph': True,
                                           'ephemeral_ceph': True,
                                           'objects_ceph': True,
                                           'volumes_lvm': False
                                       })

        plugin.activate_plugin(self)
        # activate vSRX image
        vsrx_setup_result = vsrx.activate()

        conf_env = {
            'slave-01': ['controller', 'ceph-osd'],
            'slave-02': ['controller', 'ceph-osd'],
            'slave-03': ['controller', 'ceph-osd'],
            'slave-04': ['contrail-controller'],
            'slave-05': ['contrail-controller'],
            'slave-06': ['contrail-controller'],
            'slave-07': ['contrail-analytics', 'contrail-analytics-db'],
            'slave-08': ['contrail-analytics', 'contrail-analytics-db'],
            'slave-09': ['contrail-analytics', 'contrail-analytics-db'],
        }

        self.show_step(2)
        openstack.update_deploy_check(self,
                                      conf_env,
                                      is_vsrx=vsrx_setup_result)

        self.show_step(3)
        TestContrailCheck(self).cloud_check(['contrail'])

        #open connection to qemu
        conn = libvirt.open('qemu:///system')
        if conn == None:
            raise ValueError("Failed to open connection to qemu:///system")
        else:
            logger.info("open connection to qemu:///system")
        #get list of domains
        node_list = conn.listAllDomains(0)

        for i in range(0, 3):
            m = 7
            n = str(m + i)
            steps = [4, 5, 6, 7]

            for index, step in enumerate(steps):
                steps[index] = step + (4 * i)

            for node in node_list:
                #find node with contrail
                if n in node.name():

                    self.show_step(steps[0])
                    node.destroy()  # stop node
                    logger.info("Node {0} was stopped".format(n))

                    self.show_step(steps[1])
                    self.fuel_web.run_ostf(cluster_id=self.cluster_id,
                                           test_sets=['smoke', 'sanity', 'ha'])
                    self.show_step(steps[2])
                    TestContrailCheck(self).cloud_check(
                        ['contrail'], ['test_contrail_node_status'])

                    self.show_step(steps[3])
                    node.create()  # start node
                    logger.info("Node {0} was run".format(n))
                    break
            logger.info("Waiting for node {0}".format(n))
            time.sleep(6 * 60)
        conn.close()

        self.show_step(16)
        if vsrx_setup_result:
            self.fuel_web.run_ostf(cluster_id=self.cluster_id,
                                   test_sets=['smoke', 'sanity', 'ha'],
                                   timeout=OSTF_RUN_TIMEOUT)

        self.show_step(17)
        TestContrailCheck(self).cloud_check(['contrail'])
Example #15
0
    def contrail_ha_with_shutdown_contrail_node(self):
        """Verify HA with deleting Contrail roles

        Scenario:
            1. Create an environment with
               "Neutron with tunneling segmentation"
               as a network configuration
            2. Enable and configure Contrail plugin
            3. Add some controller, compute and storage nodes
            4. Add 4 nodes with "contrail-db", "contarail-config" and
               "contrail-control" roles
            5. Deploy cluster
            6. Run OSTF tests
            7. Check Controller and Contrail nodes status
            8. Shutdown node with 'contrail-db', "contarail-config" and
               "contrail-control" roles
            9. Deploy changes
            10. Run OSTF tests
            11. Check Controller and Contrail nodes status

        """
        plugin.prepare_contrail_plugin(self, slaves=9)
        plugin.activate_plugin(self)  # enable plugin in contrail settings
        vsrx_setup_result = plugin.activate_vsrx()  # activate vSRX image

        conf_no_contrail = {
            'slave-01': ['controller'],
            'slave-02': ['controller'],
            'slave-03': ['controller'],
            'slave-04': ['compute'],
            'slave-05': ['cinder'],
            # Here slave-06 with contrail
            'slave-07': ['contrail-db', 'contrail-config', 'contrail-control'],
            'slave-08': ['contrail-db', 'contrail-config', 'contrail-control'],
            'slave-09': ['contrail-db', 'contrail-config', 'contrail-control'],
        }
        conf_contrail = {
            'slave-06': ['contrail-db', 'contrail-config', 'contrail-control']
        }

        def check_node_state(cluster_id, node_name, node_state):
            """Checks node state by it's name"""
            for node in self.fuel_web.client.list_cluster_nodes(cluster_id):
                if node_name in node['name']:
                    assert_equal(
                        node['status'], node_state,
                        'Nailgun node status is not %s but %s' %
                        (node_state, node['status']))

        # Deploy cluster and run OSTF
        openstack.update_deploy_check(self,
                                      dict(conf_no_contrail, **conf_contrail),
                                      is_vsrx=vsrx_setup_result)

        # Check all nodes are 'ready'
        for node_name in dict(conf_no_contrail, **conf_contrail):
            check_node_state(self.cluster_id, node_name, 'ready')

        # Shutdown contrail node
        for node in self.fuel_web.client.list_cluster_nodes(self.cluster_id):
            if 'slave-06' in node['name']:
                logger.info('Shutdown node "%s"' % node['name'])
                self.fuel_web.warm_shutdown_nodes(
                    self.fuel_web.get_devops_nodes_by_nailgun_nodes([node]))
                break

        # Run OSTF tests again
        if vsrx_setup_result:
            self.fuel_web.run_ostf(cluster_id=self.cluster_id)

        # Check controller and contrail nodes states
        node_roles = {'controller', 'contrail-config'}
        for node_name, roles in conf_no_contrail.items():
            if node_roles & set(roles):
                check_node_state(self.cluster_id, node_name, 'ready')
Example #16
0
    def contrail_multiple_networks_delete_compute(self):
        """Check Contrail deploy multiple networks remove compute.

        Scenario:
            1. Revert snapshot with ready master node
            2. Install contrail plugin
            3. Bootstrap slaves from default nodegroup
            4. Create cluster with Neutron GRE and custom nodegroups
            5. Activate plugin and configure plugins setings
            6. Remove 2nd custom nodegroup which is added automatically
            7. Bootstrap slave nodes from custom nodegroup
            8. Download network configuration
            9. Update network.json  with customized ip ranges
            10. Put new json on master node and update network data
            11. Verify that new IP ranges are applied for network config
            12. Add following nodes to default nodegroup:
                * 1 controller
                * 2 compute
            13. Add following nodes to custom nodegroup:
                * 1 contrail-controller
                * 1 contrail-analytics
                * 1 contrail-analytics-db
            14. Deploy cluster
            15. Run health checks (OSTF)
            16. Remove 1 compute node
            17. Redeploy cluster
            18. Run health checks (OSTF)

        Duration 2.5 hours

        """
        if not MULTIPLE_NETWORKS:
            raise SkipTest()
        self.show_step(1, initialize=True)
        self.env.revert_snapshot("ready")
        plugin.show_range(self, 2, 6)
        plugin.prepare_contrail_plugin(self, snapshot_name="ready")

        cluster_id = self.fuel_web.get_last_created_cluster()
        self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[0:3])

        plugin.activate_plugin(self)
        # activate vSRX image
        vsrx_setup_result = vsrx.activate(self, vsrx_config=True)

        self.show_step(6)
        self.netconf_all_groups = self.fuel_web.client.get_networks(cluster_id)
        custom_group2 = self.fuel_web.get_nodegroup(cluster_id,
                                                    name=NODEGROUPS[2]['name'])
        wait(lambda: not self.is_update_dnsmasq_running(self.fuel_web.client.
                                                        get_tasks()),
             timeout=60,
             timeout_msg="Timeout exceeded while waiting for task "
             "'update_dnsmasq' is finished!")
        self.fuel_web.client.delete_nodegroup(custom_group2['id'])

        self.show_step(7)
        self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[3:6])

        self.show_step(8)
        updated_storage_default, updated_storage_custom, \
            updated_mgmt_default, updated_mgmt_custom = \
            self.update_network_config(cluster_id)

        self.show_step(12)
        self.show_step(13)
        nodegroup_default = NODEGROUPS[0]['name']
        nodegroup_custom1 = NODEGROUPS[1]['name']
        self.fuel_web.update_nodes(
            cluster_id, {
                'slave-01': [['controller'], nodegroup_default],
                'slave-02': [['compute'], nodegroup_default],
                'slave-03': [['compute'], nodegroup_default],
                'slave-04': [['contrail-controller'], nodegroup_custom1],
                'slave-05': [['contrail-analytics'], nodegroup_custom1],
                'slave-06': [['contrail-analytics-db'], nodegroup_custom1],
            })
        self.show_step(14)
        openstack.deploy_cluster(self)
        TestContrailCheck(self).cloud_check(['contrail'])

        self.show_step(15)
        if vsrx_setup_result:
            self.fuel_web.run_ostf(cluster_id=cluster_id,
                                   test_sets=['smoke', 'sanity', 'ha'],
                                   timeout=settings.OSTF_RUN_TIMEOUT)

        self.show_step(16)
        conf_compute = {
            'slave-03': [['compute'], nodegroup_custom1],
        }

        plugin.show_range(self, 17, 18)
        openstack.update_deploy_check(
            self,
            conf_compute,
            delete=True,
            is_vsrx=vsrx_setup_result,
            ostf_fail_tests=['Check that required services are running'])

        TestContrailCheck(self).cloud_check(['contrail'])