'interconnection' API extension definition (neutron-interconnection)

Adds definition for 'interconnection' API extension for
neutron-interconnection project.

This patch partially implements the following spec:
https://specs.openstack.org/openstack/neutron-specs/specs/rocky/neutron-inter.html

Signed-off-by: Thomas Morin <thomas.morin@orange.com>
Submitted on behalf of a third-party: Orange

Change-Id: I7c16ffb21f88de88ab80a19d91b898be53419514
This commit is contained in:
ythomas1 2018-08-08 15:43:10 +02:00
parent 044ca8e3e4
commit 888a28d598
14 changed files with 583 additions and 0 deletions

View File

@ -84,6 +84,10 @@ BGP/MPLS VPN Interconnection
Logging
#######
.. include:: logging.inc
###############################
Neutron-Neutron Interconnection
###############################
.. include:: interconnection.inc
#################
Networking Agents
#################

View File

@ -0,0 +1,237 @@
.. -*- rst -*-
===============================
Neutron-Neutron Interconnection
===============================
Introduces a new ``interconnection`` resource.
When an interconnection is created by a tenant, parameters specific to the
interconnection mechanism (``local_parameters`` and ``remote_parameters``) are
only visible by the admin or users with specific role (default role:
``neutron_interconnection_peer``).
Creates, modifies, and deletes Neutron-Neutron interconnections.
List interconnections
=====================
.. rest_method:: GET /v2.0/interconnection/interconnections
Lists all interconnections belonging to the project.
Use the ``fields`` query parameter to control which fields are
returned in the response body. Additionally, you can filter results
by using query string parameters. For information, see `Filtering
and Column Selection <https://wiki.openstack.org/wiki/Neutron/APIv2
-specification#Filtering_and_Column_Selection>`__.
Normal response codes: 200
Error response codes: 400, 401, 403
Request
-------
.. rest_parameters:: parameters.yaml
- fields: fields
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- interconnections: interconnections
- project_id: project_id
- id: interconnection-id-body
- name: interconnection-name-required
- type: interconnection-type-required
- state: interconnection-state
- local_resource_id: interconnection-local_resource_id
- remote_resource_id: interconnection-remote_resource_id
- remote_keystone: interconnection-remote_keystone
- remote_region: interconnection-remote_region
- remote_interconnection_id: interconnection-remote_interconnection_id
- local_parameters: interconnection-local_parameters
- remote_parameters: interconnection-remote_parameters
Response Example
----------------
.. literalinclude:: samples/interconnection/interconnections-list-response.json
:language: javascript
Create interconnection
======================
.. rest_method:: POST /v2.0/interconnection/interconnections
Creates an interconnection.
Normal response codes: 201
Error response codes: 400, 401, 403
Request
-------
.. rest_parameters:: parameters.yaml
- interconnection: interconnection
- project_id: project_id-request
- name: interconnection-name
- type: interconnection-type
- local_resource_id: interconnection-local_resource_id
- remote_resource_id: interconnection-remote_resource_id
- remote_keystone: interconnection-remote_keystone
- remote_region: interconnection-remote_region
Request Example
---------------
.. literalinclude:: samples/interconnection/interconnection-create-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- interconnection: interconnection
- project_id: project_id
- id: interconnection-id-body
- name: interconnection-name-required
- type: interconnection-type-required
- state: interconnection-state
- local_resource_id: interconnection-local_resource_id
- remote_resource_id: interconnection-remote_resource_id
- remote_keystone: interconnection-remote_keystone
- remote_region: interconnection-remote_region
- remote_interconnection_id: interconnection-remote_interconnection_id
- local_parameters: interconnection-local_parameters
- remote_parameters: interconnection-remote_parameters
Response Example
----------------
.. literalinclude:: samples/interconnection/interconnection-create-response.json
:language: javascript
Show interconnection details
============================
.. rest_method:: GET /v2.0/interconnection/interconnections/{interconnection_id}
Shows an interconnection details.
Normal response codes: 200
Error response codes: 401, 403, 404
Request
-------
.. rest_parameters:: parameters.yaml
- interconnection_id: interconnection-id-path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- interconnection: interconnection
- project_id: project_id
- id: interconnection-id-body
- name: interconnection-name-required
- type: interconnection-type-required
- state: interconnection-state
- local_resource_id: interconnection-local_resource_id
- remote_resource_id: interconnection-remote_resource_id
- remote_keystone: interconnection-remote_keystone
- remote_region: interconnection-remote_region
- remote_interconnection_id: interconnection-remote_interconnection_id
- local_parameters: interconnection-local_parameters
- remote_parameters: interconnection-remote_parameters
Response Example
----------------
.. literalinclude:: samples/interconnection/interconnection-show-response.json
:language: javascript
Update an interconnection
=========================
.. rest_method:: PUT /v2.0/interconnection/interconnections/{interconnection_id}
Updates an interconnection.
Normal response codes: 201
Error response codes: 400, 401, 403, 404
Request
-------
A user can only update the name parameter.
.. rest_parameters:: parameters.yaml
- interconnection_id: interconnection-id-path
- interconnection: interconnection
- name: interconnection-name
Request Example
---------------
.. literalinclude:: samples/interconnection/interconnection-update-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- interconnection: interconnection
- project_id: project_id
- id: interconnection-id-body
- name: interconnection-name-required
- type: interconnection-type-required
- state: interconnection-state
- local_resource_id: interconnection-local_resource_id
- remote_resource_id: interconnection-remote_resource_id
- remote_keystone: interconnection-remote_keystone
- remote_region: interconnection-remote_region
- remote_interconnection_id: interconnection-remote_interconnection_id
- local_parameters: interconnection-local_parameters
- remote_parameters: interconnection-remote_parameters
Response Example
----------------
.. literalinclude:: samples/interconnection/interconnection-update-response.json
:language: javascript
Delete interconnection
======================
.. rest_method:: DELETE /v2.0/interconnection/interconnections/{interconnection_id}
Deletes an interconnection.
Normal response codes: 204
Error response codes: 401, 403, 404
Request
-------
.. rest_parameters:: parameters.yaml
- interconnection_id: interconnection-id-path
Response
--------
There is no body content for the response of a successful DELETE request.

