summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/identity/v3/access_rule.py4
-rw-r--r--openstackclient/network/v2/network.py7
-rw-r--r--openstackclient/tests/unit/network/v2/fakes.py1
-rw-r--r--openstackclient/tests/unit/network/v2/test_network.py33
-rw-r--r--openstackclient/tests/unit/network/v2/test_port.py2
5 files changed, 44 insertions, 3 deletions
diff --git a/openstackclient/identity/v3/access_rule.py b/openstackclient/identity/v3/access_rule.py
index d96b44da..65e78be1 100644
--- a/openstackclient/identity/v3/access_rule.py
+++ b/openstackclient/identity/v3/access_rule.py
@@ -38,7 +38,7 @@ class DeleteAccessRule(command.Command):
'access_rule',
metavar='<access-rule>',
nargs="+",
- help=_('Application credentials(s) to delete (name or ID)'),
+ help=_('Access rule(s) to delete (name or ID)'),
)
return parser
@@ -104,7 +104,7 @@ class ShowAccessRule(command.ShowOne):
parser.add_argument(
'access_rule',
metavar='<access-rule>',
- help=_('Application credential to display (name or ID)'),
+ help=_('Access rule to display (name or ID)'),
)
return parser
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 00cb782b..3f579b6d 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -16,6 +16,7 @@
from cliff import columns as cliff_columns
from osc_lib.cli import format_columns
from osc_lib.command import command
+from osc_lib import exceptions
from osc_lib import utils
from osc_lib.utils import tags as _tag
@@ -125,6 +126,9 @@ def _get_attrs_network(client_manager, parsed_args):
attrs['is_default'] = False
if parsed_args.default:
attrs['is_default'] = True
+ if attrs.get('is_default') and not attrs.get('router:external'):
+ msg = _("Cannot set default for internal network")
+ raise exceptions.CommandError(msg)
# Update Provider network options
if parsed_args.provider_network_type:
attrs['provider:network_type'] = parsed_args.provider_network_type
@@ -702,7 +706,8 @@ class SetNetwork(command.Command):
default_router_grp.add_argument(
'--default',
action='store_true',
- help=_("Set the network as the default external network")
+ help=_("Set the network as the default external network "
+ "(cannot be used with internal network).")
)
default_router_grp.add_argument(
'--no-default',
diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py
index 5809b225..a553f501 100644
--- a/openstackclient/tests/unit/network/v2/fakes.py
+++ b/openstackclient/tests/unit/network/v2/fakes.py
@@ -638,6 +638,7 @@ class FakePort(object):
'security_group_ids': [],
'status': 'ACTIVE',
'tenant_id': 'project-id-' + uuid.uuid4().hex,
+ 'qos_network_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
'qos_policy_id': 'qos-policy-id-' + uuid.uuid4().hex,
'tags': [],
'uplink_status_propagation': False,
diff --git a/openstackclient/tests/unit/network/v2/test_network.py b/openstackclient/tests/unit/network/v2/test_network.py
index 5f8eed67..45d6008b 100644
--- a/openstackclient/tests/unit/network/v2/test_network.py
+++ b/openstackclient/tests/unit/network/v2/test_network.py
@@ -278,6 +278,24 @@ class TestCreateNetworkIdentityV3(TestNetwork):
def test_create_with_no_tag(self):
self._test_create_with_tag(add_tags=False)
+ def test_create_default_internal(self):
+ arglist = [
+ self._network.name,
+ "--default",
+ ]
+ verifylist = [
+ ('name', self._network.name),
+ ('enable', True),
+ ('share', None),
+ ('project', None),
+ ('external', False),
+ ('default', True),
+ ]
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ self.assertRaises(exceptions.CommandError, self.cmd.take_action,
+ parsed_args)
+
class TestCreateNetworkIdentityV2(TestNetwork):
@@ -1025,6 +1043,21 @@ class TestSetNetwork(TestNetwork):
def test_set_with_no_tag(self):
self._test_set_tags(with_tags=False)
+ def test_set_default_internal(self):
+ arglist = [
+ self._network.name,
+ '--internal',
+ '--default',
+ ]
+ verifylist = [
+ ('internal', True),
+ ('default', True),
+ ]
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ self.assertRaises(exceptions.CommandError, self.cmd.take_action,
+ parsed_args)
+
class TestShowNetwork(TestNetwork):
diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py
index d64cc79d..b1a18da6 100644
--- a/openstackclient/tests/unit/network/v2/test_port.py
+++ b/openstackclient/tests/unit/network/v2/test_port.py
@@ -61,6 +61,7 @@ class TestPort(network_fakes.TestNetworkV2):
'network_id',
'port_security_enabled',
'project_id',
+ 'qos_network_policy_id',
'qos_policy_id',
'security_group_ids',
'status',
@@ -91,6 +92,7 @@ class TestPort(network_fakes.TestNetworkV2):
fake_port.network_id,
fake_port.port_security_enabled,
fake_port.project_id,
+ fake_port.qos_network_policy_id,
fake_port.qos_policy_id,
format_columns.ListColumn(fake_port.security_group_ids),
fake_port.status,