Add QoS min pps rule object and CRUD operations
Partial-Bug: #1922237 See-Also: https://review.opendev.org/785236 Change-Id: Ibde213f047d8c8cac8f54c418713703c3e6a40ee
This commit is contained in:
parent
e720330455
commit
3e84351cb8
doc/source/user
openstack
network/v2
tests
functional/network/v2
unit/network/v2
releasenotes/notes
@ -119,6 +119,12 @@ QoS Operations
|
|||||||
get_qos_minimum_bandwidth_rule,
|
get_qos_minimum_bandwidth_rule,
|
||||||
find_qos_minimum_bandwidth_rule,
|
find_qos_minimum_bandwidth_rule,
|
||||||
qos_minimum_bandwidth_rules,
|
qos_minimum_bandwidth_rules,
|
||||||
|
create_qos_minimum_packet_rate_rule,
|
||||||
|
update_qos_minimum_packet_rate_rule,
|
||||||
|
delete_qos_minimum_packet_rate_rule,
|
||||||
|
get_qos_minimum_packet_rate_rule,
|
||||||
|
find_qos_minimum_packet_rate_rule,
|
||||||
|
qos_minimum_packet_rate_rules,
|
||||||
create_qos_bandwidth_limit_rule,
|
create_qos_bandwidth_limit_rule,
|
||||||
update_qos_bandwidth_limit_rule,
|
update_qos_bandwidth_limit_rule,
|
||||||
delete_qos_bandwidth_limit_rule,
|
delete_qos_bandwidth_limit_rule,
|
||||||
|
@ -30,6 +30,7 @@ Network Resources
|
|||||||
v2/qos_bandwidth_limit_rule
|
v2/qos_bandwidth_limit_rule
|
||||||
v2/qos_dscp_marking_rule
|
v2/qos_dscp_marking_rule
|
||||||
v2/qos_minimum_bandwidth_rule
|
v2/qos_minimum_bandwidth_rule
|
||||||
|
v2/qos_minimum_packet_rate_rule
|
||||||
v2/qos_policy
|
v2/qos_policy
|
||||||
v2/qos_rule_type
|
v2/qos_rule_type
|
||||||
v2/quota
|
v2/quota
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
openstack.network.v2.qos_minimum_packet_rate_rule
|
||||||
|
=================================================
|
||||||
|
|
||||||
|
.. automodule:: openstack.network.v2.qos_minimum_packet_rate_rule
|
||||||
|
|
||||||
|
The QoSMinimumPacketRateRule Class
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
The ``QoSMinimumPacketRateRule`` class inherits from
|
||||||
|
:class:`~openstack.resource.Resource`.
|
||||||
|
|
||||||
|
.. autoclass:: openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule
|
||||||
|
:members:
|
@ -48,6 +48,8 @@ from openstack.network.v2 import qos_dscp_marking_rule as \
|
|||||||
_qos_dscp_marking_rule
|
_qos_dscp_marking_rule
|
||||||
from openstack.network.v2 import qos_minimum_bandwidth_rule as \
|
from openstack.network.v2 import qos_minimum_bandwidth_rule as \
|
||||||
_qos_minimum_bandwidth_rule
|
_qos_minimum_bandwidth_rule
|
||||||
|
from openstack.network.v2 import qos_minimum_packet_rate_rule as \
|
||||||
|
_qos_minimum_packet_rate_rule
|
||||||
from openstack.network.v2 import qos_policy as _qos_policy
|
from openstack.network.v2 import qos_policy as _qos_policy
|
||||||
from openstack.network.v2 import qos_rule_type as _qos_rule_type
|
from openstack.network.v2 import qos_rule_type as _qos_rule_type
|
||||||
from openstack.network.v2 import quota as _quota
|
from openstack.network.v2 import quota as _quota
|
||||||
@ -2715,6 +2717,132 @@ class Proxy(proxy.Proxy):
|
|||||||
QoSMinimumBandwidthRule, qos_rule,
|
QoSMinimumBandwidthRule, qos_rule,
|
||||||
qos_policy_id=policy.id, **attrs)
|
qos_policy_id=policy.id, **attrs)
|
||||||
|
|
||||||
|
def create_qos_minimum_packet_rate_rule(self, qos_policy, **attrs):
|
||||||
|
"""Create a new minimum packet rate rule
|
||||||
|
|
||||||
|
:param dict attrs: Keyword arguments which will be used to create a
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`,
|
||||||
|
comprised of the properties on the QoSMinimumPacketRateRule class.
|
||||||
|
:param qos_policy: The value can be the ID of the QoS policy that the
|
||||||
|
rule belongs or a
|
||||||
|
:class:`~openstack.network.v2.qos_policy.QoSPolicy` instance.
|
||||||
|
|
||||||
|
:returns: The results of resource creation
|
||||||
|
:rtype:
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
"""
|
||||||
|
policy = self._get_resource(_qos_policy.QoSPolicy, qos_policy)
|
||||||
|
return self._create(
|
||||||
|
_qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
qos_policy_id=policy.id, **attrs)
|
||||||
|
|
||||||
|
def delete_qos_minimum_packet_rate_rule(self, qos_rule, qos_policy,
|
||||||
|
ignore_missing=True):
|
||||||
|
"""Delete a minimum packet rate rule
|
||||||
|
|
||||||
|
:param qos_rule: The value can be either the ID of a minimum packet
|
||||||
|
rate rule or a
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
instance.
|
||||||
|
:param qos_policy: The value can be the ID of the QoS policy that the
|
||||||
|
rule belongs or a
|
||||||
|
:class:`~openstack.network.v2.qos_policy.QoSPolicy` instance.
|
||||||
|
:param bool ignore_missing: When set to ``False``
|
||||||
|
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
|
||||||
|
the resource does not exist. When set to ``True``, no exception
|
||||||
|
will be set when attempting to delete a nonexistent minimum packet
|
||||||
|
rate rule.
|
||||||
|
|
||||||
|
:returns: ``None``
|
||||||
|
"""
|
||||||
|
policy = self._get_resource(_qos_policy.QoSPolicy, qos_policy)
|
||||||
|
self._delete(_qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
qos_rule, ignore_missing=ignore_missing,
|
||||||
|
qos_policy_id=policy.id)
|
||||||
|
|
||||||
|
def find_qos_minimum_packet_rate_rule(self, qos_rule_id, qos_policy,
|
||||||
|
ignore_missing=True, **args):
|
||||||
|
"""Find a minimum packet rate rule
|
||||||
|
|
||||||
|
:param qos_rule_id: The ID of a minimum packet rate rule.
|
||||||
|
:param qos_policy: The value can be the ID of the QoS policy that the
|
||||||
|
rule belongs or a
|
||||||
|
:class:`~openstack.network.v2.qos_policy.QoSPolicy` instance.
|
||||||
|
:param bool ignore_missing: When set to ``False``
|
||||||
|
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
|
||||||
|
the resource does not exist. When set to ``True``, None will be
|
||||||
|
returned when attempting to find a nonexistent resource.
|
||||||
|
:param dict args: Any additional parameters to be passed into
|
||||||
|
underlying methods. such as query filters.
|
||||||
|
:returns: One
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
or None
|
||||||
|
"""
|
||||||
|
policy = self._get_resource(_qos_policy.QoSPolicy, qos_policy)
|
||||||
|
return self._find(
|
||||||
|
_qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
qos_rule_id, ignore_missing=ignore_missing,
|
||||||
|
qos_policy_id=policy.id, **args)
|
||||||
|
|
||||||
|
def get_qos_minimum_packet_rate_rule(self, qos_rule, qos_policy):
|
||||||
|
"""Get a single minimum packet rate rule
|
||||||
|
|
||||||
|
:param qos_rule: The value can be the ID of a minimum packet rate rule
|
||||||
|
or a
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
instance.
|
||||||
|
:param qos_policy: The value can be the ID of the QoS policy that the
|
||||||
|
rule belongs or a
|
||||||
|
:class:`~openstack.network.v2.qos_policy.QoSPolicy` instance.
|
||||||
|
:returns: One
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
|
||||||
|
resource can be found.
|
||||||
|
"""
|
||||||
|
policy = self._get_resource(_qos_policy.QoSPolicy, qos_policy)
|
||||||
|
return self._get(
|
||||||
|
_qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
qos_rule, qos_policy_id=policy.id)
|
||||||
|
|
||||||
|
def qos_minimum_packet_rate_rules(self, qos_policy, **query):
|
||||||
|
"""Return a generator of minimum packet rate rules
|
||||||
|
|
||||||
|
:param qos_policy: The value can be the ID of the QoS policy that the
|
||||||
|
rule belongs or a
|
||||||
|
:class:`~openstack.network.v2.qos_policy.QoSPolicy` instance.
|
||||||
|
:param kwargs query: Optional query parameters to be sent to limit the
|
||||||
|
resources being returned.
|
||||||
|
:returns: A generator of minimum packet rate rule objects
|
||||||
|
:rtype:
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
"""
|
||||||
|
policy = self._get_resource(_qos_policy.QoSPolicy, qos_policy)
|
||||||
|
return self._list(
|
||||||
|
_qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
qos_policy_id=policy.id, **query)
|
||||||
|
|
||||||
|
def update_qos_minimum_packet_rate_rule(self, qos_rule, qos_policy,
|
||||||
|
**attrs):
|
||||||
|
"""Update a minimum packet rate rule
|
||||||
|
|
||||||
|
:param qos_rule: Either the id of a minimum packet rate rule or a
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
instance.
|
||||||
|
:param qos_policy: The value can be the ID of the QoS policy that the
|
||||||
|
rule belongs or a
|
||||||
|
:class:`~openstack.network.v2.qos_policy.QoSPolicy` instance.
|
||||||
|
:attrs kwargs: The attributes to update on the minimum packet rate rule
|
||||||
|
represented by ``value``.
|
||||||
|
|
||||||
|
:returns: The updated minimum packet rate rule
|
||||||
|
:rtype:
|
||||||
|
:class:`~openstack.network.v2.qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule`
|
||||||
|
"""
|
||||||
|
policy = self._get_resource(_qos_policy.QoSPolicy, qos_policy)
|
||||||
|
return self._update(_qos_minimum_packet_rate_rule.
|
||||||
|
QoSMinimumPacketRateRule, qos_rule,
|
||||||
|
qos_policy_id=policy.id, **attrs)
|
||||||
|
|
||||||
def create_qos_policy(self, **attrs):
|
def create_qos_policy(self, **attrs):
|
||||||
"""Create a new QoS policy from attributes
|
"""Create a new QoS policy from attributes
|
||||||
|
|
||||||
|
37
openstack/network/v2/qos_minimum_packet_rate_rule.py
Normal file
37
openstack/network/v2/qos_minimum_packet_rate_rule.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
from openstack import resource
|
||||||
|
|
||||||
|
|
||||||
|
class QoSMinimumPacketRateRule(resource.Resource):
|
||||||
|
resource_key = 'minimum_packet_rate_rule'
|
||||||
|
resources_key = 'minimum_packet_rate_rules'
|
||||||
|
base_path = '/qos/policies/%(qos_policy_id)s/minimum_packet_rate_rules'
|
||||||
|
|
||||||
|
_allow_unknown_attrs_in_body = True
|
||||||
|
|
||||||
|
# capabilities
|
||||||
|
allow_create = True
|
||||||
|
allow_fetch = True
|
||||||
|
allow_commit = True
|
||||||
|
allow_delete = True
|
||||||
|
allow_list = True
|
||||||
|
|
||||||
|
# Properties
|
||||||
|
#: Traffic direction from the tenant point of view. Valid values: ('any',
|
||||||
|
#: 'egress', 'ingress')
|
||||||
|
direction = resource.Body('direction')
|
||||||
|
#: Minimum packet rate in kpps.
|
||||||
|
min_kpps = resource.Body('min_kpps')
|
||||||
|
#: The ID of the QoS policy who owns rule.
|
||||||
|
qos_policy_id = resource.URI('qos_policy_id')
|
@ -0,0 +1,89 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
from openstack.network.v2 import (qos_minimum_packet_rate_rule as
|
||||||
|
_qos_minimum_packet_rate_rule)
|
||||||
|
from openstack.tests.functional import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestQoSMinimumPacketRateRule(base.BaseFunctionalTest):
|
||||||
|
|
||||||
|
QOS_POLICY_ID = None
|
||||||
|
QOS_IS_SHARED = False
|
||||||
|
QOS_POLICY_DESCRIPTION = "QoS policy description"
|
||||||
|
RULE_ID = None
|
||||||
|
RULE_MIN_KPPS = 1200
|
||||||
|
RULE_MIN_KPPS_NEW = 1800
|
||||||
|
RULE_DIRECTION = 'egress'
|
||||||
|
RULE_DIRECTION_NEW = 'ingress'
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestQoSMinimumPacketRateRule, self).setUp()
|
||||||
|
self.QOS_POLICY_NAME = self.getUniqueString()
|
||||||
|
qos_policy = self.conn.network.create_qos_policy(
|
||||||
|
description=self.QOS_POLICY_DESCRIPTION,
|
||||||
|
name=self.QOS_POLICY_NAME,
|
||||||
|
shared=self.QOS_IS_SHARED,
|
||||||
|
)
|
||||||
|
self.QOS_POLICY_ID = qos_policy.id
|
||||||
|
qos_min_pps_rule = (
|
||||||
|
self.conn.network.create_qos_minimum_packet_rate_rule(
|
||||||
|
self.QOS_POLICY_ID, direction=self.RULE_DIRECTION,
|
||||||
|
min_kpps=self.RULE_MIN_KPPS))
|
||||||
|
assert isinstance(
|
||||||
|
qos_min_pps_rule,
|
||||||
|
_qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule)
|
||||||
|
self.assertEqual(self.RULE_MIN_KPPS, qos_min_pps_rule.min_kpps)
|
||||||
|
self.assertEqual(self.RULE_DIRECTION, qos_min_pps_rule.direction)
|
||||||
|
self.RULE_ID = qos_min_pps_rule.id
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
rule = self.conn.network.delete_qos_minimum_packet_rate_rule(
|
||||||
|
self.RULE_ID,
|
||||||
|
self.QOS_POLICY_ID)
|
||||||
|
qos_policy = self.conn.network.delete_qos_policy(self.QOS_POLICY_ID)
|
||||||
|
self.assertIsNone(rule)
|
||||||
|
self.assertIsNone(qos_policy)
|
||||||
|
super(TestQoSMinimumPacketRateRule, self).tearDown()
|
||||||
|
|
||||||
|
def test_find(self):
|
||||||
|
sot = self.conn.network.find_qos_minimum_packet_rate_rule(
|
||||||
|
self.RULE_ID,
|
||||||
|
self.QOS_POLICY_ID)
|
||||||
|
self.assertEqual(self.RULE_ID, sot.id)
|
||||||
|
self.assertEqual(self.RULE_DIRECTION, sot.direction)
|
||||||
|
self.assertEqual(self.RULE_MIN_KPPS, sot.min_kpps)
|
||||||
|
|
||||||
|
def test_get(self):
|
||||||
|
sot = self.conn.network.get_qos_minimum_packet_rate_rule(
|
||||||
|
self.RULE_ID,
|
||||||
|
self.QOS_POLICY_ID)
|
||||||
|
self.assertEqual(self.RULE_ID, sot.id)
|
||||||
|
self.assertEqual(self.QOS_POLICY_ID, sot.qos_policy_id)
|
||||||
|
self.assertEqual(self.RULE_DIRECTION, sot.direction)
|
||||||
|
self.assertEqual(self.RULE_MIN_KPPS, sot.min_kpps)
|
||||||
|
|
||||||
|
def test_list(self):
|
||||||
|
rule_ids = [o.id for o in
|
||||||
|
self.conn.network.qos_minimum_packet_rate_rules(
|
||||||
|
self.QOS_POLICY_ID)]
|
||||||
|
self.assertIn(self.RULE_ID, rule_ids)
|
||||||
|
|
||||||
|
def test_update(self):
|
||||||
|
sot = self.conn.network.update_qos_minimum_packet_rate_rule(
|
||||||
|
self.RULE_ID,
|
||||||
|
self.QOS_POLICY_ID,
|
||||||
|
min_kpps=self.RULE_MIN_KPPS_NEW,
|
||||||
|
direction=self.RULE_DIRECTION_NEW)
|
||||||
|
self.assertEqual(self.RULE_MIN_KPPS_NEW, sot.min_kpps)
|
||||||
|
self.assertEqual(self.RULE_DIRECTION_NEW, sot.direction)
|
@ -45,6 +45,7 @@ from openstack.network.v2 import port_forwarding
|
|||||||
from openstack.network.v2 import qos_bandwidth_limit_rule
|
from openstack.network.v2 import qos_bandwidth_limit_rule
|
||||||
from openstack.network.v2 import qos_dscp_marking_rule
|
from openstack.network.v2 import qos_dscp_marking_rule
|
||||||
from openstack.network.v2 import qos_minimum_bandwidth_rule
|
from openstack.network.v2 import qos_minimum_bandwidth_rule
|
||||||
|
from openstack.network.v2 import qos_minimum_packet_rate_rule
|
||||||
from openstack.network.v2 import qos_policy
|
from openstack.network.v2 import qos_policy
|
||||||
from openstack.network.v2 import qos_rule_type
|
from openstack.network.v2 import qos_rule_type
|
||||||
from openstack.network.v2 import quota
|
from openstack.network.v2 import quota
|
||||||
@ -952,29 +953,70 @@ class TestNetworkQosMinimumBandwidth(TestNetworkProxy):
|
|||||||
'qos_policy_id': QOS_POLICY_ID, 'foo': 'bar'})
|
'qos_policy_id': QOS_POLICY_ID, 'foo': 'bar'})
|
||||||
|
|
||||||
|
|
||||||
class TestNetworkQosPolicy(TestNetworkProxy):
|
class TestNetworkQosMinimumPacketRate(TestNetworkProxy):
|
||||||
def test_qos_policy_create_attrs(self):
|
def test_qos_minimum_packet_rate_rule_create_attrs(self):
|
||||||
self.verify_create(self.proxy.create_qos_policy, qos_policy.QoSPolicy)
|
self.verify_create(
|
||||||
|
self.proxy.create_qos_minimum_packet_rate_rule,
|
||||||
|
qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||||
|
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||||
|
|
||||||
def test_qos_policy_delete(self):
|
def test_qos_minimum_packet_rate_rule_delete(self):
|
||||||
self.verify_delete(self.proxy.delete_qos_policy, qos_policy.QoSPolicy,
|
self.verify_delete(
|
||||||
False)
|
self.proxy.delete_qos_minimum_packet_rate_rule,
|
||||||
|
qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
ignore_missing=False,
|
||||||
|
method_args=["resource_or_id", QOS_POLICY_ID],
|
||||||
|
expected_args=["resource_or_id"],
|
||||||
|
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||||
|
|
||||||
def test_qos_policy_delete_ignore(self):
|
def test_qos_minimum_packet_rate_rule_delete_ignore(self):
|
||||||
self.verify_delete(self.proxy.delete_qos_policy, qos_policy.QoSPolicy,
|
self.verify_delete(
|
||||||
True)
|
self.proxy.delete_qos_minimum_packet_rate_rule,
|
||||||
|
qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
ignore_missing=True,
|
||||||
|
method_args=["resource_or_id", QOS_POLICY_ID],
|
||||||
|
expected_args=["resource_or_id"],
|
||||||
|
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||||
|
|
||||||
def test_qos_policy_find(self):
|
def test_qos_minimum_packet_rate_rule_find(self):
|
||||||
self.verify_find(self.proxy.find_qos_policy, qos_policy.QoSPolicy)
|
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||||
|
self._verify(
|
||||||
|
'openstack.proxy.Proxy._find',
|
||||||
|
self.proxy.find_qos_minimum_packet_rate_rule,
|
||||||
|
method_args=['rule_id', policy],
|
||||||
|
expected_args=[
|
||||||
|
qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
'rule_id'],
|
||||||
|
expected_kwargs={
|
||||||
|
'ignore_missing': True, 'qos_policy_id': QOS_POLICY_ID})
|
||||||
|
|
||||||
def test_qos_policy_get(self):
|
def test_qos_minimum_packet_rate_rule_get(self):
|
||||||
self.verify_get(self.proxy.get_qos_policy, qos_policy.QoSPolicy)
|
self.verify_get(
|
||||||
|
self.proxy.get_qos_minimum_packet_rate_rule,
|
||||||
|
qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||||
|
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||||
|
|
||||||
def test_qos_policies(self):
|
def test_qos_minimum_packet_rate_rules(self):
|
||||||
self.verify_list(self.proxy.qos_policies, qos_policy.QoSPolicy)
|
self.verify_list(
|
||||||
|
self.proxy.qos_minimum_packet_rate_rules,
|
||||||
|
qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
method_kwargs={'qos_policy': QOS_POLICY_ID},
|
||||||
|
expected_kwargs={'qos_policy_id': QOS_POLICY_ID})
|
||||||
|
|
||||||
def test_qos_policy_update(self):
|
def test_qos_minimum_packet_rate_rule_update(self):
|
||||||
self.verify_update(self.proxy.update_qos_policy, qos_policy.QoSPolicy)
|
policy = qos_policy.QoSPolicy.new(id=QOS_POLICY_ID)
|
||||||
|
self._verify(
|
||||||
|
'openstack.network.v2._proxy.Proxy._update',
|
||||||
|
self.proxy.update_qos_minimum_packet_rate_rule,
|
||||||
|
method_args=['rule_id', policy],
|
||||||
|
method_kwargs={'foo': 'bar'},
|
||||||
|
expected_args=[
|
||||||
|
qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule,
|
||||||
|
'rule_id'],
|
||||||
|
expected_kwargs={
|
||||||
|
'qos_policy_id': QOS_POLICY_ID, 'foo': 'bar'})
|
||||||
|
|
||||||
|
|
||||||
class TestNetworkQosRuleType(TestNetworkProxy):
|
class TestNetworkQosRuleType(TestNetworkProxy):
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
from openstack.network.v2 import qos_minimum_packet_rate_rule
|
||||||
|
from openstack.tests.unit import base
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLE = {
|
||||||
|
'id': 'IDENTIFIER',
|
||||||
|
'qos_policy_id': 'qos-policy-' + uuid.uuid4().hex,
|
||||||
|
'min_kpps': 1500,
|
||||||
|
'direction': 'any',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestQoSMinimumPacketRateRule(base.TestCase):
|
||||||
|
|
||||||
|
def test_basic(self):
|
||||||
|
sot = qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule()
|
||||||
|
self.assertEqual('minimum_packet_rate_rule', sot.resource_key)
|
||||||
|
self.assertEqual('minimum_packet_rate_rules', sot.resources_key)
|
||||||
|
self.assertEqual(
|
||||||
|
'/qos/policies/%(qos_policy_id)s/minimum_packet_rate_rules',
|
||||||
|
sot.base_path)
|
||||||
|
self.assertTrue(sot.allow_create)
|
||||||
|
self.assertTrue(sot.allow_fetch)
|
||||||
|
self.assertTrue(sot.allow_commit)
|
||||||
|
self.assertTrue(sot.allow_delete)
|
||||||
|
self.assertTrue(sot.allow_list)
|
||||||
|
|
||||||
|
def test_make_it(self):
|
||||||
|
sot = qos_minimum_packet_rate_rule.QoSMinimumPacketRateRule(**EXAMPLE)
|
||||||
|
self.assertEqual(EXAMPLE['id'], sot.id)
|
||||||
|
self.assertEqual(EXAMPLE['qos_policy_id'], sot.qos_policy_id)
|
||||||
|
self.assertEqual(EXAMPLE['min_kpps'], sot.min_kpps)
|
||||||
|
self.assertEqual(EXAMPLE['direction'], sot.direction)
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added QoS minimum packet rate rule object and introduced support for CRUD
|
||||||
|
operations.
|
Loading…
x
Reference in New Issue
Block a user