Merge "implements: blueprint static-synchronizer"
This commit is contained in:
commit
f53d6bbf2b
@ -42,7 +42,7 @@ class SyncMode(object):
|
||||
UPDATE = 'update'
|
||||
|
||||
|
||||
class EntityTypes(object):
|
||||
class EntityCategory(object):
|
||||
RESOURCE = 'RESOURCE'
|
||||
|
||||
|
||||
@ -50,3 +50,16 @@ class EventAction(object):
|
||||
CREATE = 'create'
|
||||
DELETE = 'delete'
|
||||
UPDATE = 'update'
|
||||
|
||||
|
||||
class SynchronizerProperties(object):
|
||||
SYNC_TYPE = 'sync_type'
|
||||
SYNC_MODE = 'sync_mode'
|
||||
SAMPLE_DATE = 'sample_date'
|
||||
EVENT_TYPE = 'event_type'
|
||||
|
||||
|
||||
class EntityType(object):
|
||||
NOVA_INSTANCE = 'nova.instance'
|
||||
NOVA_HOST = 'nova.host'
|
||||
NOVA_ZONE = 'nova.zone'
|
||||
|
@ -13,16 +13,16 @@
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
from collections import namedtuple
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from collections import namedtuple
|
||||
from oslo_log import log as logging
|
||||
|
||||
import vitrage.common.constants as cons
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.exception import VitrageTransformerError
|
||||
import vitrage.graph.utils as graph_utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
NODE_SUBTYPE = 'node'
|
||||
|
||||
@ -47,7 +47,7 @@ def build_key(key_values):
|
||||
|
||||
|
||||
def create_node_placeholder_vertex():
|
||||
key = build_key([cons.EntityTypes.RESOURCE, NODE_SUBTYPE])
|
||||
key = build_key([cons.EntityCategory.RESOURCE, NODE_SUBTYPE])
|
||||
|
||||
metadata = {
|
||||
cons.VertexProperties.NAME: NODE_SUBTYPE
|
||||
@ -55,7 +55,7 @@ def create_node_placeholder_vertex():
|
||||
|
||||
return graph_utils.create_vertex(
|
||||
key,
|
||||
entity_category=cons.EntityTypes.RESOURCE,
|
||||
entity_category=cons.EntityCategory.RESOURCE,
|
||||
entity_type=NODE_SUBTYPE,
|
||||
metadata=metadata
|
||||
)
|
||||
@ -145,7 +145,7 @@ class TransformerBase(object):
|
||||
|
||||
def _extract_action_type(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
if cons.SyncMode.UPDATE == sync_mode:
|
||||
return cons.EventAction.UPDATE
|
||||
|
@ -11,10 +11,13 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.constants import EdgeLabels
|
||||
from vitrage.common.constants import EntityTypes
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.entity_graph.transformer import base
|
||||
@ -27,7 +30,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class HostTransformer(base.TransformerBase):
|
||||
|
||||
HOST_TYPE = 'nova.host'
|
||||
HOST_TYPE = EntityType.NOVA_HOST
|
||||
|
||||
# Fields returned from Nova Availability Zone snapshot
|
||||
HOST_NAME = {
|
||||
@ -41,8 +44,8 @@ class HostTransformer(base.TransformerBase):
|
||||
}
|
||||
|
||||
TIMESTAMP = {
|
||||
SyncMode.SNAPSHOT: ('sample_date',),
|
||||
SyncMode.INIT_SNAPSHOT: ('sample_date',)
|
||||
SyncMode.SNAPSHOT: (SyncProps.SAMPLE_DATE,),
|
||||
SyncMode.INIT_SNAPSHOT: (SyncProps.SAMPLE_DATE,)
|
||||
}
|
||||
|
||||
def __init__(self, transformers):
|
||||
@ -50,7 +53,7 @@ class HostTransformer(base.TransformerBase):
|
||||
|
||||
def _create_entity_vertex(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
host_name = extract_field_value(
|
||||
entity_event,
|
||||
@ -68,7 +71,7 @@ class HostTransformer(base.TransformerBase):
|
||||
return graph_utils.create_vertex(
|
||||
entity_key,
|
||||
entity_id=host_name,
|
||||
entity_category=EntityTypes.RESOURCE,
|
||||
entity_category=EntityCategory.RESOURCE,
|
||||
entity_type=self.HOST_TYPE,
|
||||
update_timestamp=timestamp,
|
||||
metadata=metadata
|
||||
@ -76,7 +79,7 @@ class HostTransformer(base.TransformerBase):
|
||||
|
||||
def _create_neighbors(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
neighbors = []
|
||||
|
||||
@ -100,7 +103,7 @@ class HostTransformer(base.TransformerBase):
|
||||
def _create_zone_neighbor(
|
||||
self, entity_event, timestamp, host_vertex_id, zone_name_path):
|
||||
|
||||
zone_transformer = self.transformers['nova.zone']
|
||||
zone_transformer = self.transformers[EntityType.NOVA_ZONE]
|
||||
|
||||
if zone_transformer:
|
||||
|
||||
@ -123,14 +126,14 @@ class HostTransformer(base.TransformerBase):
|
||||
|
||||
def _key_values(self, mutable_fields):
|
||||
|
||||
fixed_fields = [EntityTypes.RESOURCE, self.HOST_TYPE]
|
||||
fixed_fields = [EntityCategory.RESOURCE, self.HOST_TYPE]
|
||||
return fixed_fields + mutable_fields
|
||||
|
||||
def extract_key(self, entity_event):
|
||||
|
||||
host_name = extract_field_value(
|
||||
entity_event,
|
||||
self.HOST_NAME[entity_event['sync_mode']]
|
||||
self.HOST_NAME[entity_event[SyncProps.SYNC_MODE]]
|
||||
)
|
||||
|
||||
key_fields = self._key_values([host_name])
|
||||
@ -143,7 +146,7 @@ class HostTransformer(base.TransformerBase):
|
||||
return graph_utils.create_vertex(
|
||||
base.build_key(key_fields),
|
||||
entity_id=host_name,
|
||||
entity_category=EntityTypes.RESOURCE,
|
||||
entity_category=EntityCategory.RESOURCE,
|
||||
entity_type=self.HOST_TYPE,
|
||||
update_timestamp=timestamp,
|
||||
is_placeholder=True
|
||||
|
@ -11,11 +11,14 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.constants import EdgeLabels
|
||||
from vitrage.common.constants import EntityTypes
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import EventAction
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.common.exception import VitrageTransformerError
|
||||
@ -29,7 +32,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class InstanceTransformer(base.TransformerBase):
|
||||
|
||||
INSTANCE_TYPE = 'nova.instance'
|
||||
INSTANCE_TYPE = EntityType.NOVA_INSTANCE
|
||||
|
||||
# Fields returned from Nova Instance snapshot
|
||||
INSTANCE_ID = {
|
||||
@ -45,8 +48,8 @@ class InstanceTransformer(base.TransformerBase):
|
||||
}
|
||||
|
||||
TIMESTAMP = {
|
||||
SyncMode.SNAPSHOT: ('sample_date',),
|
||||
SyncMode.INIT_SNAPSHOT: ('sample_date',),
|
||||
SyncMode.SNAPSHOT: (SyncProps.SAMPLE_DATE,),
|
||||
SyncMode.INIT_SNAPSHOT: (SyncProps.SAMPLE_DATE,),
|
||||
SyncMode.UPDATE: ('metadata', 'timestamp')
|
||||
}
|
||||
|
||||
@ -68,7 +71,7 @@ class InstanceTransformer(base.TransformerBase):
|
||||
SyncMode.UPDATE: ('payload', 'hostname')
|
||||
}
|
||||
|
||||
UPDATE_EVENT_TYPE = 'event_type'
|
||||
UPDATE_EVENT_TYPE = SyncProps.EVENT_TYPE
|
||||
|
||||
# Event types which need to refer them differently
|
||||
EVENT_TYPES = {
|
||||
@ -81,7 +84,7 @@ class InstanceTransformer(base.TransformerBase):
|
||||
|
||||
def _create_entity_vertex(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
metadata = {
|
||||
VertexProperties.NAME: extract_field_value(
|
||||
@ -110,7 +113,7 @@ class InstanceTransformer(base.TransformerBase):
|
||||
return graph_utils.create_vertex(
|
||||
entity_key,
|
||||
entity_id=entity_id,
|
||||
entity_category=EntityTypes.RESOURCE,
|
||||
entity_category=EntityCategory.RESOURCE,
|
||||
entity_type=self.INSTANCE_TYPE,
|
||||
entity_project=project,
|
||||
entity_state=state,
|
||||
@ -120,10 +123,10 @@ class InstanceTransformer(base.TransformerBase):
|
||||
|
||||
def _create_neighbors(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
neighbors = []
|
||||
host_transformer = self.transformers['nova.host']
|
||||
host_transformer = self.transformers[EntityType.NOVA_HOST]
|
||||
|
||||
if host_transformer:
|
||||
|
||||
@ -146,7 +149,7 @@ class InstanceTransformer(base.TransformerBase):
|
||||
|
||||
def _extract_action_type(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
if SyncMode.UPDATE == sync_mode:
|
||||
return self.EVENT_TYPES.get(
|
||||
@ -166,7 +169,7 @@ class InstanceTransformer(base.TransformerBase):
|
||||
|
||||
instance_id = extract_field_value(
|
||||
entity_event,
|
||||
self.INSTANCE_ID[entity_event['sync_mode']])
|
||||
self.INSTANCE_ID[entity_event[SyncProps.SYNC_MODE]])
|
||||
|
||||
key_fields = self._key_values([instance_id])
|
||||
return base.build_key(key_fields)
|
||||
@ -198,11 +201,11 @@ class InstanceTransformer(base.TransformerBase):
|
||||
return graph_utils.create_vertex(
|
||||
base.build_key(key_fields),
|
||||
entity_id=instance_id,
|
||||
entity_category=EntityTypes.RESOURCE,
|
||||
entity_category=EntityCategory.RESOURCE,
|
||||
entity_type=self.INSTANCE_TYPE,
|
||||
update_timestamp=timestamp,
|
||||
is_placeholder=True
|
||||
)
|
||||
|
||||
def _key_values(self, mutable_fields):
|
||||
return [EntityTypes.RESOURCE, self.INSTANCE_TYPE] + mutable_fields
|
||||
return [EntityCategory.RESOURCE, self.INSTANCE_TYPE] + mutable_fields
|
||||
|
@ -14,6 +14,9 @@
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.exception import VitrageTransformerError
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -29,15 +32,15 @@ class TransformerManager(object):
|
||||
|
||||
transformers = {}
|
||||
|
||||
transformers['nova.instance'] = importutils.import_object(
|
||||
transformers[EntityType.NOVA_INSTANCE] = importutils.import_object(
|
||||
'vitrage.entity_graph.transformer.instance_transformer.'
|
||||
+ 'InstanceTransformer', transformers)
|
||||
|
||||
transformers['nova.host'] = importutils.import_object(
|
||||
transformers[EntityType.NOVA_HOST] = importutils.import_object(
|
||||
'vitrage.entity_graph.transformer.host_transformer.'
|
||||
+ 'HostTransformer', transformers)
|
||||
|
||||
transformers['nova.zone'] = importutils.import_object(
|
||||
transformers[EntityType.NOVA_ZONE] = importutils.import_object(
|
||||
'vitrage.entity_graph.transformer.zone_transformer.'
|
||||
+ 'ZoneTransformer', transformers)
|
||||
|
||||
@ -56,7 +59,7 @@ class TransformerManager(object):
|
||||
def transform(self, entity_event):
|
||||
|
||||
try:
|
||||
sync_type = entity_event['sync_type']
|
||||
sync_type = entity_event[SyncProps.SYNC_TYPE]
|
||||
except KeyError:
|
||||
raise VitrageTransformerError(
|
||||
'Entity Event must contains sync_type field.')
|
||||
@ -66,7 +69,7 @@ class TransformerManager(object):
|
||||
def extract_key(self, entity_event):
|
||||
|
||||
try:
|
||||
sync_type = entity_event['sync_type']
|
||||
sync_type = entity_event[SyncProps.SYNC_TYPE]
|
||||
except KeyError:
|
||||
raise VitrageTransformerError(
|
||||
'Entity Event must contains sync_type field.')
|
||||
|
@ -11,10 +11,13 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.constants import EdgeLabels
|
||||
from vitrage.common.constants import EntityTypes
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.entity_graph.transformer import base
|
||||
@ -27,7 +30,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class ZoneTransformer(base.TransformerBase):
|
||||
|
||||
ZONE_TYPE = 'nova.zone'
|
||||
ZONE_TYPE = EntityType.NOVA_ZONE
|
||||
|
||||
STATE_AVAILABLE = 'available'
|
||||
STATE_UNAVAILABLE = 'unavailable'
|
||||
@ -44,8 +47,8 @@ class ZoneTransformer(base.TransformerBase):
|
||||
}
|
||||
|
||||
TIMESTAMP = {
|
||||
SyncMode.SNAPSHOT: ('sample_date',),
|
||||
SyncMode.INIT_SNAPSHOT: ('sample_date',)
|
||||
SyncMode.SNAPSHOT: (SyncProps.SAMPLE_DATE,),
|
||||
SyncMode.INIT_SNAPSHOT: (SyncProps.SAMPLE_DATE,)
|
||||
}
|
||||
|
||||
HOSTS = {
|
||||
@ -70,7 +73,7 @@ class ZoneTransformer(base.TransformerBase):
|
||||
|
||||
def _create_entity_vertex(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
zone_name = extract_field_value(
|
||||
entity_event,
|
||||
@ -97,7 +100,7 @@ class ZoneTransformer(base.TransformerBase):
|
||||
return graph_utils.create_vertex(
|
||||
entity_key,
|
||||
entity_id=zone_name,
|
||||
entity_category=EntityTypes.RESOURCE,
|
||||
entity_category=EntityCategory.RESOURCE,
|
||||
entity_type=self.ZONE_TYPE,
|
||||
entity_state=state,
|
||||
update_timestamp=timestamp,
|
||||
@ -106,14 +109,14 @@ class ZoneTransformer(base.TransformerBase):
|
||||
|
||||
def _create_neighbors(self, entity_event):
|
||||
|
||||
sync_mode = entity_event['sync_mode']
|
||||
sync_mode = entity_event[SyncProps.SYNC_MODE]
|
||||
|
||||
zone_vertex_id = self.extract_key(entity_event)
|
||||
|
||||
neighbors = [self._create_node_neighbor(zone_vertex_id)]
|
||||
|
||||
hosts = extract_field_value(entity_event, self.HOSTS[sync_mode])
|
||||
host_transformer = self.transformers['nova.host']
|
||||
host_transformer = self.transformers[EntityType.NOVA_HOST]
|
||||
|
||||
if host_transformer:
|
||||
|
||||
@ -168,7 +171,7 @@ class ZoneTransformer(base.TransformerBase):
|
||||
host_vertex = graph_utils.create_vertex(
|
||||
base.build_key(host_transformer._key_values([host_name])),
|
||||
entity_id=host_name,
|
||||
entity_category=EntityTypes.RESOURCE,
|
||||
entity_category=EntityCategory.RESOURCE,
|
||||
entity_type=self.ZONE_TYPE,
|
||||
entity_state=host_state,
|
||||
update_timestamp=timestamp,
|
||||
@ -185,7 +188,7 @@ class ZoneTransformer(base.TransformerBase):
|
||||
|
||||
zone_name = extract_field_value(
|
||||
entity_event,
|
||||
self.ZONE_NAME[entity_event['sync_mode']]
|
||||
self.ZONE_NAME[entity_event[SyncProps.SYNC_MODE]]
|
||||
)
|
||||
|
||||
key_fields = self._key_values([zone_name])
|
||||
@ -193,7 +196,7 @@ class ZoneTransformer(base.TransformerBase):
|
||||
|
||||
def _key_values(self, mutable_fields):
|
||||
|
||||
fixed_fields = [EntityTypes.RESOURCE, self.ZONE_TYPE]
|
||||
fixed_fields = [EntityCategory.RESOURCE, self.ZONE_TYPE]
|
||||
return fixed_fields + mutable_fields
|
||||
|
||||
def create_placeholder_vertex(self, zone_name, timestamp):
|
||||
@ -202,7 +205,7 @@ class ZoneTransformer(base.TransformerBase):
|
||||
return graph_utils.create_vertex(
|
||||
key,
|
||||
entity_id=zone_name,
|
||||
entity_category=EntityTypes.RESOURCE,
|
||||
entity_category=EntityCategory.RESOURCE,
|
||||
entity_type=self.ZONE_TYPE,
|
||||
update_timestamp=timestamp,
|
||||
is_placeholder=True
|
||||
|
@ -14,11 +14,13 @@
|
||||
import vitrage.api
|
||||
import vitrage.evaluator
|
||||
import vitrage.synchronizer
|
||||
import vitrage.synchronizer.other_plugins
|
||||
|
||||
|
||||
def list_opts():
|
||||
return [
|
||||
('api', vitrage.api.OPTS),
|
||||
('synchronizer', vitrage.synchronizer.OPTS),
|
||||
('evaluator', vitrage.evaluator.OPTS)
|
||||
('evaluator', vitrage.evaluator.OPTS),
|
||||
('static_synchronizer_plugin', vitrage.synchronizer.other_plugins.OPTS)
|
||||
]
|
||||
|
@ -12,10 +12,45 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common import utils
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BasePlugin(object):
|
||||
def __init__(self):
|
||||
return
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_all(self):
|
||||
return
|
||||
pass
|
||||
|
||||
def make_pickleable(self, entities, sync_type, fields_to_remove=None):
|
||||
|
||||
pickleable_entities = []
|
||||
|
||||
for entity in entities:
|
||||
pickleable_entity = entity.__dict__
|
||||
|
||||
for field in fields_to_remove:
|
||||
pickleable_entity.pop(field)
|
||||
|
||||
self._add_sync_type(pickleable_entity)
|
||||
self._add_sampling_time(pickleable_entity)
|
||||
pickleable_entities.append(pickleable_entity)
|
||||
|
||||
return pickleable_entities
|
||||
|
||||
@staticmethod
|
||||
def _add_sync_type(entity, sync_type):
|
||||
if sync_type:
|
||||
entity[SyncProps.SYNC_TYPE] = sync_type
|
||||
|
||||
@staticmethod
|
||||
def _add_sampling_time(entity):
|
||||
entity[SyncProps.SAMPLE_DATE] = str(utils.utcnow())
|
||||
|
@ -12,14 +12,14 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_service import service as os_service
|
||||
|
||||
from nova_plugins.nova_host_plugin import NovaHostPlugin
|
||||
from nova_plugins.nova_instance_plugin import NovaInstancePlugin
|
||||
from nova_plugins.nova_zone_plugin import NovaZonePlugin
|
||||
from oslo_log import log
|
||||
from oslo_service import service as os_service
|
||||
from services import SnapshotsService
|
||||
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@ -45,7 +45,8 @@ class Launcher(object):
|
||||
service.set_callback(self.callback)
|
||||
launcher.launch_service(service, 1)
|
||||
|
||||
def _init_registered_plugins(self):
|
||||
@staticmethod
|
||||
def _init_registered_plugins():
|
||||
version = 2.0
|
||||
user = 'admin'
|
||||
password = 'password'
|
||||
|
@ -0,0 +1,15 @@
|
||||
# Copyright 2016 - Nokia
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
__author__ = 'stack'
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.synchronizer.nova_plugins.novaclient_plugin \
|
||||
import NovaClientPlugin
|
||||
|
||||
@ -35,5 +36,5 @@ class NovaHostPlugin(NovaClientPlugin):
|
||||
return compute_hosts
|
||||
|
||||
def get_all(self):
|
||||
return self.make_picklable(self.filter_none_compute_hosts(
|
||||
self.client.hosts.list()), 'nova.host', ['manager'])
|
||||
return self.make_pickleable(self.filter_none_compute_hosts(
|
||||
self.client.hosts.list()), EntityType.NOVA_HOST, ['manager'])
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.synchronizer.nova_plugins.novaclient_plugin \
|
||||
import NovaClientPlugin
|
||||
|
||||
@ -25,5 +26,5 @@ class NovaInstancePlugin(NovaClientPlugin):
|
||||
auth_url)
|
||||
|
||||
def get_all(self):
|
||||
return self.make_picklable(self.client.servers.list(),
|
||||
'nova.instance', ['manager'])
|
||||
return self.make_pickleable(self.client.servers.list(),
|
||||
EntityType.NOVA_INSTANCE, ['manager'])
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.synchronizer.nova_plugins.novaclient_plugin \
|
||||
import NovaClientPlugin
|
||||
|
||||
@ -34,5 +35,6 @@ class NovaZonePlugin(NovaClientPlugin):
|
||||
return zones_res
|
||||
|
||||
def get_all(self):
|
||||
return self.make_picklable(self.filter_internal_zone(
|
||||
self.client.availability_zones.list()), 'nova.zone', ['manager'])
|
||||
return self.make_pickleable(self.filter_internal_zone(
|
||||
self.client.availability_zones.list()),
|
||||
EntityType.NOVA_ZONE, ['manager'])
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
from novaclient import client
|
||||
from vitrage.common import utils
|
||||
|
||||
from vitrage.synchronizer.base_plugin import BasePlugin
|
||||
|
||||
|
||||
@ -25,24 +25,3 @@ class NovaClientPlugin(BasePlugin):
|
||||
|
||||
def get_client(self):
|
||||
return self.client
|
||||
|
||||
def make_picklable(self, entities, sync_type, fields_to_remove=None):
|
||||
|
||||
picklable_entities = []
|
||||
|
||||
for entity in entities:
|
||||
picklable_entity = entity.__dict__
|
||||
|
||||
for field in fields_to_remove:
|
||||
picklable_entity.pop(field)
|
||||
|
||||
picklable_entity['sync_type'] = sync_type
|
||||
self._add_sampling_time(picklable_entity)
|
||||
picklable_entities.append(picklable_entity)
|
||||
|
||||
return picklable_entities
|
||||
|
||||
@staticmethod
|
||||
def _add_sampling_time(entity):
|
||||
entity['sample_date'] = str(utils.utcnow())
|
||||
return entity
|
||||
|
24
vitrage/synchronizer/other_plugins/__init__.py
Normal file
24
vitrage/synchronizer/other_plugins/__init__.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright 2016 - Nokia
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
# Register options for the service
|
||||
OPTS = [
|
||||
cfg.StrOpt('static_plugins_dir',
|
||||
default='/etc/vitrage/static_plugins',
|
||||
help='A path for the static plugins for the syncronizer'
|
||||
),
|
||||
]
|
38
vitrage/synchronizer/other_plugins/static_plugin.py
Normal file
38
vitrage/synchronizer/other_plugins/static_plugin.py
Normal file
@ -0,0 +1,38 @@
|
||||
# Copyright 2016 - Nokia
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from vitrage.common import file_utils
|
||||
from vitrage.synchronizer.base_plugin import BasePlugin
|
||||
|
||||
|
||||
class StaticPlugin(BasePlugin):
|
||||
def __init__(self):
|
||||
super(StaticPlugin, self).__init__()
|
||||
self.cfg_opts = cfg.ConfigOpts()
|
||||
|
||||
def get_all(self):
|
||||
return self.make_pickleable(self.get_instances(), None, ['manager'])
|
||||
|
||||
def get_instances(self):
|
||||
static_entities = []
|
||||
static_plugin_configs = file_utils.load_yaml_files(
|
||||
self.cfg_opts.synchronizer.other_plugins.static_plugins_dir)
|
||||
|
||||
for config in static_plugin_configs:
|
||||
for entity in config:
|
||||
static_entities.append(entity)
|
||||
|
||||
return static_entities
|
@ -15,6 +15,7 @@
|
||||
from oslo_log import log
|
||||
from oslo_service import service as os_service
|
||||
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
@ -65,6 +66,7 @@ class SnapshotsService(SynchronizerService):
|
||||
LOG.debug("end get all with sync mode %s" % sync_mode)
|
||||
self.first_time = False
|
||||
|
||||
def _mark_snapshot_entities(self, dicts, sync_mode):
|
||||
[x.setdefault('sync_mode', sync_mode) for x in dicts]
|
||||
@staticmethod
|
||||
def _mark_snapshot_entities(dicts, sync_mode):
|
||||
[x.setdefault(SyncProps.SYNC_MODE, sync_mode) for x in dicts]
|
||||
return dicts
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import unittest
|
||||
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.common.utils import utcnow
|
||||
@ -67,16 +68,16 @@ class TestProcessor(base.BaseTest):
|
||||
# check update instance even
|
||||
# TODO(Alexey): Create an event in update event structure
|
||||
# (update snapshot fields won't work)
|
||||
event['sync_mode'] = SyncMode.UPDATE
|
||||
event['event_type'] = 'compute.instance.volume.attach'
|
||||
event[SyncProps.SYNC_MODE] = SyncMode.UPDATE
|
||||
event[SyncProps.EVENT_TYPE] = 'compute.instance.volume.attach'
|
||||
event['hostname'] = 'new_host'
|
||||
processor.process_event(event)
|
||||
self._check_graph(processor, self.NUM_VERTICES_AFTER_CREATION,
|
||||
self.NUM_EDGES_AFTER_CREATION)
|
||||
|
||||
# check delete instance event
|
||||
event['sync_mode'] = SyncMode.UPDATE
|
||||
event['event_type'] = 'compute.instance.delete.end'
|
||||
event[SyncProps.SYNC_MODE] = SyncMode.UPDATE
|
||||
event[SyncProps.EVENT_TYPE] = 'compute.instance.delete.end'
|
||||
processor.process_event(event)
|
||||
self._check_graph(processor, self.NUM_VERTICES_AFTER_DELETION,
|
||||
self.NUM_EDGES_AFTER_DELETION)
|
||||
@ -225,11 +226,12 @@ class TestProcessor(base.BaseTest):
|
||||
@staticmethod
|
||||
def _create_mock_events():
|
||||
gen_list = mock_sync.simple_zone_generators(
|
||||
2, 4, snapshot_events=2, snap_vals={'sync_mode': 'init_snapshot'})
|
||||
2, 4, snapshot_events=2,
|
||||
snap_vals={SyncProps.SYNC_MODE: SyncMode.INIT_SNAPSHOT})
|
||||
gen_list += mock_sync.simple_host_generators(
|
||||
2, 4, 4, snap_vals={'sync_mode': 'init_snapshot'})
|
||||
2, 4, 4, snap_vals={SyncProps.SYNC_MODE: SyncMode.INIT_SNAPSHOT})
|
||||
gen_list += mock_sync.simple_instance_generators(
|
||||
4, 15, 15, snap_vals={'sync_mode': 'init_snapshot'})
|
||||
4, 15, 15, snap_vals={SyncProps.SYNC_MODE: SyncMode.INIT_SNAPSHOT})
|
||||
return mock_sync.generate_sequential_events_list(gen_list)
|
||||
|
||||
def _create_event(self, spec_type=None, sync_mode=None,
|
||||
@ -241,10 +243,10 @@ class TestProcessor(base.BaseTest):
|
||||
|
||||
# update properties
|
||||
if sync_mode is not None:
|
||||
events_list[0]['sync_mode'] = sync_mode
|
||||
events_list[0][SyncProps.SYNC_MODE] = sync_mode
|
||||
|
||||
if event_type is not None:
|
||||
events_list[0]['event_type'] = event_type
|
||||
events_list[0][SyncProps.EVENT_TYPE] = event_type
|
||||
|
||||
if properties is not None:
|
||||
for key, value in properties.iteritems():
|
||||
|
@ -11,13 +11,16 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.constants import EdgeLabels
|
||||
from vitrage.common.constants import EntityTypes
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import EventAction
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.entity_graph.transformer import base as tbase
|
||||
@ -37,7 +40,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
|
||||
self.transformers = {}
|
||||
zone_transformer = ZoneTransformer(self.transformers)
|
||||
self.transformers['nova.zone'] = zone_transformer
|
||||
self.transformers[EntityType.NOVA_ZONE] = zone_transformer
|
||||
|
||||
def test_create_placeholder_vertex(self):
|
||||
LOG.debug('Nova host transformer test: Test create placeholder vertex')
|
||||
@ -69,7 +72,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
self.assertEqual(observed_entity_id, host_name)
|
||||
|
||||
observed_category = placeholder.get(VertexProperties.CATEGORY)
|
||||
self.assertEqual(observed_category, EntityTypes.RESOURCE)
|
||||
self.assertEqual(observed_category, EntityCategory.RESOURCE)
|
||||
|
||||
is_placeholder = placeholder.get(VertexProperties.IS_PLACEHOLDER)
|
||||
self.assertEqual(is_placeholder, True)
|
||||
@ -88,7 +91,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
)
|
||||
|
||||
# Test assertions
|
||||
self.assertEqual(EntityTypes.RESOURCE, observed_key_fields[0])
|
||||
self.assertEqual(EntityCategory.RESOURCE, observed_key_fields[0])
|
||||
self.assertEqual(
|
||||
host_transformer.HOST_TYPE,
|
||||
observed_key_fields[1]
|
||||
@ -117,14 +120,14 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
self.assertEqual(1, len(neighbors))
|
||||
self._validate_zone_neighbor(neighbors[0], event)
|
||||
|
||||
if SyncMode.SNAPSHOT == event['sync_mode']:
|
||||
if SyncMode.SNAPSHOT == event[SyncProps.SYNC_MODE]:
|
||||
self.assertEqual(EventAction.UPDATE, wrapper.action)
|
||||
else:
|
||||
self.assertEqual(EventAction.CREATE, wrapper.action)
|
||||
|
||||
def _validate_zone_neighbor(self, zone, event):
|
||||
|
||||
sync_mode = event['sync_mode']
|
||||
sync_mode = event[SyncProps.SYNC_MODE]
|
||||
zone_name = tbase.extract_field_value(
|
||||
event,
|
||||
HostTransformer(self.transformers).ZONE_NAME[sync_mode]
|
||||
@ -134,7 +137,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
HostTransformer(self.transformers).TIMESTAMP[sync_mode]
|
||||
)
|
||||
|
||||
zt = self.transformers['nova.zone']
|
||||
zt = self.transformers[EntityType.NOVA_ZONE]
|
||||
expected_neighbor = zt.create_placeholder_vertex(zone_name, time)
|
||||
self.assertEqual(expected_neighbor, zone.vertex)
|
||||
|
||||
@ -149,7 +152,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
|
||||
def _validate_vertex_props(self, vertex, event):
|
||||
|
||||
sync_mode = event['sync_mode']
|
||||
sync_mode = event[SyncProps.SYNC_MODE]
|
||||
extract_value = tbase.extract_field_value
|
||||
|
||||
expected_id = extract_value(
|
||||
@ -159,7 +162,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
observed_id = vertex[VertexProperties.ID]
|
||||
self.assertEqual(expected_id, observed_id)
|
||||
self.assertEqual(
|
||||
EntityTypes.RESOURCE,
|
||||
EntityCategory.RESOURCE,
|
||||
vertex[VertexProperties.CATEGORY]
|
||||
)
|
||||
|
||||
@ -196,7 +199,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
zone_num=1,
|
||||
host_num=1,
|
||||
snapshot_events=1,
|
||||
snap_vals={'sync_mode': SyncMode.SNAPSHOT})
|
||||
snap_vals={SyncProps.SYNC_MODE: SyncMode.SNAPSHOT})
|
||||
|
||||
hosts_events = mock_sync.generate_random_events_list(spec_list)
|
||||
host_transformer = HostTransformer(self.transformers)
|
||||
@ -212,7 +215,7 @@ class NovaHostTransformerTest(base.BaseTest):
|
||||
zone_num=1,
|
||||
host_num=1,
|
||||
snapshot_events=1,
|
||||
snap_vals={'sync_mode': SyncMode.INIT_SNAPSHOT})
|
||||
snap_vals={SyncProps.SYNC_MODE: SyncMode.INIT_SNAPSHOT})
|
||||
hosts_events = mock_sync.generate_random_events_list(spec_list)
|
||||
host_transformer = HostTransformer(self.transformers)
|
||||
|
||||
|
@ -17,8 +17,10 @@ import datetime
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.constants import EdgeLabels
|
||||
from vitrage.common.constants import EntityTypes
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import EventAction
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import SyncMode
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.entity_graph.transformer import base as tbase
|
||||
@ -39,7 +41,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
|
||||
self.transformers = {}
|
||||
host_transformer = HostTransformer(self.transformers)
|
||||
self.transformers['nova.host'] = host_transformer
|
||||
self.transformers[EntityType.NOVA_HOST] = host_transformer
|
||||
|
||||
def test_create_placeholder_vertex(self):
|
||||
LOG.debug('Test create placeholder vertex')
|
||||
@ -73,7 +75,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
self.assertEqual(observed_entity_id, instance_id)
|
||||
|
||||
observed_category = placeholder.get(VertexProperties.CATEGORY)
|
||||
self.assertEqual(observed_category, EntityTypes.RESOURCE)
|
||||
self.assertEqual(observed_category, EntityCategory.RESOURCE)
|
||||
|
||||
is_placeholder = placeholder.get(VertexProperties.IS_PLACEHOLDER)
|
||||
self.assertEqual(is_placeholder, True)
|
||||
@ -108,7 +110,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
host_neighbor = wrapper.neighbors[0]
|
||||
self._validate_host_neighbor(host_neighbor, event)
|
||||
|
||||
sync_mode = event['sync_mode']
|
||||
sync_mode = event[SyncProps.SYNC_MODE]
|
||||
|
||||
if sync_mode == SyncMode.INIT_SNAPSHOT:
|
||||
self.assertEqual(EventAction.CREATE, wrapper.action)
|
||||
@ -144,7 +146,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
host_neighbor = wrapper.neighbors[0]
|
||||
self._validate_host_neighbor(host_neighbor, event)
|
||||
|
||||
event_type = event['event_type']
|
||||
event_type = event[SyncProps.EVENT_TYPE]
|
||||
if event_type == 'compute.instance.delete.end':
|
||||
self.assertEqual(EventAction.DELETE, wrapper.action)
|
||||
elif event_type == 'compute.instance.create.start':
|
||||
@ -156,7 +158,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
|
||||
self.assertEqual(9, vertex.properties.__len__())
|
||||
|
||||
sync_mode = event['sync_mode']
|
||||
sync_mode = event[SyncProps.SYNC_MODE]
|
||||
|
||||
extract_value = tbase.extract_field_value
|
||||
expected_id = extract_value(
|
||||
@ -167,7 +169,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
self.assertEqual(expected_id, observed_id)
|
||||
|
||||
self.assertEqual(
|
||||
EntityTypes.RESOURCE,
|
||||
EntityCategory.RESOURCE,
|
||||
vertex[VertexProperties.CATEGORY]
|
||||
)
|
||||
|
||||
@ -213,12 +215,12 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
def _validate_host_neighbor(self, h_neighbor, event):
|
||||
|
||||
it = InstanceTransformer(self.transformers)
|
||||
sync_mode = event['sync_mode']
|
||||
sync_mode = event[SyncProps.SYNC_MODE]
|
||||
|
||||
host_name = tbase.extract_field_value(event, it.HOST_NAME[sync_mode])
|
||||
time = tbase.extract_field_value(event, it.TIMESTAMP[sync_mode])
|
||||
|
||||
ht = self.transformers['nova.host']
|
||||
ht = self.transformers[EntityType.NOVA_HOST]
|
||||
expected_neighbor = ht.create_placeholder_vertex(host_name, time)
|
||||
self.assertEqual(expected_neighbor, h_neighbor.vertex)
|
||||
|
||||
@ -249,7 +251,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
observed_key_fields = observed_key.split(
|
||||
TransformerBase.KEY_SEPARATOR)
|
||||
|
||||
self.assertEqual(EntityTypes.RESOURCE, observed_key_fields[0])
|
||||
self.assertEqual(EntityCategory.RESOURCE, observed_key_fields[0])
|
||||
self.assertEqual(
|
||||
InstanceTransformer.INSTANCE_TYPE,
|
||||
observed_key_fields[1]
|
||||
@ -257,7 +259,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
|
||||
instance_id = tbase.extract_field_value(
|
||||
event,
|
||||
instance_transformer.INSTANCE_ID[event['sync_mode']]
|
||||
instance_transformer.INSTANCE_ID[event[SyncProps.SYNC_MODE]]
|
||||
)
|
||||
|
||||
self.assertEqual(instance_id, observed_key_fields[2])
|
||||
@ -296,7 +298,7 @@ class NovaInstanceTransformerTest(base.BaseTest):
|
||||
vertex_id,
|
||||
host_name,
|
||||
time,
|
||||
self.transformers['nova.host']
|
||||
self.transformers[EntityType.NOVA_HOST]
|
||||
)
|
||||
|
||||
# Test assertions
|
||||
|
@ -11,12 +11,15 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from vitrage.common.constants import EdgeLabels
|
||||
from vitrage.common.constants import EntityTypes
|
||||
from vitrage.common.constants import EntityCategory
|
||||
from vitrage.common.constants import EntityType
|
||||
from vitrage.common.constants import SynchronizerProperties as SyncProps
|
||||
from vitrage.common.constants import VertexProperties
|
||||
from vitrage.entity_graph.transformer import base as tbase
|
||||
from vitrage.entity_graph.transformer.base import TransformerBase
|
||||
@ -35,7 +38,7 @@ class NovaZoneTransformerTest(base.BaseTest):
|
||||
|
||||
self.transformers = {}
|
||||
host_transformer = HostTransformer(self.transformers)
|
||||
self.transformers['nova.host'] = host_transformer
|
||||
self.transformers[EntityType.NOVA_HOST] = host_transformer
|
||||
|
||||
def test_create_placeholder_vertex(self):
|
||||
|
||||
@ -70,7 +73,7 @@ class NovaZoneTransformerTest(base.BaseTest):
|
||||
self.assertEqual(observed_entity_id, zone_name)
|
||||
|
||||
observed_category = placeholder.get(VertexProperties.CATEGORY)
|
||||
self.assertEqual(observed_category, EntityTypes.RESOURCE)
|
||||
self.assertEqual(observed_category, EntityCategory.RESOURCE)
|
||||
|
||||
is_placeholder = placeholder.get(VertexProperties.IS_PLACEHOLDER)
|
||||
self.assertEqual(is_placeholder, True)
|
||||
@ -86,7 +89,7 @@ class NovaZoneTransformerTest(base.BaseTest):
|
||||
observed_key_fields = zone_transformer._key_values([zone_name])
|
||||
|
||||
# Test assertions
|
||||
self.assertEqual(EntityTypes.RESOURCE, observed_key_fields[0])
|
||||
self.assertEqual(EntityCategory.RESOURCE, observed_key_fields[0])
|
||||
self.assertEqual(
|
||||
ZoneTransformer(self.transformers).ZONE_TYPE,
|
||||
observed_key_fields[1]
|
||||
@ -133,7 +136,7 @@ class NovaZoneTransformerTest(base.BaseTest):
|
||||
self._validate_host_neighbor(neighbor,
|
||||
zone_vertex_id,
|
||||
hosts,
|
||||
event['sync_mode'])
|
||||
event[SyncProps.SYNC_MODE])
|
||||
|
||||
self.assertEqual(1,
|
||||
node_neighbors_counter,
|
||||
@ -196,7 +199,7 @@ class NovaZoneTransformerTest(base.BaseTest):
|
||||
|
||||
zone_transform = ZoneTransformer(self.transformers)
|
||||
|
||||
sync_mode = event['sync_mode']
|
||||
sync_mode = event[SyncProps.SYNC_MODE]
|
||||
extract_value = tbase.extract_field_value
|
||||
|
||||
expected_id = extract_value(event, zone_transform.ZONE_NAME[sync_mode])
|
||||
@ -205,7 +208,7 @@ class NovaZoneTransformerTest(base.BaseTest):
|
||||
self.assertEqual(expected_id, observed_id)
|
||||
|
||||
self.assertEqual(
|
||||
EntityTypes.RESOURCE,
|
||||
EntityCategory.RESOURCE,
|
||||
vertex[VertexProperties.CATEGORY]
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user