summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2/floating_ip.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/floating_ip.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/floating_ip.py')
-rw-r--r--openstackclient/network/v2/floating_ip.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py
index a2765cd1..25b2a1ba 100644
--- a/openstackclient/network/v2/floating_ip.py
+++ b/openstackclient/network/v2/floating_ip.py
@@ -13,7 +13,6 @@
"""IP Floating action implementations"""
-from osc_lib.command import command
from osc_lib import utils
from osc_lib.utils import tags as _tag
@@ -94,7 +93,8 @@ def _get_attrs(client_manager, parsed_args):
return attrs
-class CreateFloatingIP(common.NetworkAndComputeShowOne):
+class CreateFloatingIP(common.NetworkAndComputeShowOne,
+ common.NeutronCommandWithExtraArgs):
_description = _("Create floating IP")
def update_parser_common(self, parser):
@@ -175,6 +175,8 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne):
def take_action_network(self, client, parsed_args):
attrs = _get_attrs(self.app.client_manager, parsed_args)
+ 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_ip(**attrs)
@@ -390,7 +392,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
) for s in data))
-class SetFloatingIP(command.Command):
+class SetFloatingIP(common.NeutronCommandWithExtraArgs):
_description = _("Set floating IP Properties")
def get_parser(self, prog_name):
@@ -456,6 +458,9 @@ class SetFloatingIP(command.Command):
if 'no_qos_policy' in parsed_args and parsed_args.no_qos_policy:
attrs['qos_policy_id'] = None
+ attrs.update(
+ self._parse_extra_properties(parsed_args.extra_properties))
+
if attrs:
client.update_ip(obj, **attrs)
@@ -490,7 +495,7 @@ class ShowFloatingIP(common.NetworkAndComputeShowOne):
return (columns, data)
-class UnsetFloatingIP(command.Command):
+class UnsetFloatingIP(common.NeutronCommandWithExtraArgs):
_description = _("Unset floating IP Properties")
def get_parser(self, prog_name):
@@ -526,6 +531,8 @@ class UnsetFloatingIP(command.Command):
attrs['port_id'] = None
if parsed_args.qos_policy:
attrs['qos_policy_id'] = None
+ attrs.update(
+ self._parse_extra_properties(parsed_args.extra_properties))
if attrs:
client.update_ip(obj, **attrs)