diff --git a/doc/source/vitrage-api.rst b/doc/source/vitrage-api.rst index f0cd68fcd..b8c372755 100644 --- a/doc/source/vitrage-api.rst +++ b/doc/source/vitrage-api.rst @@ -102,7 +102,7 @@ Response Examples Get topology ^^^^^^^^^^^^^ -Get the topology for the node. +Get the topology for the cluster. Its possible to filter the edges vertices and depth of the graph @@ -463,10 +463,10 @@ Response Examples "category": "RESOURCE", "is_placeholder": false, "is_deleted": false, - "name": "openstack.node", - "type": "openstack.node", - "id": "openstack.node", - "vitrage_id": "RESOURCE:openstack.node" + "name": "openstack.cluster", + "type": "openstack.cluster", + "id": "openstack.cluster", + "vitrage_id": "RESOURCE:openstack.cluster" } ], "links": [ diff --git a/etc/vitrage/datasources_states/cinder.volume.yaml b/etc/vitrage/datasources_values/cinder.volume.yaml similarity index 100% rename from etc/vitrage/datasources_states/cinder.volume.yaml rename to etc/vitrage/datasources_values/cinder.volume.yaml diff --git a/etc/vitrage/datasources_states/nagios.yaml b/etc/vitrage/datasources_values/nagios.yaml similarity index 100% rename from etc/vitrage/datasources_states/nagios.yaml rename to etc/vitrage/datasources_values/nagios.yaml diff --git a/etc/vitrage/datasources_states/nova.host.yaml b/etc/vitrage/datasources_values/nova.host.yaml similarity index 100% rename from etc/vitrage/datasources_states/nova.host.yaml rename to etc/vitrage/datasources_values/nova.host.yaml diff --git a/etc/vitrage/datasources_states/nova.instance.yaml b/etc/vitrage/datasources_values/nova.instance.yaml similarity index 100% rename from etc/vitrage/datasources_states/nova.instance.yaml rename to etc/vitrage/datasources_values/nova.instance.yaml diff --git a/etc/vitrage/datasources_states/nova.zone.yaml b/etc/vitrage/datasources_values/nova.zone.yaml similarity index 100% rename from etc/vitrage/datasources_states/nova.zone.yaml rename to etc/vitrage/datasources_values/nova.zone.yaml diff --git a/etc/vitrage/datasources_states/openstack.node.yaml b/etc/vitrage/datasources_values/openstack.node.yaml similarity index 100% rename from etc/vitrage/datasources_states/openstack.node.yaml rename to etc/vitrage/datasources_values/openstack.node.yaml diff --git a/etc/vitrage/datasources_states/static_physical.yaml b/etc/vitrage/datasources_values/static_physical.yaml similarity index 80% rename from etc/vitrage/datasources_states/static_physical.yaml rename to etc/vitrage/datasources_values/static_physical.yaml index b4bef5928..804d7c855 100644 --- a/etc/vitrage/datasources_states/static_physical.yaml +++ b/etc/vitrage/datasources_values/static_physical.yaml @@ -3,4 +3,4 @@ values: - normalized value: name: UNRECOGNIZED priority: 10 - original values: \ No newline at end of file + original values: diff --git a/etc/vitrage/datasources_states/switch.yaml b/etc/vitrage/datasources_values/switch.yaml similarity index 100% rename from etc/vitrage/datasources_states/switch.yaml rename to etc/vitrage/datasources_values/switch.yaml diff --git a/etc/vitrage/datasources_states/vitrage.yaml b/etc/vitrage/datasources_values/vitrage.yaml similarity index 100% rename from etc/vitrage/datasources_states/vitrage.yaml rename to etc/vitrage/datasources_values/vitrage.yaml diff --git a/etc/vitrage/graph.sample.json b/etc/vitrage/graph.sample.json index c3c45b7b8..dfc218c03 100644 --- a/etc/vitrage/graph.sample.json +++ b/etc/vitrage/graph.sample.json @@ -273,10 +273,10 @@ "category": "RESOURCE", "is_placeholder": false, "is_deleted": false, - "name": "openstack.node", - "type": "openstack.node", - "id": "openstack.node", - "vitrage_id": "RESOURCE:openstack.node", + "name": "openstack.cluster", + "type": "openstack.cluster", + "id": "openstack.cluster", + "vitrage_id": "RESOURCE:openstack.cluster", "state": "available", "aggregated_state": "RUNNING" } diff --git a/vitrage/api/controllers/rest.py b/vitrage/api/controllers/rest.py index c1eca381f..f722c5f32 100644 --- a/vitrage/api/controllers/rest.py +++ b/vitrage/api/controllers/rest.py @@ -20,7 +20,7 @@ import pecan as pecan from pecan import abort from pecan import rest -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER LOG = log.getLogger(__name__) @@ -28,7 +28,7 @@ LOG = log.getLogger(__name__) class RootRestController(rest.RestController): @staticmethod - def as_tree(graph, root=OPENSTACK_NODE, reverse=False): + def as_tree(graph, root=OPENSTACK_CLUSTER, reverse=False): linked_graph = json_graph.node_link_graph(graph) if reverse: linked_graph = linked_graph.reverse() diff --git a/vitrage/cmd/graph.py b/vitrage/cmd/graph.py index 97fe52218..bdac00e89 100644 --- a/vitrage/cmd/graph.py +++ b/vitrage/cmd/graph.py @@ -20,7 +20,7 @@ from oslo_service import service as os_service from vitrage.common.constants import EntityCategory from vitrage.datasources import launcher as datasource_launcher -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER from vitrage.entity_graph.api_handler import service as api_handler_svc from vitrage.entity_graph.consistency import service as consistency_svc from vitrage.entity_graph.initialization_status import InitializationStatus @@ -65,7 +65,7 @@ def init(): event_queue = multiprocessing.Queue() e_graph = entity_graph.EntityGraph( 'Entity Graph', - '%s:%s' % (EntityCategory.RESOURCE, OPENSTACK_NODE)) + '%s:%s' % (EntityCategory.RESOURCE, OPENSTACK_CLUSTER)) scenario_repo = ScenarioRepository(conf) evaluator = ScenarioEvaluator(conf, e_graph, scenario_repo, event_queue) initialization_status = InitializationStatus() diff --git a/vitrage/datasources/__init__.py b/vitrage/datasources/__init__.py index 503e400ec..3078ef9ee 100644 --- a/vitrage/datasources/__init__.py +++ b/vitrage/datasources/__init__.py @@ -23,7 +23,7 @@ from vitrage.datasources.nova.instance import NOVA_INSTANCE_DATASOURCE from vitrage.datasources.nova.zone import NOVA_ZONE_DATASOURCE from vitrage.datasources.static_physical import STATIC_PHYSICAL_DATASOURCE -OPENSTACK_NODE = 'openstack.node' +OPENSTACK_CLUSTER = 'openstack.cluster' # Register options for the service OPTS = [ diff --git a/vitrage/datasources/nova/zone/transformer.py b/vitrage/datasources/nova/zone/transformer.py index e5b7699a7..cd09c1f32 100644 --- a/vitrage/datasources/nova/zone/transformer.py +++ b/vitrage/datasources/nova/zone/transformer.py @@ -76,7 +76,7 @@ class ZoneTransformer(ResourceTransformerBase): def _create_neighbors(self, entity_event): zone_vertex_id = self._create_entity_key(entity_event) - neighbors = [self._create_node_neighbor(zone_vertex_id)] + neighbors = [self._create_cluster_neighbor(zone_vertex_id)] hosts = extract_field_value(entity_event, 'hosts') host_transformer = self.transformers[NOVA_HOST_DATASOURCE] @@ -107,15 +107,15 @@ class ZoneTransformer(ResourceTransformerBase): return neighbors @staticmethod - def _create_node_neighbor(zone_vertex_id): + def _create_cluster_neighbor(zone_vertex_id): - node_vertex = tbase.create_node_placeholder_vertex() + cluster_vertex = tbase.create_cluster_placeholder_vertex() relation_edge = graph_utils.create_edge( - source_id=node_vertex.vertex_id, + source_id=cluster_vertex.vertex_id, target_id=zone_vertex_id, relationship_type=EdgeLabels.CONTAINS) - return tbase.Neighbor(node_vertex, relation_edge) + return tbase.Neighbor(cluster_vertex, relation_edge) def _create_host_neighbor(self, zone_id, host_name, host_state, sample_timestamp): diff --git a/vitrage/datasources/transformer_base.py b/vitrage/datasources/transformer_base.py index 7285deb9a..390250fb5 100644 --- a/vitrage/datasources/transformer_base.py +++ b/vitrage/datasources/transformer_base.py @@ -25,7 +25,7 @@ from vitrage.common.constants import DatasourceProperties as DSProps from vitrage.common.constants import EventAction from vitrage.common.constants import SyncMode from vitrage.common.exception import VitrageTransformerError -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER import vitrage.graph.utils as graph_utils LOG = logging.getLogger(__name__) @@ -55,19 +55,19 @@ def build_key(key_values): return TransformerBase.KEY_SEPARATOR.join(map(str, key_values)) -def create_node_placeholder_vertex(): +def create_cluster_placeholder_vertex(): key = build_key([cons.EntityCategory.RESOURCE, - OPENSTACK_NODE]) + OPENSTACK_CLUSTER]) metadata = { - cons.VertexProperties.NAME: OPENSTACK_NODE + cons.VertexProperties.NAME: OPENSTACK_CLUSTER } return graph_utils.create_vertex( key, - entity_id=OPENSTACK_NODE, + entity_id=OPENSTACK_CLUSTER, entity_category=cons.EntityCategory.RESOURCE, - entity_type=OPENSTACK_NODE, + entity_type=OPENSTACK_CLUSTER, entity_state=AVAILABLE, metadata=metadata ) diff --git a/vitrage/entity_graph/api_handler/entity_graph_api.py b/vitrage/entity_graph/api_handler/entity_graph_api.py index 8408a9647..e7b7b3c6b 100644 --- a/vitrage/entity_graph/api_handler/entity_graph_api.py +++ b/vitrage/entity_graph/api_handler/entity_graph_api.py @@ -22,7 +22,7 @@ from vitrage.common.constants import VertexProperties as VProps from vitrage.datasources.nova.host import NOVA_HOST_DATASOURCE from vitrage.datasources.nova.instance import NOVA_INSTANCE_DATASOURCE from vitrage.datasources.nova.zone import NOVA_ZONE_DATASOURCE -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER from vitrage.graph import create_algorithm from vitrage.graph import Direction @@ -36,7 +36,7 @@ TREE_TOPOLOGY_QUERY = { {'==': {VProps.IS_PLACEHOLDER: False}}, { 'or': [ - {'==': {VProps.TYPE: OPENSTACK_NODE}}, + {'==': {VProps.TYPE: OPENSTACK_CLUSTER}}, {'==': {VProps.TYPE: NOVA_INSTANCE_DATASOURCE}}, {'==': {VProps.TYPE: NOVA_HOST_DATASOURCE}}, {'==': {VProps.TYPE: NOVA_ZONE_DATASOURCE}} diff --git a/vitrage/entity_graph/consistency/consistency_enforcer.py b/vitrage/entity_graph/consistency/consistency_enforcer.py index 9ef5328d1..da2bea9c9 100644 --- a/vitrage/entity_graph/consistency/consistency_enforcer.py +++ b/vitrage/entity_graph/consistency/consistency_enforcer.py @@ -20,7 +20,7 @@ from oslo_log import log from vitrage.common.constants import EntityCategory from vitrage.common.constants import VertexProperties as VProps from vitrage.common.datetime_utils import utcnow -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER from vitrage.evaluator.actions.evaluator_event_transformer import VITRAGE_TYPE LOG = log.getLogger(__name__) @@ -152,7 +152,7 @@ class ConsistencyEnforcer(object): return filter( lambda ver: not (ver[VProps.CATEGORY] == EntityCategory.RESOURCE and - ver[VProps.TYPE] == OPENSTACK_NODE), vertices) + ver[VProps.TYPE] == OPENSTACK_CLUSTER), vertices) def _wait_for_action(self, function): count_retries = 0 diff --git a/vitrage/tests/mocks/mock_transformer.py b/vitrage/tests/mocks/mock_transformer.py index 44f2c7f50..5f017ec1b 100644 --- a/vitrage/tests/mocks/mock_transformer.py +++ b/vitrage/tests/mocks/mock_transformer.py @@ -116,7 +116,8 @@ def simple_zone_generators(zone_num, snapshot_events=0, snap_vals=None): :return: generators for vm_num vms as specified """ - mapping = [('zone-{0}'.format(ind), 'node-0') for ind in range(zone_num)] + mapping = [('zone-{0}'.format(ind), 'cluster-0') + for ind in range(zone_num)] test_entity_spec_list = [ {tg.DYNAMIC_INFO_FKEY: tg.TRANS_ZONE_SNAPSHOT_D, diff --git a/vitrage/tests/mocks/trace_generator.py b/vitrage/tests/mocks/trace_generator.py index 15b6c3dee..cafff19cf 100644 --- a/vitrage/tests/mocks/trace_generator.py +++ b/vitrage/tests/mocks/trace_generator.py @@ -450,12 +450,12 @@ def _get_trans_zone_snapshot_values(spec): :rtype: list """ - zone_node_mapping = spec[MAPPING_KEY] + zone_cluster_mapping = spec[MAPPING_KEY] static_info_re = None if spec[STATIC_INFO_FKEY] is not None: static_info_re = utils.load_specs(spec[STATIC_INFO_FKEY]) static_values = [] - for zone_name, node_name in zone_node_mapping: + for zone_name, cluster_name in zone_cluster_mapping: mapping = {'name': zone_name, 'id': zone_name} static_values.append(combine_data( diff --git a/vitrage/tests/unit/datasources/nova/test_nova_zone_transformer.py b/vitrage/tests/unit/datasources/nova/test_nova_zone_transformer.py index f847ce359..52d664d4b 100644 --- a/vitrage/tests/unit/datasources/nova/test_nova_zone_transformer.py +++ b/vitrage/tests/unit/datasources/nova/test_nova_zone_transformer.py @@ -24,7 +24,7 @@ from vitrage.datasources.nova.host import NOVA_HOST_DATASOURCE from vitrage.datasources.nova.host.transformer import HostTransformer from vitrage.datasources.nova.zone import NOVA_ZONE_DATASOURCE from vitrage.datasources.nova.zone.transformer import ZoneTransformer -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER from vitrage.datasources import transformer_base as tbase from vitrage.datasources.transformer_base import TransformerBase from vitrage.tests import base @@ -130,14 +130,14 @@ class NovaZoneTransformerTest(base.BaseTest): def _validate_neighbors(self, neighbors, zone_vertex_id, event): - node_neighbors_counter = 0 + cluster_neighbors_counter = 0 for neighbor in neighbors: vertex_type = neighbor.vertex.get(VertexProperties.TYPE) - if OPENSTACK_NODE == vertex_type: - node_neighbors_counter += 1 - self._validate_node_neighbor(neighbor, zone_vertex_id) + if OPENSTACK_CLUSTER == vertex_type: + cluster_neighbors_counter += 1 + self._validate_cluster_neighbor(neighbor, zone_vertex_id) else: hosts = tbase.extract_field_value(event, 'hosts') self._validate_host_neighbor(neighbor, @@ -146,8 +146,8 @@ class NovaZoneTransformerTest(base.BaseTest): event[DSProps.SYNC_MODE]) self.assertEqual(1, - node_neighbors_counter, - 'Zone can belongs to only one Node') + cluster_neighbors_counter, + 'Zone can belongs to only one Cluster') def _validate_host_neighbor(self, host_neighbor, @@ -191,14 +191,14 @@ class NovaZoneTransformerTest(base.BaseTest): self.assertEqual(edge.source_id, zone_vertex_id) self.assertEqual(edge.label, EdgeLabels.CONTAINS) - def _validate_node_neighbor(self, node_neighbor, zone_vertex_id): + def _validate_cluster_neighbor(self, cluster_neighbor, zone_vertex_id): - expected_node_neighbor = tbase.create_node_placeholder_vertex() - self.assertEqual(expected_node_neighbor, node_neighbor.vertex) + expected_cluster_neighbor = tbase.create_cluster_placeholder_vertex() + self.assertEqual(expected_cluster_neighbor, cluster_neighbor.vertex) # Validate neighbor edge - edge = node_neighbor.edge - self.assertEqual(edge.source_id, node_neighbor.vertex.vertex_id) + edge = cluster_neighbor.edge + self.assertEqual(edge.source_id, cluster_neighbor.vertex.vertex_id) self.assertEqual(edge.target_id, zone_vertex_id) self.assertEqual(edge.label, EdgeLabels.CONTAINS) diff --git a/vitrage/tests/unit/datasources/static_physical/test_static_physical_transformer.py b/vitrage/tests/unit/datasources/static_physical/test_static_physical_transformer.py index b481e5a84..2915daaa3 100644 --- a/vitrage/tests/unit/datasources/static_physical/test_static_physical_transformer.py +++ b/vitrage/tests/unit/datasources/static_physical/test_static_physical_transformer.py @@ -144,7 +144,7 @@ class TestStaticPhysicalTransformer(base.BaseTest): self.assertEqual(5, host_counter, - 'Zone can belongs to only one Node') + 'Zone can belongs to only one Cluster') def _validate_host_neighbor(self, host_neighbor, diff --git a/vitrage/tests/unit/entity_graph/base.py b/vitrage/tests/unit/entity_graph/base.py index 5ef009ca5..e5310bbeb 100644 --- a/vitrage/tests/unit/entity_graph/base.py +++ b/vitrage/tests/unit/entity_graph/base.py @@ -55,7 +55,7 @@ class TestEntityGraphUnitBase(base.BaseTest): min=1) ] - NUM_NODES = 1 + NUM_CLUSTERS = 1 NUM_ZONES = 2 NUM_HOSTS = 4 NUM_INSTANCES = 16 @@ -147,9 +147,9 @@ class TestEntityGraphUnitBase(base.BaseTest): ) def _num_total_expected_vertices(self): - return self.NUM_NODES + self.NUM_ZONES + self.NUM_HOSTS + \ + return self.NUM_CLUSTERS + self.NUM_ZONES + self.NUM_HOSTS + \ self.NUM_INSTANCES def _num_total_expected_edges(self): - return self.NUM_NODES + self.NUM_ZONES + self.NUM_HOSTS + \ + return self.NUM_CLUSTERS + self.NUM_ZONES + self.NUM_HOSTS + \ self.NUM_INSTANCES - 1 diff --git a/vitrage/tests/unit/graph/base.py b/vitrage/tests/unit/graph/base.py index 8d5862c35..0ee90e331 100644 --- a/vitrage/tests/unit/graph/base.py +++ b/vitrage/tests/unit/graph/base.py @@ -28,7 +28,7 @@ from vitrage.common.constants import EdgeLabels as ELabel from vitrage.common.constants import EntityCategory from vitrage.datasources.nova.host import NOVA_HOST_DATASOURCE from vitrage.datasources.nova.instance import NOVA_INSTANCE_DATASOURCE -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER from vitrage.datasources.static_physical import SWITCH from vitrage.graph import create_graph from vitrage.graph import utils as graph_utils @@ -36,7 +36,7 @@ from vitrage.tests import base LOG = logging.getLogger(__name__) -ENTITY_GRAPH_HOSTS_PER_NODE = 8 +ENTITY_GRAPH_HOSTS_PER_CLUSTER = 8 ENTITY_GRAPH_VMS_PER_HOST = 8 ENTITY_GRAPH_ALARMS_PER_HOST = 8 ENTITY_GRAPH_TESTS_PER_HOST = 20 @@ -51,9 +51,9 @@ ALARM_ON_HOST = 'ALARM_ON_HOST' TEST_ON_HOST = 'TEST_ON_HOST' v_node = graph_utils.create_vertex( - vitrage_id=EntityCategory.RESOURCE + ':' + OPENSTACK_NODE, + vitrage_id=EntityCategory.RESOURCE + ':' + OPENSTACK_CLUSTER, entity_id='111111111111', - entity_type=OPENSTACK_NODE, + entity_type=OPENSTACK_CLUSTER, entity_category=RESOURCE) v_host = graph_utils.create_vertex( vitrage_id=NOVA_HOST_DATASOURCE + '222222222222', @@ -123,7 +123,7 @@ class GraphTestBase(base.BaseTest): self.host_test_id = 40000000 self.entity_graph = self._create_entity_graph( 'entity_graph', - num_of_hosts_per_node=ENTITY_GRAPH_HOSTS_PER_NODE, + num_of_hosts_per_node=ENTITY_GRAPH_HOSTS_PER_CLUSTER, num_of_vms_per_host=ENTITY_GRAPH_VMS_PER_HOST, num_of_alarms_per_host=ENTITY_GRAPH_ALARMS_PER_HOST, num_of_alarms_per_vm=ENTITY_GRAPH_ALARMS_PER_VM, @@ -141,7 +141,7 @@ class GraphTestBase(base.BaseTest): start = time.time() g = create_graph(name, EntityCategory.RESOURCE + ':' + - OPENSTACK_NODE) + OPENSTACK_CLUSTER) g.add_vertex(v_node) g.add_vertex(v_switch) g.add_edge(e_node_to_switch) diff --git a/vitrage/tests/unit/graph/test_graph.py b/vitrage/tests/unit/graph/test_graph.py index aa60a03d6..bf98fbe4a 100644 --- a/vitrage/tests/unit/graph/test_graph.py +++ b/vitrage/tests/unit/graph/test_graph.py @@ -372,20 +372,20 @@ class GraphTest(GraphTestBase): 'get_vertices __len__ all vertices') node_vertices = g.get_vertices( - vertex_attr_filter={VProps.TYPE: OPENSTACK_NODE}) + vertex_attr_filter={VProps.TYPE: OPENSTACK_CLUSTER}) self.assertEqual(1, len(node_vertices), 'get_vertices __len__ node vertices') found_vertex = node_vertices.pop() - self.assertEqual(OPENSTACK_NODE, found_vertex[VProps.TYPE], + self.assertEqual(OPENSTACK_CLUSTER, found_vertex[VProps.TYPE], 'get_vertices check node vertex') node_vertices = g.get_vertices( - vertex_attr_filter={VProps.TYPE: OPENSTACK_NODE, + vertex_attr_filter={VProps.TYPE: OPENSTACK_CLUSTER, VProps.CATEGORY: RESOURCE}) self.assertEqual(1, len(node_vertices), 'get_vertices __len__ node vertices') found_vertex = node_vertices.pop() - self.assertEqual(OPENSTACK_NODE, found_vertex[VProps.TYPE], + self.assertEqual(OPENSTACK_CLUSTER, found_vertex[VProps.TYPE], 'get_vertices check node vertex') def _check_callback_result(self, result, msg, exp_prev, exp_curr): diff --git a/vitrage/tests/unit/graph/test_graph_algo.py b/vitrage/tests/unit/graph/test_graph_algo.py index 442cfec7b..e648d87b5 100644 --- a/vitrage/tests/unit/graph/test_graph_algo.py +++ b/vitrage/tests/unit/graph/test_graph_algo.py @@ -28,22 +28,22 @@ class GraphAlgorithmTest(GraphTestBase): def test_graph_query_vertices(self): ga = create_algorithm(self.entity_graph) - query = {'==': {VProps.TYPE: OPENSTACK_NODE}} + query = {'==': {VProps.TYPE: OPENSTACK_CLUSTER}} subgraph = ga.graph_query_vertices(query) self.assertEqual( - 1, # For NODE + 1, # For Cluster subgraph.num_vertices(), 'num of vertex node') query = { 'or': [ {'==': {VProps.TYPE: NOVA_HOST_DATASOURCE}}, - {'==': {VProps.TYPE: OPENSTACK_NODE}} + {'==': {VProps.TYPE: OPENSTACK_CLUSTER}} ] } subgraph = ga.graph_query_vertices(query) self.assertEqual( - ENTITY_GRAPH_HOSTS_PER_NODE, + ENTITY_GRAPH_HOSTS_PER_CLUSTER, subgraph.num_edges(), 'num of edges Host <-- NODE') query = { @@ -51,15 +51,15 @@ class GraphAlgorithmTest(GraphTestBase): {'==': {VProps.TYPE: NOVA_INSTANCE_DATASOURCE}}, {'==': {VProps.CATEGORY: ALARM}}, {'==': {VProps.TYPE: NOVA_HOST_DATASOURCE}}, - {'==': {VProps.TYPE: OPENSTACK_NODE}} + {'==': {VProps.TYPE: OPENSTACK_CLUSTER}} ] } subgraph = ga.graph_query_vertices(query) self.assertEqual( - ENTITY_GRAPH_HOSTS_PER_NODE + - ENTITY_GRAPH_HOSTS_PER_NODE * ENTITY_GRAPH_ALARMS_PER_HOST + - ENTITY_GRAPH_HOSTS_PER_NODE * ENTITY_GRAPH_VMS_PER_HOST + - ENTITY_GRAPH_HOSTS_PER_NODE * ENTITY_GRAPH_VMS_PER_HOST * + ENTITY_GRAPH_HOSTS_PER_CLUSTER + + ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_ALARMS_PER_HOST + + ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_VMS_PER_HOST + + ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_VMS_PER_HOST * ENTITY_GRAPH_ALARMS_PER_VM, subgraph.num_edges(), 'num of BOTH edges Host (depth 1)') @@ -73,7 +73,7 @@ class GraphAlgorithmTest(GraphTestBase): query_dict=query, root_id=first_host_id, depth=1) self.assertEqual( 1 + # For tye host - 1 + # For NODE + 1 + # For Cluster 1 + # For SWITCH ENTITY_GRAPH_ALARMS_PER_HOST + ENTITY_GRAPH_TESTS_PER_HOST + @@ -94,8 +94,8 @@ class GraphAlgorithmTest(GraphTestBase): subgraph = ga.graph_query_vertices(root_id=first_host_id, depth=2) self.assertEqual( - 1 + # Node to switch - ENTITY_GRAPH_HOSTS_PER_NODE * 2 + + 1 + # Cluster to switch + ENTITY_GRAPH_HOSTS_PER_CLUSTER * 2 + ENTITY_GRAPH_ALARMS_PER_HOST + ENTITY_GRAPH_TESTS_PER_HOST + ENTITY_GRAPH_VMS_PER_HOST + @@ -118,15 +118,15 @@ class GraphAlgorithmTest(GraphTestBase): } subgraph = ga.graph_query_vertices(query_dict=query, depth=3) self.assertEqual( - 1 + # Node to switch - ENTITY_GRAPH_HOSTS_PER_NODE * 2 + - ENTITY_GRAPH_HOSTS_PER_NODE * ENTITY_GRAPH_TESTS_PER_HOST + - ENTITY_GRAPH_HOSTS_PER_NODE * ENTITY_GRAPH_VMS_PER_HOST, + 1 + # Cluster to switch + ENTITY_GRAPH_HOSTS_PER_CLUSTER * 2 + + ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_TESTS_PER_HOST + + ENTITY_GRAPH_HOSTS_PER_CLUSTER * ENTITY_GRAPH_VMS_PER_HOST, subgraph.num_edges(), 'num of edges Node (depth 3)') query = { 'or': [ - {'==': {VProps.TYPE: OPENSTACK_NODE}}, + {'==': {VProps.TYPE: OPENSTACK_CLUSTER}}, {'==': {VProps.CATEGORY: ALARM}}, ] } @@ -171,10 +171,10 @@ class GraphAlgorithmTest(GraphTestBase): t_v_node = graph_utils.create_vertex( vitrage_id='6', entity_category=RESOURCE, - entity_type=OPENSTACK_NODE) + entity_type=OPENSTACK_CLUSTER) t_v_node_not_in_graph = graph_utils.create_vertex( vitrage_id='7', entity_category=RESOURCE, - entity_type=OPENSTACK_NODE + ' not in graph') + entity_type=OPENSTACK_CLUSTER + ' not in graph') e_alarm_on_host = graph_utils.create_edge( t_v_host_alarm.vertex_id, t_v_host.vertex_id, ELabel.ON) diff --git a/vitrage_tempest_tests/tests/api/topology/base.py b/vitrage_tempest_tests/tests/api/topology/base.py index ec7346eed..056537319 100644 --- a/vitrage_tempest_tests/tests/api/topology/base.py +++ b/vitrage_tempest_tests/tests/api/topology/base.py @@ -27,7 +27,7 @@ from vitrage.datasources import CINDER_VOLUME_DATASOURCE from vitrage.datasources import NOVA_HOST_DATASOURCE from vitrage.datasources import NOVA_INSTANCE_DATASOURCE from vitrage.datasources import NOVA_ZONE_DATASOURCE -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER from vitrage.datasources.static_physical import SWITCH from vitrage.graph import Edge from vitrage.graph import NXGraph @@ -112,16 +112,16 @@ class BaseTopologyTest(test.BaseTestCase): if os.path.exists(path): os.remove(path) - def _entities_validation_data(self, node_entities=1, node_edges=1, + def _entities_validation_data(self, cluster_entities=1, cluster_edges=1, zone_entities=1, zone_edges=2, host_entities=1, host_edges=1, instance_entities=0, instance_edges=0, volume_entities=0, volume_edges=0, switch_entities=0, switch_edges=0): return [ - {VProps.TYPE: OPENSTACK_NODE, - self.NUM_ENTITIES_PER_TYPE: node_entities, - self.NUM_EDGES_PER_TYPE: node_edges}, + {VProps.TYPE: OPENSTACK_CLUSTER, + self.NUM_ENTITIES_PER_TYPE: cluster_entities, + self.NUM_EDGES_PER_TYPE: cluster_edges}, {VProps.TYPE: NOVA_ZONE_DATASOURCE, self.NUM_ENTITIES_PER_TYPE: zone_entities, self.NUM_EDGES_PER_TYPE: zone_edges}, @@ -284,7 +284,7 @@ class BaseTopologyTest(test.BaseTestCase): return '{"and": [{"==": {"category": "RESOURCE"}},' \ '{"==": {"is_deleted": false}},' \ '{"==": {"is_placeholder": false}},' \ - '{"or": [{"==": {"type": "openstack.node"}},' \ + '{"or": [{"==": {"type": "openstack.cluster"}},' \ '{"==": {"type": "nova.instance"}},' \ '{"==": {"type": "nova.host"}},' \ '{"==": {"type": "nova.zone"}}]}]}' @@ -294,6 +294,6 @@ class BaseTopologyTest(test.BaseTestCase): return '{"and": [{"==": {"category": "RESOURCE"}},' \ '{"==": {"is_deleted": false}},' \ '{"==": {"is_placeholder": false}},' \ - '{"or": [{"==": {"type": "openstack.node"}},' \ + '{"or": [{"==": {"type": "openstack.cluster"}},' \ '{"==": {"type": "nova.host"}},' \ '{"==": {"type": "nova.zone"}}]}]}' diff --git a/vitrage_tempest_tests/tests/api/topology/test_topology.py b/vitrage_tempest_tests/tests/api/topology/test_topology.py index e5201ba14..d4f12ab83 100644 --- a/vitrage_tempest_tests/tests/api/topology/test_topology.py +++ b/vitrage_tempest_tests/tests/api/topology/test_topology.py @@ -23,7 +23,7 @@ from vitrage.datasources import CINDER_VOLUME_DATASOURCE from vitrage.datasources import NOVA_HOST_DATASOURCE from vitrage.datasources import NOVA_INSTANCE_DATASOURCE from vitrage.datasources import NOVA_ZONE_DATASOURCE -from vitrage.datasources import OPENSTACK_NODE +from vitrage.datasources import OPENSTACK_CLUSTER from vitrage.graph import Edge from vitrage.graph import NXGraph from vitrage.graph import Vertex @@ -148,15 +148,15 @@ class TestTopology(BaseTopologyTest): # entity graph processor time.sleep(5) - def _entities_validation_data(self, node_entities=1, node_edges=1, + def _entities_validation_data(self, cluster_entities=1, cluster_edges=1, zone_entities=1, zone_edges=2, host_entities=1, host_edges=1, instance_entities=0, instance_edges=0, volume_entities=0, volume_edges=0): return [ - {VProps.TYPE: OPENSTACK_NODE, - self.NUM_ENTITIES_PER_TYPE: node_entities, - self.NUM_EDGES_PER_TYPE: node_edges}, + {VProps.TYPE: OPENSTACK_CLUSTER, + self.NUM_ENTITIES_PER_TYPE: cluster_entities, + self.NUM_EDGES_PER_TYPE: cluster_edges}, {VProps.TYPE: NOVA_ZONE_DATASOURCE, self.NUM_ENTITIES_PER_TYPE: zone_entities, self.NUM_EDGES_PER_TYPE: zone_edges}, @@ -316,7 +316,7 @@ class TestTopology(BaseTopologyTest): return '{"and": [{"==": {"category": "RESOURCE"}},' \ '{"==": {"is_deleted": false}},' \ '{"==": {"is_placeholder": false}},' \ - '{"or": [{"==": {"type": "openstack.node"}},' \ + '{"or": [{"==": {"type": "openstack.cluster"}},' \ '{"==": {"type": "nova.instance"}},' \ '{"==": {"type": "nova.host"}},' \ '{"==": {"type": "nova.zone"}}]}]}' @@ -326,6 +326,6 @@ class TestTopology(BaseTopologyTest): return '{"and": [{"==": {"category": "RESOURCE"}},' \ '{"==": {"is_deleted": false}},' \ '{"==": {"is_placeholder": false}},' \ - '{"or": [{"==": {"type": "openstack.node"}},' \ + '{"or": [{"==": {"type": "openstack.cluster"}},' \ '{"==": {"type": "nova.host"}},' \ '{"==": {"type": "nova.zone"}}]}]}'