Add floating-ip-port-forwarding-detail shim extension

if we list floating ip and want to operate a port forwarding, we cannot
call the update 'port forwarding' api, because we don't know the port
forwarding id.
The reason for exposing 'internal_port_id' is also to find the
associated port as soon as possible, so as to facilitate users to obtain
vm information and decide whether to update this port forwarding.
this patch adds the port forwarding returned contents: 'id' and
'internal_port_id' when list floatingip.

Partial-bug: #1971646

Change-Id: I34aa6948fccc669fc729d032b540bd1aa0c17ce9
This commit is contained in:
zhouhenglc 2022-05-06 09:47:52 +08:00 committed by Rodolfo Alonso
parent 0ed5339e99
commit 9c90f78a8b
5 changed files with 52 additions and 2 deletions

View File

@ -24,6 +24,12 @@ The ``expose-port-forwarding-in-fip`` extension adds the ``port_forwardings``
attribute to floating IPs. The value of this attribute contains the
information of associated port forwarding resources.
Floating IP port forwardings detail
===================================
The ``floating-ip-port-forwarding-detail`` extension adds the ``id`` and
``internal_port_id`` attribute to port_forwardings.
QoS extension
=============

View File

@ -75,13 +75,17 @@
"protocol": "tcp",
"internal_ip_address": "10.0.0.19",
"internal_port": 25,
"external_port": 2225
"internal_port_id": "2057ec54-8be2-11eb-8dcd-0242ac130003",
"external_port": 2225,
"id": "0f23a90a-8be2-11eb-8dcd-0242ac130003"
},
{
"protocol": "tcp",
"internal_ip_address": "10.0.0.18",
"internal_port": 16666,
"external_port": 8786
"internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",
"external_port": 8786,
"id": "e0a0274e-4d19-4eab-9e12-9e77a8caf3ea"
}
],
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",

View File

@ -48,6 +48,7 @@ from neutron_lib.api.definitions import extraroute_atomic
from neutron_lib.api.definitions import filter_validation
from neutron_lib.api.definitions import fip64
from neutron_lib.api.definitions import fip_pf_description
from neutron_lib.api.definitions import fip_pf_detail
from neutron_lib.api.definitions import fip_pf_port_range
from neutron_lib.api.definitions import fip_port_details
from neutron_lib.api.definitions import firewall_v2
@ -189,6 +190,7 @@ _ALL_API_DEFINITIONS = {
filter_validation,
fip64,
firewall_v2,
fip_pf_detail,
fip_port_details,
flavors,
floating_ip_port_forwarding,

View File

@ -0,0 +1,32 @@
# Copyright (c) 2022 Inspur, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
NAME = 'Floating IP port forwarding detail'
ALIAS = 'floating-ip-port-forwarding-detail'
DESCRIPTION = (
"Allow list floating ip return more port forwarding data, include"
"'id' and 'internal_port_id'")
UPDATED_TIMESTAMP = "2022-05-06T10:00:00-00:00"
RESOURCE_ATTRIBUTE_MAP = {}
IS_SHIM_EXTENSION = True
IS_STANDARD_ATTR_EXTENSION = False
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = []
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -0,0 +1,6 @@
---
features:
- |
Add API extension ``fip-pf-detail``. This extension indicates the list
floating ip api will return port forwarding's ``id`` and
``internal_port_id``.