Debian Codegraph @

neutron_lib/api/definitions/l3_ext_gw_multihoming.py

raw
1 # Copyright 2023 Canonical Ltd.
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 import copy
16 import typing
17
18 from neutron_lib.api.definitions import l3
19 from neutron_lib.api.definitions import l3_ext_gw_mode
20
21 EXTERNAL_GATEWAYS = 'external_gateways'
22
23 ALIAS = 'external-gateway-multihoming'
24 IS_SHIM_EXTENSION = False
25 IS_STANDARD_ATTR_EXTENSION = False
26 NAME = 'Neutron L3 External Gateway Multihoming'
27 API_PREFIX = ''
28 DESCRIPTION = 'Allow multiple external gateway ports per router'
29 UPDATED_TIMESTAMP = '2023-01-18T00:00:00-00:00'
30 RESOURCE_NAME = l3.ROUTER
31 COLLECTION_NAME = l3.ROUTERS
32
33 external_gw_info_validate: dict[str, typing.Any] = copy.deepcopy(
34 l3_ext_gw_mode.RESOURCE_ATTRIBUTE_MAP[COLLECTION_NAME][l3.EXTERNAL_GW_INFO]
35 ['validate']['type:dict_or_nodata']
36 )
37 RESOURCE_ATTRIBUTE_MAP = {
38 COLLECTION_NAME: {
39 EXTERNAL_GATEWAYS: {
40 'allow_post': False,
41 'allow_put': False,
42 'is_visible': True,
43 'default': None,
44 'enforce_policy': True,
45 'validate': {
46 'type:list_of_dict_or_nodata': external_gw_info_validate
47 },
48 },
49 },
50 }
51 SUB_RESOURCE_ATTRIBUTE_MAP = {}
52 ACTION_MAP = l3.ACTION_MAP
53 ACTION_MAP[l3.ROUTER].update({
54 'add_external_gateways': 'PUT',
55 'update_external_gateways': 'PUT',
56 'remove_external_gateways': 'PUT',
57 })
58 REQUIRED_EXTENSIONS = [l3.ALIAS, l3_ext_gw_mode.ALIAS]
59 OPTIONAL_EXTENSIONS = []
60 ACTION_STATUS = {}