From f8c5b72cc84fb982d990f127d8957071e430e577 Mon Sep 17 00:00:00 2001 From: elajkat Date: Fri, 12 Feb 2021 18:01:49 +0100 Subject: [PATCH] BFD api def Change-Id: Ia93894051c565c006749fb70950d6e67fcd82cad Related-Bug: #1907089 See-Also: https://review.opendev.org/c/openstack/neutron-specs/+/767337 --- api-ref/source/v2/bfd_monitors.inc | 310 ++++++++++++++++++ api-ref/source/v2/index.rst | 1 + api-ref/source/v2/parameters.yaml | 119 +++++++ .../bfd/bfd_monitor-create-request.json | 8 + .../bfd/bfd_monitor-create-response.json | 18 + .../bfd/bfd_monitor-list-response.json | 20 ++ .../bfd/bfd_monitor-show-response.json | 18 + .../bfd/bfd_monitor-update-request.json | 9 + .../bfd/bfd_monitor-update-response.json | 18 + .../bfd/bfd_monitor_association-response.json | 23 ++ .../bfd_monitor_session_status-response.json | 13 + neutron_lib/api/definitions/__init__.py | 2 + neutron_lib/api/definitions/base.py | 11 +- neutron_lib/api/definitions/bfd_monitor.py | 106 ++++++ .../tests/unit/api/definitions/test_bfd.py | 19 ++ ...onitor_api_extension-910f5842783e040a.yaml | 12 + 16 files changed, 706 insertions(+), 1 deletion(-) create mode 100644 api-ref/source/v2/bfd_monitors.inc create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor-create-request.json create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor-create-response.json create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor-list-response.json create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor-show-response.json create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor-update-request.json create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor-update-response.json create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor_association-response.json create mode 100644 api-ref/source/v2/samples/bfd/bfd_monitor_session_status-response.json create mode 100644 neutron_lib/api/definitions/bfd_monitor.py create mode 100644 neutron_lib/tests/unit/api/definitions/test_bfd.py create mode 100644 releasenotes/notes/bfd_monitor_api_extension-910f5842783e040a.yaml diff --git a/api-ref/source/v2/bfd_monitors.inc b/api-ref/source/v2/bfd_monitors.inc new file mode 100644 index 000000000..1778cd869 --- /dev/null +++ b/api-ref/source/v2/bfd_monitors.inc @@ -0,0 +1,310 @@ +.. -*- rst -*- + +============ +BFD monitors +============ + +A new BFD (Bidirectional Forwarding Detection) resource is introduced. + +.. warning:: + + This API extension was merged as experimental to enable parallel + development of multiple backends. At the moment this API does not have + a reference implementation and should not be considered final. The + removal of this warning will mark when the reference implementation + gets merged and the feauture is ready to be consumed. + +List BFD monitors +================= + +.. rest_method:: GET /v2.0/bfd_monitors + +Lists BFD monitors to which the project has access. + +Normal response codes: 200 + +Error response codes: 400, 401, 403 + +Request +-------- + +.. rest_parameters:: parameters.yaml + + - id: id-query + - project_id: project_id-query + - name: name-query + - description: description-query + - fields: fields + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bfd_monitors: bfd_monitor-obj + - description: description + - project_id: project_id + - name: name + - id: bfd_monitor_id + - mode: bfd_monitor_mode + - dst_ip: bfd_monitor_dst_ip + - src_ip: bfd_monitor_src_ip + - min_rx: bfd_monitor_min_rx + - min_tx: bfd_monitor_min_tx + - multiplier: bfd_monitor_multiplier + - status: bfd_monitor_status + - auth_type: bfd_monitor_auth_type + - auth_key: bfd_monitor_auth_key + +Response Example +---------------- + +.. literalinclude:: samples/bfd/bfd_monitor-list-response.json + :language: javascript + +Create BFD monitor +================== + +.. rest_method:: POST /v2.0/bfd_monitors + +Creates a BFD monitor. + +Normal response codes: 201 + +Error response codes: 401, 403, 404, 409 + +Request +-------- + +.. rest_parameters:: parameters.yaml + + - name: name + - description: description + - project_id: project_id + - mode: bfd_monitor_mode + - dst_ip: bfd_monitor_dst_ip + - src_ip: bfd_monitor_src_ip + - min_rx: bfd_monitor_min_rx + - min_tx: bfd_monitor_min_tx + - multiplier: bfd_monitor_multiplier + - auth_type: bfd_monitor_auth_type + - auth_key: bfd_monitor_auth_key + +Request Example +--------------- + +.. literalinclude:: samples/bfd/bfd_monitor-create-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bfd_monitors: bfd_monitor-obj + - description: description + - project_id: project_id + - name: name + - id: bfd_monitor_id + - mode: bfd_monitor_mode + - dst_ip: bfd_monitor_dst_ip + - src_ip: bfd_monitor_src_ip + - min_rx: bfd_monitor_min_rx + - min_tx: bfd_monitor_min_tx + - multiplier: bfd_monitor_multiplier + - status: bfd_monitor_status + - auth_type: bfd_monitor_auth_type + - auth_key: bfd_monitor_auth_key + +Response Example +---------------- + +.. literalinclude:: samples/bfd/bfd_monitor-create-response.json + :language: javascript + +Show BFD monitor details +======================== + +.. rest_method:: GET /v2.0/bfd_monitors/{monitor_id} + +Shows details for a BFD monitor. + +Normal response codes: 200 + +Error response codes: 401, 404 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - monitor_id: bfd_monitor_id-path + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bfd_monitors: bfd_monitor-obj + - description: description + - project_id: project_id + - name: name + - id: bfd_monitor_id + - mode: bfd_monitor_mode + - dst_ip: bfd_monitor_dst_ip + - src_ip: bfd_monitor_src_ip + - min_rx: bfd_monitor_min_rx + - min_tx: bfd_monitor_min_tx + - multiplier: bfd_monitor_multiplier + - status: bfd_monitor_status + - auth_type: bfd_monitor_auth_type + - auth_key: bfd_monitor_auth_key + +Response Example +---------------- + +.. literalinclude:: samples/bfd/bfd_monitor-show-response.json + :language: javascript + +Update BFD monitor +================== + +.. rest_method:: PUT /v2.0/bfd_monitors/{monitor_id} + +Updates a BFD monitor. + +If the request is valid, the service returns the ``Accepted (202)`` +response code. + +Normal response codes: 202 + +Error response codes: 400, 401, 404, 412 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - monitor_id: bfd_monitor_id-path + - name: name + - description: description + - min_rx: bfd_monitor_min_rx + - min_tx: bfd_monitor_min_tx + - multiplier: bfd_monitor_multiplier + +Request Example +--------------- + +.. literalinclude:: samples/bfd/bfd_monitor-update-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - bfd_monitors: bfd_monitor-obj + - description: description + - project_id: project_id + - name: name + - id: bfd_monitor_id + - mode: bfd_monitor_mode + - dst_ip: bfd_monitor_dst_ip + - src_ip: bfd_monitor_src_ip + - min_rx: bfd_monitor_min_rx + - min_tx: bfd_monitor_min_tx + - multiplier: bfd_monitor_multiplier + - status: bfd_monitor_status + - auth_type: bfd_monitor_auth_type + - auth_key: bfd_monitor_auth_key + +Response Example +---------------- + +.. literalinclude:: samples/bfd/bfd_monitor-update-response.json + :language: javascript + +Delete BFD monitor +================== + +.. rest_method:: DELETE /v2.0/bfd_monitors/{monitor_id} + +Deletes a BFD monitor. + +Normal response codes: 204 + +Error response codes: 400, 401, 404, 412 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - monitor_id: bfd_monitor_id-path + +Response +-------- + +There is no body content for the response of a successful DELETE request. + +Get BFD monitor session status +============================== + +.. rest_method:: GET /v2.0/bfd_monitors/{monitor_id}/get_bfd_session_status + +Shows BFD monitor's session status. + +Normal response codes: 200 + +Error response codes: 401, 404 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - monitor_id: bfd_monitor_id-path + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - remotes: bfd_monitor_status_remotes + +Response Example +---------------- + +.. literalinclude:: samples/bfd/bfd_monitor_session_status-response.json + :language: javascript + +Get BFD monitor associations +============================ + +.. rest_method:: GET /v2.0/bfd_monitors/{monitor_id}/get_bfd_monitor_associations + +Shows BFD monitor's associations. + +Normal response codes: 200 + +Error response codes: 401, 404 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - monitor_id: bfd_monitor_id-path + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - remotes: bfd_monitor_associations_remotes + +Response Example +---------------- + +.. literalinclude:: samples/bfd/bfd_monitor_association-response.json + :language: javascript \ No newline at end of file diff --git a/api-ref/source/v2/index.rst b/api-ref/source/v2/index.rst index 6a621996d..33f729d5e 100644 --- a/api-ref/source/v2/index.rst +++ b/api-ref/source/v2/index.rst @@ -34,6 +34,7 @@ Layer 3 Networking .. include:: subnetpools.inc .. include:: subnetpool_prefix_ops.inc .. include:: subnets.inc +.. include:: bfd_monitors.inc ######## Security ######## diff --git a/api-ref/source/v2/parameters.yaml b/api-ref/source/v2/parameters.yaml index b268b9e26..649c89098 100644 --- a/api-ref/source/v2/parameters.yaml +++ b/api-ref/source/v2/parameters.yaml @@ -13,6 +13,12 @@ agent_id-path: in: path required: true type: string +bfd_monitor_id-path: + description: | + The ID of the BFD monitor. + in: path + required: true + type: string bgp_speaker_id-path: description: | The ID of the BGP Speaker. @@ -1738,6 +1744,119 @@ bandwidth_limit_rules: in: body required: true type: array +bfd_monitor-obj: + description: | + A list of ``bfd_monitor`` objects. + in: body + required: true + type: object +bfd_monitor_associations_remotes: + description: | + List of dictionaries to list the routes details associated with + the BFD monitor: + + * ``type`` for now it can be ``extra_route``. + * ``router`` is the uuid of the ``router`` of which ``route`` the + monitor is associated with. + * ``extra_route`` is a dict containing the ``destination`` , ``nexthop`` + information. + * ``src_ip`` is the source ip address used as source for transmitted + BFD packets. + in: body + required: false + type: array +bfd_monitor_auth_key: + description: | + A dictionary of authentication key chain in which key is + an integer of ``Auth Key ID`` and value is a string of + ``Password`` or ``Auth Key``. + in: body + required: true + type: string +bfd_monitor_auth_type: + description: | + The Authentication Type, which can be ``password``, ``MD5``, + ``MeticulousMD5``, ``SHA1``, ``MeticulousSHA1``, if empty no + authentication is used. + in: body + required: true + type: string +bfd_monitor_dst_ip: + description: | + The destination IP address to be monitored. + in: body + required: false + type: string +bfd_monitor_id: + description: | + The ID of the BFD monitor. + in: body + required: false + type: string +bfd_monitor_min_rx: + description: | + The shortest interval, in milliseconds, at which this BFD session + offers to receive BFD control messages. At least 1. Default + is 1000. + in: body + required: false + type: string +bfd_monitor_min_tx: + description: | + The shortest interval, in milliseconds, at which this BFD session is + willing to transmit BFD control messages. At least 1. Default + is 100. + in: body + required: false + type: string +bfd_monitor_mode: + description: | + Can be ``asynchronous`` (default common echo mode of BFD) or + ``demand`` (some other mechanism is used to detect link state) + or ``one_arm_echo`` and can accept future modes. + in: body + required: false + type: string +bfd_monitor_multiplier: + description: | + The BFD detection multiplier, An endpoint signals a connectivity + fault if the given number of consecutive BFD control messages fail + to arrive. Default is 3. + in: body + required: false + type: string +bfd_monitor_src_ip: + description: | + IP address used as source for transmitted BFD packets. If empty + then it will be the address of the router interface port. + in: body + required: false + type: string +bfd_monitor_status: + description: | + Shows if the BFD monitor was succesfully created in the backend, + but nothing about the session status, for that the + session_status API endpoint can be used. + in: body + required: false + type: string +bfd_monitor_status_remotes: + description: | + List of dictionaries with the following fields: + + * ``type`` for now it can be``extra_route``. + * ``router`` is the uuid of the ``router`` of which ``route`` the + monitor is associated with. + * ``extra_route`` is a dict containing the ``destination`` , ``nexthop`` + information. + * ``src_ip`` is the source ip address used as source for transmitted + BFD packets. + * ``status`` is a dict containing the following keys: ``SessionState`` + and ``RemoteSessionState``, ``LocalDiagnostic`` and ``RemoteDiagnostic`` + ``LocalDiscriminator`` and ``RemoteDiscriminator``, ``Forwarding``. + in: body + required: false + type: array bgp_peer_auth_type_body: description: | The authentication type for the BGP Peer, can be ``none`` or ``md5``. diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor-create-request.json b/api-ref/source/v2/samples/bfd/bfd_monitor-create-request.json new file mode 100644 index 000000000..de565f1c3 --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor-create-request.json @@ -0,0 +1,8 @@ +{ + "bfd_monitor": { + "name": "bfd_monitor_1", + "description": "My BFD monitor", + "dst_ip": "192.168.100.12", + "src_ip": "169.254.112.144" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor-create-response.json b/api-ref/source/v2/samples/bfd/bfd_monitor-create-response.json new file mode 100644 index 000000000..53d329134 --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor-create-response.json @@ -0,0 +1,18 @@ +{ + "bfd_monitor": { + "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", + "name": "bfd_monitor_1", + "description": "My BFD monitor", + "mode": "asynchronous", + "dst_ip": "192.168.100.12", + "src_ip": "172.24.4.6", + "min_rx": "1000", + "min_tx": "100", + "multiplier": "3", + "status": "DOWN", + "auth_key": "None", + "auth_type": "None" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor-list-response.json b/api-ref/source/v2/samples/bfd/bfd_monitor-list-response.json new file mode 100644 index 000000000..0fe5e6bc3 --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor-list-response.json @@ -0,0 +1,20 @@ +{ + "bfd_monitors": [ + { + "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", + "name": "bfd_monitor_1", + "description": "My BFD monitor", + "mode": "asynchronous", + "dst_ip": "192.168.100.12", + "src_ip": "172.24.4.6", + "min_rx": "1000", + "min_tx": "100", + "multiplier": "3", + "status": "UP", + "auth_key": "None", + "auth_type": "None" + } + ] +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor-show-response.json b/api-ref/source/v2/samples/bfd/bfd_monitor-show-response.json new file mode 100644 index 000000000..20f030400 --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor-show-response.json @@ -0,0 +1,18 @@ +{ + "bfd_monitor": { + "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", + "name": "bfd_monitor_1", + "description": "My BFD monitor", + "mode": "asynchronous", + "dst_ip": "192.168.100.12", + "src_ip": "172.24.4.6", + "min_rx": "1000", + "min_tx": "100", + "multiplier": "3", + "status": "ACTIVE", + "auth_key": "None", + "auth_type": "None" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor-update-request.json b/api-ref/source/v2/samples/bfd/bfd_monitor-update-request.json new file mode 100644 index 000000000..b73f2fefe --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor-update-request.json @@ -0,0 +1,9 @@ +{ + "bfd_monitor": { + "name": "bfd_monitor_1", + "description": "My BFD monitor", + "min_rx": "2000", + "min_tx": "1000", + "multiplier": 4 + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor-update-response.json b/api-ref/source/v2/samples/bfd/bfd_monitor-update-response.json new file mode 100644 index 000000000..53d329134 --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor-update-response.json @@ -0,0 +1,18 @@ +{ + "bfd_monitor": { + "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", + "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", + "name": "bfd_monitor_1", + "description": "My BFD monitor", + "mode": "asynchronous", + "dst_ip": "192.168.100.12", + "src_ip": "172.24.4.6", + "min_rx": "1000", + "min_tx": "100", + "multiplier": "3", + "status": "DOWN", + "auth_key": "None", + "auth_type": "None" + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor_association-response.json b/api-ref/source/v2/samples/bfd/bfd_monitor_association-response.json new file mode 100644 index 000000000..6d9a03820 --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor_association-response.json @@ -0,0 +1,23 @@ +{ + "bfd_monitor_associations": { + "remotes": [{ + "type": "extra_route", + "router": "60dc31ed-9dfc-4294-80b1-6b7876183631", + "extra_route": { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.1" + }, + "src_ip": "169.254.112.144", + "dst_ip": "192.168.100.12", + "status": { + "SessionState": "Up", + "RemoteSessionState": "Up", + "LocalDiagnostic": "", + "RemoteDiagnostic": "", + "LocalDiscriminator": "0x524f0c0f", + "RemoteDiscriminator": "0xc2b5c555", + "Forwarding": "True" + } + }] + } +} \ No newline at end of file diff --git a/api-ref/source/v2/samples/bfd/bfd_monitor_session_status-response.json b/api-ref/source/v2/samples/bfd/bfd_monitor_session_status-response.json new file mode 100644 index 000000000..6af8ebace --- /dev/null +++ b/api-ref/source/v2/samples/bfd/bfd_monitor_session_status-response.json @@ -0,0 +1,13 @@ +{ + "bfd_session_status": { + "remotes": [{ + "type": "extra_route", + "router": "60dc31ed-9dfc-4294-80b1-6b7876183631", + "extra_route": { + "destination": "10.0.3.0/24", + "nexthop": "10.0.0.1" + }, + "src_ip": "169.254.112.144" + }] + } +} \ No newline at end of file diff --git a/neutron_lib/api/definitions/__init__.py b/neutron_lib/api/definitions/__init__.py index c4026bbbc..de53dd32d 100644 --- a/neutron_lib/api/definitions/__init__.py +++ b/neutron_lib/api/definitions/__init__.py @@ -19,6 +19,7 @@ from neutron_lib.api.definitions import allowedaddresspairs 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_filter +from neutron_lib.api.definitions import bfd_monitor from neutron_lib.api.definitions import bgp from neutron_lib.api.definitions import bgp_4byte_asn from neutron_lib.api.definitions import bgp_dragentscheduler @@ -148,6 +149,7 @@ _ALL_API_DEFINITIONS = { auto_allocated_topology, availability_zone, availability_zone_filter, + bfd_monitor, bgp, bgp_4byte_asn, bgp_dragentscheduler, diff --git a/neutron_lib/api/definitions/base.py b/neutron_lib/api/definitions/base.py index 53f1dee89..f617816a9 100644 --- a/neutron_lib/api/definitions/base.py +++ b/neutron_lib/api/definitions/base.py @@ -15,6 +15,8 @@ from neutron_lib import constants KNOWN_ATTRIBUTES = ( 'admin_state_up', + 'auth_key', + 'auth_type', 'allocation_pools', 'cidr', 'default_prefixlen', @@ -23,6 +25,7 @@ KNOWN_ATTRIBUTES = ( 'device_id', 'device_owner', 'dns_nameservers', + 'dst_ip', 'enable_dhcp', 'enable_ndp_proxy', 'fixed_ips', @@ -36,6 +39,10 @@ KNOWN_ATTRIBUTES = ( 'mac_address', 'max_prefixlen', 'min_prefixlen', + 'min_rx', + 'min_tx', + 'mode', + 'multiplier', 'name', 'network_id', 'port_id', @@ -45,10 +52,12 @@ KNOWN_ATTRIBUTES = ( 'qos_policy_id', 'service_types', constants.SHARED, + 'src_ip', 'status', 'subnets', 'subnetpool_id', - 'tenant_id' + 'tenant_id', + 'type' ) KNOWN_RESOURCES = ( diff --git a/neutron_lib/api/definitions/bfd_monitor.py b/neutron_lib/api/definitions/bfd_monitor.py new file mode 100644 index 000000000..bbed670a5 --- /dev/null +++ b/neutron_lib/api/definitions/bfd_monitor.py @@ -0,0 +1,106 @@ +# 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 l3 +from neutron_lib import constants +from neutron_lib.db import constants as db_const + + +ALIAS = 'bfd-monitor' +IS_SHIM_EXTENSION = False +IS_STANDARD_ATTR_EXTENSION = False +NAME = 'BFD monitors for Neutron' +DESCRIPTION = "Provides support for BFD monitors" +UPDATED_TIMESTAMP = "2021-07-26T11:00:00-00:00" +BFD_MONITOR = 'bfd_monitor' +BFD_MONITORS = 'bfd_monitors' +BFD_SESSION_STATUS = 'bfd_session_status' + +BFD_MODE_ASYNC = 'asynchronous' +BFD_MODE_DEMAND = 'demand' +BFD_MODE_ONE_ARM = 'one_arm_echo' + +RESOURCE_ATTRIBUTE_MAP = { + BFD_MONITORS: { + 'id': {'allow_post': False, 'allow_put': False, + 'validate': {'type:uuid': None}, + 'is_visible': True, + 'primary_key': True, + 'enforce_policy': True}, + 'name': {'allow_post': True, 'allow_put': True, + 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, + 'default': '', 'is_filter': True, 'is_sort_key': True, + 'is_visible': True}, + 'description': {'allow_post': True, 'allow_put': True, + 'is_visible': True, 'default': '', + 'validate': { + 'type:string': db_const.DESCRIPTION_FIELD_SIZE}}, + 'project_id': {'allow_post': True, 'allow_put': False, + 'validate': { + 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, + 'required_by_policy': True, + 'is_visible': True, 'enforce_policy': True}, + 'mode': {'allow_post': True, 'allow_put': False, + 'validate': {'type:string': db_const.STATUS_FIELD_SIZE}, + 'default': BFD_MODE_ASYNC, 'is_filter': True, + 'is_sort_key': True, 'is_visible': True}, + 'dst_ip': {'allow_post': True, 'allow_put': False, + 'validate': {'type:ip_address': None}, + 'is_sort_key': True, 'is_filter': True, + 'is_visible': True, 'default': None, + 'enforce_policy': True}, + 'src_ip': {'allow_post': True, 'allow_put': False, + 'validate': {'type:ip_address_or_none': None}, + 'is_sort_key': True, 'is_filter': True, + 'is_visible': True, 'default': None, + 'enforce_policy': True}, + 'min_rx': {'allow_post': True, 'allow_put': True, + 'validate': {'type:non_negative': None}, + 'convert_to': converters.convert_to_int, + 'default': 1000, + 'is_visible': True, 'enforce_policy': True}, + 'min_tx': {'allow_post': True, 'allow_put': True, + 'validate': {'type:non_negative': None}, + 'convert_to': converters.convert_to_int, + 'default': 100, + 'is_visible': True, 'enforce_policy': True}, + 'multiplier': {'allow_post': True, 'allow_put': True, + 'validate': {'type:non_negative': None}, + 'convert_to': converters.convert_to_int, + 'default': 3, + 'is_visible': True, 'enforce_policy': True}, + 'status': {'allow_post': False, 'allow_put': False, + 'is_filter': True, 'is_sort_key': True, + 'is_visible': True}, + 'auth_type': {'allow_post': True, 'allow_put': False, + 'validate': {'type:string_or_none': + db_const.NAME_FIELD_SIZE}, + 'default': constants.ATTR_NOT_SPECIFIED, + 'is_visible': True}, + 'auth_key': {'allow_post': True, 'allow_put': False, + 'validate': {'type:dict_or_none': None}, + 'default': constants.ATTR_NOT_SPECIFIED, + 'is_visible': True}, + }, +} + +SUB_RESOURCE_ATTRIBUTE_MAP = {} +ACTION_MAP = { + BFD_MONITOR: { + 'get_bfd_session_status': 'GET', + 'get_bfd_monitor_associations': 'GET', + } +} +ACTION_STATUS = {} +REQUIRED_EXTENSIONS = [l3.ALIAS] +OPTIONAL_EXTENSIONS = [] diff --git a/neutron_lib/tests/unit/api/definitions/test_bfd.py b/neutron_lib/tests/unit/api/definitions/test_bfd.py new file mode 100644 index 000000000..a123aed5b --- /dev/null +++ b/neutron_lib/tests/unit/api/definitions/test_bfd.py @@ -0,0 +1,19 @@ +# 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 bfd_monitor +from neutron_lib.tests.unit.api.definitions import base + + +class BFDDefinitionTestCase(base.DefinitionBaseTestCase): + extension_module = bfd_monitor + extension_resources = (bfd_monitor.BFD_MONITORS,) diff --git a/releasenotes/notes/bfd_monitor_api_extension-910f5842783e040a.yaml b/releasenotes/notes/bfd_monitor_api_extension-910f5842783e040a.yaml new file mode 100644 index 000000000..765d6f722 --- /dev/null +++ b/releasenotes/notes/bfd_monitor_api_extension-910f5842783e040a.yaml @@ -0,0 +1,12 @@ +--- +features: + - New extension ``bfd-monitor`` to allow creation of bfd_monitor instances, + and managing them. The API definition defines also ``bfd_session_status`` + and ``bfd_monitor_associations`` actions to make possible checking the + session status of the bfd_monitor and its asscociated routes, and listing + the routes associated with the bfd_monitor. + (``Note`` that this API extension was merged as experimental to enable + parallel development of multiple backends. At the moment this API does + not have a reference implementation and should not be considered final. + A later release note will mark when the reference implementation gets + merged and the feauture is ready to be consumed.)