summaryrefslogtreecommitdiff
path: root/neutronclient
diff options
context:
space:
mode:
authorPrzemyslaw Szczerbik <przemyslaw.szczerbik@est.tech>2021-10-01 10:01:48 +0200
committerPrzemyslaw Szczerbik <przemyslaw.szczerbik@est.tech>2021-11-19 08:05:56 +0100
commit3b80135a3d364abfaf3b3ead03bae3348627d1b2 (patch)
tree6f3da4b9294e7d1dc13919ee0d89b6ca34a6076e /neutronclient
parent3a65712b451d3eed93cbf7eef773d46c49df6358 (diff)
downloadpython-neutronclient-3b80135a3d364abfaf3b3ead03bae3348627d1b2.tar.gz
Add support for minimum packet rate rule to the client7.7.0
With the introduction of QoS minimum packet rate rule in Neutron, it's important to ensure that tools like Heat support it as well. Unfortunately, Heat still depends on python-neutronclient instead of python-openstackclient. So even though QoS minimum packet rate rule support have been proposed for python-openstackclient [1] and openstacksdk [2], it's still necessary to extend python-neutronclient code. Since Heat uses only the client part, can skip CLI support. [1] https://review.opendev.org/c/openstack/python-openstackclient/+/810559 [2] https://review.opendev.org/c/openstack/openstacksdk/+/810364 Partial-Bug: #1922237 See-Also: https://review.opendev.org/785236 Change-Id: I4f16b963a202a476cd3cd2b69c1dd4e4ee6f0fc7
Diffstat (limited to 'neutronclient')
-rw-r--r--neutronclient/v2_0/client.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py
index c264dfd..f318f3c 100644
--- a/neutronclient/v2_0/client.py
+++ b/neutronclient/v2_0/client.py
@@ -625,6 +625,10 @@ class Client(ClientBase):
"/qos/policies/%s/minimum_bandwidth_rules"
qos_minimum_bandwidth_rule_path = \
"/qos/policies/%s/minimum_bandwidth_rules/%s"
+ qos_minimum_packet_rate_rules_path = \
+ "/qos/policies/%s/minimum_packet_rate_rules"
+ qos_minimum_packet_rate_rule_path = \
+ "/qos/policies/%s/minimum_packet_rate_rules/%s"
qos_rule_types_path = "/qos/rule-types"
qos_rule_type_path = "/qos/rule-types/%s"
flavors_path = "/flavors"
@@ -709,6 +713,7 @@ class Client(ClientBase):
'policies': 'policy',
'bandwidth_limit_rules': 'bandwidth_limit_rule',
'minimum_bandwidth_rules': 'minimum_bandwidth_rule',
+ 'minimum_packet_rate_rules': 'minimum_packet_rate_rule',
'rules': 'rule',
'dscp_marking_rules': 'dscp_marking_rule',
'rule_types': 'rule_type',
@@ -1982,6 +1987,35 @@ class Client(ClientBase):
return self.delete(self.qos_minimum_bandwidth_rule_path %
(policy, rule))
+ def list_minimum_packet_rate_rules(self, policy_id, retrieve_all=True,
+ **_params):
+ """Fetches a list of all minimum packet rate rules for the given policy
+
+ """
+ return self.list('minimum_packet_rate_rules',
+ self.qos_minimum_packet_rate_rules_path %
+ policy_id, retrieve_all, **_params)
+
+ def show_minimum_packet_rate_rule(self, rule, policy, body=None):
+ """Fetches information of a certain minimum packet rate rule."""
+ return self.get(self.qos_minimum_packet_rate_rule_path %
+ (policy, rule), body=body)
+
+ def create_minimum_packet_rate_rule(self, policy, body=None):
+ """Creates a new minimum packet rate rule."""
+ return self.post(self.qos_minimum_packet_rate_rules_path % policy,
+ body=body)
+
+ def update_minimum_packet_rate_rule(self, rule, policy, body=None):
+ """Updates a minimum packet rate rule."""
+ return self.put(self.qos_minimum_packet_rate_rule_path %
+ (policy, rule), body=body)
+
+ def delete_minimum_packet_rate_rule(self, rule, policy):
+ """Deletes a minimum packet rate rule."""
+ return self.delete(self.qos_minimum_packet_rate_rule_path %
+ (policy, rule))
+
def create_flavor(self, body=None):
"""Creates a new Neutron service flavor."""
return self.post(self.flavors_path, body=body)