]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add empty policy rule to get_rule_type action
authorgong yong sheng <gong.yongsheng@99cloud.net>
Fri, 21 Aug 2015 06:51:45 +0000 (14:51 +0800)
committergong yong sheng <gong.yongsheng@99cloud.net>
Mon, 24 Aug 2015 09:43:08 +0000 (17:43 +0800)
Without this empty policy rule, get_rule_type will use default, which
will demand admin role or tenant_id in object. but rule_type has no
tenant_id in its body.

Change-Id: I92b1222fbcdc2efd13ca6f586cfefefc55b59189
Closes-bug: #1487324

etc/policy.json
neutron/tests/api/test_qos.py
neutron/tests/etc/policy.json

index ac5a27ee8102677d04c61e998016b2eb86eb5d9f..9207142582e973318a7e520509723ad3a1a87604 100644 (file)
     "create_policy_bandwidth_limit_rule": "rule:admin_only",
     "delete_policy_bandwidth_limit_rule": "rule:admin_only",
     "update_policy_bandwidth_limit_rule": "rule:admin_only",
+    "get_rule_type": "rule:regular_user",
 
     "restrict_wildcard": "(not field:rbac_policy:target_tenant=*) or rule:admin_only",
     "create_rbac_policy": "",
index 6b55afebef65c95af74960a910792e976bee1f83..3b67172c5123163a2d064442891241b3b6b3f301 100644 (file)
@@ -97,7 +97,15 @@ class QosTestJSON(base.BaseAdminNetworkTest):
 
     @test.attr(type='smoke')
     @test.idempotent_id('cf776f77-8d3d-49f2-8572-12d6a1557224')
-    def test_list_rule_types(self):
+    def test_list_admin_rule_types(self):
+        self._test_list_rule_types(self.admin_client)
+
+    @test.attr(type='smoke')
+    @test.idempotent_id('49c8ea35-83a9-453a-bd23-239cf3b13929')
+    def test_list_regular_rule_types(self):
+        self._test_list_rule_types(self.client)
+
+    def _test_list_rule_types(self, client):
         # List supported rule types
         # TODO(QoS): since in gate we run both ovs and linuxbridge ml2 drivers,
         # and since Linux Bridge ml2 driver does not have QoS support yet, ml2
@@ -111,7 +119,7 @@ class QosTestJSON(base.BaseAdminNetworkTest):
         expected_rule_types = []
         expected_rule_details = ['type']
 
-        rule_types = self.admin_client.list_qos_rule_types()
+        rule_types = client.list_qos_rule_types()
         actual_list_rule_types = rule_types['rule_types']
         actual_rule_types = [rule['type'] for rule in actual_list_rule_types]
 
index ac5a27ee8102677d04c61e998016b2eb86eb5d9f..9207142582e973318a7e520509723ad3a1a87604 100644 (file)
     "create_policy_bandwidth_limit_rule": "rule:admin_only",
     "delete_policy_bandwidth_limit_rule": "rule:admin_only",
     "update_policy_bandwidth_limit_rule": "rule:admin_only",
+    "get_rule_type": "rule:regular_user",
 
     "restrict_wildcard": "(not field:rbac_policy:target_tenant=*) or rule:admin_only",
     "create_rbac_policy": "",