Merge "Fullstack test for minimum bw rule ingress create" into stable/rocky

This commit is contained in:
Zuul 2018-10-31 03:20:31 +00:00 committed by Gerrit Code Review
commit 4a75c9f8d9
2 changed files with 34 additions and 0 deletions

View File

@ -213,6 +213,23 @@ class ClientFixture(fixtures.Fixture):
return rule['dscp_marking_rule']
def create_minimum_bandwidth_rule(self, tenant_id, policy_id,
direction=None, min_kbps=None):
rule = {'tenant_id': tenant_id}
if direction:
rule['direction'] = direction
if min_kbps:
rule['min_kbps'] = min_kbps
rule = self.client.create_minimum_bandwidth_rule(
policy=policy_id,
body={'minimum_bandwidth_rule': rule})
self.addCleanup(_safe_method(
self.client.delete_minimum_bandwidth_rule),
rule['minimum_bandwidth_rule']['id'], policy_id)
return rule['minimum_bandwidth_rule']
def create_trunk(self, tenant_id, port_id, name=None,
admin_state_up=None, sub_ports=None):
"""Create a trunk via API.

View File

@ -391,6 +391,23 @@ class TestDscpMarkingQoSLinuxbridge(_TestDscpMarkingQoS,
vm.host.host_namespace, vm.port.name, dscp_mark)
class TestMinimumBandwidthRule(BaseQoSRuleTestCase,
base.BaseFullStackTestCase):
l2_agent_type = constants.AGENT_TYPE_NIC_SWITCH
def test_rule_create_fail_for_direction_ingress(self):
policy = self._create_qos_policy()
self.assertRaises(
exceptions.BadRequest,
self.safe_client.create_minimum_bandwidth_rule,
tenant_id=self.tenant_id,
policy_id=policy['id'],
direction=constants.INGRESS_DIRECTION,
min_kbps=201
)
class TestQoSWithL2Population(base.BaseFullStackTestCase):
def setUp(self):