Merge "Unroll the network qos policy functional tests"

This commit is contained in:
Jenkins 2017-09-19 12:51:07 +00:00 committed by Gerrit Code Review
commit 763288f605

View File

@ -28,49 +28,58 @@ class NetworkQosPolicyTests(common.NetworkTests):
if not self.haz_network:
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):
# This is to check the output of qos policy delete
policy_name = uuid.uuid4().hex
self.openstack('network qos policy create -f json ' + policy_name)
raw_output = self.openstack(
'network qos policy delete ' + policy_name)
'network qos policy delete ' +
policy_name
)
self.assertEqual('', raw_output)
def test_qos_policy_list(self):
cmd_output = json.loads(self.openstack(
'network qos policy list -f json'))
self.assertIn(self.NAME, [p['Name'] for p in cmd_output])
policy_name = uuid.uuid4().hex
json_output = json.loads(self.openstack(
'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):
cmd_output = json.loads(self.openstack(
'network qos policy show -f json ' + self.NAME))
self.assertEqual(self.NAME, cmd_output['name'])
json_output = json.loads(self.openstack(
'network qos policy list -f json'
))
self.assertIn(policy_name, [p['Name'] for p in json_output])
def test_qos_policy_set(self):
self.openstack('network qos policy set --share ' + self.NAME)
cmd_output = json.loads(self.openstack(
'network qos policy show -f json ' + self.NAME))
self.assertTrue(cmd_output['shared'])
policy_name = uuid.uuid4().hex
json_output = json.loads(self.openstack(
'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_default(self):
self.openstack('network qos policy set --default ' + self.NAME)
cmd_output = json.loads(self.openstack(
'network qos policy show -f json ' + self.NAME))
self.assertTrue(cmd_output['is_default'])
self.openstack(
'network qos policy set ' +
'--share ' +
'--default ' +
policy_name
)
self.openstack('network qos policy set --no-default ' + self.NAME)
cmd_output = json.loads(self.openstack(
'network qos policy show -f json ' + self.NAME))
self.assertFalse(cmd_output['is_default'])
json_output = json.loads(self.openstack(
'network qos policy show -f json ' +
policy_name
))
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'])