Datasource tempests changes
Change-Id: I818074c086f815da732727bd1ea10e20b0701800
This commit is contained in:
parent
34cf3cfb1d
commit
16ebd1d51b
@ -27,7 +27,7 @@ LOG = log.getLogger(__name__)
|
||||
OPTS = [
|
||||
cfg.StrOpt('aodh_version', default='2', help='Aodh version'),
|
||||
cfg.FloatOpt('nova_version', default='2.11', help='Nova version'),
|
||||
cfg.StrOpt('cinder_version', default='1', help='Cinder version'),
|
||||
cfg.StrOpt('cinder_version', default='2', help='Cinder version'),
|
||||
]
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
from collections import defaultdict
|
||||
import json
|
||||
|
||||
from oslo_log import log
|
||||
import oslo_messaging
|
||||
@ -91,9 +90,6 @@ class NotificationsEndpoint(object):
|
||||
self.enqueue_callback = enqueue_callback
|
||||
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
LOG.debug('EVENT RECEIVED: %(event_type)s -> %(payload)s ' %
|
||||
{'event_type': str(event_type),
|
||||
'payload': json.dumps(payload)})
|
||||
for event_string in self.enrich_callbacks_by_events:
|
||||
if str(event_type) == event_string:
|
||||
|
||||
|
@ -59,6 +59,13 @@ class BaseApiTest(base.BaseTestCase):
|
||||
cls.cinder_client = clients.cinder_client(cls.conf)
|
||||
cls.neutron_client = clients.neutron_client(cls.conf)
|
||||
|
||||
cls.num_default_networks = \
|
||||
len(cls.neutron_client.list_networks()['networks'])
|
||||
cls.num_default_ports = \
|
||||
len(cls.neutron_client.list_ports()['ports'])
|
||||
cls.num_default_entities = 3
|
||||
cls.num_default_edges = 2
|
||||
|
||||
@staticmethod
|
||||
def _filter_list_by_pairs_parameters(origin_list,
|
||||
keys, values):
|
||||
@ -75,7 +82,7 @@ class BaseApiTest(base.BaseTestCase):
|
||||
return filtered_list
|
||||
|
||||
def _create_volume_and_attach(self, name, size, instance_id, mount_point):
|
||||
volume = self.cinder_client.volumes.create(display_name=name,
|
||||
volume = self.cinder_client.volumes.create(name=name,
|
||||
size=size)
|
||||
time.sleep(2)
|
||||
self.cinder_client.volumes.attach(volume=volume,
|
||||
|
@ -20,6 +20,8 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestAodhAlarm(BaseAlarmsTest):
|
||||
NUM_INSTANCE = 1
|
||||
NUM_ALARM = 1
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@ -28,16 +30,32 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
|
||||
def test_alarm_with_resource_id(self):
|
||||
try:
|
||||
# create entities
|
||||
self._create_instances(num_instances=1)
|
||||
# Action
|
||||
self._create_instances(num_instances=self.NUM_INSTANCE)
|
||||
self._create_ceilometer_alarm(self._find_instance_resource_id())
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get()
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=2,
|
||||
instance_entities=1, instance_edges=2,
|
||||
aodh_entities=1, aodh_edges=1)
|
||||
self._validate_graph_correctness(graph, 5, 4, entities)
|
||||
host_entities=1,
|
||||
host_edges=1 + self.NUM_INSTANCE,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=2 * self.NUM_INSTANCE + self.NUM_ALARM,
|
||||
aodh_entities=self.NUM_ALARM,
|
||||
aodh_edges=self.NUM_ALARM)
|
||||
num_entities = self.num_default_entities + \
|
||||
2 * self.NUM_INSTANCE + self.NUM_ALARM + \
|
||||
self.num_default_networks + self.num_default_ports
|
||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||
self.NUM_ALARM + self.num_default_ports
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -46,14 +64,27 @@ class TestAodhAlarm(BaseAlarmsTest):
|
||||
|
||||
def test_alarm_without_resource_id(self):
|
||||
try:
|
||||
# create entities
|
||||
# Action
|
||||
self._create_ceilometer_alarm()
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get()
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=1,
|
||||
aodh_entities=1, aodh_edges=0)
|
||||
self._validate_graph_correctness(graph, 4, 2, entities)
|
||||
host_entities=1,
|
||||
host_edges=1,
|
||||
aodh_entities=self.NUM_ALARM,
|
||||
aodh_edges=0)
|
||||
num_entities = self.num_default_entities + self.NUM_ALARM + \
|
||||
self.num_default_networks + self.num_default_ports
|
||||
num_edges = self.num_default_edges + self.num_default_ports
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
|
@ -19,6 +19,8 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestCinderVolume(BaseTopologyTest):
|
||||
NUM_INSTANCE = 3
|
||||
NUM_VOLUME = 1
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@ -26,15 +28,32 @@ class TestCinderVolume(BaseTopologyTest):
|
||||
|
||||
def test_volume(self):
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=3, num_volumes=1)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE,
|
||||
num_volumes=self.NUM_VOLUME)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get()
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=4,
|
||||
instance_entities=3, instance_edges=4,
|
||||
volume_entities=1, volume_edges=1)
|
||||
self._validate_graph_correctness(graph, 7, 6, entities)
|
||||
host_entities=1,
|
||||
host_edges=self.NUM_INSTANCE + 1,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=2 * self.NUM_INSTANCE + self.NUM_VOLUME,
|
||||
volume_entities=self.NUM_VOLUME,
|
||||
volume_edges=self.NUM_VOLUME)
|
||||
num_entities = self.num_default_entities + self.NUM_VOLUME + \
|
||||
2 * self.NUM_INSTANCE + self.num_default_ports + \
|
||||
self.num_default_networks
|
||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||
self.NUM_VOLUME + self.num_default_ports
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
|
@ -18,49 +18,50 @@ from vitrage.common.constants import VertexProperties as VProps
|
||||
from vitrage_tempest_tests.tests.api.topology.base import BaseTopologyTest
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
INSTANCE_NUM = 3
|
||||
|
||||
|
||||
class TestNeutronNetwork(BaseTopologyTest):
|
||||
class TestNeutron(BaseTopologyTest):
|
||||
NUM_INSTANCE = 3
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestNeutronNetwork, cls).setUpClass()
|
||||
super(TestNeutron, cls).setUpClass()
|
||||
|
||||
def test_neutron(self):
|
||||
"""neutron test
|
||||
|
||||
This test validate correctness topology graph with neutron module
|
||||
"""
|
||||
|
||||
try:
|
||||
# create entities
|
||||
instances = self._create_instances(
|
||||
num_instances=INSTANCE_NUM, set_public_network=True)
|
||||
network_list = self.neutron_client.list_networks()['networks']
|
||||
port_list = self.neutron_client.list_ports()['ports']
|
||||
|
||||
network_name = self._get_network_name(instances[0], network_list)
|
||||
port_to_inst_edges = self._port_to_inst_edges(
|
||||
instances, network_name, port_list)
|
||||
port_to_network_edges = self._port_to_network_edges(
|
||||
network_list, port_list)
|
||||
# Action
|
||||
self._create_instances(num_instances=self.NUM_INSTANCE,
|
||||
set_public_network=True)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get()
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1,
|
||||
host_edges=1 + INSTANCE_NUM,
|
||||
instance_entities=INSTANCE_NUM,
|
||||
instance_edges=INSTANCE_NUM + port_to_inst_edges,
|
||||
network_entities=len(network_list),
|
||||
network_edges=port_to_network_edges,
|
||||
port_entities=len(port_list),
|
||||
port_edges=port_to_inst_edges + port_to_network_edges)
|
||||
expected_entities = \
|
||||
3 + INSTANCE_NUM + len(network_list) + len(port_list)
|
||||
expected_edges = \
|
||||
2 + INSTANCE_NUM + port_to_inst_edges + port_to_network_edges
|
||||
self._validate_graph_correctness(
|
||||
graph, expected_entities, expected_edges, entities)
|
||||
host_edges=1 + self.NUM_INSTANCE,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=2 * self.NUM_INSTANCE,
|
||||
network_entities=self.num_default_networks,
|
||||
network_edges=self.num_default_ports + self.NUM_INSTANCE,
|
||||
port_entities=self.num_default_ports + self.NUM_INSTANCE,
|
||||
port_edges=self.num_default_ports + 2 * self.NUM_INSTANCE)
|
||||
num_entities = self.num_default_entities + \
|
||||
2 * self.NUM_INSTANCE + \
|
||||
self.num_default_networks + self.num_default_ports
|
||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||
self.num_default_ports
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
@ -19,6 +19,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestNova(BaseTopologyTest):
|
||||
NUM_INSTANCE = 3
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@ -26,14 +27,29 @@ class TestNova(BaseTopologyTest):
|
||||
|
||||
def test_nova_entities(self):
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=3, end_sleep=10)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get()
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=4,
|
||||
instance_entities=3, instance_edges=3)
|
||||
self._validate_graph_correctness(graph, 6, 5, entities)
|
||||
host_entities=1,
|
||||
host_edges=1 + self.NUM_INSTANCE,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=2 * self.NUM_INSTANCE)
|
||||
num_entities = self.num_default_entities + \
|
||||
2 * self.NUM_INSTANCE + \
|
||||
self.num_default_networks + self.num_default_ports
|
||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||
self.num_default_ports
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
|
@ -24,6 +24,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestStaticPhysical(BaseApiTest):
|
||||
NUM_SWITCH = 2
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@ -31,14 +32,28 @@ class TestStaticPhysical(BaseApiTest):
|
||||
|
||||
def test_switches(self):
|
||||
try:
|
||||
# create entities
|
||||
# Action
|
||||
self._create_switches()
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get()
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=3,
|
||||
switch_entities=2, switch_edges=2)
|
||||
self._validate_graph_correctness(graph, 5, 4, entities)
|
||||
host_entities=1,
|
||||
host_edges=1 + self.NUM_SWITCH,
|
||||
switch_entities=self.NUM_SWITCH,
|
||||
switch_edges=self.NUM_SWITCH)
|
||||
num_entities = self.num_default_entities + self.NUM_SWITCH + \
|
||||
self.num_default_networks + self.num_default_ports
|
||||
num_edges = self.num_default_edges + self.NUM_SWITCH + \
|
||||
self.num_default_ports
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
|
@ -19,8 +19,6 @@ import vitrage_tempest_tests.tests.utils as utils
|
||||
from vitrageclient.exc import ClientException
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
NUM_INSTANCE = 3
|
||||
NUM_VOLUME = 1
|
||||
NOVA_QUERY = '{"and": [{"==": {"category": "RESOURCE"}},' \
|
||||
'{"==": {"is_deleted": false}},' \
|
||||
'{"==": {"is_placeholder": false}},' \
|
||||
@ -33,13 +31,12 @@ NOVA_QUERY = '{"and": [{"==": {"category": "RESOURCE"}},' \
|
||||
class TestTopology(BaseTopologyTest):
|
||||
"""Topology test class for Vitrage API tests."""
|
||||
|
||||
NUM_INSTANCE = 3
|
||||
NUM_VOLUME = 1
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestTopology, cls).setUpClass()
|
||||
cls.default_networks = \
|
||||
len(cls.neutron_client.list_networks()['networks'])
|
||||
cls.default_ports = \
|
||||
len(cls.neutron_client.list_ports()['ports'])
|
||||
|
||||
def test_compare_api_and_cli(self):
|
||||
"""compare_api_and_cli
|
||||
@ -58,25 +55,32 @@ class TestTopology(BaseTopologyTest):
|
||||
This test validate correctness of default topology graph
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE,
|
||||
num_volumes=NUM_VOLUME)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE,
|
||||
num_volumes=self.NUM_VOLUME)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get()
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1,
|
||||
host_edges=NUM_INSTANCE + 1,
|
||||
instance_entities=NUM_INSTANCE,
|
||||
instance_edges=2 * NUM_INSTANCE + NUM_VOLUME,
|
||||
volume_entities=NUM_VOLUME,
|
||||
volume_edges=NUM_VOLUME)
|
||||
self._validate_graph_correctness(
|
||||
graph,
|
||||
3 + 2 * NUM_INSTANCE + NUM_VOLUME +
|
||||
self.default_networks + self.default_ports,
|
||||
2 + 3 * NUM_INSTANCE + NUM_VOLUME + self.default_ports,
|
||||
entities)
|
||||
host_edges=self.NUM_INSTANCE + 1,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=2 * self.NUM_INSTANCE + self.NUM_VOLUME,
|
||||
volume_entities=self.NUM_VOLUME,
|
||||
volume_edges=self.NUM_VOLUME)
|
||||
num_entities = self.num_default_entities + self.NUM_VOLUME + \
|
||||
2 * self.NUM_INSTANCE + self.num_default_networks + \
|
||||
self.num_default_ports
|
||||
num_edges = self.num_default_edges + 3 * self.NUM_INSTANCE + \
|
||||
self.NUM_VOLUME + self.num_default_ports
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -89,19 +93,28 @@ class TestTopology(BaseTopologyTest):
|
||||
with query
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE,
|
||||
num_volumes=NUM_VOLUME)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE,
|
||||
num_volumes=self.NUM_VOLUME)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
query=self._graph_query())
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1,
|
||||
host_edges=NUM_INSTANCE + 1,
|
||||
instance_entities=NUM_INSTANCE,
|
||||
instance_edges=NUM_INSTANCE)
|
||||
self._validate_graph_correctness(graph, 6, 5, entities)
|
||||
host_edges=self.NUM_INSTANCE + 1,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=self.NUM_INSTANCE)
|
||||
num_entities = self.num_default_entities + self.NUM_INSTANCE
|
||||
num_edges = self.num_default_edges + self.NUM_INSTANCE
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -113,19 +126,28 @@ class TestTopology(BaseTopologyTest):
|
||||
This test validate correctness of topology tree
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE,
|
||||
num_volumes=NUM_VOLUME)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE,
|
||||
num_volumes=self.NUM_VOLUME)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
graph_type='tree', query=NOVA_QUERY)
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_tree_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1,
|
||||
host_edges=NUM_INSTANCE + 1,
|
||||
instance_entities=NUM_INSTANCE,
|
||||
instance_edges=NUM_INSTANCE)
|
||||
self._validate_graph_correctness(graph, 6, 5, entities)
|
||||
host_edges=self.NUM_INSTANCE + 1,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=self.NUM_INSTANCE)
|
||||
num_entities = self.num_default_entities + self.NUM_INSTANCE
|
||||
num_edges = self.num_default_edges + self.NUM_INSTANCE
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -138,15 +160,22 @@ class TestTopology(BaseTopologyTest):
|
||||
with query
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
graph_type='tree', query=self._tree_query())
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_tree_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=1)
|
||||
self._validate_graph_correctness(graph, 3, 2, entities)
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -159,15 +188,22 @@ class TestTopology(BaseTopologyTest):
|
||||
with query
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
limit=2, graph_type='tree', query=NOVA_QUERY)
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_tree_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=1)
|
||||
self._validate_graph_correctness(graph, 3, 2, entities)
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -180,18 +216,27 @@ class TestTopology(BaseTopologyTest):
|
||||
with query
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
limit=3, graph_type='tree', query=NOVA_QUERY)
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_tree_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1,
|
||||
host_edges=NUM_INSTANCE + 1,
|
||||
instance_entities=NUM_INSTANCE,
|
||||
instance_edges=NUM_INSTANCE)
|
||||
self._validate_graph_correctness(graph, 6, 5, entities)
|
||||
host_edges=self.NUM_INSTANCE + 1,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=self.NUM_INSTANCE)
|
||||
num_entities = self.num_default_entities + self.NUM_INSTANCE
|
||||
num_edges = self.num_default_edges + self.NUM_INSTANCE
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -204,15 +249,22 @@ class TestTopology(BaseTopologyTest):
|
||||
with root and depth exclude instance
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
limit=2, root='RESOURCE:openstack.cluster')
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1, host_edges=1)
|
||||
self._validate_graph_correctness(graph, 3, 2, entities)
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
self.num_default_entities,
|
||||
self.num_default_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
finally:
|
||||
@ -225,20 +277,26 @@ class TestTopology(BaseTopologyTest):
|
||||
with root and depth include instance
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
limit=3, root='RESOURCE:openstack.cluster')
|
||||
self.assertIsNotNone(api_graph)
|
||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||
entities = self._entities_validation_data(
|
||||
host_entities=1,
|
||||
host_edges=NUM_INSTANCE + 1,
|
||||
instance_entities=NUM_INSTANCE,
|
||||
instance_edges=NUM_INSTANCE)
|
||||
host_edges=self.NUM_INSTANCE + 1,
|
||||
instance_entities=self.NUM_INSTANCE,
|
||||
instance_edges=self.NUM_INSTANCE)
|
||||
num_entities = self.num_default_entities + self.NUM_INSTANCE
|
||||
num_edges = self.num_default_edges + self.NUM_INSTANCE
|
||||
|
||||
# Test Assertions
|
||||
self._validate_graph_correctness(graph,
|
||||
3 + NUM_INSTANCE,
|
||||
2 + NUM_INSTANCE,
|
||||
num_entities,
|
||||
num_edges,
|
||||
entities)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
@ -252,8 +310,11 @@ class TestTopology(BaseTopologyTest):
|
||||
graph with depth and without root
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=3, num_volumes=1)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE,
|
||||
num_volumes=self.NUM_VOLUME)
|
||||
|
||||
# Calculate expected results
|
||||
self.vitrage_client.topology.get(limit=2,
|
||||
root='RESOURCE:openstack.cluster')
|
||||
except ClientException as e:
|
||||
@ -271,11 +332,15 @@ class TestTopology(BaseTopologyTest):
|
||||
with no match query
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE,
|
||||
num_volumes=NUM_VOLUME)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE,
|
||||
num_volumes=self.NUM_VOLUME)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
query=self._graph_no_match_query())
|
||||
|
||||
# Test Assertions
|
||||
self.assertEqual(
|
||||
0,
|
||||
len(api_graph['nodes']), 'num of vertex node')
|
||||
@ -294,10 +359,14 @@ class TestTopology(BaseTopologyTest):
|
||||
with no match query
|
||||
"""
|
||||
try:
|
||||
# create entities
|
||||
self._create_entities(num_instances=NUM_INSTANCE)
|
||||
# Action
|
||||
self._create_entities(num_instances=self.NUM_INSTANCE)
|
||||
|
||||
# Calculate expected results
|
||||
api_graph = self.vitrage_client.topology.get(
|
||||
graph_type='tree', query=self._tree_no_match_query())
|
||||
|
||||
# Test Assertions
|
||||
self.assertEqual({}, api_graph)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user