Пример #1
0
    def _stop_vitrage_processes():
        text_out = utils.get_from_terminal("pgrep vitrage-api")
        if text_out != '':
            LOG.debug("The vitrage-api process exist")
            utils.run_from_terminal("kill -9 " + text_out)

        text_out2 = utils.get_from_terminal("pgrep vitrage-graph")
        if text_out2 != '':
            LOG.debug("The vitrage-graph process exist")
            utils.run_from_terminal("kill -9 " + text_out2)
Пример #2
0
    def _stop_vitrage_processes():
        text_out = utils.get_from_terminal("pgrep vitrage-api")
        if text_out != '':
            LOG.debug("The vitrage-api process exist")
            utils.run_from_terminal("kill -9 " + text_out)

        text_out2 = utils.get_from_terminal("pgrep vitrage-graph")
        if text_out2 != '':
            LOG.debug("The vitrage-graph process exist")
            utils.run_from_terminal("kill -9 " + text_out2)
Пример #3
0
 def _validate_templates_existence_in_default_folder(self, templates_list):
     counter = 0
     text_out = utils.get_from_terminal('ls ' + self.DEFAULT_PATH)
     for item in templates_list:
         name_start = text_out.count(' ' + item['name'] + ' ')
         if name_start > -1:
             counter += 1
     self.assertEqual(counter, len(templates_list))
Пример #4
0
 def _validate_vitrage_processes():
     errors_out = utils.get_from_terminal(
         "grep ERROR /tmp/nohup-graph.out | " +
         "grep ERROR /tmp/nohup-api.out | grep -v \'ERROR %\'")
     if errors_out != '':
         LOG.error("The errors are : " + errors_out)
         return False
     return True
Пример #5
0
 def _validate_vitrage_processes():
     errors_out = utils.get_from_terminal(
         "grep ERROR /tmp/nohup-graph.out | " +
         "grep ERROR /tmp/nohup-api.out | grep -v \'ERROR %\'")
     if errors_out != '':
         LOG.error("The errors are : " + errors_out)
         return False
     return True
Пример #6
0
 def _validate_templates_existence_in_default_folder(self, templates_list):
     counter = 0
     text_out = utils.get_from_terminal("ls " + self.DEFAULT_PATH)
     for item in templates_list:
         name_start = text_out.count(" " + item["name"] + " ")
         if name_start > -1:
             counter += 1
     self.assertEqual(counter, len(templates_list))
Пример #7
0
    def _show_vitrage_processes():
        text_out = utils.get_from_terminal(
            "ps -ef | grep vitrage-api | grep -v grep")
        text_out2 = utils.get_from_terminal(
            "ps -ef | grep vitrage-graph | grep -v grep")

        if ("vitrage-api" in text_out) and ("vitrage-graph" in text_out2):
            LOG.debug('The vitrage processes exists')
            return True
        elif "vitrage-api" in text_out:
            LOG.debug('Only vitrage-api process exist')
            return True
        elif "vitrage-graph" in text_out2:
            LOG.debug('Only vitrage-graph process exist')
            return True
        else:
            LOG.debug('The vitrage process does not run')
            return False
Пример #8
0
    def _show_vitrage_processes():
        text_out = utils.get_from_terminal(
            "ps -ef | grep vitrage-api | grep -v grep")
        text_out2 = utils.get_from_terminal(
            "ps -ef | grep vitrage-graph | grep -v grep")

        if ("vitrage-api" in text_out) and ("vitrage-graph" in text_out2):
            LOG.debug('The vitrage processes exists')
            return True
        elif "vitrage-api" in text_out:
            LOG.debug('Only vitrage-api process exist')
            return True
        elif "vitrage-graph" in text_out2:
            LOG.debug('Only vitrage-graph process exist')
            return True
        else:
            LOG.debug('The vitrage process does not run')
            return False
Пример #9
0
    def _validate_template_structure(self, template_item, template_show):
        self.assertEqual(template_item["name"], template_show["metadata"]["name"])
        template_content = utils.get_from_terminal("cat " + self.DEFAULT_PATH + template_item["name"] + "*")

        entities = template_content.count("entity:")
        relationships = template_content.count("relationship:")
        scenarios = template_content.count("scenario:")

        self.assertIn(template_show["metadata"]["name"], template_content)
        self.assertEqual(len(template_show["definitions"]["entities"]), entities)
        self.assertEqual(len(template_show["definitions"]["relationships"]), relationships)
        self.assertEqual(len(template_show["scenarios"]), scenarios)
Пример #10
0
    def _validate_template_structure(self, template_item, template_show):
        self.assertEqual(template_item['name'],
                         template_show['metadata']['name'])
        template_content = utils.get_from_terminal('cat ' + self.DEFAULT_PATH +
                                                   template_item['name'] + '*')

        entities = template_content.count('entity:')
        relationships = template_content.count('relationship:')
        scenarios = template_content.count('scenario:')

        self.assertIn(template_show['metadata']['name'], template_content)
        self.assertEqual(len(template_show['definitions']['entities']),
                         entities)
        self.assertEqual(len(template_show['definitions']['relationships']),
                         relationships)
        self.assertEqual(len(template_show['scenarios']), scenarios)