remove relationship validation from template validator
Change-Id: I4888ec1ff6cd64e0c197a327e71d8563cee603e2
This commit is contained in:
parent
ad0c99f3df
commit
391967f1be
@ -22,7 +22,6 @@ from voluptuous import Invalid
|
||||
from voluptuous import Required
|
||||
from voluptuous import Schema
|
||||
|
||||
from vitrage.common.constants import EdgeLabel
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.evaluator.actions.base import action_types
|
||||
from vitrage.evaluator.template_fields import TemplateFields
|
||||
@ -159,7 +158,7 @@ def _validate_relationship_dict(relationship_dict):
|
||||
schema = Schema({
|
||||
Required(TemplateFields.SOURCE, msg=102): any_str,
|
||||
Required(TemplateFields.TARGET, msg=103): any_str,
|
||||
TemplateFields.RELATIONSHIP_TYPE: _validate_relationship_type_field(),
|
||||
Required(TemplateFields.RELATIONSHIP_TYPE, msg=100): any_str,
|
||||
Required(TemplateFields.TEMPLATE_ID, msg=104):
|
||||
All(_validate_template_id_value())
|
||||
})
|
||||
@ -281,15 +280,6 @@ def _validate_category_field(msg=None):
|
||||
return f
|
||||
|
||||
|
||||
def _validate_relationship_type_field(msg=None):
|
||||
def f(v):
|
||||
if str(v) in EdgeLabel.labels():
|
||||
return str(v)
|
||||
else:
|
||||
raise Invalid(msg or 100)
|
||||
return f
|
||||
|
||||
|
||||
def _validate_action_type_field(msg=None):
|
||||
def f(v):
|
||||
if str(v) in action_types:
|
||||
|
@ -156,16 +156,6 @@ class TemplateSyntaxValidatorTest(base.BaseTest):
|
||||
|
||||
self._test_execution_with_fault_result(template, expected_comment)
|
||||
|
||||
def test_validate_relationship_with_invalid_relationship_type_field(self):
|
||||
|
||||
template = self.clone_template
|
||||
definitions = template[TemplateFields.DEFINITIONS]
|
||||
relationship = definitions[TemplateFields.RELATIONSHIPS][0]
|
||||
relationship_dict = relationship[TemplateFields.RELATIONSHIP]
|
||||
relationship_dict[TemplateFields.RELATIONSHIP_TYPE] = 'unknown'
|
||||
|
||||
self._test_execution_with_fault_result(template, 100)
|
||||
|
||||
def test_validate_template_without_scenarios_section(self):
|
||||
|
||||
template = self.clone_template
|
||||
|
Loading…
x
Reference in New Issue
Block a user