Merge "QoS min pps API tests"
This commit is contained in:
commit
d48e1d709c
@ -24,6 +24,7 @@ from tempest.lib.services.identity.v2 import tenants_client
|
||||
from tempest.lib.services.identity.v3 import projects_client
|
||||
from tempest.lib.services.network import qos_limit_bandwidth_rules_client
|
||||
from tempest.lib.services.network import qos_minimum_bandwidth_rules_client
|
||||
from tempest.lib.services.network import qos_minimum_packet_rate_rules_client
|
||||
|
||||
from neutron_tempest_plugin import config
|
||||
from neutron_tempest_plugin.services.network.json import network_client
|
||||
@ -114,6 +115,17 @@ class Manager(clients.ServiceClients):
|
||||
build_timeout=CONF.network.build_timeout,
|
||||
**self.default_params)
|
||||
|
||||
self.qos_minimum_packet_rate_rules_client = \
|
||||
qos_minimum_packet_rate_rules_client.\
|
||||
QosMinimumPacketRateRulesClient(
|
||||
self.auth_provider,
|
||||
CONF.network.catalog_type,
|
||||
CONF.network.region or CONF.identity.region,
|
||||
endpoint_type=CONF.network.endpoint_type,
|
||||
build_interval=CONF.network.build_interval,
|
||||
build_timeout=CONF.network.build_timeout,
|
||||
**self.default_params)
|
||||
|
||||
def _set_identity_clients(self):
|
||||
params = {
|
||||
'service': CONF.identity.catalog_type,
|
||||
|
@ -1376,6 +1376,226 @@ class QosMinimumBandwidthRuleTestJSON(base.BaseAdminNetworkTest):
|
||||
self.assertNotIn(rule2['id'], rules_ids)
|
||||
|
||||
|
||||
class QosMinimumPpsRuleTestJSON(base.BaseAdminNetworkTest):
|
||||
RULE_NAME = qos_consts.RULE_TYPE_MINIMUM_PACKET_RATE + "_rule"
|
||||
RULES_NAME = RULE_NAME + "s"
|
||||
required_extensions = [qos_apidef.ALIAS]
|
||||
|
||||
@classmethod
|
||||
@utils.requires_ext(service='network',
|
||||
extension='port-resource-request-groups')
|
||||
def resource_setup(cls):
|
||||
super(QosMinimumPpsRuleTestJSON, cls).resource_setup()
|
||||
|
||||
@classmethod
|
||||
def setup_clients(cls):
|
||||
super(QosMinimumPpsRuleTestJSON, cls).setup_clients()
|
||||
cls.min_pps_client = cls.os_admin.qos_minimum_packet_rate_rules_client
|
||||
cls.min_pps_client_primary = \
|
||||
cls.os_primary.qos_minimum_packet_rate_rules_client
|
||||
|
||||
def _create_qos_min_pps_rule(self, policy_id, rule_data):
|
||||
rule = self.min_pps_client.create_minimum_packet_rate_rule(
|
||||
policy_id, **rule_data)['minimum_packet_rate_rule']
|
||||
self.addCleanup(
|
||||
test_utils.call_and_ignore_notfound_exc,
|
||||
self.min_pps_client.delete_minimum_packet_rate_rule,
|
||||
policy_id, rule['id'])
|
||||
return rule
|
||||
|
||||
@decorators.idempotent_id('66a5b9b4-d4f9-4af8-b238-9e1881b78487')
|
||||
def test_rule_create(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
rule = self._create_qos_min_pps_rule(
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 1138})
|
||||
|
||||
# Test 'show rule'
|
||||
retrieved_rule = self.min_pps_client.show_minimum_packet_rate_rule(
|
||||
policy['id'], rule['id'])[self.RULE_NAME]
|
||||
self.assertEqual(rule['id'], retrieved_rule['id'])
|
||||
self.assertEqual(1138, retrieved_rule[qos_consts.MIN_KPPS])
|
||||
self.assertEqual(n_constants.EGRESS_DIRECTION,
|
||||
retrieved_rule[qos_consts.DIRECTION])
|
||||
|
||||
# Test 'list rules'
|
||||
rules = self.min_pps_client.list_minimum_packet_rate_rules(
|
||||
policy['id'])
|
||||
rules = rules[self.RULES_NAME]
|
||||
rules_ids = [r['id'] for r in rules]
|
||||
self.assertIn(rule['id'], rules_ids)
|
||||
|
||||
# Test 'show policy'
|
||||
retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
|
||||
policy_rules = retrieved_policy['policy']['rules']
|
||||
self.assertEqual(1, len(policy_rules))
|
||||
self.assertEqual(rule['id'], policy_rules[0]['id'])
|
||||
self.assertEqual('minimum_packet_rate',
|
||||
policy_rules[0]['type'])
|
||||
|
||||
@decorators.idempotent_id('6b656b57-d2bf-47f9-89a9-1baad1bd5418')
|
||||
def test_rule_create_fail_for_missing_min_kpps(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self._create_qos_min_pps_rule,
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION})
|
||||
|
||||
@decorators.idempotent_id('f41213e5-2ab8-4916-b106-38d2cac5e18c')
|
||||
def test_rule_create_fail_for_the_same_type(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
self._create_qos_min_pps_rule(policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 200})
|
||||
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self._create_qos_min_pps_rule,
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 201})
|
||||
|
||||
@decorators.idempotent_id('ceb8e41e-3d72-11ec-a446-d7faae6daec2')
|
||||
def test_rule_create_any_direction_when_egress_direction_exists(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
self._create_qos_min_pps_rule(policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 200})
|
||||
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self._create_qos_min_pps_rule,
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.ANY_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 201})
|
||||
|
||||
@decorators.idempotent_id('a147a71e-3d7b-11ec-8097-278b1afd5fa2')
|
||||
def test_rule_create_egress_direction_when_any_direction_exists(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
self._create_qos_min_pps_rule(policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.ANY_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 200})
|
||||
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self._create_qos_min_pps_rule,
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 201})
|
||||
|
||||
@decorators.idempotent_id('522ed09a-1d7f-4c1b-9195-61f19caf916f')
|
||||
def test_rule_update(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
rule = self._create_qos_min_pps_rule(
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 300})
|
||||
|
||||
self.min_pps_client.update_minimum_packet_rate_rule(
|
||||
policy['id'], rule['id'],
|
||||
**{qos_consts.MIN_KPPS: 350,
|
||||
qos_consts.DIRECTION: n_constants.ANY_DIRECTION})
|
||||
|
||||
retrieved_rule = self.min_pps_client.show_minimum_packet_rate_rule(
|
||||
policy['id'], rule['id'])[self.RULE_NAME]
|
||||
self.assertEqual(350, retrieved_rule[qos_consts.MIN_KPPS])
|
||||
self.assertEqual(n_constants.ANY_DIRECTION,
|
||||
retrieved_rule[qos_consts.DIRECTION])
|
||||
|
||||
@decorators.idempotent_id('a020e186-3d60-11ec-88ca-d7f5eec22764')
|
||||
def test_rule_update_direction_conflict(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
rule1 = self._create_qos_min_pps_rule(
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 300})
|
||||
|
||||
rule2 = self._create_qos_min_pps_rule(
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.INGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 300})
|
||||
|
||||
retrieved_rule1 = self.min_pps_client.show_minimum_packet_rate_rule(
|
||||
policy['id'], rule1['id'])[self.RULE_NAME]
|
||||
self.assertEqual(n_constants.EGRESS_DIRECTION,
|
||||
retrieved_rule1[qos_consts.DIRECTION])
|
||||
retrieved_rule2 = self.min_pps_client.show_minimum_packet_rate_rule(
|
||||
policy['id'], rule2['id'])[self.RULE_NAME]
|
||||
self.assertEqual(n_constants.INGRESS_DIRECTION,
|
||||
retrieved_rule2[qos_consts.DIRECTION])
|
||||
|
||||
self.assertRaises(exceptions.Conflict,
|
||||
self.min_pps_client.update_minimum_packet_rate_rule,
|
||||
policy['id'], rule2['id'],
|
||||
**{qos_consts.DIRECTION: n_constants.ANY_DIRECTION})
|
||||
|
||||
@decorators.idempotent_id('c49018b6-d358-49a1-a94b-d53224165045')
|
||||
def test_rule_delete(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
rule = self._create_qos_min_pps_rule(
|
||||
policy['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 200})
|
||||
|
||||
retrieved_rule = self.min_pps_client.show_minimum_packet_rate_rule(
|
||||
policy['id'], rule['id'])[self.RULE_NAME]
|
||||
self.assertEqual(rule['id'], retrieved_rule['id'])
|
||||
|
||||
self.min_pps_client.delete_minimum_packet_rate_rule(policy['id'],
|
||||
rule['id'])
|
||||
self.assertRaises(exceptions.NotFound,
|
||||
self.min_pps_client.show_minimum_packet_rate_rule,
|
||||
policy['id'], rule['id'])
|
||||
|
||||
@decorators.idempotent_id('1a6b6128-3d3e-11ec-bf49-57b326d417c0')
|
||||
def test_rule_create_forbidden_for_regular_tenants(self):
|
||||
self.assertRaises(
|
||||
exceptions.Forbidden,
|
||||
self.min_pps_client_primary.create_minimum_packet_rate_rule,
|
||||
'policy', **{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 300})
|
||||
|
||||
@decorators.idempotent_id('1b94f4e2-3d3e-11ec-bb21-6f98e4044b8b')
|
||||
def test_get_rules_by_policy(self):
|
||||
policy1 = self.create_qos_policy(name='test-policy1',
|
||||
description='test policy1',
|
||||
shared=False)
|
||||
rule1 = self._create_qos_min_pps_rule(
|
||||
policy1['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 200})
|
||||
|
||||
policy2 = self.create_qos_policy(name='test-policy2',
|
||||
description='test policy2',
|
||||
shared=False)
|
||||
rule2 = self._create_qos_min_pps_rule(
|
||||
policy2['id'],
|
||||
{qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 5000})
|
||||
|
||||
# Test 'list rules'
|
||||
rules = self.min_pps_client.list_minimum_packet_rate_rules(
|
||||
policy1['id'])
|
||||
rules = rules[self.RULES_NAME]
|
||||
rules_ids = [r['id'] for r in rules]
|
||||
self.assertIn(rule1['id'], rules_ids)
|
||||
self.assertNotIn(rule2['id'], rules_ids)
|
||||
|
||||
|
||||
class QosSearchCriteriaTest(base.BaseSearchCriteriaTest,
|
||||
base.BaseAdminNetworkTest):
|
||||
|
||||
|
@ -11,7 +11,10 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import qos as qos_apidef
|
||||
from neutron_lib import constants as n_constants
|
||||
from neutron_lib.db import constants as db_const
|
||||
from neutron_lib.services.qos import constants as qos_consts
|
||||
from tempest.common import utils
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
@ -103,6 +106,8 @@ class QosRuleNegativeBaseTestJSON(base.BaseAdminNetworkTest):
|
||||
rule = self.rule_create_m(policy['id'], **create_params)
|
||||
if "minimum_bandwidth_rule" in rule.keys():
|
||||
rule_id = rule['minimum_bandwidth_rule']['id']
|
||||
if "minimum_packet_rate_rule" in rule.keys():
|
||||
rule_id = rule['minimum_packet_rate_rule']['id']
|
||||
if "bandwidth_limit_rule" in rule.keys():
|
||||
rule_id = rule['bandwidth_limit_rule']['id']
|
||||
if "dscp_mark" in rule.keys():
|
||||
@ -198,6 +203,41 @@ class QosMinimumBandwidthRuleNegativeTestJSON(QosRuleNegativeBaseTestJSON):
|
||||
self._test_rule_update_rule_nonexistent_rule(update_params)
|
||||
|
||||
|
||||
class QosMinimumPpsRuleNegativeTestJSON(QosRuleNegativeBaseTestJSON):
|
||||
|
||||
@classmethod
|
||||
@utils.requires_ext(service='network',
|
||||
extension='port-resource-request-groups')
|
||||
def resource_setup(cls):
|
||||
cls.rule_create_m = cls.os_admin.qos_minimum_packet_rate_rules_client.\
|
||||
create_minimum_packet_rate_rule
|
||||
cls.rule_update_m = cls.os_admin.qos_minimum_packet_rate_rules_client.\
|
||||
update_minimum_packet_rate_rule
|
||||
super(QosMinimumPpsRuleNegativeTestJSON, cls).resource_setup()
|
||||
|
||||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('ddd16824-3e10-11ec-928d-5b1ef3fb9f43')
|
||||
def test_rule_update_rule_nonexistent_policy(self):
|
||||
create_params = {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 1}
|
||||
update_params = {qos_consts.MIN_KPPS: 200}
|
||||
self._test_rule_update_rule_nonexistent_policy(
|
||||
create_params, update_params)
|
||||
|
||||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('de4f5540-3e10-11ec-9700-4bf3629b843e')
|
||||
def test_rule_create_rule_non_existent_policy(self):
|
||||
create_params = {qos_consts.DIRECTION: n_constants.EGRESS_DIRECTION,
|
||||
qos_consts.MIN_KPPS: 200}
|
||||
self._test_rule_create_rule_non_existent_policy(create_params)
|
||||
|
||||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('deb914ee-3e10-11ec-b3dc-03e52f9269c9')
|
||||
def test_rule_update_rule_nonexistent_rule(self):
|
||||
update_params = {qos_consts.MIN_KPPS: 200}
|
||||
self._test_rule_update_rule_nonexistent_rule(update_params)
|
||||
|
||||
|
||||
class QosDscpRuleNegativeTestJSON(QosRuleNegativeBaseTestJSON):
|
||||
|
||||
@classmethod
|
||||
|
@ -11,7 +11,7 @@ oslo.log>=3.36.0 # Apache-2.0
|
||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
oslo.utils>=3.33.0 # Apache-2.0
|
||||
paramiko>=2.0.0 # LGPLv2.1+
|
||||
tempest>=17.1.0 # Apache-2.0
|
||||
tempest>=29.2.0 # Apache-2.0
|
||||
tenacity>=3.2.1 # Apache-2.0
|
||||
ddt>=1.0.1 # MIT
|
||||
nose>=1.3.7 # LGPL
|
||||
|
@ -47,6 +47,7 @@
|
||||
- pagination
|
||||
- port-device-profile
|
||||
- port-resource-request
|
||||
- port-resource-request-groups
|
||||
- port-mac-address-regenerate
|
||||
- port-security
|
||||
- port-security-groups-filtering
|
||||
@ -100,6 +101,7 @@
|
||||
OVN_BUILD_FROM_SOURCE: True
|
||||
OVN_BRANCH: "v21.03.0"
|
||||
OVS_BRANCH: "8dc1733eaea866dce033b3c44853e1b09bf59fc7"
|
||||
NETWORK_API_EXTENSIONS: "{{ network_api_extensions_common | join(',') }}"
|
||||
devstack_local_conf:
|
||||
post-config:
|
||||
# NOTE(slaweq): We can get rid of this hardcoded absolute path when
|
||||
@ -133,7 +135,6 @@
|
||||
- ^zuul.d/(queens|rocky|stein|train|ussuri)_jobs.yaml$
|
||||
- ^zuul.d/base-nested-switch.yaml$
|
||||
|
||||
|
||||
- job:
|
||||
name: neutron-tempest-plugin-scenario-openvswitch
|
||||
parent: neutron-tempest-plugin-scenario-nested-switch
|
||||
|
Loading…
Reference in New Issue
Block a user