| 1 |
# Copyright (c) 2015 Cisco Systems, 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 network as network_def |
| 17 |
from neutron_lib.api import validators |
| 18 |
from neutron_lib import constants |
| 19 |
|
| 20 |
|
| 21 |
VLANTRANSPARENT = 'vlan_transparent' |
| 22 |
|
| 23 |
|
| 24 |
def get_vlan_transparent(network): |
| 25 |
"""Get the value of vlan_transparent from a network if set. |
| 26 |
|
| 27 |
:param network: The network dict to retrieve the value of vlan_transparent |
| 28 |
from. |
| 29 |
:returns: The value of vlan_transparent from the network dict if set in |
| 30 |
the dict, otherwise False is returned. |
| 31 |
""" |
| 32 |
return (network[VLANTRANSPARENT] |
| 33 |
if (VLANTRANSPARENT in network and |
| 34 |
validators.is_attr_set(network[VLANTRANSPARENT])) |
| 35 |
else False) |
| 36 |
|
| 37 |
|
| 38 |
ALIAS = 'vlan-transparent' |
| 39 |
IS_SHIM_EXTENSION = False |
| 40 |
IS_STANDARD_ATTR_EXTENSION = False |
| 41 |
NAME = 'Vlantransparent' |
| 42 |
API_PREFIX = '' |
| 43 |
DESCRIPTION = 'Provides Vlan Transparent Networks' |
| 44 |
UPDATED_TIMESTAMP = '2015-03-23T09:00:00-00:00' |
| 45 |
RESOURCE_ATTRIBUTE_MAP = { |
| 46 |
network_def.COLLECTION_NAME: { |
| 47 |
VLANTRANSPARENT: { |
| 48 |
'allow_post': True, |
| 49 |
'allow_put': False, |
| 50 |
'convert_to': converters.convert_to_boolean, |
| 51 |
'default': constants.ATTR_NOT_SPECIFIED, |
| 52 |
'is_visible': True, |
| 53 |
'is_filter': True |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
SUB_RESOURCE_ATTRIBUTE_MAP = {} |
| 58 |
ACTION_MAP = {} |
| 59 |
REQUIRED_EXTENSIONS = [] |
| 60 |
OPTIONAL_EXTENSIONS = [] |
| 61 |
ACTION_STATUS = {} |