Debian Codegraph @

neutron_lib/api/definitions/l3_conntrack_helper.py

raw
1 # Copyright (c) 2019 OpenStack Foundation
2 # All rights reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 from neutron_lib.api import converters
17 from neutron_lib.api.definitions import l3
18 from neutron_lib import constants
19 from neutron_lib.db import constants as db_const
20
21 PROTOCOLS = constants.IPTABLES_PROTOCOL_MAP.keys()
22
23 # The alias of the extension.
24 ALIAS = 'l3-conntrack-helper'
25
26 # Whether or not this extension is simply signaling behavior to the user
27 # or it actively modifies the attribute map.
28 IS_SHIM_EXTENSION = False
29
30 # Whether the extension is marking the adoption of standardattr model for
31 # legacy resources, or introducing new standardattr attributes. False or
32 # None if the standardattr model is adopted since the introduction of
33 # resource extension.
34 # If this is True, the alias for the extension should be prefixed with
35 # 'standard-attr-'.
36 IS_STANDARD_ATTR_EXTENSION = False
37
38 # The name of the extension.
39 NAME = 'L3 Conntrack helper'
40
41 # A prefix for API resources. An empty prefix means that the API is going
42 # to be exposed at the v2/ level as any other core resource.
43 API_PREFIX = '/' + l3.ROUTERS
44
45 # The description of the extension.
46 DESCRIPTION = "Allow adding CT target rules for conntrack helper"
47
48 # A timestamp of when the extension was introduced.
49 UPDATED_TIMESTAMP = "2019-04-04T10:00:00-00:00"
50
51 # The name of the resource.
52 RESOURCE_NAME = 'conntrack_helper'
53
54 # The plural for the resource.
55 COLLECTION_NAME = 'conntrack_helpers'
56
57 # parent
58 PARENT_RESOURCE_NAME = l3.ROUTER
59 PARENT_COLLECTION_NAME = l3.ROUTERS
60
61 ID = 'id'
62 PROJECT_ID = 'project_id'
63 PROTOCOL = 'protocol'
64 PORT = 'port'
65 HELPER = 'helper'
66 RESOURCE_ATTRIBUTE_MAP = {}
67
68 # The subresource attribute map for the extension. It adds child resources
69 # to main extension's resource. The subresource map must have a parent and
70 # a parameters entry. If an extension does not need such a map, None can
71 # be specified (mandatory).
72 SUB_RESOURCE_ATTRIBUTE_MAP = {
73 COLLECTION_NAME: {
74 'parent': {'collection_name': PARENT_COLLECTION_NAME,
75 'member_name': PARENT_RESOURCE_NAME},
76 'parameters': {
77 ID: {'allow_post': False,
78 'allow_put': False,
79 'validate': {'type:uuid': None},
80 'is_visible': True,
81 'primary_key': True,
82 'is_sort_key': True,
83 'is_filter': True},
84 PROJECT_ID: {'allow_post': True,
85 'allow_put': False,
86 'validate': {
87 'type:string': db_const.PROJECT_ID_FIELD_SIZE},
88 'required_by_policy': True,
89 'is_visible': False},
90 PROTOCOL: {'allow_post': True, 'allow_put': True,
91 'validate': {'type:values': PROTOCOLS},
92 'is_visible': True,
93 'convert_to': converters.convert_to_protocol,
94 'is_sort_key': True,
95 'is_filter': True},
96 PORT: {'allow_post': True, 'allow_put': True,
97 'convert_to': converters.convert_to_int,
98 'validate': {'type:range': [1, 65535]},
99 'is_visible': True,
100 'is_sort_key': True,
101 'is_filter': True},
102 HELPER: {'allow_post': True, 'allow_put': True,
103 'convert_to': converters.convert_to_string,
104 'validate': {'type:string': 64},
105 'is_visible': True,
106 'is_sort_key': True,
107 'is_filter': True},
108 }
109 }
110 }
111
112 # The action map: it associates verbs with methods to be performed on
113 # the API resource.
114 ACTION_MAP = {
115 }
116
117 # The action status.
118 ACTION_STATUS = {
119 }
120
121 # The list of required extensions.
122 REQUIRED_EXTENSIONS = [l3.ALIAS]
123
124 # The list of optional extensions.
125 OPTIONAL_EXTENSIONS = [
126 ]