Nova net functional tests round 2
* floating ip * ip availability * network qos policy * network qos rule * network qos rule type * network rbac Change-Id: Id3946bdff43bfef3a1d879c058bde4792bd299c6
This commit is contained in:
parent
e0d1af94a1
commit
dd7da49325
@ -14,10 +14,10 @@ import random
|
||||
import re
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class FloatingIpTests(base.TestCase):
|
||||
class FloatingIpTests(common.NetworkTests):
|
||||
"""Functional tests for floating ip"""
|
||||
SUBNET_NAME = uuid.uuid4().hex
|
||||
NETWORK_NAME = uuid.uuid4().hex
|
||||
@ -28,6 +28,8 @@ class FloatingIpTests(base.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
# Set up some regex for matching below
|
||||
cls.re_id = re.compile("id\s+\|\s+(\S+)")
|
||||
cls.re_floating_ip = re.compile("floating_ip_address\s+\|\s+(\S+)")
|
||||
@ -50,8 +52,9 @@ class FloatingIpTests(base.TestCase):
|
||||
cls.private_network_id = re.search(cls.re_id, raw_output).group(1)
|
||||
|
||||
# Try random subnet range for subnet creating
|
||||
# Because we can not determine ahead of time what subnets are already
|
||||
# in use, possibly by another test running in parallel, try 4 times
|
||||
# Because we can not determine ahead of time what subnets are
|
||||
# already in use, possibly by another test running in parallel,
|
||||
# try 4 times
|
||||
for i in range(4):
|
||||
# Make a random subnet
|
||||
cls.subnet = ".".join(map(
|
||||
@ -87,19 +90,35 @@ class FloatingIpTests(base.TestCase):
|
||||
break
|
||||
|
||||
cls.subnet_id = re.search(cls.re_id, raw_output).group(1)
|
||||
cls.private_subnet_id = re.search(cls.re_id, priv_raw_output).group(1)
|
||||
cls.private_subnet_id = re.search(
|
||||
cls.re_id, priv_raw_output
|
||||
).group(1)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output = cls.openstack('subnet delete ' + cls.SUBNET_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
raw_output = cls.openstack('subnet delete ' + cls.PRIVATE_SUBNET_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
raw_output = cls.openstack('network delete ' + cls.NETWORK_NAME)
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'subnet delete ' + cls.SUBNET_NAME,
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
raw_output = cls.openstack(
|
||||
'network delete ' + cls.PRIVATE_NETWORK_NAME)
|
||||
'subnet delete ' + cls.PRIVATE_SUBNET_NAME,
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
raw_output = cls.openstack(
|
||||
'network delete ' + cls.NETWORK_NAME,
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
raw_output = cls.openstack(
|
||||
'network delete ' + cls.PRIVATE_NETWORK_NAME,
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def setUp(self):
|
||||
super(FloatingIpTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_floating_ip_delete(self):
|
||||
"""Test create, delete multiple"""
|
||||
|
@ -13,14 +13,18 @@
|
||||
import json
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class IPAvailabilityTests(base.TestCase):
|
||||
class IPAvailabilityTests(common.NetworkTests):
|
||||
"""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
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class QosPolicyTests(base.TestCase):
|
||||
class NetworkQosPolicyTests(common.NetworkTests):
|
||||
"""Functional tests for QoS policy. """
|
||||
NAME = uuid.uuid4().hex
|
||||
HEADERS = ['Name']
|
||||
@ -26,11 +26,18 @@ class QosPolicyTests(base.TestCase):
|
||||
|
||||
@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)
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkQosPolicyTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
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)
|
||||
|
@ -15,10 +15,10 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkQosRuleTestsMinimumBandwidth(base.TestCase):
|
||||
class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
"""Functional tests for QoS minimum bandwidth rule."""
|
||||
RULE_ID = None
|
||||
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
@ -31,6 +31,7 @@ class NetworkQosRuleTestsMinimumBandwidth(base.TestCase):
|
||||
|
||||
@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 ' +
|
||||
@ -46,20 +47,26 @@ class NetworkQosRuleTestsMinimumBandwidth(base.TestCase):
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def test_qos_policy_list(self):
|
||||
def setUp(self):
|
||||
super(NetworkQosRuleTestsMinimumBandwidth, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_qos_rule_list(self):
|
||||
opts = self.get_opts(self.HEADERS)
|
||||
raw_output = self.openstack('network qos rule list '
|
||||
+ self.QOS_POLICY_NAME + opts)
|
||||
self.assertIn(self.RULE_ID, raw_output)
|
||||
|
||||
def test_qos_policy_show(self):
|
||||
def test_qos_rule_show(self):
|
||||
opts = self.get_opts(self.FIELDS)
|
||||
raw_output = self.openstack('network qos rule show ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID +
|
||||
opts)
|
||||
self.assertEqual(self.RULE_ID, raw_output)
|
||||
|
||||
def test_qos_policy_set(self):
|
||||
def test_qos_rule_set(self):
|
||||
self.openstack('network qos rule set --min-kbps ' +
|
||||
str(self.MIN_KBPS_MODIFIED) + ' ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID)
|
||||
@ -70,7 +77,7 @@ class NetworkQosRuleTestsMinimumBandwidth(base.TestCase):
|
||||
self.assertEqual(str(self.MIN_KBPS_MODIFIED) + "\n", raw_output)
|
||||
|
||||
|
||||
class NetworkQosRuleTestsDSCPMarking(base.TestCase):
|
||||
class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
|
||||
"""Functional tests for QoS DSCP marking rule."""
|
||||
RULE_ID = None
|
||||
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
@ -82,6 +89,7 @@ class NetworkQosRuleTestsDSCPMarking(base.TestCase):
|
||||
|
||||
@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 ' +
|
||||
@ -97,20 +105,26 @@ class NetworkQosRuleTestsDSCPMarking(base.TestCase):
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def test_qos_policy_list(self):
|
||||
def setUp(self):
|
||||
super(NetworkQosRuleTestsDSCPMarking, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_qos_rule_list(self):
|
||||
opts = self.get_opts(self.HEADERS)
|
||||
raw_output = self.openstack('network qos rule list '
|
||||
+ self.QOS_POLICY_NAME + opts)
|
||||
self.assertIn(self.RULE_ID, raw_output)
|
||||
|
||||
def test_qos_policy_show(self):
|
||||
def test_qos_rule_show(self):
|
||||
opts = self.get_opts(self.FIELDS)
|
||||
raw_output = self.openstack('network qos rule show ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID +
|
||||
opts)
|
||||
self.assertEqual(self.RULE_ID, raw_output)
|
||||
|
||||
def test_qos_policy_set(self):
|
||||
def test_qos_rule_set(self):
|
||||
self.openstack('network qos rule set --dscp-mark ' +
|
||||
str(self.DSCP_MARK_MODIFIED) + ' ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID)
|
||||
@ -121,7 +135,7 @@ class NetworkQosRuleTestsDSCPMarking(base.TestCase):
|
||||
self.assertEqual(str(self.DSCP_MARK_MODIFIED) + "\n", raw_output)
|
||||
|
||||
|
||||
class NetworkQosRuleTestsBandwidthLimit(base.TestCase):
|
||||
class NetworkQosRuleTestsBandwidthLimit(common.NetworkTests):
|
||||
"""Functional tests for QoS bandwidth limit rule."""
|
||||
RULE_ID = None
|
||||
QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
@ -135,6 +149,7 @@ class NetworkQosRuleTestsBandwidthLimit(base.TestCase):
|
||||
|
||||
@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 ' +
|
||||
@ -151,20 +166,26 @@ class NetworkQosRuleTestsBandwidthLimit(base.TestCase):
|
||||
cls.openstack('network qos policy delete ' + cls.QOS_POLICY_NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
|
||||
def test_qos_policy_list(self):
|
||||
def setUp(self):
|
||||
super(NetworkQosRuleTestsBandwidthLimit, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_qos_rule_list(self):
|
||||
opts = self.get_opts(self.HEADERS)
|
||||
raw_output = self.openstack('network qos rule list '
|
||||
+ self.QOS_POLICY_NAME + opts)
|
||||
self.assertIn(self.RULE_ID, raw_output)
|
||||
|
||||
def test_qos_policy_show(self):
|
||||
def test_qos_rule_show(self):
|
||||
opts = self.get_opts(self.FIELDS)
|
||||
raw_output = self.openstack('network qos rule show ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID +
|
||||
opts)
|
||||
self.assertEqual(self.RULE_ID, raw_output)
|
||||
|
||||
def test_qos_policy_set(self):
|
||||
def test_qos_rule_set(self):
|
||||
self.openstack('network qos rule set --max-kbps ' +
|
||||
str(self.MAX_KBPS_MODIFIED) + ' --max-burst-kbits ' +
|
||||
str(self.MAX_BURST_KBITS_MODIFIED) + ' ' +
|
||||
|
@ -13,15 +13,21 @@
|
||||
# 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 NetworkQosRuleTypeTests(base.TestCase):
|
||||
class NetworkQosRuleTypeTests(common.NetworkTests):
|
||||
"""Functional tests for Network QoS rule type. """
|
||||
|
||||
AVAILABLE_RULE_TYPES = ['dscp_marking',
|
||||
'bandwidth_limit']
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkQosRuleTypeTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_qos_rule_type_list(self):
|
||||
raw_output = self.openstack('network qos rule type list')
|
||||
for rule_type in self.AVAILABLE_RULE_TYPES:
|
||||
|
@ -12,10 +12,10 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests.functional import base
|
||||
from openstackclient.tests.functional.network.v2 import common
|
||||
|
||||
|
||||
class NetworkRBACTests(base.TestCase):
|
||||
class NetworkRBACTests(common.NetworkTests):
|
||||
"""Functional tests for network rbac. """
|
||||
NET_NAME = uuid.uuid4().hex
|
||||
PROJECT_NAME = uuid.uuid4().hex
|
||||
@ -26,25 +26,42 @@ class NetworkRBACTests(base.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
common.NetworkTests.setUpClass()
|
||||
if cls.haz_network:
|
||||
opts = cls.get_opts(cls.FIELDS)
|
||||
raw_output = cls.openstack('network create ' + cls.NET_NAME + opts)
|
||||
raw_output = cls.openstack(
|
||||
'network create ' + cls.NET_NAME + opts
|
||||
)
|
||||
cls.OBJECT_ID = raw_output.strip('\n')
|
||||
opts = cls.get_opts(['id', 'object_id'])
|
||||
raw_output = cls.openstack('network rbac create ' +
|
||||
raw_output = cls.openstack(
|
||||
'network rbac create ' +
|
||||
cls.OBJECT_ID +
|
||||
' --action access_as_shared' +
|
||||
' --target-project admin' +
|
||||
' --type network' + opts)
|
||||
' --type network' + opts
|
||||
)
|
||||
cls.ID, object_id, rol = tuple(raw_output.split('\n'))
|
||||
cls.assertOutput(cls.OBJECT_ID, object_id)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
raw_output_rbac = cls.openstack('network rbac delete ' + cls.ID)
|
||||
raw_output_network = cls.openstack('network delete ' + cls.OBJECT_ID)
|
||||
if cls.haz_network:
|
||||
raw_output_rbac = cls.openstack(
|
||||
'network rbac delete ' + cls.ID
|
||||
)
|
||||
raw_output_network = cls.openstack(
|
||||
'network delete ' + cls.OBJECT_ID
|
||||
)
|
||||
cls.assertOutput('', raw_output_rbac)
|
||||
cls.assertOutput('', raw_output_network)
|
||||
|
||||
def setUp(self):
|
||||
super(NetworkRBACTests, self).setUp()
|
||||
# Nothing in this class works with Nova Network
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
def test_network_rbac_list(self):
|
||||
opts = self.get_opts(self.HEADERS)
|
||||
raw_output = self.openstack('network rbac list' + opts)
|
||||
|
Loading…
Reference in New Issue
Block a user