View File

@ -133,6 +133,12 @@ ikepolicy_id-path:
in: path
required: true
type: string
interconnection-id-path:
description: |
The ID of the interconnection.
in: path
required: true
type: string
ipsecpolicy_id-path:
description: |
The ID of the IPsec policy.
@ -3407,6 +3413,104 @@ insert_before:
in: body
required: false
type: string
interconnection:
description: |
An ``interconnection`` object.
in: body
required: true
type: object
interconnection-id-body:
description: |
The ID of the ``interconnection``.
in: body
required: true
type: string
interconnection-local_parameters:
description: |
Parameters specific to local interconnection mechanism, represented by a
dict with a type (``bgpvpn``, ``vxlan``, etc...) key and corresponding
identifier (BGPVPN RT, VNI, etc...) value.
in: body
required: false
type: dict
interconnection-local_resource_id:
description: |
The ID of the local Neutron resource (network or router) to interconnect
with remote Neutron resource.
in: body
required: true
type: string
interconnection-name:
description: |
Name of the ``interconnection``.
in: body
required: false
type: string
interconnection-name-required:
description: |
Name of the ``interconnection``.
in: body
required: true
type: string
interconnection-remote_interconnection_id:
description: |
ID of the symmetric ``interconnection`` exchanged with remote Neutron.
in: body
required: true
type: string
interconnection-remote_keystone:
description: |
``auth_url`` of the remote Keystone service.
in: body
required: false
type: string
interconnection-remote_parameters:
description: |
Parameters specific to remote interconnection mechanism exchanged with
remote Neutron, represented by a dict with a type (``bgpvpn``, ``vxlan``,
etc...) key and corresponding identifier (BGPVPN RT, VNI, etc...) value.
in: body
required: false
type: dict
interconnection-remote_region:
description: |
Remote region name.
in: body
required: false
type: string
interconnection-remote_resource_id:
description: |
The ID of the remote Neutron resource (network or router) to interconnect
with local Neutron resource.
in: body
required: true
type: string
interconnection-state:
description: |
Indicates the state of the ``interconnection``.
in: body
required: true
type: string
interconnection-type:
description: |
Selection of the type of interconnection. Allowed values are ``network_l2``,
``network_l3`` or ``router``. Default is ``network_l3``.
in: body
required: false
type: string
interconnection-type-required:
description: |
Selection of the type of interconnection. Allowed values are ``network_l2``,
``network_l3`` or ``router``. Default is ``network_l3``.
in: body
required: true
type: string
interconnections:
description: |
A list of ``interconnection`` objects.
in: body
required: true
type: array
interfaces:
description: |
Router interfaces

View File

