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