Merge "New api-def: allowedaddresspairs-atomic"
This commit is contained in:
@@ -25,6 +25,14 @@ is optional and will be taken from the port if not specified.
|
|||||||
with source IP address restrictions for all ports which use the same security
|
with source IP address restrictions for all ports which use the same security
|
||||||
group.
|
group.
|
||||||
|
|
||||||
|
Allowed address pairs (atomic) extension
|
||||||
|
========================================
|
||||||
|
|
||||||
|
The Allowed address pairs (atomic) extension (``allowedaddresspairs-atomic``)
|
||||||
|
extends the ``port`` resource by adding two member actions
|
||||||
|
(``add_allowed_address_pairs``/ ``remove_allowed_address_pairs``) to edit the set
|
||||||
|
of Allowed address pairs atomically on the server side.
|
||||||
|
|
||||||
Data plane status extension
|
Data plane status extension
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
@@ -772,3 +780,157 @@ Response Example
|
|||||||
|
|
||||||
.. literalinclude:: samples/ports/ports-bulk-create-response.json
|
.. literalinclude:: samples/ports/ports-bulk-create-response.json
|
||||||
:language: javascript
|
:language: javascript
|
||||||
|
|
||||||
|
Add allowed_address_pairs to port
|
||||||
|
=================================
|
||||||
|
|
||||||
|
.. rest_method:: PUT /v2.0/ports/{port_id}/add_allowed_address_pairs
|
||||||
|
|
||||||
|
Atomically adds a set of allowed_address_pairs to the port's already
|
||||||
|
existing allowed_address_pairs.
|
||||||
|
|
||||||
|
Normal response codes: 200
|
||||||
|
|
||||||
|
Error response codes: 400, 401, 404, 412
|
||||||
|
|
||||||
|
Request
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. rest_parameters:: parameters.yaml
|
||||||
|
|
||||||
|
- port_id: port_id-path
|
||||||
|
- port: port
|
||||||
|
- allowed_address_pairs: allowed_address_pairs-request
|
||||||
|
|
||||||
|
Request Example
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. literalinclude:: samples/ports/port-add-allowed-address-pairs-request.json
|
||||||
|
:language: javascript
|
||||||
|
|
||||||
|
Response Parameters
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
.. rest_parameters:: parameters.yaml
|
||||||
|
|
||||||
|
- port: port
|
||||||
|
- admin_state_up: admin_state_up
|
||||||
|
- allowed_address_pairs: allowed_address_pairs
|
||||||
|
- binding:host_id: binding:host_id
|
||||||
|
- binding:profile: binding:profile
|
||||||
|
- binding:vif_details: binding:vif_details
|
||||||
|
- binding:vif_type: binding:vif_type
|
||||||
|
- binding:vnic_type: binding:vnic_type
|
||||||
|
- created_at: created_at_resource
|
||||||
|
- data_plane_status: data_plane_status
|
||||||
|
- description: description
|
||||||
|
- device_id: device_id
|
||||||
|
- device_owner: device_owner
|
||||||
|
- dns_assignment: dns_assignment
|
||||||
|
- dns_domain: dns_domain
|
||||||
|
- dns_name: dns_name
|
||||||
|
- extra_dhcp_opts: extra_dhcp_opts
|
||||||
|
- fixed_ips: fixed_ips
|
||||||
|
- hints: hints
|
||||||
|
- id: id
|
||||||
|
- ip_allocation: ip_allocation
|
||||||
|
- mac_address: mac_address
|
||||||
|
- name: name
|
||||||
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy
|
||||||
|
- port_security_enabled: port_security_enabled
|
||||||
|
- project_id: project_id
|
||||||
|
- qos_network_policy_id: qos_network_policy_id-port-response
|
||||||
|
- qos_policy_id: qos_policy_id-port-response
|
||||||
|
- revision_number: revision_number
|
||||||
|
- resource_request: port-resource
|
||||||
|
- security_groups: port-security_groups
|
||||||
|
- status: port-status
|
||||||
|
- tags: tags
|
||||||
|
- tenant_id: project_id
|
||||||
|
- updated_at: updated_at_resource
|
||||||
|
- propagate_uplink_status: propagate_uplink_status
|
||||||
|
- mac_learning_enabled: mac_learning_enabled
|
||||||
|
|
||||||
|
Response Example
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. literalinclude:: samples/ports/port-add-allowed-address-pairs-response.json
|
||||||
|
:language: javascript
|
||||||
|
|
||||||
|
Remove allowed_address_pairs from port
|
||||||
|
======================================
|
||||||
|
|
||||||
|
.. rest_method:: PUT /v2.0/ports/{port_id}/remove_allowed_address_pairs
|
||||||
|
|
||||||
|
Atomically removes a set of allowed_address_pairs from the port's already
|
||||||
|
existing allowed_address_pairs.
|
||||||
|
|
||||||
|
Normal response codes: 200
|
||||||
|
|
||||||
|
Error response codes: 400, 401, 404, 412
|
||||||
|
|
||||||
|
Request
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. rest_parameters:: parameters.yaml
|
||||||
|
|
||||||
|
- port_id: port_id-path
|
||||||
|
- port: port
|
||||||
|
- allowed_address_pairs: allowed_address_pairs-request
|
||||||
|
|
||||||
|
Request Example
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. literalinclude:: samples/ports/port-remove-allowed-address-pairs-request.json
|
||||||
|
:language: javascript
|
||||||
|
|
||||||
|
Response Parameters
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
.. rest_parameters:: parameters.yaml
|
||||||
|
|
||||||
|
- port: port
|
||||||
|
- admin_state_up: admin_state_up
|
||||||
|
- allowed_address_pairs: allowed_address_pairs
|
||||||
|
- binding:host_id: binding:host_id
|
||||||
|
- binding:profile: binding:profile
|
||||||
|
- binding:vif_details: binding:vif_details
|
||||||
|
- binding:vif_type: binding:vif_type
|
||||||
|
- binding:vnic_type: binding:vnic_type
|
||||||
|
- created_at: created_at_resource
|
||||||
|
- data_plane_status: data_plane_status
|
||||||
|
- description: description
|
||||||
|
- device_id: device_id
|
||||||
|
- device_owner: device_owner
|
||||||
|
- dns_assignment: dns_assignment
|
||||||
|
- dns_domain: dns_domain
|
||||||
|
- dns_name: dns_name
|
||||||
|
- extra_dhcp_opts: extra_dhcp_opts
|
||||||
|
- fixed_ips: fixed_ips
|
||||||
|
- hints: hints
|
||||||
|
- id: id
|
||||||
|
- ip_allocation: ip_allocation
|
||||||
|
- mac_address: mac_address
|
||||||
|
- name: name
|
||||||
|
- network_id: network_id
|
||||||
|
- numa_affinity_policy: numa_affinity_policy
|
||||||
|
- port_security_enabled: port_security_enabled
|
||||||
|
- project_id: project_id
|
||||||
|
- qos_network_policy_id: qos_network_policy_id-port-response
|
||||||
|
- qos_policy_id: qos_policy_id-port-response
|
||||||
|
- revision_number: revision_number
|
||||||
|
- resource_request: port-resource
|
||||||
|
- security_groups: port-security_groups
|
||||||
|
- status: port-status
|
||||||
|
- tags: tags
|
||||||
|
- tenant_id: project_id
|
||||||
|
- updated_at: updated_at_resource
|
||||||
|
- propagate_uplink_status: propagate_uplink_status
|
||||||
|
- mac_learning_enabled: mac_learning_enabled
|
||||||
|
|
||||||
|
Response Example
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. literalinclude:: samples/ports/port-remove-allowed-address-pairs-response.json
|
||||||
|
:language: javascript
|
||||||
|
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"port" : {
|
||||||
|
"allowed_address_pairs": [
|
||||||
|
{
|
||||||
|
"ip_address": "192.168.13.7",
|
||||||
|
"mac_address": "fa:16:3e:09:1f:b2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"port": {
|
||||||
|
"admin_state_up": true,
|
||||||
|
"allowed_address_pairs": [
|
||||||
|
{
|
||||||
|
"ip_address": "192.168.13.7",
|
||||||
|
"mac_address": "fa:16:3e:09:1f:b2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"binding:host_id": "",
|
||||||
|
"binding:profile": {},
|
||||||
|
"binding:vif_details": {},
|
||||||
|
"binding:vif_type": "unbound",
|
||||||
|
"binding:vnic_type": "normal",
|
||||||
|
"created_at": "2023-04-20T02:32:41",
|
||||||
|
"data_plane_status": null,
|
||||||
|
"description": "",
|
||||||
|
"device_id": "",
|
||||||
|
"device_owner": "",
|
||||||
|
"dns_assignment": [],
|
||||||
|
"dns_domain": "",
|
||||||
|
"dns_name": "",
|
||||||
|
"extra_dhcp_opts": [],
|
||||||
|
"fixed_ips": [
|
||||||
|
{
|
||||||
|
"ip_address": "192.168.13.6",
|
||||||
|
"subnet_id": "a4c3b506-2110-4929-a70a-bda534bc0b07"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "dc67ee67-7acd-464d-98fd-4abef6d8759d",
|
||||||
|
"ip_allocation": "immediate",
|
||||||
|
"mac_address": "fa:16:3e:09:1f:b2",
|
||||||
|
"mac_learning_enabled": false,
|
||||||
|
"name": "test-port",
|
||||||
|
"network_id": "99b8e526-e943-4463-aa28-a22395bed154",
|
||||||
|
"port_security_enabled": true,
|
||||||
|
"project_id": "294b394e8f454cc8b26bbe342bc210d3",
|
||||||
|
"revision_number": 1,
|
||||||
|
"security_groups": [
|
||||||
|
"751d740a-b52b-46d9-bca8-a21e75c8a727"
|
||||||
|
],
|
||||||
|
"status": "DOWN",
|
||||||
|
"tags": [],
|
||||||
|
"tenant_id": "294b394e8f454cc8b26bbe342bc210d3",
|
||||||
|
"updated_at": "2023-04-20T02:32:41",
|
||||||
|
"qos_network_policy_id": null,
|
||||||
|
"qos_policy_id": null,
|
||||||
|
"resource_request": null,
|
||||||
|
"propagate_uplink_status": false
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"port" : {
|
||||||
|
"allowed_address_pairs": [
|
||||||
|
{
|
||||||
|
"ip_address": "192.168.13.7",
|
||||||
|
"mac_address": "fa:16:3e:09:1f:b2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"port": {
|
||||||
|
"admin_state_up": true,
|
||||||
|
"allowed_address_pairs": [],
|
||||||
|
"binding:host_id": "",
|
||||||
|
"binding:profile": {},
|
||||||
|
"binding:vif_details": {},
|
||||||
|
"binding:vif_type": "unbound",
|
||||||
|
"binding:vnic_type": "normal",
|
||||||
|
"created_at": "2023-04-20T02:32:41",
|
||||||
|
"data_plane_status": null,
|
||||||
|
"description": "",
|
||||||
|
"device_id": "",
|
||||||
|
"device_owner": "",
|
||||||
|
"dns_assignment": [],
|
||||||
|
"dns_domain": "",
|
||||||
|
"dns_name": "",
|
||||||
|
"extra_dhcp_opts": [],
|
||||||
|
"fixed_ips": [
|
||||||
|
{
|
||||||
|
"ip_address": "192.168.13.6",
|
||||||
|
"subnet_id": "a4c3b506-2110-4929-a70a-bda534bc0b07"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "dc67ee67-7acd-464d-98fd-4abef6d8759d",
|
||||||
|
"ip_allocation": "immediate",
|
||||||
|
"mac_address": "fa:16:3e:09:1f:b2",
|
||||||
|
"mac_learning_enabled": false,
|
||||||
|
"name": "test-port",
|
||||||
|
"network_id": "99b8e526-e943-4463-aa28-a22395bed154",
|
||||||
|
"port_security_enabled": true,
|
||||||
|
"project_id": "294b394e8f454cc8b26bbe342bc210d3",
|
||||||
|
"revision_number": 1,
|
||||||
|
"security_groups": [
|
||||||
|
"751d740a-b52b-46d9-bca8-a21e75c8a727"
|
||||||
|
],
|
||||||
|
"status": "DOWN",
|
||||||
|
"tags": [],
|
||||||
|
"tenant_id": "294b394e8f454cc8b26bbe342bc210d3",
|
||||||
|
"updated_at": "2023-04-20T02:32:41",
|
||||||
|
"qos_network_policy_id": null,
|
||||||
|
"qos_policy_id": null,
|
||||||
|
"resource_request": null,
|
||||||
|
"propagate_uplink_status": false
|
||||||
|
}
|
||||||
|
}
|
@@ -16,6 +16,7 @@ from neutron_lib.api.definitions import agent
|
|||||||
from neutron_lib.api.definitions import agent_resources_synced
|
from neutron_lib.api.definitions import agent_resources_synced
|
||||||
from neutron_lib.api.definitions import agent_sort_key
|
from neutron_lib.api.definitions import agent_sort_key
|
||||||
from neutron_lib.api.definitions import allowedaddresspairs
|
from neutron_lib.api.definitions import allowedaddresspairs
|
||||||
|
from neutron_lib.api.definitions import allowedaddresspairs_atomic
|
||||||
from neutron_lib.api.definitions import auto_allocated_topology
|
from neutron_lib.api.definitions import auto_allocated_topology
|
||||||
from neutron_lib.api.definitions import availability_zone
|
from neutron_lib.api.definitions import availability_zone
|
||||||
from neutron_lib.api.definitions import availability_zone_filter
|
from neutron_lib.api.definitions import availability_zone_filter
|
||||||
@@ -165,6 +166,7 @@ _ALL_API_DEFINITIONS = {
|
|||||||
agent_resources_synced,
|
agent_resources_synced,
|
||||||
agent_sort_key,
|
agent_sort_key,
|
||||||
allowedaddresspairs,
|
allowedaddresspairs,
|
||||||
|
allowedaddresspairs_atomic,
|
||||||
auto_allocated_topology,
|
auto_allocated_topology,
|
||||||
availability_zone,
|
availability_zone,
|
||||||
availability_zone_filter,
|
availability_zone_filter,
|
||||||
|
38
neutron_lib/api/definitions/allowedaddresspairs_atomic.py
Normal file
38
neutron_lib/api/definitions/allowedaddresspairs_atomic.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# Copyright 2023 EasyStack Limited. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 allowedaddresspairs
|
||||||
|
from neutron_lib.api.definitions import port
|
||||||
|
|
||||||
|
|
||||||
|
ALIAS = 'allowed-address-pairs-atomic'
|
||||||
|
IS_SHIM_EXTENSION = False
|
||||||
|
IS_STANDARD_ATTR_EXTENSION = False
|
||||||
|
NAME = 'Atomically add/remove allowed address pairs'
|
||||||
|
DESCRIPTION = ('Edit allowed address pairs of a port on server side by '
|
||||||
|
'atomically adding/removing allowed address pairs')
|
||||||
|
UPDATED_TIMESTAMP = '2023-04-17T00:00:00+00:00'
|
||||||
|
RESOURCE_ATTRIBUTE_MAP = {
|
||||||
|
port.COLLECTION_NAME: {}
|
||||||
|
}
|
||||||
|
SUB_RESOURCE_ATTRIBUTE_MAP = None
|
||||||
|
ACTION_MAP = {
|
||||||
|
port.RESOURCE_NAME: {
|
||||||
|
'add_allowed_address_pairs': 'PUT',
|
||||||
|
'remove_allowed_address_pairs': 'PUT',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
REQUIRED_EXTENSIONS = [allowedaddresspairs.ALIAS]
|
||||||
|
OPTIONAL_EXTENSIONS = []
|
||||||
|
ACTION_STATUS = {}
|
@@ -83,6 +83,7 @@ KNOWN_EXTENSIONS = (
|
|||||||
'agent',
|
'agent',
|
||||||
'agent-resources-synced',
|
'agent-resources-synced',
|
||||||
'allowed-address-pairs',
|
'allowed-address-pairs',
|
||||||
|
'allowed-address-pairs-atomic',
|
||||||
'auto-allocated-topology',
|
'auto-allocated-topology',
|
||||||
'availability_zone',
|
'availability_zone',
|
||||||
'binding',
|
'binding',
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
# Copyright 2023 EasyStack Limited. All rights reserved.
|
||||||
|
#
|
||||||
|
# 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 allowedaddresspairs_atomic
|
||||||
|
from neutron_lib.tests.unit.api.definitions import base
|
||||||
|
|
||||||
|
|
||||||
|
class AllowedAddressPairsDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||||
|
extension_module = allowedaddresspairs_atomic
|
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
New API definition: ``allowedaddresspairs-atomic``. It adds
|
||||||
|
``add_allowed_address_pairs`` and ``remove_allowed_address_pairs``
|
||||||
|
API endpoints.
|
Reference in New Issue
Block a user