@ -0,0 +1,11 @@
{
"interconnection": {
"project_id": "5455570dafa34c32abb69c70005a57de",
"name": "interconnection1",
"type": "network_l3",
"local_resource_id": "5d6820bf-a528-4e0c-85df-c2e771368d55",
"remote_resource_id": "a02d408d-7493-4291-b7bc-56894d063693",
"remote_keystone": "http://10.0.0.100/identity",
"remote_region": "RegionOne"
}
}

View File

@ -0,0 +1,14 @@
{
"interconnection": {
"id": "1bdffef1-fc49-4299-b9b5-005a2861e716",
"project_id": "5455570dafa34c32abb69c70005a57de",
"name": "interconnection1",
"type": "network_l3",
"state": "TO_VALIDATE",
"local_resource_id": "5d6820bf-a528-4e0c-85df-c2e771368d55",
"remote_resource_id": "a02d408d-7493-4291-b7bc-56894d063693",
"remote_keystone": "http://10.0.0.100/identity",
"remote_region": "RegionOne",
"remote_interconnection_id": null
}
}

View File

@ -0,0 +1,16 @@
{
"interconnection": {
"id": "1bdffef1-fc49-4299-b9b5-005a2861e716",
"project_id": "5455570dafa34c32abb69c70005a57de",
"name": "interconnection1",
"type": "router",
"state": "ACTIVE",
"local_resource_id": "5d6820bf-a528-4e0c-85df-c2e771368d55",
"remote_resource_id": "a02d408d-7493-4291-b7bc-56894d063693",
"remote_keystone": "http://10.0.0.100/identity",
"remote_region": "RegionOne",
"remote_interconnection_id": "5f063750-ad6d-4bbe-8b82-aeb49d48ce2d",
"local_parameters": {"bgpvpn": "64512:10"},
"remote_parameters": {"bgpvpn": "64512:20"}
}
}

View File

@ -0,0 +1,5 @@
{
"interconnection": {
"name": "foo"
}
}

View File

@ -0,0 +1,16 @@
{
"interconnection": {
"id": "1bdffef1-fc49-4299-b9b5-005a2861e716",
"project_id": "5455570dafa34c32abb69c70005a57de",
"name": "foo",
"type": "network_l2",
"state": "VALIDATED",
"local_resource_id": "5d6820bf-a528-4e0c-85df-c2e771368d55",
"remote_resource_id": "a02d408d-7493-4291-b7bc-56894d063693",
"remote_keystone": "http://10.0.0.100/identity",
"remote_region": "RegionOne",
"remote_interconnection_id": "5f063750-ad6d-4bbe-8b82-aeb49d48ce2d",
"local_parameters": {"bgpvpn": "64512:10"},
"remote_parameters": {}
}
}

View File

@ -0,0 +1,18 @@
{
"interconnections": [
{
"id": "1bdffef1-fc49-4299-b9b5-005a2861e716",
"project_id": "5455570dafa34c32abb69c70005a57de",
"name": "interconnection1",
"type": "router",
"state": "ACTIVE",
"local_resource_id": "5d6820bf-a528-4e0c-85df-c2e771368d55",
"remote_resource_id": "a02d408d-7493-4291-b7bc-56894d063693",
"remote_keystone": "http://10.0.0.100/identity",
"remote_region": "RegionOne",
"remote_interconnection_id": "5f063750-ad6d-4bbe-8b82-aeb49d48ce2d",
"local_parameters": {"bgpvpn": "64512:10"},
"remote_parameters": {"bgpvpn": "64512:20"}
}
]
}

View File

