コード例 #1
0
 def setUpClass(cls):
     super(ZabbixTransformerTest, cls).setUpClass()
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=ZABBIX_DATASOURCE)
     cls.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(cls.transformers, cls.conf)
コード例 #2
0
 def setUpClass(cls):
     super(NagiosTransformerTest, cls).setUpClass()
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=NAGIOS_DATASOURCE)
     cls.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(cls.transformers)
コード例 #3
0
 def setUp(self):
     super(TestCollectdTransformer, self).setUp()
     self.transformers = {}
     self.transformers[COLLECTD_DATASOURCE] = \
         CollectdTransformer(self.transformers)
     self.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(self.transformers)
コード例 #4
0
 def setUp(self):
     super(DoctorTransformerTest, self).setUp()
     self.conf_reregister_opts(self.OPTS, group=DOCTOR_DATASOURCE)
     self.transformers = {}
     self.transformers[DOCTOR_DATASOURCE] = \
         DoctorTransformer(self.transformers)
     self.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(self.transformers)
コード例 #5
0
    def test_key_values(self):

        LOG.debug('Test key values')

        # Test setup
        host_name = 'host123456'
        host_transformer = HostTransformer(self.transformers)

        # Test action
        observed_key_fields = host_transformer._key_values(
            NOVA_HOST_DATASOURCE,
            host_name)

        # Test assertions
        self.assertEqual(EntityCategory.RESOURCE, observed_key_fields[0])
        self.assertEqual(NOVA_HOST_DATASOURCE, observed_key_fields[1])
        self.assertEqual(host_name, observed_key_fields[2])
コード例 #6
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=STATIC_DATASOURCE)
     cls.transformer = StaticTransformer(cls.transformers, cls.conf)
     cls.transformers[STATIC_DATASOURCE] = cls.transformer
     cls.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(cls.transformers, cls.conf)
コード例 #7
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=NOVA_INSTANCE_DATASOURCE)
     cls.transformers[NOVA_HOST_DATASOURCE] = HostTransformer(
         cls.transformers, cls.conf)
     cls.transformers[NOVA_INSTANCE_DATASOURCE] = \
         InstanceTransformer(cls.transformers, cls.conf)
コード例 #8
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=STATIC_PHYSICAL_DATASOURCE)
     cls.transformers[NOVA_HOST_DATASOURCE] = HostTransformer(
         cls.transformers, cls.conf)
     cls.transformers[STATIC_PHYSICAL_DATASOURCE] = \
         StaticPhysicalTransformer(cls.transformers, cls.conf)
コード例 #9
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=PROMETHEUS_DATASOURCE)
     cls.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(cls.transformers, cls.conf)
     cls.transformers[PROMETHEUS_DATASOURCE] = \
         PrometheusTransformer(cls.transformers, cls.conf)
コード例 #10
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=NOVA_ZONE_DATASOURCE)
     cls.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(cls.transformers, cls.conf)
     cls.transformers[NOVA_ZONE_DATASOURCE] = \
         ZoneTransformer(cls.transformers, cls.conf)
コード例 #11
0
 def setUpClass(cls):
     super(NovaHostTransformerTest, cls).setUpClass()
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=NOVA_HOST_DATASOURCE)
     cls.transformers[NOVA_ZONE_DATASOURCE] = ZoneTransformer(
         cls.transformers)
     cls.transformers[NOVA_HOST_DATASOURCE] = HostTransformer(
         cls.transformers)
コード例 #12
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=COLLECTD_DATASOURCE)
     cls.conf.register_opts(cls.OPTS, group=NOVA_HOST_DATASOURCE)
     cls.transformers[COLLECTD_DATASOURCE] = \
         CollectdTransformer(cls.transformers, cls.conf)
     cls.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(cls.transformers, cls.conf)
コード例 #13
0
 def setUpClass(cls):
     super(BaseNovaInstanceTransformerTest, cls).setUpClass()
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=NOVA_INSTANCE_DATASOURCE)
     cls.conf.register_opts(cls._get_default_group_opts())
     cls.transformers[NOVA_HOST_DATASOURCE] = HostTransformer(
         cls.transformers)
     cls.transformers[NOVA_INSTANCE_DATASOURCE] = \
         InstanceTransformer(cls.transformers)
コード例 #14
0
 def setUp(self):
     super(PrometheusTransformerTest, self).setUp()
     self.transformers = {}
     self.conf_reregister_opts(self.OPTS, group=PROMETHEUS_DATASOURCE)
     self.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(self.transformers)
     self.transformers[NOVA_INSTANCE_DATASOURCE] = \
         InstanceTransformer(self.transformers)
     self.transformers[PROMETHEUS_DATASOURCE] = \
         PrometheusTransformer(self.transformers)
