Merge "bgpvpn-vni api extension"

This commit is contained in:
Jenkins 2017-10-05 09:49:58 +00:00 committed by Gerrit Code Review
commit 772a0e612c
13 changed files with 168 additions and 5 deletions

View File

@ -55,6 +55,7 @@ Response Parameters
- routers: bgpvpn-routers-required
- ports: bgpvpn-ports
- local_pref: bgpvpn-local_pref
- vni: bgpvpn-vni-required
- tenant_id: project_id
- project_id: project_id
@ -87,6 +88,7 @@ Request
- import_targets: bgpvpn-import_targets
- export_targets: bgpvpn-export_targets
- local_pref: bgpvpn-local_pref-request
- vni: bgpvpn-vni
- tenant_id: tenant_id-request
- project_id: project_id-request
- type: bgpvpn-type
@ -113,6 +115,7 @@ Response Parameters
- routers: bgpvpn-routers-required
- ports: bgpvpn-ports
- local_pref: bgpvpn-local_pref
- vni: bgpvpn-vni-required
- tenant_id: project_id
- project_id: project_id
@ -157,6 +160,7 @@ Response Parameters
- routers: bgpvpn-routers-required
- ports: bgpvpn-ports
- local_pref: bgpvpn-local_pref
- vni: bgpvpn-vni-required
- tenant_id: project_id
- project_id: project_id
@ -216,6 +220,7 @@ Response Parameters
- routers: bgpvpn-routers-required
- ports: bgpvpn-ports
- local_pref: bgpvpn-local_pref
- vni: bgpvpn-vni-required
- tenant_id: project_id
- project_id: project_id

View File

@ -50,6 +50,27 @@ Valid strings for a Route Target or a Route Distinguisher are the following:
- <4-byte AS#>:<16bit-number>
- <4-byte IPv4>:<16bit-number>
On VXLAN VNI
============
.. note:: This feature is under development in the Queens release
VXLAN is one option among others that could be used for BGP E-VPNs.
When VXLAN is used on a hardware platform the use of a locally-assigned id
may not be always possible which introduces the need to configure a
globally-assigned VXLAN VNI.
The optional ``vni`` attribute is an admin-only parameter and allows the
admin to enforce the use of a chosen globally-assigned VXLAN VNI for the
said BGPVPN.
The default when no VNI is specified and the VXLAN encapsulation is used, is
to let the backend choose the VNI in advertised routes, and use the VNI in
received routes for transmitted traffic. The backend will conform to
E-VPN overlay specs.
Valid range for the ``vni`` attribute is [1, 2\ :sup:`24`\ -1].
Control of routes advertised to BGPVPNs
=======================================

View File

@ -945,6 +945,18 @@ bgpvpn-type-required:
in: body
required: true
type: string
bgpvpn-vni:
description: |
The globally-assigned VXLAN ``vni`` for the BGP VPN.
in: body
required: false
type: integer
bgpvpn-vni-required:
description: |
The globally-assigned VXLAN ``vni`` for the BGP VPN.
in: body
required: true
type: integer
bgpvpns:
description: |
A list of ``bgpvpn`` objects. Each ``bgpvpn`` object represents an

View File

@ -5,6 +5,7 @@
"import_targets": "64512:1555",
"export_targets": "64512:1666",
"route_distinguishers": ["64512:1777", "64512:1888", "64512:1999"],
"type": "l3"
"type": "l3",
"vni": 1000
}
}

View File

@ -21,6 +21,7 @@
"type": "l3",
"id": "0f9d472a-908f-40f5-8574-b4e8a63ccbf0",
"networks": [],
"local_pref": null
"local_pref": null,
"vni": 1000
}
}

View File

@ -13,6 +13,7 @@
"networks": [
"a4f2b8df-cb42-4893-a333-d0b5c36ade17"
],
"local_pref": null
"local_pref": null,
"vni": 1000
}
}

View File

@ -12,6 +12,7 @@
"type": "l3",
"id": "4d627abf-06dd-45ab-920b-8e61422bb984",
"networks": [],
"local_pref": null
"local_pref": null,
"vni": 1000
}
}

View File

@ -22,7 +22,8 @@
"type": "l3",
"id": "0f9d472a-908f-40f5-8574-b4e8a63ccbf0",
"networks": [],
"local_pref": null
"local_pref": null,
"vni": 1000
}
]
}

View File

@ -17,6 +17,7 @@ from neutron_lib.api.definitions import auto_allocated_topology
from neutron_lib.api.definitions import availability_zone
from neutron_lib.api.definitions import bgpvpn
from neutron_lib.api.definitions import bgpvpn_routes_control
from neutron_lib.api.definitions import bgpvpn_vni
from neutron_lib.api.definitions import data_plane_status
from neutron_lib.api.definitions import default_subnetpools
from neutron_lib.api.definitions import dns
@ -69,6 +70,7 @@ _ALL_API_DEFINITIONS = {
availability_zone,
bgpvpn,
bgpvpn_routes_control,
bgpvpn_vni,
data_plane_status,
default_subnetpools,
dns,

View File

@ -125,6 +125,7 @@ KNOWN_EXTENSIONS = (
'fwaas_v2',
'bgpvpn', # https://git.openstack.org/cgit/openstack/networking-bgpvpn
'bgpvpn-routes-control',
'bgpvpn-vni',
)
KNOWN_KEYWORDS = (

View File

@ -0,0 +1,86 @@
#
# Copyright 2017 Ericsson India Global Services Pvt Ltd. 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 import converters as lib_converters
from neutron_lib.api.definitions import bgpvpn
from neutron_lib import constants
VNI = 'vni'
# The alias of the extension.
ALIAS = 'bgpvpn-vni'
# The label to lookup the plugin in the plugin directory. It can match the
# alias, as required.
LABEL = ALIAS
# 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 = 'BGPVPN VXLAN VNI extension'
# A prefix for API resources. An empty prefix means that the API is going
# to be exposed at the v2/ level as any other core resource.
API_PREFIX = ''
# The description of the extension.
DESCRIPTION = "BGPVPN VXLAN VNI extension"
# A timestamp of when the extension was introduced.
UPDATED_TIMESTAMP = "2017-09-12T10:00:00-00:00"
RESOURCE_ATTRIBUTE_MAP = {
bgpvpn.COLLECTION_NAME: {
VNI: {'allow_post': True, 'allow_put': False,
'convert_to': lib_converters.convert_to_int_if_not_none,
'validate': {'type:range_or_none': [constants.MIN_VXLAN_VNI,
constants.MAX_VXLAN_VNI]
},
'is_visible': True, 'enforce_policy': 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 = {}
# The action map: it associates verbs with methods to be performed on
# the API resource.
ACTION_MAP = {}
# The action status.
ACTION_STATUS = {
}
# The list of required extensions.
REQUIRED_EXTENSIONS = [bgpvpn.ALIAS]
# The list of optional extensions.
OPTIONAL_EXTENSIONS = []

View File

@ -0,0 +1,25 @@
#
# Copyright 2017 Ericsson India Global Services Pvt Ltd. 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 bgpvpn
from neutron_lib.api.definitions import bgpvpn_vni
from neutron_lib.tests.unit.api.definitions import base
class BgpvpnDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = bgpvpn_vni
extension_resources = (bgpvpn.COLLECTION_NAME,)
extension_attributes = (bgpvpn_vni.VNI,)

View File

@ -0,0 +1,6 @@
---
features:
- |
The ``bgpvpn-vni`` API extension adds the ``vni`` optional attribute to
``bgpvpn`` objects to control the VXLAN VNI when VXLAN encapsulation
is used.