change normalized state to normalized value
Change-Id: I795995d57234a79935286c37393fd6a48b555bcf
This commit is contained in:
parent
fa24ee3c96
commit
623b01cc70
@ -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
|
||||
|
@ -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 <datasource name>.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: <normalized alarm severity>
|
||||
priority: <Alarm severity priority - an integer>
|
||||
original states:
|
||||
original values:
|
||||
- name: <Original alarm severity 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
|
||||
|
@ -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: <Normalized resource state name - must be from NormalizedResourceState class>
|
||||
priority: <Resource state priority - an integer>
|
||||
original states:
|
||||
- name: <Original resource state name>
|
||||
- name: <Original resource state name>
|
||||
- normalized state:
|
||||
name: <Normalized resource state name - must be from NormalizedResourceState class>
|
||||
priority: <Resource state priority - an integer>
|
||||
original states:
|
||||
- name: <Original resource state name>
|
||||
- name: <Original resource state name>
|
||||
values:
|
||||
- normalized value:
|
||||
name: <Normalized resource value name - must be from NormalizedResourcevalue class>
|
||||
priority: <Resource value priority - an integer>
|
||||
original values:
|
||||
- name: <Original resource value name>
|
||||
- name: <Original resource value name>
|
||||
- normalized value:
|
||||
name: <Normalized resource value name - must be from NormalizedResourcevalue class>
|
||||
priority: <Resource value priority - an integer>
|
||||
original values:
|
||||
- name: <Original resource value name>
|
||||
- name: <Original resource value 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.
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
category: RESOURCE
|
||||
states:
|
||||
- normalized state:
|
||||
values:
|
||||
- normalized value:
|
||||
name: UNRECOGNIZED
|
||||
priority: 10
|
||||
original states:
|
||||
original values:
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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'
|
||||
),
|
||||
]
|
||||
|
@ -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__)
|
||||
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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 = [
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user