cascade='delete', lazy='joined'))
-class QosRuleColumns(models_v2.HasId):
- # NOTE(ihrachyshka): we may need to rework it later when we introduce types
- # that should not enforce uniqueness
- qos_policy_id = sa.Column(sa.String(36), nullable=False, unique=True)
-
- __table_args__ = (
- sa.ForeignKeyConstraint(['qos_policy_id'], ['qos_policies.id']),
- model_base.BASEV2.__table_args__
- )
-
-
-class QosBandwidthLimitRule(QosRuleColumns, model_base.BASEV2):
+class QosBandwidthLimitRule(models_v2.HasId, model_base.BASEV2):
__tablename__ = 'qos_bandwidth_limit_rules'
+ qos_policy_id = sa.Column(sa.String(36),
+ sa.ForeignKey('qos_policies.id',
+ ondelete='CASCADE'),
+ nullable=False,
+ unique=True)
max_kbps = sa.Column(sa.Integer)
max_burst_kbps = sa.Column(sa.Integer)
# under the License.
from tempest_lib import exceptions
+import testtools
from neutron.services.qos import qos_consts
from neutron.tests.api import base
self._disassociate_port(port['id'])
self.admin_client.delete_qos_policy(policy['id'])
+ @test.attr(type='smoke')
+ @test.idempotent_id('a2a5849b-dd06-4b18-9664-0b6828a1fc27')
+ def test_qos_policy_delete_with_rules(self):
+ policy = self.create_qos_policy(name='test-policy',
+ description='test policy',
+ shared=False)
+ self.admin_client.create_bandwidth_limit_rule(
+ policy['id'], 200, 1337)['bandwidth_limit_rule']
+
+ self.admin_client.delete_qos_policy(policy['id'])
+
+ with testtools.ExpectedException(exceptions.NotFound):
+ self.admin_client.show_qos_policy(policy['id'])
+
class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
@classmethod