template list - changed template class name to template_data

Change-Id: I10ac018ed96547bd5e002a7c19a0d70824970705
This commit is contained in:
liathartal 2016-06-14 13:19:00 +00:00
parent 0e5e98dc4c
commit 78fbb81579
9 changed files with 22 additions and 22 deletions

View File

@ -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

View File

@ -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:

View File

@ -38,7 +38,7 @@ RELATIONSHIP = 'relationship'
# noinspection PyAttributeOutsideInit
class Template(object):
class TemplateData(object):
def __init__(self, template_def):

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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