Merge "Remove env variable from RBAC tests"
This commit is contained in:
commit
80ff524ef7
@ -13,20 +13,6 @@ from tests.fv_rbac import OpenStackNetworkingSetup
|
|||||||
from tests.fv_rbac import OpenStackTestingSetup
|
from tests.fv_rbac import OpenStackTestingSetup
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
|
||||||
parser.addoption(
|
|
||||||
"--env",
|
|
||||||
action="store",
|
|
||||||
default="stx",
|
|
||||||
help="Environment to run tests against (stx or wro). Default: stx"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@fixture(scope="session")
|
|
||||||
def env(request):
|
|
||||||
return request.config.getoption("--env")
|
|
||||||
|
|
||||||
|
|
||||||
@fixture(scope='session')
|
@fixture(scope='session')
|
||||||
def rbac_setup(request):
|
def rbac_setup(request):
|
||||||
|
|
||||||
@ -90,9 +76,9 @@ def rbac_setup(request):
|
|||||||
|
|
||||||
|
|
||||||
@fixture(scope='session')
|
@fixture(scope='session')
|
||||||
def network_admin_setup(request, rbac_setup, env):
|
def network_admin_setup(request, rbac_setup):
|
||||||
|
|
||||||
cfg = OpenStackNetworkingSetup(env)
|
cfg = OpenStackNetworkingSetup()
|
||||||
|
|
||||||
# Create segment ranges based on projects
|
# Create segment ranges based on projects
|
||||||
cfg._create_network_segment_range(
|
cfg._create_network_segment_range(
|
||||||
@ -102,7 +88,6 @@ def network_admin_setup(request, rbac_setup, env):
|
|||||||
physical_network="group0-data0",
|
physical_network="group0-data0",
|
||||||
minimum=10, maximum=10
|
minimum=10, maximum=10
|
||||||
)
|
)
|
||||||
|
|
||||||
cfg._create_network_segment_range(
|
cfg._create_network_segment_range(
|
||||||
"group0-data0-r0",
|
"group0-data0-r0",
|
||||||
project_name="project1",
|
project_name="project1",
|
||||||
@ -111,7 +96,6 @@ def network_admin_setup(request, rbac_setup, env):
|
|||||||
physical_network="group0-data0",
|
physical_network="group0-data0",
|
||||||
minimum=400, maximum=499
|
minimum=400, maximum=499
|
||||||
)
|
)
|
||||||
|
|
||||||
cfg._create_network_segment_range(
|
cfg._create_network_segment_range(
|
||||||
"group0-data0b-r0",
|
"group0-data0b-r0",
|
||||||
shared=True,
|
shared=True,
|
||||||
@ -119,7 +103,6 @@ def network_admin_setup(request, rbac_setup, env):
|
|||||||
physical_network="group0-data0",
|
physical_network="group0-data0",
|
||||||
minimum=500, maximum=599
|
minimum=500, maximum=599
|
||||||
)
|
)
|
||||||
|
|
||||||
cfg._create_network_segment_range(
|
cfg._create_network_segment_range(
|
||||||
"group0-data1-r0",
|
"group0-data1-r0",
|
||||||
project="project2",
|
project="project2",
|
||||||
@ -129,19 +112,11 @@ def network_admin_setup(request, rbac_setup, env):
|
|||||||
minimum=600, maximum=699
|
minimum=600, maximum=699
|
||||||
)
|
)
|
||||||
|
|
||||||
if env == "wro":
|
|
||||||
cfg._create_qos("admin-qos", weight=16,
|
|
||||||
description="External Network Policy")
|
|
||||||
|
|
||||||
def network_admin_teardown():
|
def network_admin_teardown():
|
||||||
cfg._delete_network_segment_range("group0-data1-r0")
|
cfg._delete_network_segment_range("group0-data1-r0")
|
||||||
cfg._delete_network_segment_range("group0-data0b-r0")
|
cfg._delete_network_segment_range("group0-data0b-r0")
|
||||||
cfg._delete_network_segment_range("group0-data0-r0")
|
cfg._delete_network_segment_range("group0-data0-r0")
|
||||||
cfg._delete_network_segment_range("group0-ext-r0")
|
cfg._delete_network_segment_range("group0-ext-r0")
|
||||||
|
|
||||||
if env == "wro":
|
|
||||||
cfg._delete_qos("admin-qos")
|
|
||||||
|
|
||||||
request.addfinalizer(network_admin_teardown)
|
request.addfinalizer(network_admin_teardown)
|
||||||
|
|
||||||
return cfg
|
return cfg
|
||||||
|
@ -147,9 +147,8 @@ class OpenStackTestingSetup:
|
|||||||
|
|
||||||
class OpenStackNetworkingSetup(OpenStackTestingSetup):
|
class OpenStackNetworkingSetup(OpenStackTestingSetup):
|
||||||
|
|
||||||
def __init__(self, env):
|
def __init__(self):
|
||||||
super(OpenStackNetworkingSetup, self).__init__()
|
super(OpenStackNetworkingSetup, self).__init__()
|
||||||
self.env = env
|
|
||||||
|
|
||||||
def _create_network_segment_range(self, name, project_name=None, **kwargs):
|
def _create_network_segment_range(self, name, project_name=None, **kwargs):
|
||||||
sr = self.os_sdk_admin_conn.network.find_network_segment_range(name)
|
sr = self.os_sdk_admin_conn.network.find_network_segment_range(name)
|
||||||
@ -158,7 +157,6 @@ class OpenStackNetworkingSetup(OpenStackTestingSetup):
|
|||||||
if project_name:
|
if project_name:
|
||||||
project_id = self.os_sdk_admin_conn.get_project(
|
project_id = self.os_sdk_admin_conn.get_project(
|
||||||
project_name).id
|
project_name).id
|
||||||
|
|
||||||
if project_id is None:
|
if project_id is None:
|
||||||
return self.os_sdk_admin_conn.network. \
|
return self.os_sdk_admin_conn.network. \
|
||||||
create_network_segment_range(name=name, **kwargs)
|
create_network_segment_range(name=name, **kwargs)
|
||||||
|
@ -18,17 +18,13 @@ from tests.test_neutron.rbac_neutron import OpenStackNetworkingTesting
|
|||||||
def networking_setup(request, network_admin_setup):
|
def networking_setup(request, network_admin_setup):
|
||||||
|
|
||||||
cfg = network_admin_setup
|
cfg = network_admin_setup
|
||||||
|
|
||||||
request.cls.os_sdk_admin_conn = cfg.os_sdk_admin_conn
|
request.cls.os_sdk_admin_conn = cfg.os_sdk_admin_conn
|
||||||
request.cls.users = cfg.users
|
request.cls.users = cfg.users
|
||||||
|
|
||||||
request.cls.user02 = cfg.user02
|
request.cls.user02 = cfg.user02
|
||||||
request.cls.user11 = cfg.user11
|
request.cls.user11 = cfg.user11
|
||||||
request.cls.user12 = cfg.user12
|
request.cls.user12 = cfg.user12
|
||||||
request.cls.user13 = cfg.user13
|
request.cls.user13 = cfg.user13
|
||||||
|
|
||||||
request.cls.env = cfg.env
|
|
||||||
|
|
||||||
|
|
||||||
class TestNetworking(OpenStackNetworkingTesting):
|
class TestNetworking(OpenStackNetworkingTesting):
|
||||||
def test_uc_network_1(self, tc_teardown):
|
def test_uc_network_1(self, tc_teardown):
|
||||||
|
@ -18,6 +18,7 @@ from tests.test_nova.rbac_nova import OpenStackComputeTesting
|
|||||||
|
|
||||||
@pytest.fixture(scope='class', autouse=True)
|
@pytest.fixture(scope='class', autouse=True)
|
||||||
def networking_setup(request, network_admin_setup):
|
def networking_setup(request, network_admin_setup):
|
||||||
|
|
||||||
cfg = network_admin_setup
|
cfg = network_admin_setup
|
||||||
request.cls.os_sdk_admin_conn = cfg.os_sdk_admin_conn
|
request.cls.os_sdk_admin_conn = cfg.os_sdk_admin_conn
|
||||||
request.cls.users = cfg.users
|
request.cls.users = cfg.users
|
||||||
@ -28,7 +29,6 @@ def networking_setup(request, network_admin_setup):
|
|||||||
request.cls.user21 = cfg.user21
|
request.cls.user21 = cfg.user21
|
||||||
request.cls.user22 = cfg.user22
|
request.cls.user22 = cfg.user22
|
||||||
request.cls.user23 = cfg.user23
|
request.cls.user23 = cfg.user23
|
||||||
request.cls.env = cfg.env
|
|
||||||
|
|
||||||
|
|
||||||
class TestVM(OpenStackComputeTesting):
|
class TestVM(OpenStackComputeTesting):
|
||||||
|
Loading…
Reference in New Issue
Block a user