Allow static physical configuration to include all sorts of resources and make relationships non mandatory.

Change-Id: I68ddb738fd101eac6f0c715b76f117b23bd37068
This commit is contained in:
Idan Hefetz 2016-08-17 15:09:20 +00:00
parent 7a8df27338
commit b34c21d697
4 changed files with 12 additions and 11 deletions

View File

@ -23,10 +23,10 @@ export KEEP_LOCALRC=1
if [ -z ${DEVSTACK_LOCAL_CONFIG+x} ]; then
DEVSTACK_LOCAL_CONFIG="enable_plugin vitrage git://git.openstack.org/openstack/vitrage"
fi
DEVSTACK_LOCAL_CONFIG+=$'\nenable_plugin ceilometer git://git.openstack.org/openstack/ceilometer'
DEVSTACK_LOCAL_CONFIG+=$'\nenable_plugin aodh git://git.openstack.org/openstack/aodh'
DEVSTACK_LOCAL_CONFIG+=$'\ndisable_service ceilometer-alarm-evaluator,ceilometer-alarm-notifier'
DEVSTACK_LOCAL_CONFIG+=$'\ndisable_service n-net'
#DEVSTACK_LOCAL_CONFIG+=$'\nenable_plugin ceilometer git://git.openstack.org/openstack/ceilometer'
#DEVSTACK_LOCAL_CONFIG+=$'\nenable_plugin aodh git://git.openstack.org/openstack/aodh'
#DEVSTACK_LOCAL_CONFIG+=$'\ndisable_service ceilometer-alarm-evaluator,ceilometer-alarm-notifier'
#DEVSTACK_LOCAL_CONFIG+=$'\ndisable_service n-net'
export DEVSTACK_LOCAL_CONFIG

View File

@ -24,7 +24,6 @@ from vitrage.datasources.nagios import NAGIOS_DATASOURCE
from vitrage.datasources.nagios.properties import NagiosProperties
from vitrage.datasources.nagios.properties import NagiosTestStatus
from vitrage.datasources.nova.host import NOVA_HOST_DATASOURCE
from vitrage.datasources.static_physical import SWITCH
from vitrage.datasources import transformer_base as tbase
from vitrage.datasources.transformer_base import Neighbor
import vitrage.graph.utils as graph_utils
@ -84,7 +83,7 @@ class NagiosTransformer(AlarmTransformerBase):
tbase.TIMESTAMP_FORMAT)
resource_type = entity_event[NagiosProperties.RESOURCE_TYPE]
if resource_type == NOVA_HOST_DATASOURCE or resource_type == SWITCH:
if resource_type:
return [self._create_neighbor(
vitrage_id,
timestamp,
@ -98,7 +97,8 @@ class NagiosTransformer(AlarmTransformerBase):
sample_timestamp,
resource_type,
resource_name):
transformer = self.transformers[resource_type]
# Any resource transformer will do (nova for example)
transformer = self.transformers[NOVA_HOST_DATASOURCE]
if transformer:
properties = {

View File

@ -84,7 +84,8 @@ class StaticPhysicalTransformer(ResourceTransformerBase):
entity_key = self._create_entity_key(entity_event)
timestamp = entity_event[DSProps.SAMPLE_DATE]
for neighbor_details in entity_event[self.RELATIONSHIPS_SECTION]:
for neighbor_details in entity_event.get(
self.RELATIONSHIPS_SECTION, {}):
# TODO(alexey): need to decide what to do if one of the entities
# fails
neighbor = self._create_neighbor(neighbor_details, entity_type,

View File

@ -23,7 +23,6 @@ from vitrage.common.datetime_utils import format_unix_timestamp
from vitrage.datasources.alarm_properties import AlarmProperties as AlarmProps
from vitrage.datasources.alarm_transformer_base import AlarmTransformerBase
from vitrage.datasources.nova.host import NOVA_HOST_DATASOURCE
from vitrage.datasources.static_physical import SWITCH
from vitrage.datasources import transformer_base as tbase
from vitrage.datasources.transformer_base import Neighbor
from vitrage.datasources.zabbix.properties import ZabbixProperties as ZProps
@ -98,7 +97,7 @@ class ZabbixTransformer(AlarmTransformerBase):
timestamp = entity_event[ZProps.TIMESTAMP]
resource_type = entity_event[ZProps.RESOURCE_TYPE]
if resource_type == NOVA_HOST_DATASOURCE or resource_type == SWITCH:
if resource_type:
return [self._create_neighbor(
vitrage_id,
timestamp,
@ -112,7 +111,8 @@ class ZabbixTransformer(AlarmTransformerBase):
sample_timestamp,
resource_type,
resource_name):
transformer = self.transformers[resource_type]
# Any resource transformer will do (nova for example)
transformer = self.transformers[NOVA_HOST_DATASOURCE]
if transformer:
properties = {