@ -46,6 +46,7 @@ from neutron_lib.api.definitions import floating_ip_port_forwarding
from neutron_lib.api.definitions import floatingip_autodelete_internal
from neutron_lib.api.definitions import floatingip_pools
from neutron_lib.api.definitions import flowclassifier
from neutron_lib.api.definitions import interconnection
from neutron_lib.api.definitions import ip_allocation
from neutron_lib.api.definitions import ip_substring_port_filtering
from neutron_lib.api.definitions import l2_adjacency
@ -143,6 +144,7 @@ _ALL_API_DEFINITIONS = {
floating_ip_port_forwarding,
floatingip_autodelete_internal,
floatingip_pools,
interconnection,
ip_allocation,
ip_substring_port_filtering,
l2_adjacency,

View File

@ -160,6 +160,9 @@ KNOWN_EXTENSIONS = (
# http://git.openstack.org/cgit/openstack/networking-sfc:
'flow_classifier',
'sfc',
# http://git.openstack.org/cgit/openstack/neutron-interconnection:
'interconnection',
)
KNOWN_KEYWORDS = (

View File

@ -0,0 +1,125 @@
# 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 l3
from neutron_lib.db import constants as db_const
# The alias of the extension.
ALIAS = 'interconnection'
# Whether or not this extension is simply signaling behavior to the user
# or it actively modifies the attribute map.
IS_SHIM_EXTENSION = False
# Whether the extension is marking the adoption of standardattr model for
# legacy resources, or introducing new standardattr attributes. False or
# None if the standardattr model is adopted since the introduction of
# resource extension.
# If this is True, the alias for the extension should be prefixed with
# 'standard-attr-'.
IS_STANDARD_ATTR_EXTENSION = False
# The name of the extension.
NAME = 'Neutron-Neutron Interconnection'
# The description of the extension.
DESCRIPTION = "Provides support for Neutron-Neutron Interconnections"
# A timestamp of when the extension was introduced.
UPDATED_TIMESTAMP = "2019-01-14T16:30:00-00:00"
API_PREFIX = 'interconnection'
# The specific resources and/or attributes for the extension (optional).
RESOURCE_NAME = 'interconnection'
COLLECTION_NAME = 'interconnections'
NETWORK_L2 = 'network_l2'
NETWORK_L3 = 'network_l3'
VALID_TYPES = [l3.ROUTER, NETWORK_L2, NETWORK_L3]
# The resource attribute map for the extension.
RESOURCE_ATTRIBUTE_MAP = {
COLLECTION_NAME: {
'id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid': None},
'is_filter': True, 'is_sort_key': True,
'is_visible': True,
'primary_key': True},
'project_id': {'allow_post': True, 'allow_put': False,
'validate': {
'type:string': db_const.PROJECT_ID_FIELD_SIZE},
'required_by_policy': True,
'is_filter': True, 'is_sort_key': True,
'is_visible': True},
'name': {'allow_post': True, 'allow_put': True,
'default': '',
'validate': {'type:string': db_const.NAME_FIELD_SIZE},
'is_filter': True, 'is_sort_key': True,
'is_visible': True},
'type': {'allow_post': True, 'allow_put': False,
'validate': {'type:values': VALID_TYPES},
'is_filter': True, 'is_sort_key': True,
'is_visible': True},
'state': {'allow_post': False, 'allow_put': False,
'is_filter': True, 'is_sort_key': True,
'is_visible': True},
'local_resource_id': {'allow_post': True, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True},
'remote_resource_id': {'allow_post': True, 'allow_put': False,
'validate': {'type:uuid': None},
'is_visible': True},
'remote_keystone': {'allow_post': True, 'allow_put': False,
'validate': {'type:string_or_none': None},
'is_visible': True},
'remote_region': {'allow_post': True, 'allow_put': False,
'validate': {'type:string_or_none': None},
'is_visible': True},
'remote_interconnection_id': {'allow_post': False, 'allow_put': False,
'validate': {'type:uuid_or_none': None},
'is_visible': True},
'local_parameters': {'allow_post': False, 'allow_put': False,
'is_visible': True},
'remote_parameters': {'allow_post': False, 'allow_put': False,
'is_visible': True}
},
}
# The subresource attribute map for the extension. It adds child resources
# to main extension's resource. The subresource map must have a parent and
# a parameters entry. If an extension does not need such a map, None can
# be specified (mandatory).
SUB_RESOURCE_ATTRIBUTE_MAP = None
# The action map: it associates verbs with methods to be performed on
# the API resource.
ACTION_MAP = {
RESOURCE_NAME: {
'refresh': 'PUT'
}
}
# The action status.
ACTION_STATUS = {
}
# The list of required extensions.
REQUIRED_EXTENSIONS = [
l3.ALIAS
]
# The list of optional extensions.
OPTIONAL_EXTENSIONS = [
]

View File

@ -0,0 +1,24 @@
# 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 interconnection
from neutron_lib.tests.unit.api.definitions import base
class InterconnectionDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = interconnection
extension_resources = (interconnection.COLLECTION_NAME,)
extension_attributes = ('type', 'state',
'local_resource_id', 'remote_resource_id',
'remote_keystone', 'remote_region',
'remote_interconnection_id', 'local_parameters',
'remote_parameters')

View File

@ -0,0 +1,4 @@
---
features:
- Adds definition of ``interconnection`` API extension for
neutron-interconnection project.