Add --description to Create/Set Network
Added simple option for network description to create and set network. Change-Id: I90ce4db4e365a56ecddb00d59f4c5aa2ebbd49a3 Partially-Implements: blueprint network-command-options
This commit is contained in:
parent
44cf358a14
commit
88be7ddd38
doc/source/command-objects
openstackclient
@ -23,6 +23,7 @@ Create new network
|
|||||||
[--project <project> [--project-domain <project-domain>]]
|
[--project <project> [--project-domain <project-domain>]]
|
||||||
[--enable | --disable]
|
[--enable | --disable]
|
||||||
[--share | --no-share]
|
[--share | --no-share]
|
||||||
|
[--description <description>]
|
||||||
[--availability-zone-hint <availability-zone>]
|
[--availability-zone-hint <availability-zone>]
|
||||||
[--enable-port-security | --disable-port-security]
|
[--enable-port-security | --disable-port-security]
|
||||||
[--external [--default | --no-default] | --internal]
|
[--external [--default | --no-default] | --internal]
|
||||||
@ -65,6 +66,10 @@ Create new network
|
|||||||
|
|
||||||
Do not share the network between projects
|
Do not share the network between projects
|
||||||
|
|
||||||
|
.. option:: --description <description>
|
||||||
|
|
||||||
|
Set network description
|
||||||
|
|
||||||
.. option:: --availability-zone-hint <availability-zone>
|
.. option:: --availability-zone-hint <availability-zone>
|
||||||
|
|
||||||
Availability Zone in which to create this network
|
Availability Zone in which to create this network
|
||||||
@ -206,6 +211,7 @@ Set network properties
|
|||||||
[--name <name>]
|
[--name <name>]
|
||||||
[--enable | --disable]
|
[--enable | --disable]
|
||||||
[--share | --no-share]
|
[--share | --no-share]
|
||||||
|
[--description <description>]
|
||||||
[--enable-port-security | --disable-port-security]
|
[--enable-port-security | --disable-port-security]
|
||||||
[--external [--default | --no-default] | --internal]
|
[--external [--default | --no-default] | --internal]
|
||||||
[--provider-network-type <provider-network-type>]
|
[--provider-network-type <provider-network-type>]
|
||||||
@ -234,6 +240,10 @@ Set network properties
|
|||||||
|
|
||||||
Do not share the network between projects
|
Do not share the network between projects
|
||||||
|
|
||||||
|
.. option:: --description <description>
|
||||||
|
|
||||||
|
Set network description
|
||||||
|
|
||||||
.. option:: --enable-port-security
|
.. option:: --enable-port-security
|
||||||
|
|
||||||
Enable port security by default for ports created on
|
Enable port security by default for ports created on
|
||||||
|
@ -78,6 +78,10 @@ def _get_attrs(client_manager, parsed_args):
|
|||||||
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
|
||||||
|
|
||||||
|
# set description
|
||||||
|
if parsed_args.description:
|
||||||
|
attrs['description'] = parsed_args.description
|
||||||
|
|
||||||
# update_external_network_options
|
# update_external_network_options
|
||||||
if parsed_args.internal:
|
if parsed_args.internal:
|
||||||
attrs['router:external'] = False
|
attrs['router:external'] = False
|
||||||
@ -191,6 +195,11 @@ class CreateNetwork(common.NetworkAndComputeShowOne):
|
|||||||
metavar='<project>',
|
metavar='<project>',
|
||||||
help=_("Owner's project (name or ID)")
|
help=_("Owner's project (name or ID)")
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--description',
|
||||||
|
metavar='<description>',
|
||||||
|
help=_("Set network description")
|
||||||
|
)
|
||||||
identity_common.add_project_domain_option_to_parser(parser)
|
identity_common.add_project_domain_option_to_parser(parser)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--availability-zone-hint',
|
'--availability-zone-hint',
|
||||||
@ -420,6 +429,11 @@ class SetNetwork(command.Command):
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help=_("Do not share the network between projects")
|
help=_("Do not share the network between projects")
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--description',
|
||||||
|
metavar="<description",
|
||||||
|
help=_("Set network description")
|
||||||
|
)
|
||||||
port_security_group = parser.add_mutually_exclusive_group()
|
port_security_group = parser.add_mutually_exclusive_group()
|
||||||
port_security_group.add_argument(
|
port_security_group.add_argument(
|
||||||
'--enable-port-security',
|
'--enable-port-security',
|
||||||
|
@ -285,6 +285,7 @@ class FakeNetwork(object):
|
|||||||
'id': 'network-id-' + uuid.uuid4().hex,
|
'id': 'network-id-' + uuid.uuid4().hex,
|
||||||
'name': 'network-name-' + uuid.uuid4().hex,
|
'name': 'network-name-' + uuid.uuid4().hex,
|
||||||
'status': 'ACTIVE',
|
'status': 'ACTIVE',
|
||||||
|
'description': 'network-description-' + uuid.uuid4().hex,
|
||||||
'tenant_id': 'project-id-' + uuid.uuid4().hex,
|
'tenant_id': 'project-id-' + uuid.uuid4().hex,
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'shared': False,
|
'shared': False,
|
||||||
|
@ -57,6 +57,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|||||||
'admin_state_up',
|
'admin_state_up',
|
||||||
'availability_zone_hints',
|
'availability_zone_hints',
|
||||||
'availability_zones',
|
'availability_zones',
|
||||||
|
'description',
|
||||||
'id',
|
'id',
|
||||||
'is_default',
|
'is_default',
|
||||||
'name',
|
'name',
|
||||||
@ -73,6 +74,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|||||||
network._format_admin_state(_network.admin_state_up),
|
network._format_admin_state(_network.admin_state_up),
|
||||||
utils.format_list(_network.availability_zone_hints),
|
utils.format_list(_network.availability_zone_hints),
|
||||||
utils.format_list(_network.availability_zones),
|
utils.format_list(_network.availability_zones),
|
||||||
|
_network.description,
|
||||||
_network.id,
|
_network.id,
|
||||||
_network.is_default,
|
_network.is_default,
|
||||||
_network.name,
|
_network.name,
|
||||||
@ -129,6 +131,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|||||||
arglist = [
|
arglist = [
|
||||||
"--disable",
|
"--disable",
|
||||||
"--share",
|
"--share",
|
||||||
|
"--description", self._network.description,
|
||||||
"--project", self.project.name,
|
"--project", self.project.name,
|
||||||
"--project-domain", self.domain.name,
|
"--project-domain", self.domain.name,
|
||||||
"--availability-zone-hint", "nova",
|
"--availability-zone-hint", "nova",
|
||||||
@ -143,6 +146,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|||||||
verifylist = [
|
verifylist = [
|
||||||
('disable', True),
|
('disable', True),
|
||||||
('share', True),
|
('share', True),
|
||||||
|
('description', self._network.description),
|
||||||
('project', self.project.name),
|
('project', self.project.name),
|
||||||
('project_domain', self.domain.name),
|
('project_domain', self.domain.name),
|
||||||
('availability_zone_hints', ["nova"]),
|
('availability_zone_hints', ["nova"]),
|
||||||
@ -164,6 +168,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
|||||||
'availability_zone_hints': ["nova"],
|
'availability_zone_hints': ["nova"],
|
||||||
'name': self._network.name,
|
'name': self._network.name,
|
||||||
'shared': True,
|
'shared': True,
|
||||||
|
'description': self._network.description,
|
||||||
'tenant_id': self.project.id,
|
'tenant_id': self.project.id,
|
||||||
'is_default': True,
|
'is_default': True,
|
||||||
'router:external': True,
|
'router:external': True,
|
||||||
@ -216,6 +221,7 @@ class TestCreateNetworkIdentityV2(TestNetwork):
|
|||||||
'admin_state_up',
|
'admin_state_up',
|
||||||
'availability_zone_hints',
|
'availability_zone_hints',
|
||||||
'availability_zones',
|
'availability_zones',
|
||||||
|
'description',
|
||||||
'id',
|
'id',
|
||||||
'is_default',
|
'is_default',
|
||||||
'name',
|
'name',
|
||||||
@ -232,6 +238,7 @@ class TestCreateNetworkIdentityV2(TestNetwork):
|
|||||||
network._format_admin_state(_network.admin_state_up),
|
network._format_admin_state(_network.admin_state_up),
|
||||||
utils.format_list(_network.availability_zone_hints),
|
utils.format_list(_network.availability_zone_hints),
|
||||||
utils.format_list(_network.availability_zones),
|
utils.format_list(_network.availability_zones),
|
||||||
|
_network.description,
|
||||||
_network.id,
|
_network.id,
|
||||||
_network.is_default,
|
_network.is_default,
|
||||||
_network.name,
|
_network.name,
|
||||||
@ -532,6 +539,7 @@ class TestSetNetwork(TestNetwork):
|
|||||||
'--enable',
|
'--enable',
|
||||||
'--name', 'noob',
|
'--name', 'noob',
|
||||||
'--share',
|
'--share',
|
||||||
|
'--description', self._network.description,
|
||||||
'--external',
|
'--external',
|
||||||
'--default',
|
'--default',
|
||||||
'--provider-network-type', 'vlan',
|
'--provider-network-type', 'vlan',
|
||||||
@ -543,6 +551,7 @@ class TestSetNetwork(TestNetwork):
|
|||||||
verifylist = [
|
verifylist = [
|
||||||
('network', self._network.name),
|
('network', self._network.name),
|
||||||
('enable', True),
|
('enable', True),
|
||||||
|
('description', self._network.description),
|
||||||
('name', 'noob'),
|
('name', 'noob'),
|
||||||
('share', True),
|
('share', True),
|
||||||
('external', True),
|
('external', True),
|
||||||
@ -560,6 +569,7 @@ class TestSetNetwork(TestNetwork):
|
|||||||
attrs = {
|
attrs = {
|
||||||
'name': 'noob',
|
'name': 'noob',
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
|
'description': self._network.description,
|
||||||
'shared': True,
|
'shared': True,
|
||||||
'router:external': True,
|
'router:external': True,
|
||||||
'is_default': True,
|
'is_default': True,
|
||||||
@ -624,6 +634,7 @@ class TestShowNetwork(TestNetwork):
|
|||||||
'admin_state_up',
|
'admin_state_up',
|
||||||
'availability_zone_hints',
|
'availability_zone_hints',
|
||||||
'availability_zones',
|
'availability_zones',
|
||||||
|
'description',
|
||||||
'id',
|
'id',
|
||||||
'is_default',
|
'is_default',
|
||||||
'name',
|
'name',
|
||||||
@ -640,6 +651,7 @@ class TestShowNetwork(TestNetwork):
|
|||||||
network._format_admin_state(_network.admin_state_up),
|
network._format_admin_state(_network.admin_state_up),
|
||||||
utils.format_list(_network.availability_zone_hints),
|
utils.format_list(_network.availability_zone_hints),
|
||||||
utils.format_list(_network.availability_zones),
|
utils.format_list(_network.availability_zones),
|
||||||
|
_network.description,
|
||||||
_network.id,
|
_network.id,
|
||||||
_network.is_default,
|
_network.is_default,
|
||||||
_network.name,
|
_network.name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user