| 1 |
# All rights reserved. |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 |
# not use this file except in compliance with the License. You may obtain |
| 5 |
# a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 |
# License for the specific language governing permissions and limitations |
| 13 |
# under the License. |
| 14 |
|
| 15 |
from neutron_lib.api import converters |
| 16 |
from neutron_lib.api.definitions import network |
| 17 |
from neutron_lib import constants |
| 18 |
|
| 19 |
# The alias of the extension. |
| 20 |
ALIAS = 'provider' |
| 21 |
|
| 22 |
# Whether or not this extension is simply signaling behavior to the user |
| 23 |
# or it actively modifies the attribute map. |
| 24 |
IS_SHIM_EXTENSION = False |
| 25 |
|
| 26 |
# Whether the extension is marking the adoption of standardattr model for |
| 27 |
# legacy resources, or introducing new standardattr attributes. False or |
| 28 |
# None if the standardattr model is adopted since the introduction of |
| 29 |
# resource extension. |
| 30 |
# If this is True, the alias for the extension should be prefixed with |
| 31 |
# 'standard-attr-'. |
| 32 |
IS_STANDARD_ATTR_EXTENSION = False |
| 33 |
|
| 34 |
# The name of the extension. |
| 35 |
NAME = 'Provider Network' |
| 36 |
|
| 37 |
# A prefix for API resources. An empty prefix means that the API is going |
| 38 |
# to be exposed at the v2/ level as any other core resource. |
| 39 |
API_PREFIX = '' |
| 40 |
|
| 41 |
# The description of the extension. |
| 42 |
DESCRIPTION = "Expose mapping of virtual networks to physical networks" |
| 43 |
|
| 44 |
# A timestamp of when the extension was introduced. |
| 45 |
UPDATED_TIMESTAMP = "2012-09-07T10:00:00-00:00" |
| 46 |
|
| 47 |
# The name of the resource. |
| 48 |
RESOURCE_NAME = network.RESOURCE_NAME |
| 49 |
|
| 50 |
# The plural for the resource. |
| 51 |
COLLECTION_NAME = network.COLLECTION_NAME |
| 52 |
|
| 53 |
NETWORK_TYPE = 'provider:network_type' |
| 54 |
PHYSICAL_NETWORK = 'provider:physical_network' |
| 55 |
SEGMENTATION_ID = 'provider:segmentation_id' |
| 56 |
ATTRIBUTES = (NETWORK_TYPE, PHYSICAL_NETWORK, SEGMENTATION_ID) |
| 57 |
|
| 58 |
# Common definitions for maximum string field length |
| 59 |
NETWORK_TYPE_MAX_LEN = 32 |
| 60 |
PHYSICAL_NETWORK_MAX_LEN = 64 |
| 61 |
|
| 62 |
RESOURCE_ATTRIBUTE_MAP = { |
| 63 |
COLLECTION_NAME: { |
| 64 |
NETWORK_TYPE: {'allow_post': True, 'allow_put': True, |
| 65 |
'validate': {'type:string': NETWORK_TYPE_MAX_LEN}, |
| 66 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 67 |
'enforce_policy': True, |
| 68 |
'is_filter': True, |
| 69 |
'is_visible': True}, |
| 70 |
PHYSICAL_NETWORK: {'allow_post': True, 'allow_put': True, |
| 71 |
'validate': {'type:string': |
| 72 |
PHYSICAL_NETWORK_MAX_LEN}, |
| 73 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 74 |
'enforce_policy': True, |
| 75 |
'is_filter': True, |
| 76 |
'is_visible': True}, |
| 77 |
SEGMENTATION_ID: {'allow_post': True, 'allow_put': True, |
| 78 |
'convert_to': converters.convert_to_int, |
| 79 |
'enforce_policy': True, |
| 80 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 81 |
'is_filter': True, |
| 82 |
'is_visible': True}, |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
# The subresource attribute map for the extension. It adds child resources |
| 87 |
# to main extension's resource. The subresource map must have a parent and |
| 88 |
# a parameters entry. If an extension does not need such a map, None can |
| 89 |
# be specified (mandatory). |
| 90 |
SUB_RESOURCE_ATTRIBUTE_MAP = None |
| 91 |
|
| 92 |
# The action map: it associates verbs with methods to be performed on |
| 93 |
# the API resource. For example: |
| 94 |
# |
| 95 |
# ACTION_MAP = { |
| 96 |
# RESOURCE_NAME: { |
| 97 |
# 'add_my_foo_bars': 'PUT', |
| 98 |
# 'remove_my_foo_bars': 'PUT', |
| 99 |
# 'get_my_foo_bars': 'GET' |
| 100 |
# } |
| 101 |
# } |
| 102 |
ACTION_MAP = { |
| 103 |
} |
| 104 |
|
| 105 |
# The action status. |
| 106 |
ACTION_STATUS = { |
| 107 |
} |
| 108 |
|
| 109 |
# The list of required extensions. |
| 110 |
REQUIRED_EXTENSIONS = [ |
| 111 |
] |
| 112 |
|
| 113 |
# The list of optional extensions. |
| 114 |
OPTIONAL_EXTENSIONS = [ |
| 115 |
] |