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:
Ifat Afek 2018-12-10 09:31:04 +00:00
parent b4a8c3371d
commit 05dcd7b74b
4 changed files with 40 additions and 37 deletions

View File

@ -33,7 +33,6 @@ 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_CLUSTER
from vitrage.datasources.static_physical import SWITCH
from vitrage.graph.driver.networkx_graph import NXGraph
from vitrage.graph import Edge
from vitrage.graph import Vertex
@ -235,7 +234,7 @@ class BaseVitrageTempest(base.BaseTestCase):
# switch
props = {VProps.VITRAGE_CATEGORY: EntityCategory.RESOURCE,
VProps.VITRAGE_TYPE: SWITCH,
VProps.VITRAGE_TYPE: 'switch',
self.NUM_VERTICES_PER_TYPE: kwargs.get(
'switch_entities', 0),
self.NUM_EDGES_PER_TYPE: kwargs.get(
@ -303,6 +302,8 @@ class BaseVitrageTempest(base.BaseTestCase):
'%s%s' % ('Num vertices is incorrect for: ',
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))
for vertex in vertices])
self.assertEqual(entity[self.NUM_EDGES_PER_TYPE],

View File

@ -25,18 +25,19 @@ from vitrage_tempest_plugin.tests import utils
LOG = logging.getLogger(__name__)
class TestStaticPhysical(BaseVitrageTempest):
NUM_SWITCH = 2
class TestStatic(BaseVitrageTempest):
NUM_SWITCH = 1
NUM_NIC = 1
def setUp(self):
super(TestStaticPhysical, self).setUp()
super(TestStatic, self).setUp()
def tearDown(self):
super(TestStaticPhysical, self).tearDown()
super(TestStatic, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestStaticPhysical, cls).setUpClass()
super(TestStatic, cls).setUpClass()
@utils.tempest_logger
def test_switches(self):
@ -49,11 +50,14 @@ class TestStaticPhysical(BaseVitrageTempest):
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
host_edges=1 + self.NUM_SWITCH,
host_edges=1,
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 + \
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 + \
self.num_default_ports
@ -73,26 +77,24 @@ class TestStaticPhysical(BaseVitrageTempest):
hostname = socket.gethostname()
# template file
resources_path = tempest_resources_dir() + '/static_physical/'
file_path = resources_path + '/static_physical_configuration.yaml'
file_path = \
tempest_resources_dir() + '/static/static_configuration.yaml'
with open(file_path, 'r') as f:
template_data = f.read()
template_data = template_data.replace('tmp-devstack', hostname)
# new file
new_file = open(
'/etc/vitrage/static_datasources/'
'static_physical_configuration.yaml', 'w')
'/etc/vitrage/static_datasources/static_configuration.yaml', 'w')
new_file.write(template_data)
new_file.close()
time.sleep(25)
time.sleep(35)
@staticmethod
def _delete_switches():
path = '/etc/vitrage/static_datasources/' \
'static_physical_configuration.yaml'
path = '/etc/vitrage/static_datasources/static_configuration.yaml'
if os.path.exists(path):
os.remove(path)
time.sleep(25)
time.sleep(35)

View File

@ -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

View File

@ -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