| 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 |
# not use this file except in compliance with the License. You may obtain |
| 3 |
# a copy of the License at |
| 4 |
# |
| 5 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 6 |
# |
| 7 |
# Unless required by applicable law or agreed to in writing, software |
| 8 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 |
# License for the specific language governing permissions and limitations |
| 11 |
# under the License. |
| 12 |
|
| 13 |
from neutron_lib.api.definitions import taas |
| 14 |
from neutron_lib.db import constants as db_const |
| 15 |
|
| 16 |
|
| 17 |
ALIAS = 'tap-mirror' |
| 18 |
IS_SHIM_EXTENSION = False |
| 19 |
IS_STANDARD_ATTR_EXTENSION = False |
| 20 |
NAME = "Tap as a Service GRE or ERSPAN mirror" |
| 21 |
DESCRIPTION = "Neutron Tap as a Service extension for GRE or ERSPAN mirroring." |
| 22 |
UPDATED_TIMESTAMP = "2023-05-05T11:45:00-00:00" |
| 23 |
RESOURCE_NAME = 'tap_mirror' |
| 24 |
COLLECTION_NAME = 'tap_mirrors' |
| 25 |
|
| 26 |
mirror_types_list = ['erspanv1', 'gre'] |
| 27 |
DIRECTION_SPEC = { |
| 28 |
'type:dict': { |
| 29 |
'IN': {'type:integer': None, 'default': None, 'required': False}, |
| 30 |
'OUT': {'type:integer': None, 'default': None, 'required': False} |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
RESOURCE_ATTRIBUTE_MAP = { |
| 35 |
COLLECTION_NAME: { |
| 36 |
'id': { |
| 37 |
'allow_post': False, 'allow_put': False, |
| 38 |
'validate': {'type:uuid': None}, 'is_visible': True, |
| 39 |
'primary_key': True}, |
| 40 |
'project_id': { |
| 41 |
'allow_post': True, 'allow_put': False, |
| 42 |
'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, |
| 43 |
'required_by_policy': True, 'is_filter': True, |
| 44 |
'is_sort_key': True, 'is_visible': True}, |
| 45 |
'name': { |
| 46 |
'allow_post': True, 'allow_put': True, |
| 47 |
'validate': {'type:string': None}, |
| 48 |
'is_visible': True, 'default': ''}, |
| 49 |
'description': { |
| 50 |
'allow_post': True, 'allow_put': True, |
| 51 |
'validate': {'type:string': None}, |
| 52 |
'is_visible': True, 'default': ''}, |
| 53 |
'port_id': { |
| 54 |
'allow_post': True, 'allow_put': False, |
| 55 |
'validate': {'type:uuid': None}, |
| 56 |
'enforce_policy': True, 'is_visible': True}, |
| 57 |
'directions': { |
| 58 |
'allow_post': True, 'allow_put': False, |
| 59 |
'validate': DIRECTION_SPEC, |
| 60 |
'is_visible': True}, |
| 61 |
'remote_ip': { |
| 62 |
'allow_post': True, 'allow_put': False, |
| 63 |
'validate': {'type:ip_address': None}, |
| 64 |
'is_visible': True}, |
| 65 |
'mirror_type': { |
| 66 |
'allow_post': True, 'allow_put': False, |
| 67 |
'validate': {'type:values': mirror_types_list}, |
| 68 |
'is_visible': True}, |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
SUB_RESOURCE_ATTRIBUTE_MAP = None |
| 73 |
ACTION_MAP = {} |
| 74 |
ACTION_STATUS = {} |
| 75 |
REQUIRED_EXTENSIONS = [taas.ALIAS] |
| 76 |
OPTIONAL_EXTENSIONS = [] |