| 1 |
# Copyright (c) 2021 Ericsson Software Technology |
| 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 |
from neutron_lib.api import converters |
| 16 |
from neutron_lib.api.definitions import qos |
| 17 |
from neutron_lib.api.definitions import qos_pps_minimum_rule |
| 18 |
from neutron_lib import constants |
| 19 |
from neutron_lib.db import constants as db_const |
| 20 |
from neutron_lib.services.qos import constants as qos_constants |
| 21 |
|
| 22 |
|
| 23 |
MIN_PACKET_RATE_RULES_ALIAS = 'alias_minimum_packet_rate_rules' |
| 24 |
|
| 25 |
ALIAS = 'qos-pps-minimum-rule-alias' |
| 26 |
IS_SHIM_EXTENSION = False |
| 27 |
IS_STANDARD_ATTR_EXTENSION = False |
| 28 |
NAME = 'QoS minimum packet rate rule alias' |
| 29 |
API_PREFIX = '/' + qos.ALIAS |
| 30 |
DESCRIPTION = ('API to enable GET, PUT and DELETE operations on QoS minimum ' |
| 31 |
'packet rate rule without specifying policy ID') |
| 32 |
UPDATED_TIMESTAMP = '2021-10-22T10:00:00-00:00' |
| 33 |
RESOURCE_ATTRIBUTE_MAP = { |
| 34 |
MIN_PACKET_RATE_RULES_ALIAS: { |
| 35 |
**qos._QOS_RULE_COMMON_FIELDS, |
| 36 |
qos_constants.MIN_KPPS: { |
| 37 |
'allow_post': False, |
| 38 |
'allow_put': True, |
| 39 |
'convert_to': converters.convert_to_int, |
| 40 |
'is_visible': True, |
| 41 |
'is_filter': True, |
| 42 |
'is_sort_key': True, |
| 43 |
'validate': { |
| 44 |
'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]} |
| 45 |
}, |
| 46 |
qos_constants.DIRECTION: { |
| 47 |
'allow_post': False, |
| 48 |
'allow_put': True, |
| 49 |
'is_visible': True, |
| 50 |
'default': constants.EGRESS_DIRECTION, |
| 51 |
'is_filter': True, |
| 52 |
'is_sort_key': True, |
| 53 |
'validate': { |
| 54 |
'type:values': constants.VALID_DIRECTIONS_AND_ANY, |
| 55 |
} |
| 56 |
} |
| 57 |
} |
| 58 |
} |
| 59 |
SUB_RESOURCE_ATTRIBUTE_MAP = {} |
| 60 |
ACTION_MAP = {} |
| 61 |
REQUIRED_EXTENSIONS = [qos.ALIAS, qos_pps_minimum_rule.ALIAS] |
| 62 |
OPTIONAL_EXTENSIONS = [] |
| 63 |
ACTION_STATUS = {} |