]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
QoS: Remove type attribute from QoS rules
authorJakub Libosvar <libosvar@redhat.com>
Tue, 21 Jul 2015 11:17:18 +0000 (11:17 +0000)
committerIhar Hrachyshka <ihrachys@redhat.com>
Sat, 25 Jul 2015 13:50:31 +0000 (15:50 +0200)
The type is given by object itself. We don't specify type when creating
resource cause it's a part of uri. This patch allows a
bandwidth_limit_rule to be created in given policy.

Partially-Implements: blueprint quantum-qos-api
Change-Id: Ica4626083054200e3b82bef23984462e7c596e1e

neutron/extensions/qos.py
neutron/objects/qos/rule.py
neutron/tests/tempest/services/network/json/network_client.py

index 1c89acac1158217d8190ff053d14123f5dfae030..76b9f6f8ac77a8e3944824aa02adf85ee17b8b48 100644 (file)
@@ -37,9 +37,6 @@ QOS_RULE_COMMON_FIELDS = {
            'validate': {'type:uuid': None},
            'is_visible': True,
            'primary_key': True},
-    'type': {'allow_post': True, 'allow_put': True, 'is_visible': True,
-             'default': '',
-             'validate': {'type:values': VALID_RULE_TYPES}},
     'tenant_id': {'allow_post': True, 'allow_put': False,
                   'required_by_policy': True,
                   'is_visible': True},
index 0b5713e73b4fb0e1b8c2b22a88653c2ce3a56933..b2bdd93f4b3e89eab5d7ae72b7ace0bb3e3334b0 100644 (file)
@@ -32,6 +32,7 @@ class QosRule(base.NeutronObject):
 
     fields = {
         'id': obj_fields.UUIDField(),
+        #TODO(QoS): We ought to kill the `type' attribute
         'type': obj_fields.StringField(),
         'qos_policy_id': obj_fields.UUIDField()
     }
index bbee873419c0f48e185d101786384aed857334a1..a95443294331447f86e2419512a6a85b2c063cef 100644 (file)
@@ -657,8 +657,8 @@ class NetworkClientJSON(service_client.ServiceClient):
         post_data = self.serialize(
             {'bandwidth_limit_rule': {
                 'max_kbps': max_kbps,
-                'max_burst_kbps': max_burst_kbps,
-                'type': 'bandwidth_limit'}})
+                'max_burst_kbps': max_burst_kbps}
+            })
         resp, body = self.post(uri, post_data)
         self.expected_success(201, resp.status)
         body = json.loads(body)
@@ -687,8 +687,8 @@ class NetworkClientJSON(service_client.ServiceClient):
         post_data = {
             'bandwidth_limit_rule': {
                 'max_kbps': max_kbps,
-                'max_burst_kbps': max_burst_kbps,
-                'type': 'bandwidth_limit'}}
+                'max_burst_kbps': max_burst_kbps}
+            }
         resp, body = self.put(uri, json.dumps(post_data))
         self.expected_success(200, resp.status)
         return service_client.ResponseBody(resp, body)