Unroll the network qos policy functional tests
These seem to have gotten a bit racy in the last revision, just do it the long way now. Change-Id: I3748b8b4f264dbfa8c991b32653682e5c86eeb4c
This commit is contained in:
parent
21542d1e6e
commit
59bba7c0d2
@ -28,49 +28,58 @@ class NetworkQosPolicyTests(common.NetworkTests):
|
|||||||
if not self.haz_network:
|
if not self.haz_network:
|
||||||
self.skipTest("No Network service present")
|
self.skipTest("No Network service present")
|
||||||
|
|
||||||
self.NAME = uuid.uuid4().hex
|
|
||||||
cmd_output = json.loads(self.openstack(
|
|
||||||
'network qos policy create -f json ' +
|
|
||||||
self.NAME
|
|
||||||
))
|
|
||||||
self.addCleanup(
|
|
||||||
self.openstack,
|
|
||||||
'network qos policy delete ' + self.NAME,
|
|
||||||
fail_ok=True,
|
|
||||||
)
|
|
||||||
self.assertEqual(self.NAME, cmd_output['name'])
|
|
||||||
|
|
||||||
def test_qos_rule_create_delete(self):
|
def test_qos_rule_create_delete(self):
|
||||||
# This is to check the output of qos policy delete
|
# This is to check the output of qos policy delete
|
||||||
policy_name = uuid.uuid4().hex
|
policy_name = uuid.uuid4().hex
|
||||||
self.openstack('network qos policy create -f json ' + policy_name)
|
self.openstack('network qos policy create -f json ' + policy_name)
|
||||||
raw_output = self.openstack(
|
raw_output = self.openstack(
|
||||||
'network qos policy delete ' + policy_name)
|
'network qos policy delete ' +
|
||||||
|
policy_name
|
||||||
|
)
|
||||||
self.assertEqual('', raw_output)
|
self.assertEqual('', raw_output)
|
||||||
|
|
||||||
def test_qos_policy_list(self):
|
def test_qos_policy_list(self):
|
||||||
cmd_output = json.loads(self.openstack(
|
policy_name = uuid.uuid4().hex
|
||||||
'network qos policy list -f json'))
|
json_output = json.loads(self.openstack(
|
||||||
self.assertIn(self.NAME, [p['Name'] for p in cmd_output])
|
'network qos policy create -f json ' +
|
||||||
|
policy_name
|
||||||
|
))
|
||||||
|
self.addCleanup(self.openstack,
|
||||||
|
'network qos policy delete ' + policy_name)
|
||||||
|
self.assertEqual(policy_name, json_output['name'])
|
||||||
|
|
||||||
def test_qos_policy_show(self):
|
json_output = json.loads(self.openstack(
|
||||||
cmd_output = json.loads(self.openstack(
|
'network qos policy list -f json'
|
||||||
'network qos policy show -f json ' + self.NAME))
|
))
|
||||||
self.assertEqual(self.NAME, cmd_output['name'])
|
self.assertIn(policy_name, [p['Name'] for p in json_output])
|
||||||
|
|
||||||
def test_qos_policy_set(self):
|
def test_qos_policy_set(self):
|
||||||
self.openstack('network qos policy set --share ' + self.NAME)
|
policy_name = uuid.uuid4().hex
|
||||||
cmd_output = json.loads(self.openstack(
|
json_output = json.loads(self.openstack(
|
||||||
'network qos policy show -f json ' + self.NAME))
|
'network qos policy create -f json ' +
|
||||||
self.assertTrue(cmd_output['shared'])
|
policy_name
|
||||||
|
))
|
||||||
|
self.addCleanup(self.openstack,
|
||||||
|
'network qos policy delete ' + policy_name)
|
||||||
|
self.assertEqual(policy_name, json_output['name'])
|
||||||
|
|
||||||
def test_qos_policy_default(self):
|
self.openstack(
|
||||||
self.openstack('network qos policy set --default ' + self.NAME)
|
'network qos policy set ' +
|
||||||
cmd_output = json.loads(self.openstack(
|
'--share ' +
|
||||||
'network qos policy show -f json ' + self.NAME))
|
'--default ' +
|
||||||
self.assertTrue(cmd_output['is_default'])
|
policy_name
|
||||||
|
)
|
||||||
|
|
||||||
self.openstack('network qos policy set --no-default ' + self.NAME)
|
json_output = json.loads(self.openstack(
|
||||||
cmd_output = json.loads(self.openstack(
|
'network qos policy show -f json ' +
|
||||||
'network qos policy show -f json ' + self.NAME))
|
policy_name
|
||||||
self.assertFalse(cmd_output['is_default'])
|
))
|
||||||
|
self.assertTrue(json_output['shared'])
|
||||||
|
self.assertTrue(json_output['is_default'])
|
||||||
|
|
||||||
|
self.openstack('network qos policy set --no-default ' + policy_name)
|
||||||
|
json_output = json.loads(self.openstack(
|
||||||
|
'network qos policy show -f json ' +
|
||||||
|
policy_name
|
||||||
|
))
|
||||||
|
self.assertFalse(json_output['is_default'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user