template list - change template class name to template_data
Change-Id: I97ea69a72cc0f5135af41e8b131ed1ca7466c187
This commit is contained in:
parent
e308be47dc
commit
e11d1815d8
@ -30,7 +30,7 @@ Evaluator Design
|
||||
|Loading | load |
|
||||
| | |
|
||||
| +-----v-------------+ +---------------+ +---------------+ |
|
||||
| | Template | | | | | |
|
||||
| | Template Data | | | | | |
|
||||
| | |process | Template | add | Scenario | |
|
||||
| |(Python Dictionary)+--------> Object +-------> Repo | |
|
||||
| | | | | | | |
|
||||
|
@ -17,7 +17,7 @@ The template is written in YAML language, with the following structure.
|
||||
::
|
||||
|
||||
metadata:
|
||||
id: <unique template identifier>
|
||||
name: <unique template identifier>
|
||||
description: <what this template does>
|
||||
definitions:
|
||||
entities:
|
||||
@ -35,7 +35,7 @@ The template is written in YAML language, with the following structure.
|
||||
|
||||
The template is divided into three main sections:
|
||||
|
||||
- *metadata:* Contains the template identifier, and brief description of what the template does (optional)
|
||||
- *metadata:* Contains the template name, and brief description of what the template does (optional)
|
||||
- *definitions:* This section contains the atomic definitions referenced later on, for entities and relationships
|
||||
- *entities –* describes the resources and alarms which are relevant to the template scenario (conceptually, corresponds to a vertex in the entity graph)
|
||||
- *relationships –* the relationships between the entities (conceptually, corresponds to an edge in the entity graph)
|
||||
@ -84,7 +84,7 @@ The following template demonstrates
|
||||
::
|
||||
|
||||
metadata:
|
||||
id: host_high_mem_load_to_instance_mem_suboptimal
|
||||
name: host_high_mem_load_to_instance_mem_suboptimal
|
||||
description: when there is high memory on the host, show implications on the instances
|
||||
definitions:
|
||||
entities:
|
||||
@ -193,7 +193,7 @@ case-insensitive.
|
||||
::
|
||||
|
||||
metadata:
|
||||
id: deduced_alarm_for_all_host_in_error
|
||||
name: deduced_alarm_for_all_host_in_error
|
||||
description: raise deduced alarm for all hosts in error
|
||||
definitions:
|
||||
entities:
|
||||
@ -222,7 +222,7 @@ an alarm on the hosting zone or an alarm on the hosting host.
|
||||
::
|
||||
|
||||
metadata:
|
||||
id: deduced_alarm_two_possibile_triggers
|
||||
name: deduced_alarm_two_possibile_triggers
|
||||
description: deduced alarm using or in condition
|
||||
definitions:
|
||||
entities:
|
||||
@ -337,7 +337,7 @@ E2 both are instances like this:
|
||||
::
|
||||
|
||||
metadata:
|
||||
id: two_similar_instances
|
||||
name: two_similar_instances
|
||||
definitions:
|
||||
entities:
|
||||
- entity:
|
||||
|
@ -77,8 +77,8 @@ class ScenarioRepository(object):
|
||||
else:
|
||||
metadata = template_def.get(TemplateFields.METADATA, None)
|
||||
if metadata:
|
||||
template_id = metadata.get(TemplateFields.ID, None)
|
||||
LOG.info('Unable to load template: %s' % template_id)
|
||||
template_name = metadata.get(TemplateFields.NAME, None)
|
||||
LOG.info('Unable to load template: %s' % template_name)
|
||||
else:
|
||||
LOG.info('Unable to load template with invalid metadata')
|
||||
|
||||
|
@ -42,7 +42,7 @@ class TemplateData(object):
|
||||
|
||||
def __init__(self, template_def):
|
||||
|
||||
self.name = template_def[TFields.METADATA][TFields.ID]
|
||||
self.name = template_def[TFields.METADATA][TFields.NAME]
|
||||
|
||||
defs = template_def[TFields.DEFINITIONS]
|
||||
self.entities = self._build_entities(defs[TFields.ENTITIES])
|
||||
|
@ -29,7 +29,7 @@ class TemplateFields(object):
|
||||
DESCRIPTION = 'description'
|
||||
ENTITIES = 'entities'
|
||||
ENTITY = 'entity'
|
||||
ID = 'id'
|
||||
NAME = 'name'
|
||||
PROPERTIES = 'properties'
|
||||
RELATIONSHIPS = 'relationships'
|
||||
RELATIONSHIP = 'relationship'
|
||||
|
@ -70,7 +70,7 @@ def validate_metadata_section(metadata):
|
||||
any_str = Any(str, six.text_type)
|
||||
|
||||
schema = Schema({
|
||||
Required(TemplateFields.ID, msg=60): any_str,
|
||||
Required(TemplateFields.NAME, msg=60): any_str,
|
||||
TemplateFields.DESCRIPTION: any_str
|
||||
})
|
||||
return _validate_dict_schema(schema, metadata)
|
||||
|
@ -1,5 +1,5 @@
|
||||
metadata:
|
||||
id: deduced_alarm_on_instance
|
||||
name: deduced_alarm_on_instance
|
||||
definitions:
|
||||
entities:
|
||||
- entity:
|
||||
|
@ -1,5 +1,5 @@
|
||||
metadata:
|
||||
id: basic_causal_links
|
||||
name: basic_causal_links
|
||||
definitions:
|
||||
entities:
|
||||
- entity:
|
||||
|
@ -1,5 +1,5 @@
|
||||
metadata:
|
||||
id: deduced_alarm_for_host_alarms
|
||||
name: deduced_alarm_for_host_alarms
|
||||
definitions:
|
||||
entities:
|
||||
- entity:
|
||||
|
@ -1,5 +1,5 @@
|
||||
metadata:
|
||||
id: deduced_state_for_host_alarms
|
||||
name: deduced_state_for_host_alarms
|
||||
definitions:
|
||||
entities:
|
||||
- entity:
|
||||
|
@ -1,5 +1,5 @@
|
||||
metadata:
|
||||
id: deduced_state_for_host_alarms_2
|
||||
name: deduced_state_for_host_alarms_2
|
||||
description: replicates deduced_state.yaml, with changes to template_ids, to test overlapping templates
|
||||
definitions:
|
||||
entities:
|
||||
|
@ -1,5 +1,5 @@
|
||||
metadata:
|
||||
id: basic_template
|
||||
name: basic_template
|
||||
description: basic template for general tests
|
||||
definitions:
|
||||
entities:
|
||||
|
@ -1,5 +1,5 @@
|
||||
metadata:
|
||||
id: host_high_cpu_load_to_instance_cpu_suboptimal
|
||||
name: host_high_cpu_load_to_instance_cpu_suboptimal
|
||||
definitions:
|
||||
entities:
|
||||
- entity:
|
||||
|
@ -57,7 +57,7 @@ class TemplateSyntaxValidatorTest(base.BaseTest):
|
||||
def test_validate_template_without_id_in_metadata_section(self):
|
||||
|
||||
template = self.clone_template
|
||||
template[TemplateFields.METADATA].pop(TemplateFields.ID)
|
||||
template[TemplateFields.METADATA].pop(TemplateFields.NAME)
|
||||
self._test_execution_with_fault_result(template, 60)
|
||||
|
||||
def test_validate_template_without_definitions_section(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user