[ovn]Floating IP adds distributed attributes

Partial-bug: #1978039

Partially-Implements: blueprint custom-floatingip-distributed

Change-Id: I7894c2b5afa11bcb0c78b3525d74bd9345edd361
This commit is contained in:
zhouhenglc 2022-08-30 10:36:38 +08:00 committed by ZhouHeng
parent 7e9f66aca4
commit 7441b091ee
6 changed files with 100 additions and 0 deletions

View File

@ -10,6 +10,13 @@ attributes to floating IPs allowing them to be specified at creation time.
The data in these attributes will be published in an external DNS service
when Neutron is configured to integrate with such a service.
Floating IP distributed
========================
The ``floating-ip-distributed`` extension adds the ``distributed`` attribute
to the floating IPs. The value of this attribute identify the Floating IP is
distributed or centralized.
Floating IP port details
========================
@ -97,6 +104,7 @@ Request
- project_id: project_id-query
- revision_number: revision_number-query
- description: description-query
- distributed: fip-distributed-request
- floating_network_id: floating_network_id-query
- fixed_ip_address: floatingip-fixed_ip_address-query
- floating_ip_address: floating_ip_address-query
@ -124,6 +132,7 @@ Response Parameters
- updated_at: updated_at_resource
- revision_number: revision_number
- description: description
- distributed: fip-distributed
- dns_domain: dns_domain
- dns_name: dns_name
- port_details: floating_port_details
@ -216,6 +225,7 @@ Request
- floating_ip_address: floating_ip_address-request
- port_id: floatingip-port_id-post-request
- subnet_id: floatingip-subnet_id
- distributed: fip-distributed-request
- description: description-request
- dns_domain: dns_domain-request
- dns_name: dns_name-request
@ -236,6 +246,7 @@ Response Parameters
- router_id: floatingip-router_id
- status: floatingip-status
- description: description
- distributed: fip-distributed
- dns_domain: dns_domain
- dns_name: dns_name
- port_details: floating_port_details
@ -304,6 +315,7 @@ Response Parameters
- router_id: floatingip-router_id
- status: floatingip-status
- description: description
- distributed: fip-distributed
- dns_domain: dns_domain
- dns_name: dns_name
- port_details: floating_port_details
@ -364,6 +376,7 @@ Request
- port_id: floatingip-port_id-put-request
- fixed_ip_address: floatingip-fixed_ip_address-request
- description: description-request
- distributed: fip-distributed-request
Request Example
---------------
@ -396,6 +409,7 @@ Response Parameters
- updated_at: updated_at_resource
- revision_number: revision_number
- description: description
- distributed: fip-distributed
- dns_domain: dns_domain
- dns_name: dns_name
- port_details: floating_port_details

View File

@ -3072,6 +3072,20 @@ extra_dhcp_opts-request:
in: body
required: false
type: array
fip-distributed:
description: |
``true`` indicates a distributed floatingip.
It is available when ``floating-ip-distributed`` extension is enabled.
in: body
required: true
type: boolean
fip-distributed-request:
description: |
``true`` indicates a distributed floatingip.
It is available when ``floating-ip-distributed`` extension is enabled.
in: body
required: false
type: boolean
fip_port_forwarding:
description: |
A ``floating IP port forwarding`` object.

View File

@ -46,6 +46,7 @@ from neutron_lib.api.definitions import extraroute
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_distributed
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
@ -189,6 +190,7 @@ _ALL_API_DEFINITIONS = {
filter_validation,
fip64,
firewall_v2,
fip_distributed,
fip_pf_detail,
fip_port_details,
flavors,

View File

@ -0,0 +1,44 @@
# 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.
from neutron_lib.api import converters
from neutron_lib.api.definitions import dvr
from neutron_lib.api.definitions import l3
from neutron_lib import constants
ALIAS = 'floating-ip-distributed'
IS_SHIM_EXTENSION = False
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Floating IP Distributed Extension'
DESCRIPTION = 'Add distributed attribute to Floating IP resource'
UPDATED_TIMESTAMP = '2022-08-30T10:00:00-00:00'
DISTRIBUTED = 'distributed'
RESOURCE_ATTRIBUTE_MAP = {
l3.FLOATINGIPS: {
DISTRIBUTED: {
'allow_post': True,
'allow_put': True,
'convert_to': converters.convert_to_boolean_if_not_none,
'default': constants.ATTR_NOT_SPECIFIED,
'is_visible': True,
'is_filter': True
}
}
}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [l3.ALIAS, dvr.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -0,0 +1,21 @@
# 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.
from neutron_lib.api.definitions import fip_distributed
from neutron_lib.api.definitions import l3
from neutron_lib.tests.unit.api.definitions import base
class FipDistributedDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = fip_distributed
extension_resources = (l3.FLOATINGIPS,)
extension_attributes = (fip_distributed.DISTRIBUTED,)

View File

@ -0,0 +1,5 @@
---
features:
- |
Add API extension ``floating-ip-distributed``. This extension
adds ``distributed`` attribute to the Floating IP resource.