diff --git a/vitrage/evaluator/scenario_evaluator.py b/vitrage/evaluator/scenario_evaluator.py index 97e6d3de5..e24173949 100644 --- a/vitrage/evaluator/scenario_evaluator.py +++ b/vitrage/evaluator/scenario_evaluator.py @@ -24,9 +24,9 @@ from vitrage.evaluator.actions.action_executor import ActionExecutor from vitrage.evaluator.actions.base import ActionMode from vitrage.evaluator.actions.base import ActionType import vitrage.evaluator.actions.priority_tools as pt -from vitrage.evaluator.template import ActionSpecs -from vitrage.evaluator.template import EdgeDescription -from vitrage.evaluator.template import ENTITY +from vitrage.evaluator.template_data import ActionSpecs +from vitrage.evaluator.template_data import EdgeDescription +from vitrage.evaluator.template_data import ENTITY from vitrage.graph.algo_driver.algorithm import Mapping from vitrage.graph import create_algorithm from vitrage.graph import create_graph diff --git a/vitrage/evaluator/scenario_repository.py b/vitrage/evaluator/scenario_repository.py index 5cac48da2..d4f64110e 100644 --- a/vitrage/evaluator/scenario_repository.py +++ b/vitrage/evaluator/scenario_repository.py @@ -17,8 +17,8 @@ from collections import namedtuple from oslo_log import log from vitrage.common import file_utils -from vitrage.evaluator.template import RELATIONSHIP -from vitrage.evaluator.template import Template +from vitrage.evaluator.template_data import RELATIONSHIP +from vitrage.evaluator.template_data import TemplateData from vitrage.evaluator.template_fields import TemplateFields from vitrage.evaluator.template_validation.template_content_validator import \ content_validation @@ -71,9 +71,9 @@ class ScenarioRepository(object): content_validation_result = content_validation(template_def) if syntax_validation_result.is_valid and \ content_validation_result.is_valid: - template = Template(template_def) - self.templates[template.name] = template - self._add_template_scenarios(template) + template_data = TemplateData(template_def) + self.templates[template_data.name] = template_data + self._add_template_scenarios(template_data) else: metadata = template_def.get(TemplateFields.METADATA, None) if metadata: diff --git a/vitrage/evaluator/template.py b/vitrage/evaluator/template_data.py similarity index 99% rename from vitrage/evaluator/template.py rename to vitrage/evaluator/template_data.py index 534ad6f85..bd62dadf7 100644 --- a/vitrage/evaluator/template.py +++ b/vitrage/evaluator/template_data.py @@ -38,7 +38,7 @@ RELATIONSHIP = 'relationship' # noinspection PyAttributeOutsideInit -class Template(object): +class TemplateData(object): def __init__(self, template_def): diff --git a/vitrage/evaluator/template_validation/template_content_validator.py b/vitrage/evaluator/template_validation/template_content_validator.py index 7de521e0e..34541b855 100644 --- a/vitrage/evaluator/template_validation/template_content_validator.py +++ b/vitrage/evaluator/template_validation/template_content_validator.py @@ -15,7 +15,7 @@ from oslo_log import log from six.moves import reduce from vitrage.evaluator.actions.base import ActionType -from vitrage.evaluator.template import Template +from vitrage.evaluator.template_data import TemplateData from vitrage.evaluator.template_fields import TemplateFields from vitrage.evaluator.template_validation.base import get_correct_result from vitrage.evaluator.template_validation.base import get_fault_result @@ -135,7 +135,7 @@ def validate_scenarios(scenarios, template_ids): def validate_scenario_condition(condition, template_ids): try: - Template.convert_to_dnf_format(condition) + TemplateData.convert_to_dnf_format(condition) except Exception: LOG.error('%s error code: %s' % (status_msgs[85], 85)) return get_fault_result(RESULT_DESCRIPTION, 85) diff --git a/vitrage/tests/functional/evaluator/test_action_executor.py b/vitrage/tests/functional/evaluator/test_action_executor.py index 29b872159..430974923 100644 --- a/vitrage/tests/functional/evaluator/test_action_executor.py +++ b/vitrage/tests/functional/evaluator/test_action_executor.py @@ -29,7 +29,7 @@ from vitrage.evaluator.actions.action_executor import ActionExecutor from vitrage.evaluator.actions.base import ActionMode from vitrage.evaluator.actions.base import ActionType from vitrage.evaluator.actions.evaluator_event_transformer import VITRAGE_TYPE -from vitrage.evaluator.template import ActionSpecs +from vitrage.evaluator.template_data import ActionSpecs from vitrage.evaluator.template_fields import TemplateFields as TFields from vitrage.service import load_datasource from vitrage.tests.functional.base import TestFunctionalBase diff --git a/vitrage/tests/unit/evaluator/recipes/test_add_causal_relationship_recipe.py b/vitrage/tests/unit/evaluator/recipes/test_add_causal_relationship_recipe.py index d1b53e3cc..cc636d884 100644 --- a/vitrage/tests/unit/evaluator/recipes/test_add_causal_relationship_recipe.py +++ b/vitrage/tests/unit/evaluator/recipes/test_add_causal_relationship_recipe.py @@ -20,7 +20,7 @@ from vitrage.evaluator.actions.recipes.action_steps import ADD_EDGE from vitrage.evaluator.actions.recipes.action_steps import REMOVE_EDGE from vitrage.evaluator.actions.recipes.add_causal_relationship import \ AddCausalRelationship -from vitrage.evaluator.template import ActionSpecs +from vitrage.evaluator.template_data import ActionSpecs from vitrage.evaluator.template_fields import TemplateFields as TField from vitrage.graph import Vertex from vitrage.tests import base diff --git a/vitrage/tests/unit/evaluator/recipes/test_raise_alarm.py b/vitrage/tests/unit/evaluator/recipes/test_raise_alarm.py index 2e85ed030..af6cd954c 100644 --- a/vitrage/tests/unit/evaluator/recipes/test_raise_alarm.py +++ b/vitrage/tests/unit/evaluator/recipes/test_raise_alarm.py @@ -18,7 +18,7 @@ from vitrage.evaluator.actions.base import ActionType from vitrage.evaluator.actions.recipes.action_steps import ADD_VERTEX from vitrage.evaluator.actions.recipes.action_steps import REMOVE_VERTEX from vitrage.evaluator.actions.recipes.raise_alarm import RaiseAlarm -from vitrage.evaluator.template import ActionSpecs +from vitrage.evaluator.template_data import ActionSpecs from vitrage.evaluator.template_fields import TemplateFields as TFields from vitrage.graph import Vertex from vitrage.tests import base diff --git a/vitrage/tests/unit/evaluator/recipes/test_set_state_recipe.py b/vitrage/tests/unit/evaluator/recipes/test_set_state_recipe.py index 310b48581..70cd56137 100644 --- a/vitrage/tests/unit/evaluator/recipes/test_set_state_recipe.py +++ b/vitrage/tests/unit/evaluator/recipes/test_set_state_recipe.py @@ -18,7 +18,7 @@ from vitrage.common.constants import VertexProperties as VProps from vitrage.evaluator.actions.base import ActionType from vitrage.evaluator.actions.recipes.action_steps import UPDATE_VERTEX from vitrage.evaluator.actions.recipes.set_state import SetState -from vitrage.evaluator.template import ActionSpecs +from vitrage.evaluator.template_data import ActionSpecs from vitrage.evaluator.template_fields import TemplateFields as TFields from vitrage.graph import Vertex from vitrage.tests import base diff --git a/vitrage/tests/unit/evaluator/test_template.py b/vitrage/tests/unit/evaluator/test_template_data.py similarity index 93% rename from vitrage/tests/unit/evaluator/test_template.py rename to vitrage/tests/unit/evaluator/test_template_data.py index 0c2b56c24..03bbac1e8 100644 --- a/vitrage/tests/unit/evaluator/test_template.py +++ b/vitrage/tests/unit/evaluator/test_template_data.py @@ -15,9 +15,9 @@ from oslo_log import log as logging from vitrage.common.constants import EdgeLabel from vitrage.common import file_utils -from vitrage.evaluator.template import ConditionVar -from vitrage.evaluator.template import EdgeDescription -from vitrage.evaluator.template import Template +from vitrage.evaluator.template_data import ConditionVar +from vitrage.evaluator.template_data import EdgeDescription +from vitrage.evaluator.template_data import TemplateData from vitrage.evaluator.template_fields import TemplateFields as TFields from vitrage.graph import Vertex from vitrage.tests import base @@ -37,10 +37,10 @@ class BasicTemplateTest(base.BaseTest): self.BASIC_TEMPLATE) template_definition = file_utils.load_yaml_file(template_path, True) - template = Template(template_definition) - entities = template.entities - relationships = template.relationships - scenarios = template.scenarios + template_data = TemplateData(template_definition) + entities = template_data.entities + relationships = template_data.relationships + scenarios = template_data.scenarios definitions = template_definition[TFields.DEFINITIONS] # Assertions