template validate - status code documentation and status code OK changed to 0
Change-Id: If9e94e58fced45bdd8105571c877ca85198df4b5
This commit is contained in:
parent
2235af69f8
commit
0e5e98dc4c
95
doc/source/tempolate_validation_status_code.rst
Normal file
95
doc/source/tempolate_validation_status_code.rst
Normal file
@ -0,0 +1,95 @@
|
||||
===============================
|
||||
Template Validation Status Code
|
||||
===============================
|
||||
|
||||
Overview
|
||||
--------
|
||||
Status codes are received after executing Vitrage template validation.
|
||||
The code describes the Vitrage template status: if the template is correct, the status code is 0. Otherwise the code describes the error in the template itself.
|
||||
|
||||
Description
|
||||
-----------
|
||||
The following describes all the possible status code and their messages:
|
||||
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| code | message | Test Type |
|
||||
+==================+=========================================================+===============================+
|
||||
| 0 | Template validation is OK | content and syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 1 | template_id field contains incorrect string value | content |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 2 | Duplicate template_id definition | content |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 3 | template_id does not appear in the definition block | content |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 20 | definitions section must contain entities field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 21 | definitions section is a mandatory section | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 41 | Entity definition must contain template_id field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 42 | Entity definition must contain category field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 43 | At least one entity must be defined | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 45 | Invalid entity category. Category must be from types: | syntax |
|
||||
| | [entities_categories] | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 46 | Entity field is required | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 60 | metadata section must contain id field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 61 | metadata is a mandatory section | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 80 | scenarios is a mandatory section | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 81 | At least one scenario must be defined | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 82 | scenario field is required | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 83 | Entity definition must contain condition field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 84 | Entity definition must contain actions field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 85 | Failed to convert condition | content |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 100 | Invalid relation type. Relation type must be from types:| syntax |
|
||||
| | [relation_types] | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 101 | Relationship field is required | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 102 | Relationship definition must contain source field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 103 | Relationship definition must contain target field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 104 | Relationship definition must contain template_id field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 120 | Invalid action type. Action type must be from types: | content |
|
||||
| [action_types] | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 121 | At least one action must be defined | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 122 | Action field is required | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 123 | Relationship definition must contain action_type field | syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 124 | Relationship definition must contain action_target field| syntax |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 125 | raise_alarm action must contain alarm_name field in | content |
|
||||
| | properties block | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 126 | raise_alarm action must contain severity field in | content |
|
||||
| | properties block | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 127 | raise_alarm action must contain target field in | content |
|
||||
| | target_action block | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 128 | set_state action must contain state field in properties | content |
|
||||
| | block | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 129 | set_state action must contain target field in | content |
|
||||
| | target_action block | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
||||
| 130 | add_causal_relationship action must contain target and | content |
|
||||
| | source field in target_action block | |
|
||||
+------------------+---------------------------------------------------------+-------------------------------+
|
@ -22,7 +22,7 @@ Result = namedtuple('Result', ['description', 'is_valid', 'status_code',
|
||||
|
||||
|
||||
def get_correct_result(description):
|
||||
return Result(description, True, 4, status_msgs[4])
|
||||
return Result(description, True, 0, status_msgs[0])
|
||||
|
||||
|
||||
def get_fault_result(description, code):
|
||||
|
@ -18,10 +18,10 @@ from vitrage.evaluator.actions.base import action_types
|
||||
status_msgs = {
|
||||
|
||||
# General 1-19
|
||||
0: 'Template validation is OK',
|
||||
1: 'template_id field contains incorrect string value.',
|
||||
2: 'Duplicate template_id definition.',
|
||||
3: 'template_id does not appear in the definition block.',
|
||||
4: 'Template validation is OK',
|
||||
|
||||
# definitions section 20-39
|
||||
20: 'definitions section must contain entities field.',
|
||||
|
@ -311,8 +311,8 @@ class TemplateContentValidatorTest(base.BaseTest):
|
||||
def _test_assert_with_correct_result(self, result):
|
||||
|
||||
self.assertTrue(result.is_valid)
|
||||
self.assertEqual(result.comment, status_msgs[4])
|
||||
self.assertEqual(result.status_code, 4)
|
||||
self.assertEqual(result.comment, status_msgs[0])
|
||||
self.assertEqual(result.status_code, 0)
|
||||
|
||||
def _create_scenario_actions(self, target, source):
|
||||
|
||||
|
@ -250,8 +250,8 @@ class TemplateSyntaxValidatorTest(base.BaseTest):
|
||||
|
||||
# Test assertions
|
||||
self.assertTrue(result.is_valid)
|
||||
self.assertEqual(result.comment, status_msgs[4])
|
||||
self.assertEqual(result.status_code, 4)
|
||||
self.assertEqual(result.comment, status_msgs[0])
|
||||
self.assertEqual(result.status_code, 0)
|
||||
|
||||
@staticmethod
|
||||
def _hide_useless_logging_messages():
|
||||
|
Loading…
Reference in New Issue
Block a user