Debian Codegraph @

neutron_lib/api/definitions/qos_pps_rule.py

raw
1 # Copyright (c) 2021 China Unicom Cloud Data Co.,Ltd.
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 import copy
17
18 from neutron_lib.api import converters
19 from neutron_lib.api.definitions import qos as qos_apidef
20 from neutron_lib.api.definitions import qos_bw_minimum_ingress
21 from neutron_lib import constants
22 from neutron_lib.db import constants as db_const
23 from neutron_lib.services.qos import constants as qos_const
24
25
26 ALIAS = 'qos-pps'
27 IS_SHIM_EXTENSION = False
28 IS_STANDARD_ATTR_EXTENSION = False
29 NAME = 'QoS Rule Type Packet per Second Extension'
30 API_PREFIX = ''
31 DESCRIPTION = 'Add QoS Rule Type Packet per Second'
32 UPDATED_TIMESTAMP = '2021-05-12T10:00:00-00:00'
33 RESOURCE_ATTRIBUTE_MAP = {}
34 PACKET_RATE_LIMIT_RULES = 'packet_rate_limit_rules'
35 RESOURCE_NAME = 'packet_rate_limit_rule'
36 SUB_RES_ATTR_MAP = copy.deepcopy(
37 qos_apidef.SUB_RESOURCE_ATTRIBUTE_MAP)
38 SUB_RES_ATTR_MAP.update({
39 PACKET_RATE_LIMIT_RULES: {
40 'parent': qos_apidef._PARENT,
41 'parameters': dict(
42 qos_apidef._QOS_RULE_COMMON_FIELDS,
43 **{
44 qos_const.MAX_KPPS: {
45 'allow_post': True, 'allow_put': True,
46 'convert_to': converters.convert_to_int,
47 'is_visible': True,
48 'is_filter': True,
49 'is_sort_key': True,
50 'validate': {
51 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]}
52 },
53 qos_const.MAX_BURST_KPPS: {
54 'allow_post': True, 'allow_put': True,
55 'is_visible': True, 'default': 0,
56 'is_filter': True,
57 'is_sort_key': True,
58 'convert_to': converters.convert_to_int,
59 'validate': {
60 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]}
61 },
62 qos_const.DIRECTION: {
63 'allow_post': True,
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 ),
74 }
75 })
76 SUB_RES_ATTR_MAP.update(
77 qos_bw_minimum_ingress.SUB_RESOURCE_ATTRIBUTE_MAP)
78 SUB_RESOURCE_ATTRIBUTE_MAP = SUB_RES_ATTR_MAP
79 ACTION_MAP = {}
80 REQUIRED_EXTENSIONS = [qos_apidef.ALIAS]
81 OPTIONAL_EXTENSIONS = []
82 ACTION_STATUS = {}