Clean up W503 and E402 pep8 errors
pycodestyle 2.40 and later enforce these rules that were not previously enforced. Rather than just skipping them, this cleans up the trivial instances of these violations. This does also include some other updates that were not triggering errors in an attempt to keep some of the style consistent. Change-Id: Id7c0a6b8f1f835e69d844b000e3ed751852ada63 Closes-bug: #1762803
This commit is contained in:
parent
972a345014
commit
d601415259
@ -11,10 +11,10 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
__all__ = ['__version__']
|
||||
|
||||
import pbr.version
|
||||
|
||||
__all__ = ['__version__']
|
||||
|
||||
version_info = pbr.version.VersionInfo('python-openstackclient')
|
||||
try:
|
||||
__version__ = version_info.version_string()
|
||||
|
@ -75,8 +75,10 @@ class ListExtension(command.Lister):
|
||||
# by default we want to show everything, unless the
|
||||
# user specifies one or more of the APIs to show
|
||||
# for now, only identity and compute are supported.
|
||||
show_all = (not parsed_args.identity and not parsed_args.compute
|
||||
and not parsed_args.volume and not parsed_args.network)
|
||||
show_all = (not parsed_args.identity and
|
||||
not parsed_args.compute and
|
||||
not parsed_args.volume and
|
||||
not parsed_args.network)
|
||||
|
||||
if parsed_args.identity or show_all:
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
@ -126,8 +126,8 @@ class AddRole(command.Command):
|
||||
def take_action(self, parsed_args):
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
if (not parsed_args.user and not parsed_args.domain
|
||||
and not parsed_args.group and not parsed_args.project):
|
||||
if (not parsed_args.user and not parsed_args.domain and
|
||||
not parsed_args.group and not parsed_args.project):
|
||||
msg = _("Role not added, incorrect set of arguments "
|
||||
"provided. See openstack --help for more details")
|
||||
raise exceptions.CommandError(msg)
|
||||
@ -399,8 +399,8 @@ class RemoveRole(command.Command):
|
||||
def take_action(self, parsed_args):
|
||||
identity_client = self.app.client_manager.identity
|
||||
|
||||
if (not parsed_args.user and not parsed_args.domain
|
||||
and not parsed_args.group and not parsed_args.project):
|
||||
if (not parsed_args.user and not parsed_args.domain and
|
||||
not parsed_args.group and not parsed_args.project):
|
||||
msg = _("Incorrect set of arguments provided. "
|
||||
"See openstack --help for more details")
|
||||
raise exceptions.CommandError(msg)
|
||||
|
@ -21,11 +21,6 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
if os.name == "nt":
|
||||
import msvcrt
|
||||
else:
|
||||
msvcrt = None
|
||||
|
||||
from glanceclient.common import utils as gc_utils
|
||||
from osc_lib.cli import parseractions
|
||||
from osc_lib.command import command
|
||||
@ -35,6 +30,11 @@ import six
|
||||
from openstackclient.api import utils as api_utils
|
||||
from openstackclient.i18n import _
|
||||
|
||||
if os.name == "nt":
|
||||
import msvcrt
|
||||
else:
|
||||
msvcrt = None
|
||||
|
||||
|
||||
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
|
||||
DEFAULT_CONTAINER_FORMAT = 'bare'
|
||||
|
@ -86,8 +86,8 @@ def _get_attrs(client_manager, parsed_args):
|
||||
attrs['distributed'] = False
|
||||
if parsed_args.distributed:
|
||||
attrs['distributed'] = True
|
||||
if ('availability_zone_hints' in parsed_args
|
||||
and parsed_args.availability_zone_hints is not None):
|
||||
if ('availability_zone_hints' in parsed_args and
|
||||
parsed_args.availability_zone_hints is not None):
|
||||
attrs['availability_zone_hints'] = parsed_args.availability_zone_hints
|
||||
if parsed_args.description is not None:
|
||||
attrs['description'] = parsed_args.description
|
||||
|
@ -209,7 +209,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
cmd_output["description"],
|
||||
)
|
||||
|
||||
del_output = self.openstack('network delete ' + name1 + ' ' + name2)
|
||||
del_output = self.openstack('network delete %s %s' % (name1, name2))
|
||||
self.assertOutput('', del_output)
|
||||
|
||||
def test_network_list(self):
|
||||
@ -224,7 +224,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
network_options +
|
||||
name1
|
||||
))
|
||||
self.addCleanup(self.openstack, 'network delete ' + name1)
|
||||
self.addCleanup(self.openstack, 'network delete %s' % name1)
|
||||
self.assertIsNotNone(cmd_output["id"])
|
||||
if self.haz_network:
|
||||
self.assertEqual(
|
||||
@ -264,10 +264,8 @@ class NetworkTests(common.NetworkTagTests):
|
||||
else:
|
||||
network_options = '--subnet 4.5.6.7/28 '
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network create -f json ' +
|
||||
'--share ' +
|
||||
network_options +
|
||||
name2
|
||||
'network create -f json --share %s%s' %
|
||||
(network_options, name2)
|
||||
))
|
||||
self.addCleanup(self.openstack, 'network delete ' + name2)
|
||||
self.assertIsNotNone(cmd_output["id"])
|
||||
@ -313,8 +311,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
# Test list --long
|
||||
if self.haz_network:
|
||||
cmd_output = json.loads(self.openstack(
|
||||
"network list -f json " +
|
||||
"--long"
|
||||
"network list -f json --long"
|
||||
))
|
||||
col_name = [x["Name"] for x in cmd_output]
|
||||
self.assertIn(name1, col_name)
|
||||
@ -323,9 +320,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
# Test list --long --enable
|
||||
if self.haz_network:
|
||||
cmd_output = json.loads(self.openstack(
|
||||
"network list -f json " +
|
||||
"--enable " +
|
||||
"--long"
|
||||
"network list -f json --enable --long"
|
||||
))
|
||||
col_name = [x["Name"] for x in cmd_output]
|
||||
self.assertIn(name1, col_name)
|
||||
@ -334,9 +329,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
# Test list --long --disable
|
||||
if self.haz_network:
|
||||
cmd_output = json.loads(self.openstack(
|
||||
"network list -f json " +
|
||||
"--disable " +
|
||||
"--long"
|
||||
"network list -f json --disable --long"
|
||||
))
|
||||
col_name = [x["Name"] for x in cmd_output]
|
||||
self.assertNotIn(name1, col_name)
|
||||
@ -345,8 +338,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
# Test list --share
|
||||
if self.haz_network:
|
||||
cmd_output = json.loads(self.openstack(
|
||||
"network list -f json " +
|
||||
"--share "
|
||||
"network list -f json --share "
|
||||
))
|
||||
col_name = [x["Name"] for x in cmd_output]
|
||||
self.assertNotIn(name1, col_name)
|
||||
@ -355,8 +347,7 @@ class NetworkTests(common.NetworkTagTests):
|
||||
# Test list --no-share
|
||||
if self.haz_network:
|
||||
cmd_output = json.loads(self.openstack(
|
||||
"network list -f json " +
|
||||
"--no-share "
|
||||
"network list -f json --no-share "
|
||||
))
|
||||
col_name = [x["Name"] for x in cmd_output]
|
||||
self.assertIn(name1, col_name)
|
||||
@ -368,12 +359,10 @@ class NetworkTests(common.NetworkTagTests):
|
||||
|
||||
name1 = uuid.uuid4().hex
|
||||
cmd_output1 = json.loads(self.openstack(
|
||||
'network create -f json ' +
|
||||
'--description aaaa ' +
|
||||
name1
|
||||
'network create -f json --description aaaa %s' % name1
|
||||
))
|
||||
|
||||
self.addCleanup(self.openstack, 'network delete ' + name1)
|
||||
self.addCleanup(self.openstack, 'network delete %s' % name1)
|
||||
|
||||
# Get network ID
|
||||
network_id = cmd_output1['id']
|
||||
@ -386,20 +375,19 @@ class NetworkTests(common.NetworkTagTests):
|
||||
|
||||
# Add Agent to Network
|
||||
self.openstack(
|
||||
'network agent add network --dhcp '
|
||||
+ agent_id + ' ' + network_id
|
||||
'network agent add network --dhcp %s %s' % (agent_id, network_id)
|
||||
)
|
||||
|
||||
# Test network list --agent
|
||||
cmd_output3 = json.loads(self.openstack(
|
||||
'network list -f json --agent ' + agent_id
|
||||
'network list -f json --agent %s' % agent_id
|
||||
))
|
||||
|
||||
# Cleanup
|
||||
# Remove Agent from Network
|
||||
self.openstack(
|
||||
'network agent remove network --dhcp '
|
||||
+ agent_id + ' ' + network_id
|
||||
'network agent remove network --dhcp %s %s' %
|
||||
(agent_id, network_id)
|
||||
)
|
||||
|
||||
# Assert
|
||||
@ -415,16 +403,16 @@ class NetworkTests(common.NetworkTagTests):
|
||||
|
||||
name = uuid.uuid4().hex
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network create -f json ' +
|
||||
'--description aaaa ' +
|
||||
'--enable ' +
|
||||
'--no-share ' +
|
||||
'--internal ' +
|
||||
'--no-default ' +
|
||||
'--enable-port-security ' +
|
||||
'network create -f json '
|
||||
'--description aaaa '
|
||||
'--enable '
|
||||
'--no-share '
|
||||
'--internal '
|
||||
'--no-default '
|
||||
'--enable-port-security %s' %
|
||||
name
|
||||
))
|
||||
self.addCleanup(self.openstack, 'network delete ' + name)
|
||||
self.addCleanup(self.openstack, 'network delete %s' % name)
|
||||
self.assertIsNotNone(cmd_output["id"])
|
||||
self.assertEqual(
|
||||
'aaaa',
|
||||
@ -453,12 +441,12 @@ class NetworkTests(common.NetworkTagTests):
|
||||
)
|
||||
|
||||
raw_output = self.openstack(
|
||||
'network set ' +
|
||||
'--description cccc ' +
|
||||
'--disable ' +
|
||||
'--share ' +
|
||||
'--external ' +
|
||||
'--disable-port-security ' +
|
||||
'network set '
|
||||
'--description cccc '
|
||||
'--disable '
|
||||
'--share '
|
||||
'--external '
|
||||
'--disable-port-security %s' %
|
||||
name
|
||||
)
|
||||
self.assertOutput('', raw_output)
|
||||
|
@ -42,8 +42,7 @@ class NetworkAgentTests(common.NetworkTests):
|
||||
|
||||
# agent show
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network agent show -f json ' +
|
||||
agent_ids[0]
|
||||
'network agent show -f json %s' % agent_ids[0]
|
||||
))
|
||||
self.assertEqual(
|
||||
agent_ids[0],
|
||||
@ -52,15 +51,12 @@ class NetworkAgentTests(common.NetworkTests):
|
||||
|
||||
# agent set
|
||||
raw_output = self.openstack(
|
||||
'network agent set ' +
|
||||
'--disable ' +
|
||||
agent_ids[0]
|
||||
'network agent set --disable %s' % agent_ids[0]
|
||||
)
|
||||
self.assertOutput('', raw_output)
|
||||
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network agent show -f json ' +
|
||||
agent_ids[0]
|
||||
'network agent show -f json %s' % agent_ids[0]
|
||||
))
|
||||
self.assertEqual(
|
||||
"DOWN",
|
||||
@ -68,15 +64,12 @@ class NetworkAgentTests(common.NetworkTests):
|
||||
)
|
||||
|
||||
raw_output = self.openstack(
|
||||
'network agent set ' +
|
||||
'--enable ' +
|
||||
agent_ids[0]
|
||||
'network agent set --enable %s' % agent_ids[0]
|
||||
)
|
||||
self.assertOutput('', raw_output)
|
||||
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network agent show -f json ' +
|
||||
agent_ids[0]
|
||||
'network agent show -f json %s' % agent_ids[0]
|
||||
))
|
||||
self.assertEqual(
|
||||
"UP",
|
||||
@ -98,12 +91,10 @@ class NetworkAgentListTests(common.NetworkTests):
|
||||
|
||||
name1 = uuid.uuid4().hex
|
||||
cmd_output1 = json.loads(self.openstack(
|
||||
'network create -f json ' +
|
||||
'--description aaaa ' +
|
||||
name1
|
||||
'network create -f json --description aaaa %s' % name1
|
||||
))
|
||||
|
||||
self.addCleanup(self.openstack, 'network delete ' + name1)
|
||||
self.addCleanup(self.openstack, 'network delete %s' % name1)
|
||||
|
||||
# Get network ID
|
||||
network_id = cmd_output1['id']
|
||||
@ -116,20 +107,20 @@ class NetworkAgentListTests(common.NetworkTests):
|
||||
|
||||
# Add Agent to Network
|
||||
self.openstack(
|
||||
'network agent add network --dhcp '
|
||||
+ agent_id + ' ' + network_id
|
||||
'network agent add network --dhcp %s %s' %
|
||||
(agent_id, network_id)
|
||||
)
|
||||
|
||||
# Test network agent list --network
|
||||
cmd_output3 = json.loads(self.openstack(
|
||||
'network agent list -f json --network ' + network_id
|
||||
'network agent list -f json --network %s' % network_id
|
||||
))
|
||||
|
||||
# Cleanup
|
||||
# Remove Agent from Network
|
||||
self.openstack(
|
||||
'network agent remove network --dhcp '
|
||||
+ agent_id + ' ' + network_id
|
||||
'network agent remove network --dhcp %s %s' %
|
||||
(agent_id, network_id)
|
||||
)
|
||||
|
||||
# Assert
|
||||
@ -142,9 +133,9 @@ class NetworkAgentListTests(common.NetworkTests):
|
||||
"""Add agent to router, list agents on router, delete."""
|
||||
name = uuid.uuid4().hex
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'router create -f json ' + name))
|
||||
'router create -f json %s' % name))
|
||||
|
||||
self.addCleanup(self.openstack, 'router delete ' + name)
|
||||
self.addCleanup(self.openstack, 'router delete %s' % name)
|
||||
# Get router ID
|
||||
router_id = cmd_output['id']
|
||||
# Get l3 agent id
|
||||
@ -157,19 +148,19 @@ class NetworkAgentListTests(common.NetworkTests):
|
||||
|
||||
# Add router to agent
|
||||
self.openstack(
|
||||
'network agent add router --l3 ' + agent_id + ' ' + router_id)
|
||||
'network agent add router --l3 %s %s' % (agent_id, router_id))
|
||||
|
||||
# Test router list --agent
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network agent list -f json --router ' + router_id))
|
||||
'network agent list -f json --router %s' % router_id))
|
||||
|
||||
agent_ids = [x['ID'] for x in cmd_output]
|
||||
self.assertIn(agent_id, agent_ids)
|
||||
|
||||
# Remove router from agent
|
||||
self.openstack(
|
||||
'network agent remove router --l3 ' + agent_id + ' ' + router_id)
|
||||
'network agent remove router --l3 %s %s' % (agent_id, router_id))
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network agent list -f json --router ' + router_id))
|
||||
'network agent list -f json --router %s' % router_id))
|
||||
agent_ids = [x['ID'] for x in cmd_output]
|
||||
self.assertNotIn(agent_id, agent_ids)
|
||||
|
@ -39,13 +39,13 @@ class NetworkFlavorTests(common.NetworkTests):
|
||||
# Create Service Flavor
|
||||
cmd_output2 = json.loads(self.openstack(
|
||||
'network flavor profile create -f json --description '
|
||||
+ 'fakedescription' + ' --enable --metainfo ' + 'Extrainfo'
|
||||
'fakedescription --enable --metainfo Extrainfo'
|
||||
))
|
||||
service_profile_id = cmd_output2.get('id')
|
||||
|
||||
self.addCleanup(self.openstack, 'network flavor delete ' +
|
||||
self.addCleanup(self.openstack, 'network flavor delete %s' %
|
||||
flavor_id)
|
||||
self.addCleanup(self.openstack, 'network flavor profile delete ' +
|
||||
self.addCleanup(self.openstack, 'network flavor profile delete %s' %
|
||||
service_profile_id)
|
||||
# Add flavor to service profile
|
||||
self.openstack(
|
||||
|
@ -28,62 +28,60 @@ class NetworkQosRuleTestsMinimumBandwidth(common.NetworkTests):
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
self.QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
self.QOS_POLICY_NAME = 'qos_policy_%s' % uuid.uuid4().hex
|
||||
|
||||
self.openstack(
|
||||
'network qos policy create ' +
|
||||
self.QOS_POLICY_NAME
|
||||
'network qos policy create %s' % self.QOS_POLICY_NAME
|
||||
)
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos policy delete ' + self.QOS_POLICY_NAME)
|
||||
'network qos policy delete %s' % self.QOS_POLICY_NAME)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule create -f json ' +
|
||||
'--type minimum-bandwidth ' +
|
||||
'--min-kbps 2800 ' +
|
||||
'--egress ' +
|
||||
'network qos rule create -f json '
|
||||
'--type minimum-bandwidth '
|
||||
'--min-kbps 2800 '
|
||||
'--egress %s' %
|
||||
self.QOS_POLICY_NAME
|
||||
))
|
||||
self.RULE_ID = cmd_output['id']
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos rule delete ' +
|
||||
self.QOS_POLICY_NAME + ' ' +
|
||||
self.RULE_ID)
|
||||
'network qos rule delete %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID))
|
||||
self.assertTrue(self.RULE_ID)
|
||||
|
||||
def test_qos_rule_create_delete(self):
|
||||
# This is to check the output of qos rule delete
|
||||
policy_name = uuid.uuid4().hex
|
||||
self.openstack('network qos policy create -f json ' + policy_name)
|
||||
self.openstack('network qos policy create -f json %s' % policy_name)
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos policy delete ' + policy_name)
|
||||
'network qos policy delete %s' % policy_name)
|
||||
rule = json.loads(self.openstack(
|
||||
'network qos rule create -f json ' +
|
||||
'--type minimum-bandwidth ' +
|
||||
'--min-kbps 2800 ' +
|
||||
'--egress ' + policy_name
|
||||
'network qos rule create -f json '
|
||||
'--type minimum-bandwidth '
|
||||
'--min-kbps 2800 '
|
||||
'--egress %s' % policy_name
|
||||
))
|
||||
raw_output = self.openstack(
|
||||
'network qos rule delete ' +
|
||||
policy_name + ' ' + rule['id'])
|
||||
'network qos rule delete %s %s' %
|
||||
(policy_name, rule['id']))
|
||||
self.assertEqual('', raw_output)
|
||||
|
||||
def test_qos_rule_list(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule list -f json ' + self.QOS_POLICY_NAME))
|
||||
'network qos rule list -f json %s' % self.QOS_POLICY_NAME))
|
||||
self.assertIn(self.RULE_ID, [rule['ID'] for rule in cmd_output])
|
||||
|
||||
def test_qos_rule_show(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule show -f json ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID))
|
||||
'network qos rule show -f json %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID)))
|
||||
self.assertEqual(self.RULE_ID, cmd_output['id'])
|
||||
|
||||
def test_qos_rule_set(self):
|
||||
self.openstack('network qos rule set --min-kbps 7500 ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID)
|
||||
self.openstack('network qos rule set --min-kbps 7500 %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID))
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule show -f json ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID))
|
||||
'network qos rule show -f json %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID)))
|
||||
self.assertEqual(7500, cmd_output['min_kbps'])
|
||||
|
||||
|
||||
@ -96,58 +94,57 @@ class NetworkQosRuleTestsDSCPMarking(common.NetworkTests):
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
self.QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
self.QOS_POLICY_NAME = 'qos_policy_%s' % uuid.uuid4().hex
|
||||
self.openstack(
|
||||
'network qos policy create ' +
|
||||
self.QOS_POLICY_NAME
|
||||
'network qos policy create %s' % self.QOS_POLICY_NAME
|
||||
)
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos policy delete ' + self.QOS_POLICY_NAME)
|
||||
'network qos policy delete %s' % self.QOS_POLICY_NAME)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule create -f json ' +
|
||||
'--type dscp-marking ' +
|
||||
'--dscp-mark 8 ' +
|
||||
'network qos rule create -f json '
|
||||
'--type dscp-marking '
|
||||
'--dscp-mark 8 %s' %
|
||||
self.QOS_POLICY_NAME
|
||||
))
|
||||
self.RULE_ID = cmd_output['id']
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos rule delete ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID)
|
||||
'network qos rule delete %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID))
|
||||
self.assertTrue(self.RULE_ID)
|
||||
|
||||
def test_qos_rule_create_delete(self):
|
||||
# This is to check the output of qos rule delete
|
||||
policy_name = uuid.uuid4().hex
|
||||
self.openstack('network qos policy create -f json ' + policy_name)
|
||||
self.openstack('network qos policy create -f json %s' % policy_name)
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos policy delete ' + policy_name)
|
||||
'network qos policy delete %s' % policy_name)
|
||||
rule = json.loads(self.openstack(
|
||||
'network qos rule create -f json ' +
|
||||
'--type dscp-marking ' +
|
||||
'--dscp-mark 8 ' + policy_name
|
||||
'network qos rule create -f json '
|
||||
'--type dscp-marking '
|
||||
'--dscp-mark 8 %s' % policy_name
|
||||
))
|
||||
raw_output = self.openstack(
|
||||
'network qos rule delete ' +
|
||||
policy_name + ' ' + rule['id'])
|
||||
'network qos rule delete %s %s' %
|
||||
(policy_name, rule['id']))
|
||||
self.assertEqual('', raw_output)
|
||||
|
||||
def test_qos_rule_list(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule list -f json ' + self.QOS_POLICY_NAME))
|
||||
'network qos rule list -f json %s' % self.QOS_POLICY_NAME))
|
||||
self.assertIn(self.RULE_ID, [rule['ID'] for rule in cmd_output])
|
||||
|
||||
def test_qos_rule_show(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule show -f json ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID))
|
||||
'network qos rule show -f json %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID)))
|
||||
self.assertEqual(self.RULE_ID, cmd_output['id'])
|
||||
|
||||
def test_qos_rule_set(self):
|
||||
self.openstack('network qos rule set --dscp-mark 32 ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID)
|
||||
self.openstack('network qos rule set --dscp-mark 32 %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID))
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule show -f json ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID))
|
||||
'network qos rule show -f json %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID)))
|
||||
self.assertEqual(32, cmd_output['dscp_mark'])
|
||||
|
||||
|
||||
@ -160,65 +157,64 @@ class NetworkQosRuleTestsBandwidthLimit(common.NetworkTests):
|
||||
if not self.haz_network:
|
||||
self.skipTest("No Network service present")
|
||||
|
||||
self.QOS_POLICY_NAME = 'qos_policy_' + uuid.uuid4().hex
|
||||
self.QOS_POLICY_NAME = 'qos_policy_%s' % uuid.uuid4().hex
|
||||
self.openstack(
|
||||
'network qos policy create ' +
|
||||
self.QOS_POLICY_NAME
|
||||
'network qos policy create %s' % self.QOS_POLICY_NAME
|
||||
)
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos policy delete ' + self.QOS_POLICY_NAME)
|
||||
'network qos policy delete %s' % self.QOS_POLICY_NAME)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule create -f json ' +
|
||||
'--type bandwidth-limit ' +
|
||||
'--max-kbps 10000 ' +
|
||||
'--max-burst-kbits 1400 ' +
|
||||
'--egress ' +
|
||||
'network qos rule create -f json '
|
||||
'--type bandwidth-limit '
|
||||
'--max-kbps 10000 '
|
||||
'--max-burst-kbits 1400 '
|
||||
'--egress %s' %
|
||||
self.QOS_POLICY_NAME
|
||||
))
|
||||
self.RULE_ID = cmd_output['id']
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos rule delete ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID)
|
||||
'network qos rule delete %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID))
|
||||
self.assertTrue(self.RULE_ID)
|
||||
|
||||
def test_qos_rule_create_delete(self):
|
||||
# This is to check the output of qos rule delete
|
||||
policy_name = uuid.uuid4().hex
|
||||
self.openstack('network qos policy create -f json ' + policy_name)
|
||||
self.openstack('network qos policy create -f json %s' % policy_name)
|
||||
self.addCleanup(self.openstack,
|
||||
'network qos policy delete ' + policy_name)
|
||||
'network qos policy delete %s' % policy_name)
|
||||
rule = json.loads(self.openstack(
|
||||
'network qos rule create -f json ' +
|
||||
'--type bandwidth-limit ' +
|
||||
'--max-kbps 10000 ' +
|
||||
'--max-burst-kbits 1400 ' +
|
||||
'--egress ' + policy_name
|
||||
'network qos rule create -f json '
|
||||
'--type bandwidth-limit '
|
||||
'--max-kbps 10000 '
|
||||
'--max-burst-kbits 1400 '
|
||||
'--egress %s' % policy_name
|
||||
))
|
||||
raw_output = self.openstack(
|
||||
'network qos rule delete ' +
|
||||
policy_name + ' ' + rule['id'])
|
||||
'network qos rule delete %s %s' %
|
||||
(policy_name, rule['id']))
|
||||
self.assertEqual('', raw_output)
|
||||
|
||||
def test_qos_rule_list(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule list -f json '
|
||||
+ self.QOS_POLICY_NAME))
|
||||
'network qos rule list -f json %s' %
|
||||
self.QOS_POLICY_NAME))
|
||||
self.assertIn(self.RULE_ID, [rule['ID'] for rule in cmd_output])
|
||||
|
||||
def test_qos_rule_show(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule show -f json ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID))
|
||||
'network qos rule show -f json %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID)))
|
||||
self.assertEqual(self.RULE_ID, cmd_output['id'])
|
||||
|
||||
def test_qos_rule_set(self):
|
||||
self.openstack('network qos rule set --max-kbps 15000 ' +
|
||||
'--max-burst-kbits 1800 ' +
|
||||
'--ingress ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID)
|
||||
self.openstack('network qos rule set --max-kbps 15000 '
|
||||
'--max-burst-kbits 1800 '
|
||||
'--ingress %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID))
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'network qos rule show -f json ' +
|
||||
self.QOS_POLICY_NAME + ' ' + self.RULE_ID))
|
||||
'network qos rule show -f json %s %s' %
|
||||
(self.QOS_POLICY_NAME, self.RULE_ID)))
|
||||
self.assertEqual(15000, cmd_output['max_kbps'])
|
||||
self.assertEqual(1800, cmd_output['max_burst_kbps'])
|
||||
self.assertEqual('ingress', cmd_output['direction'])
|
||||
|
@ -33,7 +33,7 @@ class PortTests(common.NetworkTagTests):
|
||||
|
||||
# Create a network for the port tests
|
||||
cls.openstack(
|
||||
'network create ' + cls.NETWORK_NAME
|
||||
'network create %s' % cls.NETWORK_NAME
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@ -41,7 +41,7 @@ class PortTests(common.NetworkTagTests):
|
||||
try:
|
||||
if cls.haz_network:
|
||||
raw_output = cls.openstack(
|
||||
'network delete ' + cls.NETWORK_NAME
|
||||
'network delete %s' % cls.NETWORK_NAME
|
||||
)
|
||||
cls.assertOutput('', raw_output)
|
||||
finally:
|
||||
@ -56,8 +56,8 @@ class PortTests(common.NetworkTagTests):
|
||||
def test_port_delete(self):
|
||||
"""Test create, delete multiple"""
|
||||
json_output = json.loads(self.openstack(
|
||||
'port create -f json --network ' +
|
||||
self.NETWORK_NAME + ' ' + self.NAME
|
||||
'port create -f json --network %s %s' %
|
||||
(self.NETWORK_NAME, self.NAME)
|
||||
))
|
||||
id1 = json_output.get('id')
|
||||
self.assertIsNotNone(id1)
|
||||
@ -65,8 +65,8 @@ class PortTests(common.NetworkTagTests):
|
||||
self.assertEqual(self.NAME, json_output.get('name'))
|
||||
|
||||
json_output = json.loads(self.openstack(
|
||||
'port create -f json --network ' + self.NETWORK_NAME + ' ' +
|
||||
self.NAME + 'x'
|
||||
'port create -f json --network %s %sx' %
|
||||
(self.NETWORK_NAME, self.NAME)
|
||||
))
|
||||
id2 = json_output.get('id')
|
||||
self.assertIsNotNone(id2)
|
||||
@ -74,31 +74,31 @@ class PortTests(common.NetworkTagTests):
|
||||
self.assertEqual(self.NAME + 'x', json_output.get('name'))
|
||||
|
||||
# Clean up after ourselves
|
||||
raw_output = self.openstack('port delete ' + id1 + ' ' + id2)
|
||||
raw_output = self.openstack('port delete %s %s' % (id1, id2))
|
||||
self.assertOutput('', raw_output)
|
||||
|
||||
def test_port_list(self):
|
||||
"""Test create defaults, list, delete"""
|
||||
json_output = json.loads(self.openstack(
|
||||
'port create -f json --network ' + self.NETWORK_NAME + ' ' +
|
||||
self.NAME
|
||||
'port create -f json --network %s %s' %
|
||||
(self.NETWORK_NAME, self.NAME)
|
||||
))
|
||||
id1 = json_output.get('id')
|
||||
self.assertIsNotNone(id1)
|
||||
mac1 = json_output.get('mac_address')
|
||||
self.assertIsNotNone(mac1)
|
||||
self.addCleanup(self.openstack, 'port delete ' + id1)
|
||||
self.addCleanup(self.openstack, 'port delete %s' % id1)
|
||||
self.assertEqual(self.NAME, json_output.get('name'))
|
||||
|
||||
json_output = json.loads(self.openstack(
|
||||
'port create -f json --network ' + self.NETWORK_NAME + ' ' +
|
||||
self.NAME + 'x'
|
||||
'port create -f json --network %s %sx' %
|
||||
(self.NETWORK_NAME, self.NAME)
|
||||
))
|
||||
id2 = json_output.get('id')
|
||||
self.assertIsNotNone(id2)
|
||||
mac2 = json_output.get('mac_address')
|
||||
self.assertIsNotNone(mac2)
|
||||
self.addCleanup(self.openstack, 'port delete ' + id2)
|
||||
self.addCleanup(self.openstack, 'port delete %s' % id2)
|
||||
self.assertEqual(self.NAME + 'x', json_output.get('name'))
|
||||
|
||||
# Test list
|
||||
@ -122,7 +122,7 @@ class PortTests(common.NetworkTagTests):
|
||||
|
||||
# Test list --mac-address
|
||||
json_output = json.loads(self.openstack(
|
||||
'port list -f json --mac-address ' + mac2
|
||||
'port list -f json --mac-address %s' % mac2
|
||||
))
|
||||
item_map = {item.get('ID'): item.get('MAC Address') for item in
|
||||
json_output}
|
||||
@ -145,26 +145,26 @@ class PortTests(common.NetworkTagTests):
|
||||
"""Test create, set, show, delete"""
|
||||
name = uuid.uuid4().hex
|
||||
json_output = json.loads(self.openstack(
|
||||
'port create -f json ' +
|
||||
'--network ' + self.NETWORK_NAME + ' ' +
|
||||
'--description xyzpdq ' +
|
||||
'--disable ' +
|
||||
name
|
||||
'port create -f json '
|
||||
'--network %s '
|
||||
'--description xyzpdq '
|
||||
'--disable %s' %
|
||||
(self.NETWORK_NAME, name)
|
||||
))
|
||||
id1 = json_output.get('id')
|
||||
self.addCleanup(self.openstack, 'port delete ' + id1)
|
||||
self.addCleanup(self.openstack, 'port delete %s' % id1)
|
||||
self.assertEqual(name, json_output.get('name'))
|
||||
self.assertEqual('xyzpdq', json_output.get('description'))
|
||||
self.assertEqual('DOWN', json_output.get('admin_state_up'))
|
||||
|
||||
raw_output = self.openstack(
|
||||
'port set ' + '--enable ' +
|
||||
'port set --enable %s' %
|
||||
name
|
||||
)
|
||||
self.assertOutput('', raw_output)
|
||||
|
||||
json_output = json.loads(self.openstack(
|
||||
'port show -f json ' + name
|
||||
'port show -f json %s' % name
|
||||
))
|
||||
sg_id = json_output.get('security_group_ids')
|
||||
|
||||
@ -174,30 +174,30 @@ class PortTests(common.NetworkTagTests):
|
||||
self.assertIsNotNone(json_output.get('mac_address'))
|
||||
|
||||
raw_output = self.openstack(
|
||||
'port unset --security-group ' + sg_id + ' ' + id1)
|
||||
'port unset --security-group %s %s' % (sg_id, id1))
|
||||
self.assertOutput('', raw_output)
|
||||
|
||||
json_output = json.loads(self.openstack(
|
||||
'port show -f json ' + name
|
||||
'port show -f json %s' % name
|
||||
))
|
||||
self.assertEqual('', json_output.get('security_group_ids'))
|
||||
|
||||
def test_port_admin_set(self):
|
||||
"""Test create, set (as admin), show, delete"""
|
||||
json_output = json.loads(self.openstack(
|
||||
'port create -f json ' +
|
||||
'--network ' + self.NETWORK_NAME + ' ' + self.NAME
|
||||
'port create -f json '
|
||||
'--network %s %s' % (self.NETWORK_NAME, self.NAME)
|
||||
))
|
||||
id_ = json_output.get('id')
|
||||
self.addCleanup(self.openstack, 'port delete ' + id_)
|
||||
self.addCleanup(self.openstack, 'port delete %s' % id_)
|
||||
|
||||
raw_output = self.openstack(
|
||||
'--os-username admin '
|
||||
+ 'port set --mac-address 11:22:33:44:55:66 '
|
||||
+ self.NAME)
|
||||
'port set --mac-address 11:22:33:44:55:66 %s' %
|
||||
self.NAME)
|
||||
self.assertOutput('', raw_output)
|
||||
json_output = json.loads(self.openstack(
|
||||
'port show -f json ' + self.NAME
|
||||
'port show -f json %s' % self.NAME
|
||||
))
|
||||
self.assertEqual(json_output.get('mac_address'), '11:22:33:44:55:66')
|
||||
|
||||
@ -205,41 +205,41 @@ class PortTests(common.NetworkTagTests):
|
||||
"""Test create, set, show, delete"""
|
||||
sg_name1 = uuid.uuid4().hex
|
||||
json_output = json.loads(self.openstack(
|
||||
'security group create -f json ' +
|
||||
'security group create -f json %s' %
|
||||
sg_name1
|
||||
))
|
||||
sg_id1 = json_output.get('id')
|
||||
self.addCleanup(self.openstack, 'security group delete ' + sg_id1)
|
||||
self.addCleanup(self.openstack, 'security group delete %s' % sg_id1)
|
||||
|
||||
sg_name2 = uuid.uuid4().hex
|
||||
json_output = json.loads(self.openstack(
|
||||
'security group create -f json ' +
|
||||
'security group create -f json %s' %
|
||||
sg_name2
|
||||
))
|
||||
sg_id2 = json_output.get('id')
|
||||
self.addCleanup(self.openstack, 'security group delete ' + sg_id2)
|
||||
self.addCleanup(self.openstack, 'security group delete %s' % sg_id2)
|
||||
|
||||
name = uuid.uuid4().hex
|
||||
json_output = json.loads(self.openstack(
|
||||
'port create -f json ' +
|
||||
'--network ' + self.NETWORK_NAME + ' ' +
|
||||
'--security-group ' + sg_name1 + ' ' +
|
||||
name
|
||||
'port create -f json '
|
||||
'--network %s '
|
||||
'--security-group %s %s' %
|
||||
(self.NETWORK_NAME, sg_name1, name)
|
||||
))
|
||||
id1 = json_output.get('id')
|
||||
self.addCleanup(self.openstack, 'port delete ' + id1)
|
||||
self.addCleanup(self.openstack, 'port delete %s' % id1)
|
||||
self.assertEqual(name, json_output.get('name'))
|
||||
self.assertEqual(sg_id1, json_output.get('security_group_ids'))
|
||||
|
||||
raw_output = self.openstack(
|
||||
'port set ' +
|
||||
'--security-group ' + sg_name2 + ' ' +
|
||||
name
|
||||
'port set '
|
||||
'--security-group %s %s' %
|
||||
(sg_name2, name)
|
||||
)
|
||||
self.assertOutput('', raw_output)
|
||||
|
||||
json_output = json.loads(self.openstack(
|
||||
'port show -f json ' + name
|
||||
'port show -f json %s' % name
|
||||
))
|
||||
self.assertEqual(name, json_output.get('name'))
|
||||
self.assertIn(
|
||||
@ -254,11 +254,11 @@ class PortTests(common.NetworkTagTests):
|
||||
)
|
||||
|
||||
raw_output = self.openstack(
|
||||
'port unset --security-group ' + sg_id1 + ' ' + id1)
|
||||
'port unset --security-group %s %s' % (sg_id1, id1))
|
||||
self.assertOutput('', raw_output)
|
||||
|
||||
json_output = json.loads(self.openstack(
|
||||
'port show -f json ' + name
|
||||
'port show -f json %s' % name
|
||||
))
|
||||
self.assertEqual(
|
||||
# TODO(dtroyer): output formatters should do this on JSON!
|
||||
|
@ -53,39 +53,39 @@ class ObjectTests(common.ObjectStoreTests):
|
||||
self.openstack('container save ' + self.CONTAINER_NAME)
|
||||
# TODO(stevemar): Assert returned fields
|
||||
|
||||
raw_output = self.openstack('object create ' + self.CONTAINER_NAME
|
||||
+ ' ' + object_file)
|
||||
raw_output = self.openstack('object create %s %s' %
|
||||
(self.CONTAINER_NAME, object_file))
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_show_fields(items, OBJECT_FIELDS)
|
||||
|
||||
raw_output = self.openstack('object list ' + self.CONTAINER_NAME)
|
||||
raw_output = self.openstack('object list %s' % self.CONTAINER_NAME)
|
||||
items = self.parse_listing(raw_output)
|
||||
self.assert_table_structure(items, BASIC_LIST_HEADERS)
|
||||
|
||||
self.openstack('object save ' + self.CONTAINER_NAME
|
||||
+ ' ' + object_file)
|
||||
self.openstack('object save %s %s' %
|
||||
(self.CONTAINER_NAME, object_file))
|
||||
# TODO(stevemar): Assert returned fields
|
||||
|
||||
tmp_file = 'tmp.txt'
|
||||
self.addCleanup(os.remove, tmp_file)
|
||||
self.openstack('object save ' + self.CONTAINER_NAME
|
||||
+ ' ' + object_file + ' --file ' + tmp_file)
|
||||
self.openstack('object save %s %s --file %s' %
|
||||
(self.CONTAINER_NAME, object_file, tmp_file))
|
||||
# TODO(stevemar): Assert returned fields
|
||||
|
||||
raw_output = self.openstack('object save ' + self.CONTAINER_NAME
|
||||
+ ' ' + object_file + ' --file -')
|
||||
raw_output = self.openstack('object save %s %s --file -' %
|
||||
(self.CONTAINER_NAME, object_file))
|
||||
self.assertEqual(raw_output, 'test content')
|
||||
|
||||
self.openstack('object show ' + self.CONTAINER_NAME
|
||||
+ ' ' + object_file)
|
||||
self.openstack('object show %s %s' %
|
||||
(self.CONTAINER_NAME, object_file))
|
||||
# TODO(stevemar): Assert returned fields
|
||||
|
||||
raw_output = self.openstack('object delete ' + self.CONTAINER_NAME
|
||||
+ ' ' + object_file)
|
||||
raw_output = self.openstack('object delete %s %s' %
|
||||
(self.CONTAINER_NAME, object_file))
|
||||
self.assertEqual(0, len(raw_output))
|
||||
|
||||
self.openstack('object create ' + self.CONTAINER_NAME
|
||||
+ ' ' + object_file)
|
||||
raw_output = self.openstack('container delete -r ' +
|
||||
self.openstack('object create %s %s' %
|
||||
(self.CONTAINER_NAME, object_file))
|
||||
raw_output = self.openstack('container delete -r %s' %
|
||||
self.CONTAINER_NAME)
|
||||
self.assertEqual(0, len(raw_output))
|
||||
|
@ -26,13 +26,13 @@ class VolumeTypeTests(common.BaseVolumeTests):
|
||||
def setUpClass(cls):
|
||||
super(VolumeTypeTests, cls).setUpClass()
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
'volume type create -f json ' + cls.NAME))
|
||||
'volume type create -f json %s' % cls.NAME))
|
||||
cls.assertOutput(cls.NAME, cmd_output['name'])
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
try:
|
||||
raw_output = cls.openstack('volume type delete ' + cls.NAME)
|
||||
raw_output = cls.openstack('volume type delete %s' % cls.NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
finally:
|
||||
super(VolumeTypeTests, cls).tearDownClass()
|
||||
@ -43,47 +43,47 @@ class VolumeTypeTests(common.BaseVolumeTests):
|
||||
|
||||
def test_volume_type_show(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual(self.NAME, cmd_output['name'])
|
||||
|
||||
def test_volume_type_set_unset_properties(self):
|
||||
raw_output = self.openstack(
|
||||
'volume type set --property a=b --property c=d ' + self.NAME)
|
||||
'volume type set --property a=b --property c=d %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
self.assertEqual("a='b', c='d'", cmd_output['properties'])
|
||||
|
||||
raw_output = self.openstack('volume type unset --property a '
|
||||
+ self.NAME)
|
||||
raw_output = self.openstack('volume type unset --property a %s' %
|
||||
self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual("c='d'", cmd_output['properties'])
|
||||
|
||||
def test_volume_type_set_unset_multiple_properties(self):
|
||||
raw_output = self.openstack(
|
||||
'volume type set --property a=b --property c=d ' + self.NAME)
|
||||
'volume type set --property a=b --property c=d %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual("a='b', c='d'", cmd_output['properties'])
|
||||
|
||||
raw_output = self.openstack(
|
||||
'volume type unset --property a --property c ' + self.NAME)
|
||||
'volume type unset --property a --property c %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual("", cmd_output['properties'])
|
||||
|
||||
def test_multi_delete(self):
|
||||
vol_type1 = uuid.uuid4().hex
|
||||
vol_type2 = uuid.uuid4().hex
|
||||
self.openstack('volume type create ' + vol_type1)
|
||||
self.openstack('volume type create %s' % vol_type1)
|
||||
time.sleep(5)
|
||||
self.openstack('volume type create ' + vol_type2)
|
||||
self.openstack('volume type create %s' % vol_type2)
|
||||
time.sleep(5)
|
||||
cmd = 'volume type delete %s %s' % (vol_type1, vol_type2)
|
||||
raw_output = self.openstack(cmd)
|
||||
|
@ -26,13 +26,13 @@ class VolumeTypeTests(common.BaseVolumeTests):
|
||||
def setUpClass(cls):
|
||||
super(VolumeTypeTests, cls).setUpClass()
|
||||
cmd_output = json.loads(cls.openstack(
|
||||
'volume type create -f json --private ' + cls.NAME))
|
||||
'volume type create -f json --private %s' % cls.NAME))
|
||||
cls.assertOutput(cls.NAME, cmd_output['name'])
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
try:
|
||||
raw_output = cls.openstack('volume type delete ' + cls.NAME)
|
||||
raw_output = cls.openstack('volume type delete %s' % cls.NAME)
|
||||
cls.assertOutput('', raw_output)
|
||||
finally:
|
||||
super(VolumeTypeTests, cls).tearDownClass()
|
||||
@ -49,55 +49,55 @@ class VolumeTypeTests(common.BaseVolumeTests):
|
||||
|
||||
def test_volume_type_show(self):
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual(self.NAME, cmd_output['name'])
|
||||
|
||||
def test_volume_type_set_unset_properties(self):
|
||||
raw_output = self.openstack(
|
||||
'volume type set --property a=b --property c=d ' + self.NAME)
|
||||
'volume type set --property a=b --property c=d %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
# TODO(amotoki): properties output should be machine-readable
|
||||
self.assertEqual("a='b', c='d'", cmd_output['properties'])
|
||||
|
||||
raw_output = self.openstack('volume type unset --property a '
|
||||
+ self.NAME)
|
||||
raw_output = self.openstack('volume type unset --property a %s' %
|
||||
self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual("c='d'", cmd_output['properties'])
|
||||
|
||||
def test_volume_type_set_unset_multiple_properties(self):
|
||||
raw_output = self.openstack(
|
||||
'volume type set --property a=b --property c=d ' + self.NAME)
|
||||
'volume type set --property a=b --property c=d %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual("a='b', c='d'", cmd_output['properties'])
|
||||
|
||||
raw_output = self.openstack(
|
||||
'volume type unset --property a --property c ' + self.NAME)
|
||||
'volume type unset --property a --property c %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
cmd_output = json.loads(self.openstack(
|
||||
'volume type show -f json ' + self.NAME))
|
||||
'volume type show -f json %s' % self.NAME))
|
||||
self.assertEqual("", cmd_output['properties'])
|
||||
|
||||
def test_volume_type_set_unset_project(self):
|
||||
raw_output = self.openstack(
|
||||
'volume type set --project admin ' + self.NAME)
|
||||
'volume type set --project admin %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
|
||||
raw_output = self.openstack(
|
||||
'volume type unset --project admin ' + self.NAME)
|
||||
'volume type unset --project admin %s' % self.NAME)
|
||||
self.assertEqual("", raw_output)
|
||||
|
||||
def test_multi_delete(self):
|
||||
vol_type1 = uuid.uuid4().hex
|
||||
vol_type2 = uuid.uuid4().hex
|
||||
self.openstack('volume type create ' + vol_type1)
|
||||
self.openstack('volume type create %s' % vol_type1)
|
||||
time.sleep(5)
|
||||
self.openstack('volume type create ' + vol_type2)
|
||||
self.openstack('volume type create %s' % vol_type2)
|
||||
time.sleep(5)
|
||||
cmd = 'volume type delete %s %s' % (vol_type1, vol_type2)
|
||||
raw_output = self.openstack(cmd)
|
||||
|
Loading…
Reference in New Issue
Block a user