summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2/port.py
diff options
context:
space:
mode:
authorSlawek Kaplonski <skaplons@redhat.com>2020-12-22 15:31:44 +0100
committerSlawek Kaplonski <skaplons@redhat.com>2021-05-26 09:29:15 +0200
commitb26b7f3440d4f756c0b7906b93751d7e83a733f7 (patch)
treee318e4700f87222b87a4e677e2f7f4dbcf518fae /openstackclient/network/v2/port.py
parent6bdf030953d449693c97bff8812b7ced981a2015 (diff)
downloadpython-openstackclient-b26b7f3440d4f756c0b7906b93751d7e83a733f7.tar.gz
Allow to send extra attributes in Neutron related commands
To deprecate and drop support for neutronclient CLI and use only OSC we need feature parity between OSC and neutronclient. Last missing piece here is possibility to send in POST/PUT requests unknown parameters to the Neutron server. This patch adds such possibility to the OSC. Change-Id: Iba09297c2be9fb9fa0be1b3dc65755277b79230e
Diffstat (limited to 'openstackclient/network/v2/port.py')
-rw-r--r--openstackclient/network/v2/port.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
index 4feffc1d..ecb2382a 100644
--- a/openstackclient/network/v2/port.py
+++ b/openstackclient/network/v2/port.py
@@ -326,7 +326,7 @@ def _convert_extra_dhcp_options(parsed_args):
return dhcp_options
-class CreatePort(command.ShowOne):
+class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs):
_description = _("Create a new port")
def get_parser(self, prog_name):
@@ -501,6 +501,9 @@ class CreatePort(command.ShowOne):
if parsed_args.tags:
attrs['tags'] = list(set(parsed_args.tags))
+ attrs.update(
+ self._parse_extra_properties(parsed_args.extra_properties))
+
with common.check_missing_extension_if_error(
self.app.client_manager.network, attrs):
obj = client.create_port(**attrs)
@@ -697,7 +700,7 @@ class ListPort(command.Lister):
# TODO(abhiraut): Use the SDK resource mapped attribute names once the
# OSC minimum requirements include SDK 1.0.
-class SetPort(command.Command):
+class SetPort(common.NeutronCommandWithExtraArgs):
_description = _("Set port properties")
def get_parser(self, prog_name):
@@ -871,6 +874,9 @@ class SetPort(command.Command):
if parsed_args.data_plane_status:
attrs['data_plane_status'] = parsed_args.data_plane_status
+ attrs.update(
+ self._parse_extra_properties(parsed_args.extra_properties))
+
if attrs:
with common.check_missing_extension_if_error(
self.app.client_manager.network, attrs):
@@ -902,7 +908,7 @@ class ShowPort(command.ShowOne):
# TODO(abhiraut): Use the SDK resource mapped attribute names once the
# OSC minimum requirements include SDK 1.0.
-class UnsetPort(command.Command):
+class UnsetPort(common.NeutronUnsetCommandWithExtraArgs):
_description = _("Unset port properties")
def get_parser(self, prog_name):
@@ -1023,6 +1029,9 @@ class UnsetPort(command.Command):
if parsed_args.numa_policy:
attrs['numa_affinity_policy'] = None
+ attrs.update(
+ self._parse_extra_properties(parsed_args.extra_properties))
+
if attrs:
client.update_port(obj, **attrs)