コード例 #15
0
 def setUpClass(cls):
     super(TestKapacitorTransformer, cls).setUpClass()
     cls.transformers = {}
     cls.conf = cfg.ConfigOpts()
     cls.conf.register_opts(cls.OPTS, group=KAPACITOR_DATASOURCE)
     cls.transformers[KAPACITOR_DATASOURCE] = \
         KapacitorTransformer(cls.transformers)
     cls.transformers[NOVA_INSTANCE_DATASOURCE] = \
         InstanceTransformer(cls.transformers)
     cls.transformers[NOVA_HOST_DATASOURCE] = \
         HostTransformer(cls.transformers)
コード例 #16
0
    def test_extract_action_type(self):
        LOG.debug('Test extract action type')

        # Test setup
        spec_list = mock_sync.simple_host_generators(
            zone_num=1,
            host_num=1,
            snapshot_events=1,
            snap_vals={DSProps.SYNC_MODE: SyncMode.SNAPSHOT})

        hosts_events = mock_sync.generate_random_events_list(spec_list)
        host_transformer = HostTransformer(self.transformers)

        # Test action
        action = host_transformer._extract_action_type(hosts_events[0])

        # Test assertion
        self.assertEqual(EventAction.UPDATE_ENTITY, action)

        # Test setup
        spec_list = mock_sync.simple_host_generators(
            zone_num=1,
            host_num=1,
            snapshot_events=1,
            snap_vals={DSProps.SYNC_MODE: SyncMode.INIT_SNAPSHOT})
        hosts_events = mock_sync.generate_random_events_list(spec_list)
        host_transformer = HostTransformer(self.transformers)

        # Test action
        action = host_transformer._extract_action_type(hosts_events[0])

        # Test assertions
        self.assertEqual(EventAction.CREATE_ENTITY, action)
コード例 #17
0
    def test_create_placeholder_vertex(self):
        LOG.debug('Nova host transformer test: Test create placeholder vertex')

        # Test setup
        host_name = 'host123'
        timestamp = datetime.datetime.utcnow()
        host_transformer = HostTransformer(self.transformers)

        # Test action
        properties = {
            VertexProperties.ID: host_name,
            VertexProperties.TYPE: NOVA_HOST_DATASOURCE,
            VertexProperties.SAMPLE_TIMESTAMP: timestamp
        }
        placeholder = host_transformer.create_placeholder_vertex(**properties)

        # Test assertions
        observed_id_values = placeholder.vertex_id.split(
            TransformerBase.KEY_SEPARATOR)
        expected_id_values = host_transformer._key_values(
            NOVA_HOST_DATASOURCE,
            host_name)
        self.assertEqual(tuple(observed_id_values), expected_id_values)

        observed_time = placeholder.get(VertexProperties.SAMPLE_TIMESTAMP)
        self.assertEqual(observed_time, timestamp)

        observed_subtype = placeholder.get(VertexProperties.TYPE)
        self.assertEqual(observed_subtype, NOVA_HOST_DATASOURCE)

        observed_entity_id = placeholder.get(VertexProperties.ID)
        self.assertEqual(observed_entity_id, host_name)

        observed_category = placeholder.get(VertexProperties.CATEGORY)
        self.assertEqual(observed_category, EntityCategory.RESOURCE)

        is_placeholder = placeholder.get(VertexProperties.IS_PLACEHOLDER)
        self.assertEqual(is_placeholder, True)
コード例 #18
0
    def _validate_zone_neighbor(self, zone, event):

        zone_name = tbase.extract_field_value(event, 'zone')
        time = event[DSProps.SAMPLE_DATE]

        zt = self.transformers[NOVA_ZONE_DATASOURCE]
        properties = {
            VertexProperties.ID: zone_name,
            VertexProperties.TYPE: NOVA_ZONE_DATASOURCE,
            VertexProperties.SAMPLE_TIMESTAMP: time
        }
        expected_neighbor = zt.create_placeholder_vertex(**properties)
        self.assertEqual(expected_neighbor, zone.vertex)

        # Validate neighbor edge
        edge = zone.edge
        self.assertEqual(edge.source_id, zone.vertex.vertex_id)
        self.assertEqual(
            edge.target_id,
            HostTransformer(self.transformers)._create_entity_key(event)
        )
        self.assertEqual(edge.label, EdgeLabels.CONTAINS)
コード例 #19
0
 def setUpClass(cls):
     cls.transformers = {}
     host_transformer = HostTransformer(cls.transformers)
     cls.transformers[NOVA_HOST_DATASOURCE] = host_transformer
コード例 #20
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.transformers[NOVA_ZONE_DATASOURCE] = ZoneTransformer(
         cls.transformers)
     cls.transformers[NOVA_HOST_DATASOURCE] = HostTransformer(
         cls.transformers)
コード例 #21
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.transformers[NOVA_HOST_DATASOURCE] = HostTransformer(
         cls.transformers)
     cls.transformers[STATIC_PHYSICAL_DATASOURCE] = \
         StaticPhysicalTransformer(cls.transformers)
コード例 #22
0
 def setUpClass(cls):
     cls.transformers = {}
     cls.transformers[NOVA_HOST_DATASOURCE] = HostTransformer(
         cls.transformers)
     cls.transformers[NOVA_INSTANCE_DATASOURCE] = \
         InstanceTransformer(cls.transformers)