misc typo and docstring fix
Change-Id: I80819413759b4ffdda75a87beddc5dab1adc6bd3
This commit is contained in:
parent
feb2c777b6
commit
34e9e3cc16
@ -96,7 +96,7 @@ tuple with the following details:
|
|||||||
|
|
||||||
Note that for every driver there should be a matching Transformer.
|
Note that for every driver there should be a matching Transformer.
|
||||||
A transformer should inherit from
|
A transformer should inherit from
|
||||||
``vitrage.datasoures.transformer_base.TransformerBase`` class and
|
``vitrage.datasources.transformer_base.TransformerBase`` class and
|
||||||
must implement the following methods:
|
must implement the following methods:
|
||||||
|
|
||||||
+----------------------------------+------------------------------------+----------------------------------------+
|
+----------------------------------+------------------------------------+----------------------------------------+
|
||||||
|
@ -53,7 +53,7 @@ Let's take a basic template as example
|
|||||||
action_target:
|
action_target:
|
||||||
target: resource
|
target: resource
|
||||||
|
|
||||||
``TemplateData`` will build ``entites``, ``relationships`` and most importantly
|
``TemplateData`` will build ``entities``, ``relationships`` and most importantly
|
||||||
``scenarios`` out from the definition.
|
``scenarios`` out from the definition.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
@ -28,7 +28,7 @@ Zabbix web ui configuration
|
|||||||
|
|
||||||
To forward zabbix events to Vitrage a new media script needs to be created and associated with a user. Follow the steps below as a Zabbix Admin user:
|
To forward zabbix events to Vitrage a new media script needs to be created and associated with a user. Follow the steps below as a Zabbix Admin user:
|
||||||
|
|
||||||
1. Create a new media type [Admininstration > Media Types > Create Media Type]
|
1. Create a new media type [Administration > Media Types > Create Media Type]
|
||||||
|
|
||||||
| **Name:** Vitrage Notifications
|
| **Name:** Vitrage Notifications
|
||||||
| **Type:** Script
|
| **Type:** Script
|
||||||
|
@ -93,15 +93,15 @@ def _create_query_expression(query, parent_operator=None):
|
|||||||
# Recursion evaluate leaf (stop condition)
|
# Recursion evaluate leaf (stop condition)
|
||||||
elif parent_operator in operators:
|
elif parent_operator in operators:
|
||||||
for key, val in query.items():
|
for key, val in query.items():
|
||||||
expressions.append('item.get(' + _evaluatable_str(key) + ')' +
|
expressions.append('item.get(' + _evaluable_str(key) + ')' +
|
||||||
parent_operator + ' ' + _evaluatable_str(val))
|
parent_operator + ' ' + _evaluable_str(val))
|
||||||
return _join_logical_operator('and', expressions)
|
return _join_logical_operator('and', expressions)
|
||||||
else:
|
else:
|
||||||
raise VitrageError('invalid partial query format',
|
raise VitrageError('invalid partial query format',
|
||||||
parent_operator, query)
|
parent_operator, query)
|
||||||
|
|
||||||
|
|
||||||
def _evaluatable_str(value):
|
def _evaluable_str(value):
|
||||||
"""wrap string/unicode with back tick"""
|
"""wrap string/unicode with back tick"""
|
||||||
if isinstance(value, six.string_types):
|
if isinstance(value, six.string_types):
|
||||||
return '\'' + value + '\''
|
return '\'' + value + '\''
|
||||||
|
@ -65,7 +65,7 @@ class SnmpSender(SnmpSenderBase):
|
|||||||
self._get_var_binds(alarm_data),
|
self._get_var_binds(alarm_data),
|
||||||
alarm_oid)
|
alarm_oid)
|
||||||
else:
|
else:
|
||||||
LOG.info('Vitrage snmp Info: Unregconized alarm. Alarm type: %s',
|
LOG.info('Vitrage snmp Info: Unrecognized alarm. Alarm type: %s',
|
||||||
alarm_data[VProps.NAME])
|
alarm_data[VProps.NAME])
|
||||||
|
|
||||||
def _get_details(self, alarm_data):
|
def _get_details(self, alarm_data):
|
||||||
|
@ -324,8 +324,8 @@ class TestApis(TestEntityGraphUnitBase):
|
|||||||
|
|
||||||
# Test assertions
|
# Test assertions
|
||||||
self.assertIsNotNone(resource)
|
self.assertIsNotNone(resource)
|
||||||
self._check_resource_propeties(resource, 'zone_1',
|
self._check_resource_properties(resource, 'zone_1',
|
||||||
NOVA_ZONE_DATASOURCE)
|
NOVA_ZONE_DATASOURCE)
|
||||||
|
|
||||||
def test_resource_show_with_not_admin_and_no_project_resource(self):
|
def test_resource_show_with_not_admin_and_no_project_resource(self):
|
||||||
# Setup
|
# Setup
|
||||||
@ -351,9 +351,9 @@ class TestApis(TestEntityGraphUnitBase):
|
|||||||
|
|
||||||
# Test assertions
|
# Test assertions
|
||||||
self.assertIsNotNone(resource)
|
self.assertIsNotNone(resource)
|
||||||
self._check_resource_propeties(resource, 'instance_2',
|
self._check_resource_properties(resource, 'instance_2',
|
||||||
NOVA_INSTANCE_DATASOURCE,
|
NOVA_INSTANCE_DATASOURCE,
|
||||||
project_id='project_1')
|
project_id='project_1')
|
||||||
|
|
||||||
def test_resource_show_with_not_admin_and_resource_in_other_project(self):
|
def test_resource_show_with_not_admin_and_resource_in_other_project(self):
|
||||||
# Setup
|
# Setup
|
||||||
@ -379,9 +379,9 @@ class TestApis(TestEntityGraphUnitBase):
|
|||||||
|
|
||||||
# Test assertions
|
# Test assertions
|
||||||
self.assertIsNotNone(resource)
|
self.assertIsNotNone(resource)
|
||||||
self._check_resource_propeties(resource, 'instance_2',
|
self._check_resource_properties(resource, 'instance_2',
|
||||||
NOVA_INSTANCE_DATASOURCE,
|
NOVA_INSTANCE_DATASOURCE,
|
||||||
project_id='project_1')
|
project_id='project_1')
|
||||||
|
|
||||||
def test_resource_show_with_admin_and_resource_in_other_project(self):
|
def test_resource_show_with_admin_and_resource_in_other_project(self):
|
||||||
# Setup
|
# Setup
|
||||||
@ -395,9 +395,9 @@ class TestApis(TestEntityGraphUnitBase):
|
|||||||
|
|
||||||
# Test assertions
|
# Test assertions
|
||||||
self.assertIsNotNone(resource)
|
self.assertIsNotNone(resource)
|
||||||
self._check_resource_propeties(resource, 'instance_2',
|
self._check_resource_properties(resource, 'instance_2',
|
||||||
NOVA_INSTANCE_DATASOURCE,
|
NOVA_INSTANCE_DATASOURCE,
|
||||||
project_id='project_1')
|
project_id='project_1')
|
||||||
|
|
||||||
def _check_projects_entities(self,
|
def _check_projects_entities(self,
|
||||||
alarms,
|
alarms,
|
||||||
@ -415,8 +415,8 @@ class TestApis(TestEntityGraphUnitBase):
|
|||||||
(tmp_project_id and tmp_project_id == project_id))
|
(tmp_project_id and tmp_project_id == project_id))
|
||||||
self.assertEqual(True, condition)
|
self.assertEqual(True, condition)
|
||||||
|
|
||||||
def _check_resource_propeties(self, resource, vitrage_id,
|
def _check_resource_properties(self, resource, vitrage_id,
|
||||||
resource_type, project_id=None):
|
resource_type, project_id=None):
|
||||||
self.assertEqual(resource[VProps.VITRAGE_ID], vitrage_id)
|
self.assertEqual(resource[VProps.VITRAGE_ID], vitrage_id)
|
||||||
self.assertEqual(resource[VProps.ID], vitrage_id)
|
self.assertEqual(resource[VProps.ID], vitrage_id)
|
||||||
self.assertEqual(resource[VProps.VITRAGE_CATEGORY],
|
self.assertEqual(resource[VProps.VITRAGE_CATEGORY],
|
||||||
|
@ -253,8 +253,7 @@ def simple_stack_generators(stack_num, instance_and_volume_num,
|
|||||||
:param update_vals: number of values from update event
|
:param update_vals: number of values from update event
|
||||||
:param update_events: number of events from update event
|
:param update_events: number of events from update event
|
||||||
:param stack_num: number of stacks
|
:param stack_num: number of stacks
|
||||||
:param volume_num: number of volumes
|
:param instance_and_volume_num: number of volumes and instances
|
||||||
:param instance_num: number of instances
|
|
||||||
:param snapshot_events: number of snapshot events per host
|
:param snapshot_events: number of snapshot events per host
|
||||||
:param snap_vals: preset vals for ALL snapshot events
|
:param snap_vals: preset vals for ALL snapshot events
|
||||||
:return: generators for volume_num volumes as specified
|
:return: generators for volume_num volumes as specified
|
||||||
@ -299,7 +298,7 @@ def simple_consistency_generators(consistency_num, update_events=0,
|
|||||||
|
|
||||||
:param update_vals: number of values from update event
|
:param update_vals: number of values from update event
|
||||||
:param update_events: number of events from update event
|
:param update_events: number of events from update event
|
||||||
:param consistency_num: number of consisteny events
|
:param consistency_num: number of consistency events
|
||||||
:param snap_vals: preset vals for ALL snapshot events
|
:param snap_vals: preset vals for ALL snapshot events
|
||||||
:return: generators for consistency_num consistency events as specified
|
:return: generators for consistency_num consistency events as specified
|
||||||
"""
|
"""
|
||||||
|
@ -121,7 +121,7 @@ class ZabbixDriverTest(ZabbixBaseTest):
|
|||||||
self._assert_contains(expected_alarm2, alarms)
|
self._assert_contains(expected_alarm2, alarms)
|
||||||
|
|
||||||
# Step 4 - Check inactive alarms. Get all function should return
|
# Step 4 - Check inactive alarms. Get all function should return
|
||||||
# inactive alarm (alarm that teir status has changed to OK)
|
# inactive alarm (alarm that its status has changed to OK)
|
||||||
# Test setup
|
# Test setup
|
||||||
alarm_data1 = self._extract_alarm_data()
|
alarm_data1 = self._extract_alarm_data()
|
||||||
alarm_data2 = self._extract_alarm_data(z_resource_name='compute-2')
|
alarm_data2 = self._extract_alarm_data(z_resource_name='compute-2')
|
||||||
|
Loading…
Reference in New Issue
Block a user