From 210862034b8b0d4b8dfe51440010b8a3de598c50 Mon Sep 17 00:00:00 2001 From: liushy Date: Thu, 27 Apr 2023 14:59:02 +0800 Subject: [PATCH] Add a shim extension standard-attr-fwaas-v2 Neutron-fwaas patch: https://review.opendev.org/c/866988 Partial-Bug: #1986906 Change-Id: I8db2eed7b55c12042804de1710778b008d8bf49c --- neutron_lib/api/definitions/__init__.py | 2 ++ neutron_lib/api/definitions/base.py | 1 + .../api/definitions/firewall_v2_stdattrs.py | 33 +++++++++++++++++++ .../definitions/test_firewall_v2_stdattrs.py | 20 +++++++++++ ...tandard-attr-fwaasv2-7e9250015afbe112.yaml | 5 +++ 5 files changed, 61 insertions(+) create mode 100644 neutron_lib/api/definitions/firewall_v2_stdattrs.py create mode 100644 neutron_lib/tests/unit/api/definitions/test_firewall_v2_stdattrs.py create mode 100644 releasenotes/notes/add-extension-standard-attr-fwaasv2-7e9250015afbe112.yaml diff --git a/neutron_lib/api/definitions/__init__.py b/neutron_lib/api/definitions/__init__.py index cecb501b0..e5883c9be 100644 --- a/neutron_lib/api/definitions/__init__.py +++ b/neutron_lib/api/definitions/__init__.py @@ -52,6 +52,7 @@ 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 +from neutron_lib.api.definitions import firewall_v2_stdattrs from neutron_lib.api.definitions import flavors from neutron_lib.api.definitions import floating_ip_port_forwarding from neutron_lib.api.definitions import floatingip_autodelete_internal @@ -195,6 +196,7 @@ _ALL_API_DEFINITIONS = { filter_validation, fip64, firewall_v2, + firewall_v2_stdattrs, fip_distributed, fip_pf_detail, fip_port_details, diff --git a/neutron_lib/api/definitions/base.py b/neutron_lib/api/definitions/base.py index f482bf98a..e63556f00 100644 --- a/neutron_lib/api/definitions/base.py +++ b/neutron_lib/api/definitions/base.py @@ -160,6 +160,7 @@ KNOWN_EXTENSIONS = ( 'sort-key-validation', 'sorting', 'standard-attr-description', + 'standard-attr-fwaas-v2', 'standard-attr-revisions', 'standard-attr-segment', 'standard-attr-timestamp', diff --git a/neutron_lib/api/definitions/firewall_v2_stdattrs.py b/neutron_lib/api/definitions/firewall_v2_stdattrs.py new file mode 100644 index 000000000..5d4bd2b69 --- /dev/null +++ b/neutron_lib/api/definitions/firewall_v2_stdattrs.py @@ -0,0 +1,33 @@ +# Copyright 2023 EasyStack Limited +# +# 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 firewall_v2 + + +ALIAS = 'standard-attr-fwaas-v2' +IS_SHIM_EXTENSION = True +IS_STANDARD_ATTR_EXTENSION = True +NAME = 'Standard Attribute FWaaS v2 Extension' +DESCRIPTION = 'Add standard attributes to FWaaS v2 resources' +UPDATED_TIMESTAMP = '2023-04-027T01:00:00-00:00' +RESOURCE_ATTRIBUTE_MAP = {} +SUB_RESOURCE_ATTRIBUTE_MAP = {} +ACTION_MAP = {} +REQUIRED_EXTENSIONS = [firewall_v2.ALIAS] +OPTIONAL_EXTENSIONS = [ + 'standard-attr-description', + 'standard-attr-timestamp', + 'standard-attr-revisions' +] +ACTION_STATUS = {} diff --git a/neutron_lib/tests/unit/api/definitions/test_firewall_v2_stdattrs.py b/neutron_lib/tests/unit/api/definitions/test_firewall_v2_stdattrs.py new file mode 100644 index 000000000..f2bef2ec8 --- /dev/null +++ b/neutron_lib/tests/unit/api/definitions/test_firewall_v2_stdattrs.py @@ -0,0 +1,20 @@ +# Copyright 2023 EasyStack Limited +# +# 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 firewall_v2_stdattrs +from neutron_lib.tests.unit.api.definitions import base + + +class FWaaSV2StdAttrDefinitionTestCase(base.DefinitionBaseTestCase): + extension_module = firewall_v2_stdattrs diff --git a/releasenotes/notes/add-extension-standard-attr-fwaasv2-7e9250015afbe112.yaml b/releasenotes/notes/add-extension-standard-attr-fwaasv2-7e9250015afbe112.yaml new file mode 100644 index 000000000..ad1aecba2 --- /dev/null +++ b/releasenotes/notes/add-extension-standard-attr-fwaasv2-7e9250015afbe112.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add API extensions to advertise the support of standard attributes with + FWaaS v2 resources: ``standard-attr-fwaas-v2``.