Пример #1
0
    def test_compare_cli_and_api(self):
        """compare_cli_and_api test

        There test validate correctness of rca of created
        aodh event alarms, and equals them with cli rca
        """
        try:
            instances = nova_utils.create_instances(num_instances=1,
                                                    set_public_network=True)
            self.assertThat(instances, IsNotEmpty(),
                            'Failed to create instance')

            instance_alarm = self._create_alarm(
                resource_id=instances[0].id,
                alarm_name='instance_rca_alarm',
                unic=True)

            vitrage_id = instance_alarm.get(VProps.VITRAGE_ID)
            api_rca = self.vitrage_client.rca.get(alarm_id=vitrage_id)
            cli_rca = utils.run_vitrage_command(
                'vitrage rca show ' + vitrage_id, self.conf)

            self._compare_rca(api_rca, cli_rca)
        except Exception as e:
            self._handle_exception(e)
            raise
        finally:
            self._clean_all()
    def test_compare_cli_to_api(self):
        """Compare between api template list

        to cli template list
        compares each template in list
        """
        templates_names = list()
        try:
            # Add standard ,equivalence and definition templates
            templates_names = self._add_templates()
            cli_templates_list = utils.run_vitrage_command(
                "vitrage template list", self.conf)
            api_templates_list = self.client.template.list()

            self.assertThat(api_templates_list, IsNotEmpty(),
                            'The template list taken from api is empty')
            self.assertIsNotNone(cli_templates_list,
                                 'The template list taken from cli is empty')
            self._validate_templates_list_length(api_templates_list,
                                                 cli_templates_list)
            self._validate_passed_templates_length(api_templates_list,
                                                   cli_templates_list)
            self._compare_each_template_in_list(api_templates_list,
                                                cli_templates_list)
        except Exception as e:
            self._handle_exception(e)
            raise
        finally:
            self._rollback_to_default(templates_names)
    def test_compare_cli_vs_api_resource_list(self):
        """resource list """
        api_resources = self.vitrage_client.resource.list(all_tenants=True)

        LOG.info("api_resources = %s", api_resources)

        cli_resources = utils.run_vitrage_command(
            'vitrage resource list --all -f json')

        self._compare_resources(api_resources, cli_resources)
Пример #4
0
    def test_templates_list(self):
        """template_list test

        There test validate correctness of template list,
        equals templates files existence with default folder
        and between cli via api ...
        """
        api_template_list = self.vitrage_client.template.list()
        cli_template_list = utils.run_vitrage_command('vitrage template list')

        self._compare_template_lists(api_template_list, cli_template_list)
    def test_compare_api_and_cli(self):
        """compare_api_and_cli

        This test validate correctness of topology graph:
         cli via api
        """
        api_graph = self.vitrage_client.topology.get(all_tenants=True)
        cli_graph = utils.run_vitrage_command(
            'vitrage topology show --all-tenants')

        self._assert_graph_equal(api_graph, json.loads(cli_graph))
Пример #6
0
    def test_compare_resource_show(self):
        """resource_show test"""
        resource_list = self.vitrage_client.resource.list(all_tenants=False)
        self.self.assertThat(resource_list, IsNotEmpty())
        for resource in resource_list:
            api_resource_show = \
                self.vitrage_client.resource.get(resource[VProps.VITRAGE_ID])
            cli_resource_show = utils.run_vitrage_command(
                'vitrage resource show ' + resource[VProps.VITRAGE_ID],
                self.conf)

            self._compare_resource_show(
                api_resource_show, cli_resource_show)
    def test_compare_api_and_cli(self):
        """compare_api_and_cli

        This test validate correctness of topology graph:
         cli via api
        """
        api_graph = self.vitrage_client.topology.get(all_tenants=True)
        cli_graph = utils.run_vitrage_command(
            'vitrage topology show --all-tenants', self.conf)

        LOG.info('api-graph=%(api)s cli-graph=%(cli)s', {
            'api': api_graph,
            'cli': cli_graph
        })

        self._compare_graphs(api_graph, cli_graph)
Пример #8
0
    def test_compare_cli_to_api(self):
        """Compare between api template list

        to cli template list
        compares each template in list
        """
        # Add standard ,equivalence and definition templates
        self._add_templates()
        cli_templates_list = utils.run_vitrage_command("vitrage template list")
        api_templates_list = self.vitrage_client.template.list()

        self.assertThat(api_templates_list, IsNotEmpty(),
                        'The template list taken from api is empty')
        self.assertIsNotNone(cli_templates_list,
                             'The template list taken from cli is empty')
        self._validate_templates_list_length(api_templates_list,
                                             cli_templates_list)
        self._validate_passed_templates_length(api_templates_list,
                                               cli_templates_list)
        self._compare_each_template_in_list(api_templates_list,
                                            cli_templates_list)
Пример #9
0
    def test_compare_cli_vs_api_resource_list(self):
        """resource list """
        try:
            instances = nova_utils.create_instances(num_instances=1,
                                                    set_public_network=True)
            self.assertThat(instances, IsNotEmpty(),
                            'The instances list is empty')
            api_resources = self.vitrage_client.resource.list(
                all_tenants=True)

            LOG.info("api_resources = %s", api_resources)

            cli_resources = utils.run_vitrage_command(
                'vitrage resource list --all -f json', self.conf)

            self._compare_resources(api_resources, cli_resources)
        except Exception as e:
            self._handle_exception(e)
            raise
        finally:
            nova_utils.delete_all_instances()
Пример #10
0
    def test_compare_cli_vs_api_alarms(self):
        """Wrapper that returns a test graph."""
        try:
            instances = nova_utils.create_instances(num_instances=1,
                                                    set_public_network=True)
            self.assertThat(instances, IsNotEmpty(),
                            'The instances list is empty')
            aodh_utils.create_aodh_alarm(resource_id=instances[0].id,
                                         name='tempest_aodh_test')

            api_alarms = TempestClients.vitrage().alarm.list(vitrage_id='all',
                                                             all_tenants=True)
            cli_alarms = utils.run_vitrage_command('vitrage alarm list',
                                                   self.conf)
            self._compare_alarms_lists(api_alarms, cli_alarms, AODH_DATASOURCE,
                                       instances[0].id)
        except Exception as e:
            self._handle_exception(e)
            raise
        finally:
            aodh_utils.delete_all_aodh_alarms()
            nova_utils.delete_all_instances()