Remove the static physical datasource
The static physical datasource was deprecated in Queens and removed in Stein. Please use the static datasource instead. Change-Id: Ib20c4f2811cd1e1ebd100a67aa747268f6443a81 Story: 2003172 Task: 28363
This commit is contained in:
parent
b4a8c3371d
commit
05dcd7b74b
|
@ -33,7 +33,6 @@ from vitrage.datasources import NOVA_HOST_DATASOURCE
|
||||||
from vitrage.datasources import NOVA_INSTANCE_DATASOURCE
|
from vitrage.datasources import NOVA_INSTANCE_DATASOURCE
|
||||||
from vitrage.datasources import NOVA_ZONE_DATASOURCE
|
from vitrage.datasources import NOVA_ZONE_DATASOURCE
|
||||||
from vitrage.datasources import OPENSTACK_CLUSTER
|
from vitrage.datasources import OPENSTACK_CLUSTER
|
||||||
from vitrage.datasources.static_physical import SWITCH
|
|
||||||
from vitrage.graph.driver.networkx_graph import NXGraph
|
from vitrage.graph.driver.networkx_graph import NXGraph
|
||||||
from vitrage.graph import Edge
|
from vitrage.graph import Edge
|
||||||
from vitrage.graph import Vertex
|
from vitrage.graph import Vertex
|
||||||
|
@ -235,7 +234,7 @@ class BaseVitrageTempest(base.BaseTestCase):
|
||||||
|
|
||||||
# switch
|
# switch
|
||||||
props = {VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
|
props = {VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
|
||||||
VProps.VITRAGE_TYPE: SWITCH,
|
VProps.VITRAGE_TYPE: 'switch',
|
||||||
self.NUM_VERTICES_PER_TYPE: kwargs.get(
|
self.NUM_VERTICES_PER_TYPE: kwargs.get(
|
||||||
'switch_entities', 0),
|
'switch_entities', 0),
|
||||||
self.NUM_EDGES_PER_TYPE: kwargs.get(
|
self.NUM_EDGES_PER_TYPE: kwargs.get(
|
||||||
|
@ -303,6 +302,8 @@ class BaseVitrageTempest(base.BaseTestCase):
|
||||||
'%s%s' % ('Num vertices is incorrect for: ',
|
'%s%s' % ('Num vertices is incorrect for: ',
|
||||||
entity[VProps.VITRAGE_TYPE]))
|
entity[VProps.VITRAGE_TYPE]))
|
||||||
|
|
||||||
|
# TODO(iafek): bug - edges between entities of the same type are
|
||||||
|
# counted twice
|
||||||
entity_num_edges = sum([len(graph.get_edges(vertex.vertex_id))
|
entity_num_edges = sum([len(graph.get_edges(vertex.vertex_id))
|
||||||
for vertex in vertices])
|
for vertex in vertices])
|
||||||
self.assertEqual(entity[self.NUM_EDGES_PER_TYPE],
|
self.assertEqual(entity[self.NUM_EDGES_PER_TYPE],
|
||||||
|
|
|
@ -25,18 +25,19 @@ from vitrage_tempest_plugin.tests import utils
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TestStaticPhysical(BaseVitrageTempest):
|
class TestStatic(BaseVitrageTempest):
|
||||||
NUM_SWITCH = 2
|
NUM_SWITCH = 1
|
||||||
|
NUM_NIC = 1
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestStaticPhysical, self).setUp()
|
super(TestStatic, self).setUp()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TestStaticPhysical, self).tearDown()
|
super(TestStatic, self).tearDown()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestStaticPhysical, cls).setUpClass()
|
super(TestStatic, cls).setUpClass()
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_switches(self):
|
def test_switches(self):
|
||||||
|
@ -49,11 +50,14 @@ class TestStaticPhysical(BaseVitrageTempest):
|
||||||
graph = self._create_graph_from_graph_dictionary(api_graph)
|
graph = self._create_graph_from_graph_dictionary(api_graph)
|
||||||
entities = self._entities_validation_data(
|
entities = self._entities_validation_data(
|
||||||
host_entities=1,
|
host_entities=1,
|
||||||
host_edges=1 + self.NUM_SWITCH,
|
host_edges=1,
|
||||||
switch_entities=self.NUM_SWITCH,
|
switch_entities=self.NUM_SWITCH,
|
||||||
switch_edges=self.NUM_SWITCH)
|
switch_edges=1,
|
||||||
|
nic_entities=self.NUM_NIC,
|
||||||
|
nic_edges=1)
|
||||||
num_entities = self.num_default_entities + self.NUM_SWITCH + \
|
num_entities = self.num_default_entities + self.NUM_SWITCH + \
|
||||||
self.num_default_networks + self.num_default_ports
|
self.NUM_NIC + self.num_default_networks + \
|
||||||
|
self.num_default_ports
|
||||||
num_edges = self.num_default_edges + self.NUM_SWITCH + \
|
num_edges = self.num_default_edges + self.NUM_SWITCH + \
|
||||||
self.num_default_ports
|
self.num_default_ports
|
||||||
|
|
||||||
|
@ -73,26 +77,24 @@ class TestStaticPhysical(BaseVitrageTempest):
|
||||||
hostname = socket.gethostname()
|
hostname = socket.gethostname()
|
||||||
|
|
||||||
# template file
|
# template file
|
||||||
resources_path = tempest_resources_dir() + '/static_physical/'
|
file_path = \
|
||||||
file_path = resources_path + '/static_physical_configuration.yaml'
|
tempest_resources_dir() + '/static/static_configuration.yaml'
|
||||||
with open(file_path, 'r') as f:
|
with open(file_path, 'r') as f:
|
||||||
template_data = f.read()
|
template_data = f.read()
|
||||||
template_data = template_data.replace('tmp-devstack', hostname)
|
template_data = template_data.replace('tmp-devstack', hostname)
|
||||||
|
|
||||||
# new file
|
# new file
|
||||||
new_file = open(
|
new_file = open(
|
||||||
'/etc/vitrage/static_datasources/'
|
'/etc/vitrage/static_datasources/static_configuration.yaml', 'w')
|
||||||
'static_physical_configuration.yaml', 'w')
|
|
||||||
new_file.write(template_data)
|
new_file.write(template_data)
|
||||||
new_file.close()
|
new_file.close()
|
||||||
|
|
||||||
time.sleep(25)
|
time.sleep(35)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _delete_switches():
|
def _delete_switches():
|
||||||
path = '/etc/vitrage/static_datasources/' \
|
path = '/etc/vitrage/static_datasources/static_configuration.yaml'
|
||||||
'static_physical_configuration.yaml'
|
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
time.sleep(25)
|
time.sleep(35)
|
|
@ -0,0 +1,19 @@
|
||||||
|
metadata:
|
||||||
|
description: 'static configuration with switches'
|
||||||
|
name: test_static
|
||||||
|
definitions:
|
||||||
|
entities:
|
||||||
|
- id: 12345
|
||||||
|
name: nic-1
|
||||||
|
static_id: nic-1
|
||||||
|
type: nic
|
||||||
|
state: available
|
||||||
|
- id: 23456
|
||||||
|
name: switch-2
|
||||||
|
static_id: switch-2
|
||||||
|
type: switch
|
||||||
|
state: available
|
||||||
|
relationships:
|
||||||
|
- relationship_type: attached
|
||||||
|
source: nic-1
|
||||||
|
target: switch-2
|
|
@ -1,19 +0,0 @@
|
||||||
entities:
|
|
||||||
- type: switch
|
|
||||||
name: switch-1
|
|
||||||
id: 12345
|
|
||||||
state: available
|
|
||||||
relationships:
|
|
||||||
- type: nova.host
|
|
||||||
name: tmp-devstack
|
|
||||||
id: tmp-devstack
|
|
||||||
relation_type: attached
|
|
||||||
- type: switch
|
|
||||||
name: switch-2
|
|
||||||
id: 23456
|
|
||||||
state: available
|
|
||||||
relationships:
|
|
||||||
- type: nova.host
|
|
||||||
name: tmp-devstack
|
|
||||||
id: tmp-devstack
|
|
||||||
relation_type: attached
|
|
Loading…
Reference in New Issue