summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Henrique <phpm13@gmail.com>2022-04-13 09:32:41 -0300
committerPedro Henrique <phpm13@gmail.com>2022-07-15 10:06:03 -0300
commit7467c710f624aee80de8ef487e5b2c0e78143214 (patch)
tree052fd5c7cfcce2737e66c64fb7641d59d9d08aa0
parentb720fdaee7cb2bc8d38c63042c0b455cfd2be312 (diff)
downloadpython-neutronclient-7467c710f624aee80de8ef487e5b2c0e78143214.tar.gz
Add support to floating ip port forwarding8.1.0
To extend Horizon to allow users to create port forwarding rules for their floating ips, we need to extend this client to allow it, as Horizon uses this client. This patch is the one of a series of patches to implement floating ip port forwarding with port ranges. The specification is defined in: https://github.com/openstack/neutron-specs/blob/master/specs/wallaby/port-forwarding-port-ranges.rst Implements: blueprint floatingips-portforwarding-ranges Related-Bug: #1885921 Change-Id: I3f616dba5e2ebe301cf6ce4bed8c2e6e4da2da9b
-rw-r--r--neutronclient/v2_0/client.py28
-rw-r--r--releasenotes/notes/add-support-to-floating-ip-port-forwardings-9dc838a5c5727eb7.yaml4
2 files changed, 32 insertions, 0 deletions
diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py
index 93a3af7..de05291 100644
--- a/neutronclient/v2_0/client.py
+++ b/neutronclient/v2_0/client.py
@@ -515,6 +515,8 @@ class Client(ClientBase):
router_path = "/routers/%s"
floatingips_path = "/floatingips"
floatingip_path = "/floatingips/%s"
+ port_forwardings_path = "/floatingips/%s/port_forwardings"
+ port_forwarding_path = "/floatingips/%s/port_forwardings/%s"
security_groups_path = "/security-groups"
security_group_path = "/security-groups/%s"
security_group_rules_path = "/security-group-rules"
@@ -1019,6 +1021,32 @@ class Client(ClientBase):
"""Deletes the specified floatingip."""
return self.delete(self.floatingip_path % (floatingip))
+ def show_port_forwarding(self, floatingip, portforwarding):
+ """Fetches information of a certain portforwarding"""
+ return self.get(self.port_forwarding_path % (floatingip,
+ portforwarding))
+
+ def list_port_forwardings(self, floatingip, retrieve_all=True, **_params):
+ """Fetches a list of all portforwardings for a floatingip."""
+ return self.list('port_forwardings',
+ self.port_forwardings_path % floatingip, retrieve_all,
+ **_params)
+
+ def create_port_forwarding(self, floatingip, body=None):
+ """Creates a new portforwarding."""
+ return self.post(self.port_forwardings_path % floatingip, body=body)
+
+ def delete_port_forwarding(self, floatingip, portforwarding):
+ """Deletes the specified portforwarding."""
+ return self.delete(self.port_forwarding_path % (floatingip,
+ portforwarding))
+
+ def update_port_forwarding(self, floatingip, portforwarding, body=None):
+ """Updates a portforwarding."""
+ return self.put(self.port_forwarding_path % (floatingip,
+ portforwarding),
+ body=body)
+
def create_security_group(self, body=None):
"""Creates a new security group."""
return self.post(self.security_groups_path, body=body)
diff --git a/releasenotes/notes/add-support-to-floating-ip-port-forwardings-9dc838a5c5727eb7.yaml b/releasenotes/notes/add-support-to-floating-ip-port-forwardings-9dc838a5c5727eb7.yaml
new file mode 100644
index 0000000..3ba168e
--- /dev/null
+++ b/releasenotes/notes/add-support-to-floating-ip-port-forwardings-9dc838a5c5727eb7.yaml
@@ -0,0 +1,4 @@
+---
+features:
+ - |
+ Add support to floating ip port forwarding. \ No newline at end of file