From 623b01cc701ef42078174db613cbf62bb70fa86a Mon Sep 17 00:00:00 2001 From: Alexey Weyl Date: Mon, 11 Apr 2016 14:17:17 +0300 Subject: [PATCH] change normalized state to normalized value Change-Id: I795995d57234a79935286c37393fd6a48b555bcf --- devstack/plugin.sh | 4 +- doc/source/alarm-state-config.rst | 58 +++++++++---------- doc/source/resource-state-config.rst | 56 +++++++++--------- .../datasources_states/cinder.volume.yaml | 22 +++---- etc/vitrage/datasources_states/nagios.yaml | 22 +++---- etc/vitrage/datasources_states/nova.host.yaml | 22 +++---- .../datasources_states/nova.instance.yaml | 38 ++++++------ etc/vitrage/datasources_states/nova.zone.yaml | 22 +++---- .../datasources_states/openstack.node.yaml | 22 +++---- .../static_physical.yaml | 6 +- etc/vitrage/datasources_states/switch.yaml | 22 +++---- etc/vitrage/datasources_states/vitrage.yaml | 22 +++---- etc/vitrage/vitrage.conf.sample | 4 +- vitrage/entity_graph/__init__.py | 6 +- vitrage/entity_graph/states/state_manager.py | 34 +++++------ .../erroneous_values}/nagios.yaml | 22 +++---- .../erroneous_values}/nova.host.yaml | 20 +++---- .../erroneous_values}/nova.instance.yaml | 40 ++++++------- .../nagios.yaml | 22 +++---- .../nova.host.yaml | 22 +++---- .../nova.instance.yaml | 38 ++++++------ .../nova.zone.yaml | 22 +++---- .../vitrage.yaml | 22 +++---- vitrage/tests/unit/entity_graph/base.py | 4 +- .../entity_graph/states/test_state_manager.py | 12 ++-- vitrage_tempest_tests/tests/base_mock.py | 4 +- 26 files changed, 294 insertions(+), 294 deletions(-) rename etc/vitrage/{states_plugins => datasources_states}/static_physical.yaml (54%) rename vitrage/tests/resources/{datasources_states => datasources_values/erroneous_values}/nagios.yaml (59%) rename vitrage/tests/resources/{datasources_states/erroneous_states => datasources_values/erroneous_values}/nova.host.yaml (52%) rename vitrage/tests/resources/{datasources_states/erroneous_states => datasources_values/erroneous_values}/nova.instance.yaml (63%) rename vitrage/tests/resources/{datasources_states/erroneous_states => datasources_values}/nagios.yaml (59%) rename vitrage/tests/resources/{datasources_states => datasources_values}/nova.host.yaml (58%) rename vitrage/tests/resources/{datasources_states => datasources_values}/nova.instance.yaml (66%) rename vitrage/tests/resources/{datasources_states => datasources_values}/nova.zone.yaml (58%) rename vitrage/tests/resources/{datasources_states => datasources_values}/vitrage.yaml (61%) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 3fc575c13..8bb0a7cf3 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -156,12 +156,12 @@ function configure_vitrage { cp $VITRAGE_DIR/etc/vitrage/*.sample.json $VITRAGE_CONF_DIR # create some folders - mkdir -p $VITRAGE_CONF_DIR/datasources_states + mkdir -p $VITRAGE_CONF_DIR/datasources_values mkdir -p $VITRAGE_CONF_DIR/static_datasources mkdir -p $VITRAGE_CONF_DIR/templates # copy datasources - cp $VITRAGE_DIR/etc/vitrage/datasources_states/*.yaml $VITRAGE_CONF_DIR/datasources_states + cp $VITRAGE_DIR/etc/vitrage/datasources_values/*.yaml $VITRAGE_CONF_DIR/datasources_values configure_auth_token_middleware $VITRAGE_CONF vitrage $VITRAGE_AUTH_CACHE_DIR diff --git a/doc/source/alarm-state-config.rst b/doc/source/alarm-state-config.rst index 3ef8cf6c8..570b516a5 100644 --- a/doc/source/alarm-state-config.rst +++ b/doc/source/alarm-state-config.rst @@ -25,33 +25,33 @@ The alarm severity configuration is handled via config files. The location of these files can be determined in **/etc/vitrage/vitrage.conf**. Under the [entity_graph] section, set: -+----------------------+------------------------------------+--------------------------------+ -| Name | Description | Default Value | -+======================+====================================+================================+ -| states_plugins_dir | Directory path from where to load | /etc/vitrage/states_plugins/ | -| | the states configurations | | -+----------------------+------------------------------------+--------------------------------+ ++------------------------+------------------------------------+----------------------------------+ +| Name | Description | Default Value | ++========================+====================================+==================================+ +| datasources_values_dir | Directory path from where to load | /etc/vitrage/datasources_values/ | +| | the values configurations | | ++------------------------+------------------------------------+----------------------------------+ -Configure Alarm State Mapping ------------------------------ +Configure Alarm Severity Mapping +-------------------------------- The alarm severity configuration files configure how the severity of each alarm is normalized. There are several guidelines for creating a config file: -- Normalized alarm states which can be mapped to can be found in +- Normalized alarm values which can be mapped to can be found in normalized_alarm_severity.py (NormalizedAlarmSeverity class). - Each normalized severity also comes with a priority, so that if an alarm is given different severities from different sources (e.g., a host alarm raised both by nagios and Vitrage), the severity with the - highest priority will be used as the **aggregated state**. + highest priority will be used as the **aggregated severity**. - The *UNKNOWN* severity will be used for severities with no corresponding normalized severity. This severity *must* appear in the config file. - The config file is in YAML format. - The config filename must be .yaml, for the relevant datasource. - Defining a config file for each datasource is recommended, but not mandatory. - Datasources with no such configuration will use the states as-is. + Datasources with no such configuration will use the values as-is. Default Configuration @@ -68,14 +68,14 @@ Format :: category: ALARM - states: - - normalized state: + values: + - normalized value: name: priority: - original states: + original values: - name: - name: ... # can list several severities for one normalized - - normalized state: + - normalized value: name: ... # can list several normalized severities ... @@ -87,37 +87,37 @@ Example +++++++ The following file will map alarm severities. -Original severities 'CRITICAL' and 'DOWN' will be mapped to normalized state -'CRITICAL'. Normalized state 'SEVERE' has no original severity. -Original state 'WARNING' is mapped to normalized state 'WARNING', etc. +Original severities 'CRITICAL' and 'DOWN' will be mapped to normalized value +'CRITICAL'. Normalized value 'SEVERE' has no original severity. +Original value 'WARNING' is mapped to normalized value 'WARNING', etc. :: category: ALARM - states: - - normalized state: + values: + - normalized value: name: CRITICAL priority: 50 - original states: + original values: - name: CRITICAL - name: DOWN - - normalized state: + - normalized value: name: SEVERE priority: 40 - original states: - - normalized state: + original values: + - normalized value: name: WARNING priority: 30 - original states: + original values: - name: WARNING - - normalized state: + - normalized value: name: UNKNOWN priority: 20 - original states: + original values: - name: UNKNOWN - - normalized state: + - normalized value: name: OK priority: 10 - original states: + original values: - name: OK - name: UP diff --git a/doc/source/resource-state-config.rst b/doc/source/resource-state-config.rst index 5a81df7d5..3bbc99ff2 100644 --- a/doc/source/resource-state-config.rst +++ b/doc/source/resource-state-config.rst @@ -7,12 +7,12 @@ Configure Access to Resource State The following should be set in **/etc/vitrage/vitrage.conf**, under entity_graph section: -+----------------------+------------------------------------+--------------------------------+ -| Name | Description | Default Value | -+======================+====================================+================================+ -| states_plugins_dir | Directory path from where to load | /etc/vitrage/states_plugins/ | -| | the states configurations | | -+----------------------+------------------------------------+--------------------------------+ ++------------------------+------------------------------------+----------------------------------+ +| Name | Description | Default Value | ++========================+====================================+==================================+ +| datasources_values_dir | Directory path from where to load | /etc/vitrage/datasources_values/ | +| | the values configurations | | ++------------------------+------------------------------------+----------------------------------+ Configure Resource State Mapping @@ -29,43 +29,43 @@ State configuration yaml file has to be defined for all the plugins which were c :: category: RESOURCE - states: - - normalized state: - name: - priority: - original states: - - name: - - name: - - normalized state: - name: - priority: - original states: - - name: - - name: + values: + - normalized value: + name: + priority: + original values: + - name: + - name: + - normalized value: + name: + priority: + original values: + - name: + - name: ... **Example** -The following is mapping resource states. -Original states 'DELETED' and 'TERMINATED' will be mapped to normalized state 'TERMINATED'. -Original states 'ACTIVE' and 'RUNNING' to normalized state 'RUNNING'. +The following is mapping resource values. +Original values 'DELETED' and 'TERMINATED' will be mapped to normalized value 'TERMINATED'. +Original values 'ACTIVE' and 'RUNNING' to normalized value 'RUNNING'. :: category: RESOURCE - states: - - normalized state: + values: + - normalized value: name: TERMINATED priority: 20 - original states: + original values: - name: DELETED - name: TERMINATED - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: ACTIVE - name: RUNNING @@ -73,7 +73,7 @@ Original states 'ACTIVE' and 'RUNNING' to normalized state 'RUNNING'. **Default Configuration** -Default configurations for resource states will be installed with Vitrage. +Default configurations for resource values will be installed with Vitrage. diff --git a/etc/vitrage/datasources_states/cinder.volume.yaml b/etc/vitrage/datasources_states/cinder.volume.yaml index c64a89d04..fb20e0982 100644 --- a/etc/vitrage/datasources_states/cinder.volume.yaml +++ b/etc/vitrage/datasources_states/cinder.volume.yaml @@ -1,36 +1,36 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: ERROR priority: 50 - original states: + original values: - name: ERROR - name: ERROR_DELETING - name: ERROR_RESTORING - name: ERROR_EXTENDING - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 40 - original states: + original values: - name: UNRECOGNIZED - - normalized state: + - normalized value: name: TRANSIENT priority: 30 - original states: + original values: - name: CREATING - name: ATTACHING - name: DELETING - name: RESTORING-BACKUP - name: BACKING-UP - name: DETACHING - - normalized state: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: IN-USE - name: AVAILABLE diff --git a/etc/vitrage/datasources_states/nagios.yaml b/etc/vitrage/datasources_states/nagios.yaml index b8676a81c..0027ce6f6 100644 --- a/etc/vitrage/datasources_states/nagios.yaml +++ b/etc/vitrage/datasources_states/nagios.yaml @@ -1,28 +1,28 @@ category: ALARM -states: - - normalized state: +values: + - normalized value: name: CRITICAL priority: 50 - original states: + original values: - name: CRITICAL - name: DOWN - - normalized state: + - normalized value: name: SEVERE priority: 40 - original states: - - normalized state: + original values: + - normalized value: name: WARNING priority: 30 - original states: + original values: - name: WARNING - - normalized state: + - normalized value: name: UNKNOWN priority: 20 - original states: + original values: - name: UNKNOWN - - normalized state: + - normalized value: name: DISABLED priority: 10 - original states: + original values: - name: OK - name: UP diff --git a/etc/vitrage/datasources_states/nova.host.yaml b/etc/vitrage/datasources_states/nova.host.yaml index b067039b9..e3b24252a 100644 --- a/etc/vitrage/datasources_states/nova.host.yaml +++ b/etc/vitrage/datasources_states/nova.host.yaml @@ -1,26 +1,26 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 50 - original states: + original values: - name: DELETED - - normalized state: + - normalized value: name: ERROR priority: 40 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 30 - original states: - - normalized state: + original values: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: available diff --git a/etc/vitrage/datasources_states/nova.instance.yaml b/etc/vitrage/datasources_states/nova.instance.yaml index 0332af424..ef0f19f12 100644 --- a/etc/vitrage/datasources_states/nova.instance.yaml +++ b/etc/vitrage/datasources_states/nova.instance.yaml @@ -1,55 +1,55 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 90 - original states: + original values: - name: DELETED - name: HARD_DELETED - name: SHELVED_OFFLOADED - name: SOFT_DELETED - - normalized state: + - normalized value: name: ERROR priority: 80 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 70 - original states: + original values: - name: UNRECOGNIZED - - normalized state: + - normalized value: name: SUSPENDED priority: 60 - original states: + original values: - name: SUSPENDED - name: PAUSED - name: STOPPED - name: SHELVED - - normalized state: + - normalized value: name: RESCUED priority: 50 - original states: + original values: - name: RESCUED - - normalized state: + - normalized value: name: RESIZED priority: 40 - original states: + original values: - name: RESIZED - - normalized state: + - normalized value: name: TRANSIENT priority: 30 - original states: + original values: - name: BUILDING - name: INITIALIZED - - normalized state: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: ACTIVE - name: RESIZED diff --git a/etc/vitrage/datasources_states/nova.zone.yaml b/etc/vitrage/datasources_states/nova.zone.yaml index b067039b9..e3b24252a 100644 --- a/etc/vitrage/datasources_states/nova.zone.yaml +++ b/etc/vitrage/datasources_states/nova.zone.yaml @@ -1,26 +1,26 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 50 - original states: + original values: - name: DELETED - - normalized state: + - normalized value: name: ERROR priority: 40 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 30 - original states: - - normalized state: + original values: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: available diff --git a/etc/vitrage/datasources_states/openstack.node.yaml b/etc/vitrage/datasources_states/openstack.node.yaml index b067039b9..e3b24252a 100644 --- a/etc/vitrage/datasources_states/openstack.node.yaml +++ b/etc/vitrage/datasources_states/openstack.node.yaml @@ -1,26 +1,26 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 50 - original states: + original values: - name: DELETED - - normalized state: + - normalized value: name: ERROR priority: 40 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 30 - original states: - - normalized state: + original values: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: available diff --git a/etc/vitrage/states_plugins/static_physical.yaml b/etc/vitrage/datasources_states/static_physical.yaml similarity index 54% rename from etc/vitrage/states_plugins/static_physical.yaml rename to etc/vitrage/datasources_states/static_physical.yaml index 172b912ec..b4bef5928 100644 --- a/etc/vitrage/states_plugins/static_physical.yaml +++ b/etc/vitrage/datasources_states/static_physical.yaml @@ -1,6 +1,6 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: UNRECOGNIZED priority: 10 - original states: \ No newline at end of file + original values: \ No newline at end of file diff --git a/etc/vitrage/datasources_states/switch.yaml b/etc/vitrage/datasources_states/switch.yaml index b067039b9..e3b24252a 100644 --- a/etc/vitrage/datasources_states/switch.yaml +++ b/etc/vitrage/datasources_states/switch.yaml @@ -1,26 +1,26 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 50 - original states: + original values: - name: DELETED - - normalized state: + - normalized value: name: ERROR priority: 40 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 30 - original states: - - normalized state: + original values: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: available diff --git a/etc/vitrage/datasources_states/vitrage.yaml b/etc/vitrage/datasources_states/vitrage.yaml index 6f74fc23d..690ec2150 100644 --- a/etc/vitrage/datasources_states/vitrage.yaml +++ b/etc/vitrage/datasources_states/vitrage.yaml @@ -1,27 +1,27 @@ category: ALARM -states: - - normalized state: +values: + - normalized value: name: CRITICAL priority: 50 - original states: + original values: - name: CRITICAL - - normalized state: + - normalized value: name: SEVERE priority: 40 - original states: + original values: - name: SEVERE - - normalized state: + - normalized value: name: WARNING priority: 30 - original states: + original values: - name: WARNING - - normalized state: + - normalized value: name: UNKNOWN priority: 20 - original states: + original values: - name: UNKNOWN - - normalized state: + - normalized value: name: DISABLED priority: 10 - original states: + original values: - name: OK diff --git a/etc/vitrage/vitrage.conf.sample b/etc/vitrage/vitrage.conf.sample index f6c50efa4..90181f595 100644 --- a/etc/vitrage/vitrage.conf.sample +++ b/etc/vitrage/vitrage.conf.sample @@ -237,8 +237,8 @@ # From vitrage # -# A path for the configuration files of the data sources states (string value) -#states_plugins_dir = /etc/vitrage/datasources_states +# A path for the configuration files of the data sources values (string value) +#datasources_values_dir = /etc/vitrage/datasources_values [evaluator] diff --git a/vitrage/entity_graph/__init__.py b/vitrage/entity_graph/__init__.py index 6ea689c47..b4d1b3af2 100644 --- a/vitrage/entity_graph/__init__.py +++ b/vitrage/entity_graph/__init__.py @@ -17,9 +17,9 @@ from oslo_config import cfg OPTS = [ - cfg.StrOpt('datasources_states_dir', - default='/etc/vitrage/datasources_states', + cfg.StrOpt('datasources_values_dir', + default='/etc/vitrage/datasources_values', help='A path for the configuration files of the data sources' - ' states' + ' values' ), ] diff --git a/vitrage/entity_graph/states/state_manager.py b/vitrage/entity_graph/states/state_manager.py index a28bfbd11..39f661153 100644 --- a/vitrage/entity_graph/states/state_manager.py +++ b/vitrage/entity_graph/states/state_manager.py @@ -29,7 +29,7 @@ LOG = log.getLogger(__name__) class StateManager(object): - STATES = 'states' + VALUES = 'values' PRIORITIES = 'priorities' def __init__(self, conf): @@ -46,8 +46,8 @@ class StateManager(object): states_conf = self.datasources_state_confs[datasource_name] - return states_conf[self.STATES][upper_state] \ - if upper_state in states_conf[self.STATES] \ + return states_conf[self.VALUES][upper_state] \ + if upper_state in states_conf[self.VALUES] \ else states_conf[important_states.unknown] else: return important_states.undefined @@ -115,16 +115,16 @@ class StateManager(object): erroneous_datasources = [] files = file_utils.load_files( - self.conf.entity_graph.datasources_states_dir, '.yaml') + self.conf.entity_graph.datasources_values_dir, '.yaml') for file_name in files: try: - full_path = self.conf.entity_graph.datasources_states_dir \ + full_path = self.conf.entity_graph.datasources_values_dir \ + '/' + file_name states, priorities = \ self._retrieve_states_and_priorities_from_file(full_path) ok_datasources[os.path.splitext(file_name)[0]] = { - self.STATES: states, + self.VALUES: states, self.PRIORITIES: priorities } except Exception as e: @@ -145,17 +145,17 @@ class StateManager(object): config = file_utils.load_yaml_file(full_path, with_exception=True) category = config['category'] - for item in config['states']: - normalized_state = item['normalized state'] + for item in config[self.VALUES]: + normalized_state = item['normalized value'] - # original to normalized state + # original to normalized value normalized_state_name = normalized_state['name'] - for original_state in normalized_state['original states']: + for original_state in normalized_state['original values']: states[original_state['name'].upper()] = normalized_state_name self._add_default_states(states, priorities, category) - # normalized state priority + # normalized value priority priorities[normalized_state_name] = \ int(normalized_state['priority']) @@ -164,8 +164,8 @@ class StateManager(object): return states, priorities def _add_default_states(self, states, priorities, category): - default_states = self.category_normalizator[category].default_states() - for state, priority in default_states: + default_values = self.category_normalizator[category].default_states() + for state, priority in default_values: states[None] = state priorities[NormalizedResourceState.UNDEFINED] = priority @@ -176,14 +176,14 @@ class StateManager(object): raise ValueError('%s state is not defined in %s', important_states.unknown, full_path) - # check that all the normalized states exists + # check that all the normalized values exists state_class_instance = \ self.category_normalizator[category].get_state_class_instance() - normalized_states = StateManager._get_all_local_variables_of_class( + normalized_values = StateManager._get_all_local_variables_of_class( state_class_instance) for key in priorities.keys(): - if key not in normalized_states: - raise ValueError('Normalized state %s for %s is not in %s', + if key not in normalized_values: + raise ValueError('normalized value %s for %s is not in %s', key, full_path, state_class_instance.__class__.__name__) diff --git a/vitrage/tests/resources/datasources_states/nagios.yaml b/vitrage/tests/resources/datasources_values/erroneous_values/nagios.yaml similarity index 59% rename from vitrage/tests/resources/datasources_states/nagios.yaml rename to vitrage/tests/resources/datasources_values/erroneous_values/nagios.yaml index b8676a81c..0027ce6f6 100644 --- a/vitrage/tests/resources/datasources_states/nagios.yaml +++ b/vitrage/tests/resources/datasources_values/erroneous_values/nagios.yaml @@ -1,28 +1,28 @@ category: ALARM -states: - - normalized state: +values: + - normalized value: name: CRITICAL priority: 50 - original states: + original values: - name: CRITICAL - name: DOWN - - normalized state: + - normalized value: name: SEVERE priority: 40 - original states: - - normalized state: + original values: + - normalized value: name: WARNING priority: 30 - original states: + original values: - name: WARNING - - normalized state: + - normalized value: name: UNKNOWN priority: 20 - original states: + original values: - name: UNKNOWN - - normalized state: + - normalized value: name: DISABLED priority: 10 - original states: + original values: - name: OK - name: UP diff --git a/vitrage/tests/resources/datasources_states/erroneous_states/nova.host.yaml b/vitrage/tests/resources/datasources_values/erroneous_values/nova.host.yaml similarity index 52% rename from vitrage/tests/resources/datasources_states/erroneous_states/nova.host.yaml rename to vitrage/tests/resources/datasources_values/erroneous_values/nova.host.yaml index 497206eb4..91c3e16e1 100644 --- a/vitrage/tests/resources/datasources_states/erroneous_states/nova.host.yaml +++ b/vitrage/tests/resources/datasources_values/erroneous_values/nova.host.yaml @@ -1,23 +1,23 @@ -# erroneous yaml file - missing normalized UNRECOGNIZED state +# erroneous yaml file - missing normalized UNRECOGNIZED value category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 50 - original states: + original values: - name: DELETED - - normalized state: + - normalized value: name: ERROR priority: 40 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: available diff --git a/vitrage/tests/resources/datasources_states/erroneous_states/nova.instance.yaml b/vitrage/tests/resources/datasources_values/erroneous_values/nova.instance.yaml similarity index 63% rename from vitrage/tests/resources/datasources_states/erroneous_states/nova.instance.yaml rename to vitrage/tests/resources/datasources_values/erroneous_values/nova.instance.yaml index 2faa6eb6c..7e4fd512c 100644 --- a/vitrage/tests/resources/datasources_states/erroneous_states/nova.instance.yaml +++ b/vitrage/tests/resources/datasources_values/erroneous_values/nova.instance.yaml @@ -1,56 +1,56 @@ -# erroneous yaml file - parsing error in DELETED state +# erroneous yaml file - parsing error in DELETED value category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 90 - original states: + original values: - name: DELETED - name: HARD_DELETED - name: SHELVED_OFFLOADED - name: SOFT_DELETED - - normalized state: + - normalized value: name: ERROR priority: 80 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 70 - original states: + original values: - name: UNRECOGNIZED - - normalized state: + - normalized value: name: SUSPENDED priority: 60 - original states: + original values: - name: SUSPENDED - name: PAUSED - name: STOPPED - name: SHELVED - - normalized state: + - normalized value: name: RESCUED priority: 50 - original states: + original values: - name: RESCUED - - normalized state: + - normalized value: name: RESIZED priority: 40 - original states: + original values: - name: RESIZED - - normalized state: + - normalized value: name: TRANSIENT priority: 30 - original states: + original values: - name: BUILDING - name: INITIALIZED - - normalized state: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: ACTIVE - name: RESIZED diff --git a/vitrage/tests/resources/datasources_states/erroneous_states/nagios.yaml b/vitrage/tests/resources/datasources_values/nagios.yaml similarity index 59% rename from vitrage/tests/resources/datasources_states/erroneous_states/nagios.yaml rename to vitrage/tests/resources/datasources_values/nagios.yaml index b8676a81c..0027ce6f6 100644 --- a/vitrage/tests/resources/datasources_states/erroneous_states/nagios.yaml +++ b/vitrage/tests/resources/datasources_values/nagios.yaml @@ -1,28 +1,28 @@ category: ALARM -states: - - normalized state: +values: + - normalized value: name: CRITICAL priority: 50 - original states: + original values: - name: CRITICAL - name: DOWN - - normalized state: + - normalized value: name: SEVERE priority: 40 - original states: - - normalized state: + original values: + - normalized value: name: WARNING priority: 30 - original states: + original values: - name: WARNING - - normalized state: + - normalized value: name: UNKNOWN priority: 20 - original states: + original values: - name: UNKNOWN - - normalized state: + - normalized value: name: DISABLED priority: 10 - original states: + original values: - name: OK - name: UP diff --git a/vitrage/tests/resources/datasources_states/nova.host.yaml b/vitrage/tests/resources/datasources_values/nova.host.yaml similarity index 58% rename from vitrage/tests/resources/datasources_states/nova.host.yaml rename to vitrage/tests/resources/datasources_values/nova.host.yaml index b067039b9..e3b24252a 100644 --- a/vitrage/tests/resources/datasources_states/nova.host.yaml +++ b/vitrage/tests/resources/datasources_values/nova.host.yaml @@ -1,26 +1,26 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 50 - original states: + original values: - name: DELETED - - normalized state: + - normalized value: name: ERROR priority: 40 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 30 - original states: - - normalized state: + original values: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: available diff --git a/vitrage/tests/resources/datasources_states/nova.instance.yaml b/vitrage/tests/resources/datasources_values/nova.instance.yaml similarity index 66% rename from vitrage/tests/resources/datasources_states/nova.instance.yaml rename to vitrage/tests/resources/datasources_values/nova.instance.yaml index 0332af424..ef0f19f12 100644 --- a/vitrage/tests/resources/datasources_states/nova.instance.yaml +++ b/vitrage/tests/resources/datasources_values/nova.instance.yaml @@ -1,55 +1,55 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 90 - original states: + original values: - name: DELETED - name: HARD_DELETED - name: SHELVED_OFFLOADED - name: SOFT_DELETED - - normalized state: + - normalized value: name: ERROR priority: 80 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 70 - original states: + original values: - name: UNRECOGNIZED - - normalized state: + - normalized value: name: SUSPENDED priority: 60 - original states: + original values: - name: SUSPENDED - name: PAUSED - name: STOPPED - name: SHELVED - - normalized state: + - normalized value: name: RESCUED priority: 50 - original states: + original values: - name: RESCUED - - normalized state: + - normalized value: name: RESIZED priority: 40 - original states: + original values: - name: RESIZED - - normalized state: + - normalized value: name: TRANSIENT priority: 30 - original states: + original values: - name: BUILDING - name: INITIALIZED - - normalized state: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: ACTIVE - name: RESIZED diff --git a/vitrage/tests/resources/datasources_states/nova.zone.yaml b/vitrage/tests/resources/datasources_values/nova.zone.yaml similarity index 58% rename from vitrage/tests/resources/datasources_states/nova.zone.yaml rename to vitrage/tests/resources/datasources_values/nova.zone.yaml index b067039b9..e3b24252a 100644 --- a/vitrage/tests/resources/datasources_states/nova.zone.yaml +++ b/vitrage/tests/resources/datasources_values/nova.zone.yaml @@ -1,26 +1,26 @@ category: RESOURCE -states: - - normalized state: +values: + - normalized value: name: TERMINATED priority: 50 - original states: + original values: - name: DELETED - - normalized state: + - normalized value: name: ERROR priority: 40 - original states: + original values: - name: ERROR - - normalized state: + - normalized value: name: UNRECOGNIZED priority: 30 - original states: - - normalized state: + original values: + - normalized value: name: SUBOPTIMAL priority: 20 - original states: + original values: - name: SUBOPTIMAL - - normalized state: + - normalized value: name: RUNNING priority: 10 - original states: + original values: - name: available diff --git a/vitrage/tests/resources/datasources_states/vitrage.yaml b/vitrage/tests/resources/datasources_values/vitrage.yaml similarity index 61% rename from vitrage/tests/resources/datasources_states/vitrage.yaml rename to vitrage/tests/resources/datasources_values/vitrage.yaml index bdcd74f0d..f0373ea5f 100644 --- a/vitrage/tests/resources/datasources_states/vitrage.yaml +++ b/vitrage/tests/resources/datasources_values/vitrage.yaml @@ -1,29 +1,29 @@ category: ALARM -states: - - normalized state: +values: + - normalized value: name: CRITICAL priority: 50 - original states: + original values: - name: CRITICAL - - normalized state: + - normalized value: name: SEVERE priority: 40 - original states: + original values: - name: SEVERE - name: MAJOR - - normalized state: + - normalized value: name: WARNING priority: 30 - original states: + original values: - name: WARNING - name: MINOR - - normalized state: + - normalized value: name: UNKNOWN priority: 20 - original states: + original values: - name: UNKNOWN - - normalized state: + - normalized value: name: DISABLED priority: 10 - original states: + original values: - name: OK diff --git a/vitrage/tests/unit/entity_graph/base.py b/vitrage/tests/unit/entity_graph/base.py index a1184c503..5ef009ca5 100644 --- a/vitrage/tests/unit/entity_graph/base.py +++ b/vitrage/tests/unit/entity_graph/base.py @@ -34,8 +34,8 @@ from vitrage.tests.mocks import utils class TestEntityGraphUnitBase(base.BaseTest): PROCESSOR_OPTS = [ - cfg.StrOpt('datasources_states_dir', - default=utils.get_resources_dir() + '/datasources_states'), + cfg.StrOpt('datasources_values_dir', + default=utils.get_resources_dir() + '/datasources_values'), ] DATASOURCES_OPTS = [ diff --git a/vitrage/tests/unit/entity_graph/states/test_state_manager.py b/vitrage/tests/unit/entity_graph/states/test_state_manager.py index f53e860f0..925410821 100644 --- a/vitrage/tests/unit/entity_graph/states/test_state_manager.py +++ b/vitrage/tests/unit/entity_graph/states/test_state_manager.py @@ -32,8 +32,8 @@ from vitrage.tests.mocks import utils class TestStateManager(base.BaseTest): ENTITY_GRAPH_OPTS = [ - cfg.StrOpt('datasources_states_dir', - default=utils.get_resources_dir() + '/datasources_states'), + cfg.StrOpt('datasources_values_dir', + default=utils.get_resources_dir() + '/datasources_values'), ] DATASOURCES_OPTS = [ @@ -77,9 +77,9 @@ class TestStateManager(base.BaseTest): def test_load_datasources_state_with_errors(self): # setup entity_graph_opts = [ - cfg.StrOpt('datasources_states_dir', + cfg.StrOpt('datasources_values_dir', default=utils.get_resources_dir() + - '/datasources_states/erroneous_states'), + '/datasources_values/erroneous_values'), ] conf = cfg.ConfigOpts() conf.register_opts(entity_graph_opts, group='entity_graph') @@ -91,9 +91,9 @@ class TestStateManager(base.BaseTest): # test assertions missing_states = 1 - erroneous_states = 2 + erroneous_values = 2 num_valid_datasources = len(state_manager.datasources_state_confs) + \ - missing_states + erroneous_states + missing_states + erroneous_values self.assertEqual(len(conf.datasources.types), num_valid_datasources) diff --git a/vitrage_tempest_tests/tests/base_mock.py b/vitrage_tempest_tests/tests/base_mock.py index 91ca56d54..37a1331c1 100644 --- a/vitrage_tempest_tests/tests/base_mock.py +++ b/vitrage_tempest_tests/tests/base_mock.py @@ -27,8 +27,8 @@ class BaseMock(testtools.TestCase): """Base test class for Vitrage API tests.""" PROCESSOR_OPTS = [ - cfg.StrOpt('states_datasources_dir', - default=utils.get_resources_dir() + '/datasources_states'), + cfg.StrOpt('datasources_values_dir', + default=utils.get_resources_dir() + '/datasources_values'), ] def create_processor_with_graph(self):