Nova net functional tests round 3
* network segment * network service * port * router * security group * security group rule * subnet * subnet pool * extension The extension tests were duplicated to have both compute and network extensions tests so the nova-net case will still exercise the extension commands. Also clean up formatting from previous reviews to make the Network functional tests look and act consistently. Change-Id: I286c40572faa31ddcef595cec740da933b2defc1
This commit is contained in:
parent
efcf3b22ad
commit
190711ecd7
@ -18,25 +18,66 @@ import json
|
||||
from openstackclient.tests.functional import base
|
||||
|
||||
|
||||
class TestExtension(base.TestCase):
|
||||
"""Functional tests for extension."""
|
||||
class ExtensionTests(base.TestCase):
|
||||
"""Functional tests for extension"""
|
||||
|
||||
def test_extension_list(self):
|
||||
"""Test extension list."""
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# super(NetworkTests, cls).setUp()
|
||||
cls.haz_network = base.is_service_enabled('network')
|
||||
|
||||
def test_extension_list_compute(self):
|
||||
"""Test compute extension list"""
|
||||
json_output = json.loads(self.openstack(
|
||||
'extension list -f json ' + '--network')
|
||||
)
|
||||
self.assertEqual(
|
||||
'Default Subnetpools',
|
||||
json_output[0]['Name'],
|
||||
'extension list -f json ' +
|
||||
'--compute'
|
||||
))
|
||||
name_list = [item.get('Name') for item in json_output]
|
||||
self.assertIn(
|
||||
'ImageSize',
|
||||
name_list,
|
||||
)
|
||||
|
||||
def test_extension_show(self):
|
||||
"""Test extension show."""
|
||||
def test_extension_list_network(self):
|
||||
"""Test network extension list"""
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
json_output = json.loads(self.openstack(
|
||||
'extension list -f json ' +
|
||||
'--network'
|
||||
))
|
||||
name_list = [item.get('Name') for item in json_output]
|
||||
self.assertIn(
|
||||
'Default Subnetpools',
|
||||
name_list,
|
||||
)
|
||||
|
||||
# NOTE(dtroyer): Only network extensions are currently supported but
|
||||
# I am going to leave this here anyway as a reminder
|
||||
# fix that.
|
||||
# def test_extension_show_compute(self):
|
||||
# """Test compute extension show"""
|
||||
# json_output = json.loads(self.openstack(
|
||||
# 'extension show -f json ' +
|
||||
# 'ImageSize'
|
||||
# ))
|
||||
# self.assertEqual(
|
||||
# 'OS-EXT-IMG-SIZE',
|
||||
# json_output.get('Alias'),
|
||||
# )
|
||||
|
||||
def test_extension_show_network(self):
|
||||
"""Test network extension show"""
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
name = 'agent'
|
||||
json_output = json.loads(self.openstack(
|
||||
'extension show -f json ' + name)
|
||||
)
|
||||
'extension show -f json ' +
|
||||
name
|
||||
))
|
||||
self.assertEqual(
|
||||
name,
|
||||
json_output.get('Alias'))
|
||||
json_output.get('Alias'),
|
||||
)
|
||||
|
@ -15,6 +15,7 @@ import uuid
|
||||
|
||||
from tempest.lib import exceptions
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.compute.v2 import common
|
||||
from openstackclient.tests.functional.volume.v2 import test_volume
|
||||
|
||||
@ -22,6 +23,10 @@ from openstackclient.tests.functional.volume.v2 import test_volume
|
||||
class ServerTests(common.ComputeTestCase):
|
||||
"""Functional tests for openstack server commands"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.haz_network = base.is_service_enabled('network')
|
||||
|
||||
def test_server_list(self):
|
||||
"""Test server list, set"""
|
||||
cmd_output = self.server_create()
|
||||
@ -202,6 +207,15 @@ class ServerTests(common.ComputeTestCase):
|
||||
name = cmd_output['name']
|
||||
self.wait_for_status(name, "ACTIVE")
|
||||
|
||||
if not self.haz_network:
|
||||
# nova-net needs a public subnet
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network create -f json ' +
|
||||
'--subnet 8.6.7.5/28 ' +
|
||||
'public'
|
||||
))
|
||||
self.addCleanup(self.openstack, 'network delete public')
|
||||
|
||||
# attach ip
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'floating ip create -f json ' +
|
||||
|
@ -17,7 +17,7 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class AddressScopeTests(common.NetworkTests):
|
||||
"""Functional tests for address scope. """
|
||||
"""Functional tests for address scope"""
|
||||
|
||||
# NOTE(dtroyer): Do not normalize the setup and teardown of the resource
|
||||
# creation and deletion. Little is gained when each test
|
||||
|
@ -17,31 +17,46 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class IPAvailabilityTests(common.NetworkTests):
|
||||
"""Functional tests for IP availability. """
|
||||
"""Functional tests for IP availability"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if not cls.haz_network:
|
||||
common.NetworkTests.skipTest(cls, "No Network service present")
|
||||
|
||||
# Create a network for the subnet.
|
||||
cls.NAME = uuid.uuid4().hex
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
cls.openstack('network create ' + cls.NETWORK_NAME)
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
'subnet create -f json --network ' + cls.NETWORK_NAME +
|
||||
' --subnet-range 10.10.10.0/24 ' +
|
||||
cls.NAME
|
||||
))
|
||||
cls.assertOutput(cls.NAME, cmd_output['name'])
|
||||
if cls.haz_network:
|
||||
# Create a network for the subnet.
|
||||
cls.NAME = uuid.uuid4().hex
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
cls.openstack(
|
||||
'network create ' +
|
||||
cls.NETWORK_NAME
|
||||
)
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
'subnet create -f json ' +
|
||||
'--network ' + cls.NETWORK_NAME + ' ' +
|
||||
'--subnet-range 10.10.10.0/24 ' +
|
||||
cls.NAME
|
||||
))
|
||||
cls.assertOutput(cls.NAME, cmd_output['name'])
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_subnet = cls.openstack('subnet delete ' + cls.NAME)
|
||||
raw_network = cls.openstack('network delete ' + cls.NETWORK_NAME)
|
||||
cls.assertOutput('', raw_subnet)
|
||||
cls.assertOutput('', raw_network)
|
||||
if cls.haz_network:
|
||||
raw_subnet = cls.openstack(
|
||||
'subnet delete ' +
|
||||
cls.NAME
|
||||
)
|
||||
raw_network = cls.openstack(
|
||||
'network delete ' +
|
||||
cls.NETWORK_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_subnet)
|
||||
cls.assertOutput('', raw_network)
|
||||
|
||||
def setUp(self):
|
||||
super(IPAvailabilityTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_ip_availability_list(self):
|
||||
"""Test ip availability list"""
|
||||
|
@ -13,17 +13,17 @@
|
||||
import json
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkTests(base.TestCase):
|
||||
class NetworkTests(common.NetworkTests):
|
||||
"""Functional tests for network"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.haz_network = base.is_service_enabled('network')
|
||||
cls.PROJECT_NAME =\
|
||||
cls.get_openstack_configuration_value('auth.project_name')
|
||||
def setUp(self):
|
||||
super(NetworkTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_network_create_compute(self):
|
||||
"""Test Nova-net create options, delete"""
|
||||
|
@ -31,7 +31,8 @@ class TestMeterRule(common.NetworkTests):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
json_output = json.loads(cls.openstack(
|
||||
'network meter create -f json ' + cls.METER_NAME
|
||||
'network meter create -f json ' +
|
||||
cls.METER_NAME
|
||||
))
|
||||
cls.METER_ID = json_output.get('id')
|
||||
|
||||
@ -39,7 +40,10 @@ class TestMeterRule(common.NetworkTests):
|
||||
def tearDownClass(cls):
|
||||
common.NetworkTests.tearDownClass()
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack('network meter delete ' + cls.METER_ID)
|
||||
raw_output = cls.openstack(
|
||||
'network meter delete ' +
|
||||
cls.METER_ID
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
|
@ -27,10 +27,23 @@ class NetworkQosPolicyTests(common.NetworkTests):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack('network qos policy create ' + cls.NAME +
|
||||
opts)
|
||||
cls.assertOutput(cls.NAME + "\n", raw_output)
|
||||
if cls.haz_network:
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack(
|
||||
'network qos policy create ' +
|
||||
cls.NAME +
|
||||
opts
|
||||
)
|
||||
cls.assertOutput(cls.NAME + "\n", raw_output)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network qos policy delete ' +
|
||||
cls.NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkQosPolicyTests, self).setUp()
|
||||
@ -38,11 +51,6 @@ class NetworkQosPolicyTests(common.NetworkTests):
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('network qos policy delete ' + cls.NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def test_qos_policy_list(self):
|
||||
opts = self.get_opts(self.HEADERS)
|
||||
raw_output = self.openstack('network qos policy list' + opts)
|
||||
|
@ -19,7 +19,7 @@ from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
"""Functional tests for QoS minimum bandwidth rule."""
|
||||
"""Functional tests for QoS minimum bandwidth rule"""
|
||||
RULE_ID = None
|
||||
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
MIN_KBPS = 2800
|
||||
@ -32,20 +32,35 @@ class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
cls.openstack('network qos policy create ' + cls.QOS_POLICY_NAME)
|
||||
cls.RULE_ID = cls.openstack('network qos rule create --type ' +
|
||||
cls.TYPE + ' --min-kbps ' +
|
||||
str(cls.MIN_KBPS) + ' ' + cls.DIRECTION +
|
||||
' ' + cls.QOS_POLICY_NAME + opts)
|
||||
cls.assertsOutputNotNone(cls.RULE_ID)
|
||||
if cls.haz_network:
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
cls.openstack(
|
||||
'network qos policy create ' +
|
||||
cls.QOS_POLICY_NAME
|
||||
)
|
||||
cls.RULE_ID = cls.openstack(
|
||||
'network qos rule create ' +
|
||||
'--type ' + cls.TYPE + ' ' +
|
||||
'--min-kbps ' + str(cls.MIN_KBPS) + ' ' +
|
||||
cls.DIRECTION + ' ' +
|
||||
cls.QOS_POLICY_NAME +
|
||||
opts
|
||||
)
|
||||
cls.assertsOutputNotNone(cls.RULE_ID)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('network qos rule delete ' +
|
||||
cls.QOS_POLICY_NAME + ' ' + cls.RULE_ID)
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network qos rule delete ' +
|
||||
cls.QOS_POLICY_NAME + ' ' +
|
||||
cls.RULE_ID
|
||||
)
|
||||
cls.openstack(
|
||||
'network qos policy delete ' +
|
||||
cls.QOS_POLICY_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkQosRuleTestsMinimumBandwidth, self).setUp()
|
||||
@ -78,7 +93,7 @@ class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
|
||||
|
||||
class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
|
||||
"""Functional tests for QoS DSCP marking rule."""
|
||||
"""Functional tests for QoS DSCP marking rule"""
|
||||
RULE_ID = None
|
||||
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
DSCP_MARK = 8
|
||||
@ -90,20 +105,31 @@ class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
cls.openstack('network qos policy create ' + cls.QOS_POLICY_NAME)
|
||||
cls.RULE_ID = cls.openstack('network qos rule create --type ' +
|
||||
cls.TYPE + ' --dscp-mark ' +
|
||||
str(cls.DSCP_MARK) + ' ' +
|
||||
cls.QOS_POLICY_NAME + opts)
|
||||
cls.assertsOutputNotNone(cls.RULE_ID)
|
||||
if cls.haz_network:
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
cls.openstack(
|
||||
'network qos policy create ' +
|
||||
cls.QOS_POLICY_NAME
|
||||
)
|
||||
cls.RULE_ID = cls.openstack(
|
||||
'network qos rule create ' +
|
||||
'--type ' + cls.TYPE + ' ' +
|
||||
'--dscp-mark ' + str(cls.DSCP_MARK) + ' ' +
|
||||
cls.QOS_POLICY_NAME +
|
||||
opts
|
||||
)
|
||||
cls.assertsOutputNotNone(cls.RULE_ID)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('network qos rule delete ' +
|
||||
cls.QOS_POLICY_NAME + ' ' + cls.RULE_ID)
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network qos rule delete ' +
|
||||
cls.QOS_POLICY_NAME + ' ' +
|
||||
cls.RULE_ID
|
||||
)
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkQosRuleTestsDSCPMarking, self).setUp()
|
||||
@ -136,7 +162,7 @@ class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
|
||||
|
||||
|
||||
class NetworkQosRuleTestsBandwidthLimit(common.NetworkTests):
|
||||
"""Functional tests for QoS bandwidth limit rule."""
|
||||
"""Functional tests for QoS bandwidth limit rule"""
|
||||
RULE_ID = None
|
||||
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
MAX_KBPS = 10000
|
||||
@ -150,21 +176,32 @@ class NetworkQosRuleTestsBandwidthLimit(common.NetworkTests):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
cls.openstack('network qos policy create ' + cls.QOS_POLICY_NAME)
|
||||
cls.RULE_ID = cls.openstack('network qos rule create --type ' +
|
||||
cls.TYPE + ' --max-kbps ' +
|
||||
str(cls.MAX_KBPS) + ' --max-burst-kbits ' +
|
||||
str(cls.MAX_BURST_KBITS) + ' ' +
|
||||
cls.QOS_POLICY_NAME + opts)
|
||||
cls.assertsOutputNotNone(cls.RULE_ID)
|
||||
if cls.haz_network:
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
cls.openstack(
|
||||
'network qos policy create ' +
|
||||
cls.QOS_POLICY_NAME
|
||||
)
|
||||
cls.RULE_ID = cls.openstack(
|
||||
'network qos rule create ' +
|
||||
'--type ' + cls.TYPE + ' ' +
|
||||
'--max-kbps ' + str(cls.MAX_KBPS) + ' ' +
|
||||
'--max-burst-kbits ' + str(cls.MAX_BURST_KBITS) + ' ' +
|
||||
cls.QOS_POLICY_NAME +
|
||||
opts
|
||||
)
|
||||
cls.assertsOutputNotNone(cls.RULE_ID)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('network qos rule delete ' +
|
||||
cls.QOS_POLICY_NAME + ' ' + cls.RULE_ID)
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network qos rule delete ' +
|
||||
cls.QOS_POLICY_NAME + ' ' +
|
||||
cls.RULE_ID
|
||||
)
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkQosRuleTestsBandwidthLimit, self).setUp()
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkSegmentTests(base.TestCase):
|
||||
"""Functional tests for network segment. """
|
||||
class NetworkSegmentTests(common.NetworkTests):
|
||||
"""Functional tests for network segment"""
|
||||
NETWORK_NAME = uuid.uuid4().hex
|
||||
PHYSICAL_NETWORK_NAME = uuid.uuid4().hex
|
||||
NETWORK_SEGMENT_ID = None
|
||||
@ -25,30 +25,46 @@ class NetworkSegmentTests(base.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# Create a network for the segment.
|
||||
opts = cls.get_opts(['id'])
|
||||
raw_output = cls.openstack('network create ' + cls.NETWORK_NAME + opts)
|
||||
cls.NETWORK_ID = raw_output.strip('\n')
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create a network for the segment.
|
||||
opts = cls.get_opts(['id'])
|
||||
raw_output = cls.openstack(
|
||||
'network create ' + cls.NETWORK_NAME + opts
|
||||
)
|
||||
cls.NETWORK_ID = raw_output.strip('\n')
|
||||
|
||||
# NOTE(rtheis): The segment extension is not yet enabled by default.
|
||||
# Skip the tests if not enabled.
|
||||
extensions = cls.get_openstack_extention_names()
|
||||
if 'Segment' in extensions:
|
||||
cls.NETWORK_SEGMENT_EXTENSION = 'Segment'
|
||||
# NOTE(rtheis): The segment extension is not yet enabled
|
||||
# by default.
|
||||
# Skip the tests if not enabled.
|
||||
extensions = cls.get_openstack_extention_names()
|
||||
if 'Segment' in extensions:
|
||||
cls.NETWORK_SEGMENT_EXTENSION = 'Segment'
|
||||
|
||||
if cls.NETWORK_SEGMENT_EXTENSION:
|
||||
# Get the segment for the network.
|
||||
opts = cls.get_opts(['ID', 'Network'])
|
||||
raw_output = cls.openstack('network segment list '
|
||||
' --network ' + cls.NETWORK_NAME +
|
||||
' ' + opts)
|
||||
raw_output_row = raw_output.split('\n')[0]
|
||||
cls.NETWORK_SEGMENT_ID = raw_output_row.split(' ')[0]
|
||||
if cls.NETWORK_SEGMENT_EXTENSION:
|
||||
# Get the segment for the network.
|
||||
opts = cls.get_opts(['ID', 'Network'])
|
||||
raw_output = cls.openstack(
|
||||
'network segment list '
|
||||
'--network ' + cls.NETWORK_NAME + ' ' +
|
||||
opts
|
||||
)
|
||||
raw_output_row = raw_output.split('\n')[0]
|
||||
cls.NETWORK_SEGMENT_ID = raw_output_row.split(' ')[0]
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('network delete ' + cls.NETWORK_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network delete ' + cls.NETWORK_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkSegmentTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_network_segment_create_delete(self):
|
||||
if self.NETWORK_SEGMENT_EXTENSION:
|
||||
|
@ -13,14 +13,20 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class TestNetworkServiceProvider(base.TestCase):
|
||||
class TestNetworkServiceProvider(common.NetworkTests):
|
||||
"""Functional tests for network service provider"""
|
||||
|
||||
SERVICE_TYPE = 'L3_ROUTER_NAT'
|
||||
|
||||
def setUp(self):
|
||||
super(TestNetworkServiceProvider, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_network_service_provider_list(self):
|
||||
raw_output = self.openstack('network service provider list')
|
||||
self.assertIn(self.SERVICE_TYPE, raw_output)
|
||||
|
@ -13,23 +13,36 @@
|
||||
import json
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class PortTests(base.TestCase):
|
||||
"""Functional tests for port. """
|
||||
class PortTests(common.NetworkTests):
|
||||
"""Functional tests for port"""
|
||||
NAME = uuid.uuid4().hex
|
||||
NETWORK_NAME = uuid.uuid4().hex
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# Create a network for the port
|
||||
cls.openstack('network create ' + cls.NETWORK_NAME)
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create a network for the port
|
||||
cls.openstack(
|
||||
'network create ' + cls.NETWORK_NAME
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('network delete ' + cls.NETWORK_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network delete ' + cls.NETWORK_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(PortTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_port_delete(self):
|
||||
"""Test create, delete multiple"""
|
||||
|
@ -13,11 +13,17 @@
|
||||
import json
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class RouterTests(base.TestCase):
|
||||
"""Functional tests for router. """
|
||||
class RouterTests(common.NetworkTests):
|
||||
"""Functional tests for router"""
|
||||
|
||||
def setUp(self):
|
||||
super(RouterTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_router_create_and_delete(self):
|
||||
"""Test create options, delete multiple"""
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class SecurityGroupTests(base.TestCase):
|
||||
"""Functional tests for security group. """
|
||||
class SecurityGroupTests(common.NetworkTests):
|
||||
"""Functional tests for security group"""
|
||||
NAME = uuid.uuid4().hex
|
||||
OTHER_NAME = uuid.uuid4().hex
|
||||
HEADERS = ['Name']
|
||||
@ -24,20 +24,39 @@ class SecurityGroupTests(base.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack('security group create ' + cls.NAME + opts)
|
||||
expected = cls.NAME + '\n'
|
||||
cls.assertOutput(expected, raw_output)
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack(
|
||||
'security group create ' +
|
||||
cls.NAME +
|
||||
opts
|
||||
)
|
||||
expected = cls.NAME + '\n'
|
||||
cls.assertOutput(expected, raw_output)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
# Rename test
|
||||
raw_output = cls.openstack('security group set --name ' +
|
||||
cls.OTHER_NAME + ' ' + cls.NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
# Delete test
|
||||
raw_output = cls.openstack('security group delete ' + cls.OTHER_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
# Rename test
|
||||
raw_output = cls.openstack(
|
||||
'security group set --name ' +
|
||||
cls.OTHER_NAME + ' ' +
|
||||
cls.NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
# Delete test
|
||||
raw_output = cls.openstack(
|
||||
'security group delete ' +
|
||||
cls.OTHER_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(SecurityGroupTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_security_group_list(self):
|
||||
opts = self.get_opts(self.HEADERS)
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class SecurityGroupRuleTests(base.TestCase):
|
||||
"""Functional tests for security group rule. """
|
||||
class SecurityGroupRuleTests(common.NetworkTests):
|
||||
"""Functional tests for security group rule"""
|
||||
SECURITY_GROUP_NAME = uuid.uuid4().hex
|
||||
SECURITY_GROUP_RULE_ID = None
|
||||
NAME_FIELD = ['name']
|
||||
@ -25,32 +25,49 @@ class SecurityGroupRuleTests(base.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# Create the security group to hold the rule.
|
||||
opts = cls.get_opts(cls.NAME_FIELD)
|
||||
raw_output = cls.openstack('security group create ' +
|
||||
cls.SECURITY_GROUP_NAME +
|
||||
opts)
|
||||
expected = cls.SECURITY_GROUP_NAME + '\n'
|
||||
cls.assertOutput(expected, raw_output)
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create the security group to hold the rule.
|
||||
opts = cls.get_opts(cls.NAME_FIELD)
|
||||
raw_output = cls.openstack(
|
||||
'security group create ' +
|
||||
cls.SECURITY_GROUP_NAME +
|
||||
opts
|
||||
)
|
||||
expected = cls.SECURITY_GROUP_NAME + '\n'
|
||||
cls.assertOutput(expected, raw_output)
|
||||
|
||||
# Create the security group rule.
|
||||
opts = cls.get_opts(cls.ID_FIELD)
|
||||
raw_output = cls.openstack('security group rule create ' +
|
||||
cls.SECURITY_GROUP_NAME +
|
||||
' --protocol tcp --dst-port 80:80' +
|
||||
' --ingress --ethertype IPv4' +
|
||||
opts)
|
||||
cls.SECURITY_GROUP_RULE_ID = raw_output.strip('\n')
|
||||
# Create the security group rule.
|
||||
opts = cls.get_opts(cls.ID_FIELD)
|
||||
raw_output = cls.openstack(
|
||||
'security group rule create ' +
|
||||
cls.SECURITY_GROUP_NAME + ' ' +
|
||||
'--protocol tcp --dst-port 80:80 ' +
|
||||
'--ingress --ethertype IPv4 ' +
|
||||
opts
|
||||
)
|
||||
cls.SECURITY_GROUP_RULE_ID = raw_output.strip('\n')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('security group rule delete ' +
|
||||
cls.SECURITY_GROUP_RULE_ID)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'security group rule delete ' +
|
||||
cls.SECURITY_GROUP_RULE_ID
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
raw_output = cls.openstack('security group delete ' +
|
||||
cls.SECURITY_GROUP_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
raw_output = cls.openstack(
|
||||
'security group delete ' +
|
||||
cls.SECURITY_GROUP_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(SecurityGroupRuleTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_security_group_rule_list(self):
|
||||
opts = self.get_opts(self.ID_HEADER)
|
||||
|
@ -14,27 +14,39 @@ import json
|
||||
import random
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class SubnetTests(base.TestCase):
|
||||
"""Functional tests for subnet. """
|
||||
class SubnetTests(common.NetworkTests):
|
||||
"""Functional tests for subnet"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
# Create a network for the all subnet tests.
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
'network create -f json ' +
|
||||
cls.NETWORK_NAME
|
||||
))
|
||||
# Get network_id for assertEqual
|
||||
cls.NETWORK_ID = cmd_output["id"]
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Create a network for the all subnet tests
|
||||
cls.NETWORK_NAME = uuid.uuid4().hex
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
'network create -f json ' +
|
||||
cls.NETWORK_NAME
|
||||
))
|
||||
# Get network_id for assertEqual
|
||||
cls.NETWORK_ID = cmd_output["id"]
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('network delete ' + cls.NETWORK_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network delete ' +
|
||||
cls.NETWORK_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(SubnetTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_subnet_create_and_delete(self):
|
||||
"""Test create, delete multiple"""
|
||||
|
@ -14,12 +14,18 @@ import json
|
||||
import random
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class SubnetPoolTests(base.TestCase):
|
||||
class SubnetPoolTests(common.NetworkTests):
|
||||
"""Functional tests for subnet pool"""
|
||||
|
||||
def setUp(self):
|
||||
super(SubnetPoolTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_subnet_pool_create_delete(self):
|
||||
"""Test create, delete"""
|
||||
name1 = uuid.uuid4().hex
|
||||
|
Loading…
x
Reference in New Issue
Block a user