| 1 |
# Copyright 2013 VMware, Inc. 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 port |
| 17 |
from neutron_lib.api import validators |
| 18 |
from neutron_lib.api.validators import allowedaddresspairs as addr_validation |
| 19 |
from neutron_lib import constants |
| 20 |
|
| 21 |
validators.add_validator('allowed_address_pairs', |
| 22 |
addr_validation._validate_allowed_address_pairs) |
| 23 |
|
| 24 |
|
| 25 |
ADDRESS_PAIRS = 'allowed_address_pairs' |
| 26 |
ALIAS = 'allowed-address-pairs' |
| 27 |
IS_SHIM_EXTENSION = False |
| 28 |
IS_STANDARD_ATTR_EXTENSION = False |
| 29 |
NAME = 'Allowed Address Pairs' |
| 30 |
API_PREFIX = '' |
| 31 |
DESCRIPTION = 'Provides allowed address pairs' |
| 32 |
UPDATED_TIMESTAMP = '2013-07-23T10:00:00-00:00' |
| 33 |
RESOURCE_NAME = port.RESOURCE_NAME |
| 34 |
COLLECTION_NAME = port.COLLECTION_NAME |
| 35 |
RESOURCE_ATTRIBUTE_MAP = { |
| 36 |
COLLECTION_NAME: { |
| 37 |
ADDRESS_PAIRS: { |
| 38 |
'allow_post': True, 'allow_put': True, |
| 39 |
'convert_to': converters.convert_none_to_empty_list, |
| 40 |
'convert_list_to': |
| 41 |
converters.convert_kvp_list_to_dict, |
| 42 |
'validate': {'type:allowed_address_pairs': None}, |
| 43 |
'enforce_policy': True, |
| 44 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 45 |
'is_visible': True}, |
| 46 |
} |
| 47 |
} |
| 48 |
SUB_RESOURCE_ATTRIBUTE_MAP = {} |
| 49 |
ACTION_MAP = {} |
| 50 |
REQUIRED_EXTENSIONS = [] |
| 51 |
OPTIONAL_EXTENSIONS = [] |
| 52 |
ACTION_STATUS = {} |