예제 #1
0
    def test_update_transform(self):
        LOG.debug('Test transform entity update event')

        # Test setup
        spec_list = mock_sync.simple_switch_generators(2, 10, 0, None, 10)
        static_events = mock_sync.generate_random_events_list(spec_list)
        self._events_transform_test(static_events)
예제 #2
0
    def test_snapshot_transform(self):
        LOG.debug('Test transform entity snapshot/snapshot_init event')

        # Test setup
        spec_list = mock_sync.simple_switch_generators(2, 10, 10)
        static_events = mock_sync.generate_random_events_list(spec_list)
        self._events_transform_test(static_events)
    def test_update_transform(self):
        LOG.debug('Test transform entity update event')

        # Test setup
        spec_list = mock_sync.simple_switch_generators(2, 10, 0, None, 10)
        static_events = mock_sync.generate_random_events_list(spec_list)
        self._events_transform_test(static_events)
    def test_snapshot_transform(self):
        LOG.debug('Test transform entity snapshot/snapshot_init event')

        # Test setup
        spec_list = mock_sync.simple_switch_generators(2, 10, 10)
        static_events = mock_sync.generate_random_events_list(spec_list)
        self._events_transform_test(static_events)
예제 #5
0
    def test_static_physical_validity(self):
        # Setup
        processor = self._create_processor_with_graph(self.conf)
        transformers = processor.transformer_manager.transformers
        transformers[SWITCH] = transformers[STATIC_PHYSICAL_DATASOURCE]
        self.assertThat(processor.entity_graph,
                        matchers.HasLength(
                            self._num_total_expected_vertices())
                        )

        spec_list = mock_driver.simple_switch_generators(
            switch_num=1,
            host_num=1,
            snapshot_events=1)
        static_events = mock_driver.generate_random_events_list(spec_list)
        static_physical_event = static_events[0]
        static_physical_event[DSProps.ENTITY_TYPE] = SWITCH
        static_physical_event['relationships'][0]['name'] = \
            self._find_entity_id_by_type(processor.entity_graph,
                                         NOVA_HOST_DATASOURCE)

        # Action
        processor.process_event(static_physical_event)

        # Test assertions
        self.assertThat(processor.entity_graph,
                        matchers.HasLength(
                            self._num_total_expected_vertices() + 1)
                        )

        static_physical_vertices = processor.entity_graph.get_vertices(
            vertex_attr_filter={
                VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
                VProps.VITRAGE_TYPE: SWITCH
            })
        self.assertThat(static_physical_vertices, matchers.HasLength(1))

        static_physical_neighbors = processor.entity_graph.neighbors(
            static_physical_vertices[0].vertex_id)
        self.assertThat(static_physical_neighbors, matchers.HasLength(1))

        self.assertEqual(NOVA_HOST_DATASOURCE,
                         static_physical_neighbors[0][VProps.VITRAGE_TYPE])
예제 #6
0
    def test_static_physical_validity(self):
        # Setup
        processor = self._create_processor_with_graph(self.conf)
        transformers = processor.transformer_manager.transformers
        transformers[SWITCH] = transformers[STATIC_PHYSICAL_DATASOURCE]
        self.assertEqual(self._num_total_expected_vertices(),
                         len(processor.entity_graph))

        spec_list = mock_driver.simple_switch_generators(
            switch_num=1,
            host_num=1,
            snapshot_events=1)
        static_events = mock_driver.generate_random_events_list(spec_list)
        static_physical_event = static_events[0]
        static_physical_event[DSProps.SYNC_TYPE] = SWITCH
        static_physical_event['relationships'][0]['name'] = \
            self._find_entity_id_by_type(processor.entity_graph,
                                         NOVA_HOST_DATASOURCE)

        # Action
        processor.process_event(static_physical_event)

        # Test assertions
        self.assertEqual(self._num_total_expected_vertices() + 1,
                         len(processor.entity_graph))

        static_physical_vertices = processor.entity_graph.get_vertices(
            vertex_attr_filter={
                VProps.CATEGORY: EntityCategory.RESOURCE,
                VProps.TYPE: SWITCH
            })
        self.assertEqual(1, len(static_physical_vertices))

        static_physical_neighbors = processor.entity_graph.neighbors(
            static_physical_vertices[0].vertex_id)
        self.assertEqual(1, len(static_physical_neighbors))

        self.assertEqual(NOVA_HOST_DATASOURCE,
                         static_physical_neighbors[0][VProps.TYPE])