From 49940ba417ad143f562151f76f8c3cdd7933cc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awek=20Kap=C5=82o=C5=84ski?= Date: Sat, 29 Apr 2017 09:07:20 +0000 Subject: [PATCH] Adjust qos supported rules to Neutron In Neutron in patch I75bd18b3a1875daa5639dd141fb7bbd6e1c54118 list of supported_rules was changed from list of rule types to dict with rule types and available parameters and values. Additionally parameter `direction` was introduced for qos_bandwidth_limit rule type in Neutron in Ia13568879c2b6f80fb190ccafe7e19ca05b0c6a8 By default each rule has got EGRESS direction so this value of direction is supported by existing qos_driver. Change-Id: I1584703a5e43638a3a5f6b96c35614c203c03584 Depends-On: Ia13568879c2b6f80fb190ccafe7e19ca05b0c6a8 Related-Bug: #1586056 Related-Bug: #1560961 --- vmware_nsx/services/qos/nsx_v/driver.py | 16 ++++++++++++++-- vmware_nsx/services/qos/nsx_v3/driver.py | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/vmware_nsx/services/qos/nsx_v/driver.py b/vmware_nsx/services/qos/nsx_v/driver.py index 4b49918fd5..dcc82f06a5 100644 --- a/vmware_nsx/services/qos/nsx_v/driver.py +++ b/vmware_nsx/services/qos/nsx_v/driver.py @@ -16,13 +16,25 @@ from oslo_log import log as logging +from neutron.common import constants as n_consts from neutron.services.qos.drivers import base from neutron.services.qos import qos_consts LOG = logging.getLogger(__name__) DRIVER = None -SUPPORTED_RULES = [qos_consts.RULE_TYPE_BANDWIDTH_LIMIT, - qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH] +SUPPORTED_RULES = { + qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: { + qos_consts.MAX_KBPS: { + 'type:range': [0, n_consts.DB_INTEGER_MAX_VALUE]}, + qos_consts.MAX_BURST: { + 'type:range': [0, n_consts.DB_INTEGER_MAX_VALUE]}, + qos_consts.DIRECTION: { + 'type:values': [n_consts.EGRESS_DIRECTION]} + }, + qos_consts.RULE_TYPE_DSCP_MARKING: { + qos_consts.DSCP_MARK: {'type:values': n_consts.VALID_DSCP_MARKS} + } +} class NSXvQosDriver(base.DriverBase): diff --git a/vmware_nsx/services/qos/nsx_v3/driver.py b/vmware_nsx/services/qos/nsx_v3/driver.py index 715411be70..1c3478d83f 100644 --- a/vmware_nsx/services/qos/nsx_v3/driver.py +++ b/vmware_nsx/services/qos/nsx_v3/driver.py @@ -16,6 +16,7 @@ from oslo_log import log as logging +from neutron.common import constants as n_consts from neutron.services.qos.drivers import base from neutron.services.qos import qos_consts @@ -25,8 +26,19 @@ LOG = logging.getLogger(__name__) DRIVER = None -SUPPORTED_RULES = [qos_consts.RULE_TYPE_BANDWIDTH_LIMIT, - qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH] +SUPPORTED_RULES = { + qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: { + qos_consts.MAX_KBPS: { + 'type:range': [0, n_consts.DB_INTEGER_MAX_VALUE]}, + qos_consts.MAX_BURST: { + 'type:range': [0, n_consts.DB_INTEGER_MAX_VALUE]}, + qos_consts.DIRECTION: { + 'type:values': [n_consts.EGRESS_DIRECTION]} + }, + qos_consts.RULE_TYPE_DSCP_MARKING: { + qos_consts.DSCP_MARK: {'type:values': n_consts.VALID_DSCP_MARKS} + } +} class NSXv3QosDriver(base.DriverBase):