| 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.api.definitions import port |
| 18 |
from neutron_lib import constants |
| 19 |
|
| 20 |
|
| 21 |
DEFAULT_PORT_SECURITY = True |
| 22 |
|
| 23 |
PORTSECURITY = 'port_security_enabled' |
| 24 |
|
| 25 |
# The alias of the extension. |
| 26 |
ALIAS = 'port-security' |
| 27 |
|
| 28 |
# Whether or not this extension is simply signaling behavior to the user |
| 29 |
# or it actively modifies the attribute map. |
| 30 |
IS_SHIM_EXTENSION = False |
| 31 |
|
| 32 |
# Whether the extension is marking the adoption of standardattr model for |
| 33 |
# legacy resources, or introducing new standardattr attributes. False or |
| 34 |
# None if the standardattr model is adopted since the introduction of |
| 35 |
# resource extension. |
| 36 |
# If this is True, the alias for the extension should be prefixed with |
| 37 |
# 'standard-attr-'. |
| 38 |
IS_STANDARD_ATTR_EXTENSION = False |
| 39 |
|
| 40 |
# The name of the extension. |
| 41 |
NAME = 'Port Security' |
| 42 |
|
| 43 |
# A prefix for API resources. An empty prefix means that the API is going |
| 44 |
# to be exposed at the v2/ level as any other core resource. |
| 45 |
API_PREFIX = '' |
| 46 |
|
| 47 |
# The description of the extension. |
| 48 |
DESCRIPTION = "Provides port security" |
| 49 |
|
| 50 |
# A timestamp of when the extension was introduced. |
| 51 |
UPDATED_TIMESTAMP = "2012-07-23T10:00:00-00:00" |
| 52 |
|
| 53 |
|
| 54 |
RESOURCE_ATTRIBUTE_MAP = { |
| 55 |
network.COLLECTION_NAME: { |
| 56 |
PORTSECURITY: {'allow_post': True, 'allow_put': True, |
| 57 |
'convert_to': converters.convert_to_boolean, |
| 58 |
'enforce_policy': True, |
| 59 |
'default': DEFAULT_PORT_SECURITY, |
| 60 |
'is_visible': True}, |
| 61 |
}, |
| 62 |
port.COLLECTION_NAME: { |
| 63 |
PORTSECURITY: {'allow_post': True, 'allow_put': True, |
| 64 |
'convert_to': converters.convert_to_boolean, |
| 65 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 66 |
'enforce_policy': True, |
| 67 |
'is_visible': True}, |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
# The subresource attribute map for the extension. It adds child resources |
| 72 |
# to main extension's resource. The subresource map must have a parent and |
| 73 |
# a parameters entry. If an extension does not need such a map, None can |
| 74 |
# be specified (mandatory). |
| 75 |
SUB_RESOURCE_ATTRIBUTE_MAP = {} |
| 76 |
|
| 77 |
# The action map: it associates verbs with methods to be performed on |
| 78 |
# the API resource. |
| 79 |
ACTION_MAP = {} |
| 80 |
|
| 81 |
# The action status. |
| 82 |
ACTION_STATUS = { |
| 83 |
} |
| 84 |
|
| 85 |
# The list of required extensions. |
| 86 |
REQUIRED_EXTENSIONS = [] |
| 87 |
|
| 88 |
# The list of optional extensions. |
| 89 |
OPTIONAL_EXTENSIONS = [] |