Debian Codegraph @

neutron_lib/api/definitions/qos_rules_alias.py

raw
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 import converters
14 from neutron_lib.api.definitions import qos
15 from neutron_lib.api.definitions import qos_bw_limit_direction
16 from neutron_lib import constants
17 from neutron_lib.db import constants as db_const
18 from neutron_lib.services.qos import constants as q_const
19
20
21 BANDWIDTH_LIMIT_RULES_ALIAS = "alias_bandwidth_limit_rules"
22 DSCP_MARKING_RULES_ALIAS = 'alias_dscp_marking_rules'
23 MIN_BANDWIDTH_RULES_ALIAS = 'alias_minimum_bandwidth_rules'
24
25 _QOS_RULE_COMMON_FIELDS = {
26 'id': {
27 'allow_post': False, 'allow_put': False,
28 'validate': {'type:uuid': None},
29 'is_visible': True,
30 'is_filter': True,
31 'is_sort_key': True,
32 'primary_key': True
33 },
34 'tenant_id': {
35 'allow_post': False, 'allow_put': False,
36 'required_by_policy': True,
37 'is_visible': True
38 }
39 }
40
41 ALIAS = 'qos-rules-alias'
42 IS_SHIM_EXTENSION = False
43 IS_STANDARD_ATTR_EXTENSION = False
44 NAME = 'Quality of Service rules alias API'
45 API_PREFIX = '/' + qos.ALIAS
46 DESCRIPTION = ('API to enable GET, PUT and DELETE operations on QoS policy '
47 'rules without specifying policy ID')
48 UPDATED_TIMESTAMP = '2018-10-07T10:00:00-00:00'
49 RESOURCE_ATTRIBUTE_MAP = {
50 BANDWIDTH_LIMIT_RULES_ALIAS: dict(
51 _QOS_RULE_COMMON_FIELDS,
52 **{q_const.MAX_KBPS: {
53 'allow_post': False, 'allow_put': True,
54 'convert_to': converters.convert_to_int,
55 'is_visible': True,
56 'is_filter': True,
57 'is_sort_key': True,
58 'validate': {
59 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]
60 }
61 },
62 q_const.DIRECTION: {
63 'allow_post': False,
64 'allow_put': True,
65 'is_visible': True,
66 'is_filter': True,
67 'is_sort_key': True,
68 'default': constants.EGRESS_DIRECTION,
69 'validate': {
70 'type:values': constants.VALID_DIRECTIONS
71 }
72 },
73 q_const.MAX_BURST: {
74 'allow_post': False, 'allow_put': True,
75 'is_visible': True, 'default': 0,
76 'is_filter': True,
77 'is_sort_key': True,
78 'convert_to': converters.convert_to_int,
79 'validate': {
80 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]
81 }
82 }}),
83 DSCP_MARKING_RULES_ALIAS: dict(
84 _QOS_RULE_COMMON_FIELDS,
85 **{q_const.DSCP_MARK: {
86 'allow_post': False, 'allow_put': True,
87 'convert_to': converters.convert_to_int,
88 'is_visible': True,
89 'is_filter': True,
90 'is_sort_key': True,
91 'validate': {
92 'type:values': constants.VALID_DSCP_MARKS
93 }
94 }}),
95 MIN_BANDWIDTH_RULES_ALIAS: dict(
96 _QOS_RULE_COMMON_FIELDS,
97 **{q_const.MIN_KBPS: {
98 'allow_post': False, 'allow_put': True,
99 'is_visible': True,
100 'is_filter': True,
101 'is_sort_key': True,
102 'convert_to': converters.convert_to_int,
103 'validate': {
104 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]
105 }
106 },
107 q_const.DIRECTION: {
108 'allow_post': False, 'allow_put': True,
109 'is_visible': True, 'default': constants.EGRESS_DIRECTION,
110 'is_filter': True,
111 'is_sort_key': True,
112 'validate': {
113 'type:values': constants.VALID_DIRECTIONS
114 }
115 }
116 }
117 )
118 }
119 SUB_RESOURCE_ATTRIBUTE_MAP = {}
120 ACTION_MAP = {}
121 REQUIRED_EXTENSIONS = [qos.ALIAS, qos_bw_limit_direction.ALIAS]
122 OPTIONAL_EXTENSIONS = []
123 ACTION_STATUS = {}