]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
make subnets attribute of a network read-only
authorDan Wendlandt <dan@nicira.com>
Tue, 11 Sep 2012 08:26:57 +0000 (01:26 -0700)
committerDan Wendlandt <dan@nicira.com>
Tue, 11 Sep 2012 08:26:57 +0000 (01:26 -0700)
bug 1046173

writing to the subnets attribute is not supported, so rather than
making it looks like we accept it but ignoring it, we should explicitly
reject requests to specify it on network create/update.

Change-Id: I5b6f0f35794c9d5606befb97a89c6c6c97ee3dbf

quantum/api/v2/attributes.py
quantum/tests/unit/test_api_v2.py

index 0aee016097450ebf2a00db1e0389f3e681910cae..1425375faf4e24afbc4fb02e51b7c27da7262491 100644 (file)
@@ -174,7 +174,7 @@ RESOURCE_ATTRIBUTE_MAP = {
                'is_visible': True},
         'name': {'allow_post': True, 'allow_put': True,
                  'default': '', 'is_visible': True},
-        'subnets': {'allow_post': True, 'allow_put': True,
+        'subnets': {'allow_post': False, 'allow_put': False,
                     'default': [],
                     'is_visible': True},
         'admin_state_up': {'allow_post': True, 'allow_put': True,
index 5fcc0b818f4f33fb82728aeb66be59538ff9134e..af23f157e56cdbd40cf9e0e42c3fd0490efc8171 100644 (file)
@@ -361,8 +361,7 @@ class JSONV2TestCase(APIv2TestBase):
         net_id = _uuid()
         initial_input = {'network': {'name': 'net1', 'tenant_id': _uuid()}}
         full_input = {'network': {'admin_state_up': True,
-                                  'shared': False,
-                                  'subnets': []}}
+                                  'shared': False}}
         full_input['network'].update(initial_input['network'])
 
         return_value = {'id': net_id, 'status': "ACTIVE"}
@@ -394,7 +393,7 @@ class JSONV2TestCase(APIv2TestBase):
         env = {'quantum.context': context.Context('', tenant_id)}
         # tenant_id should be fetched from env
         initial_input = {'network': {'name': 'net1'}}
-        full_input = {'network': {'admin_state_up': True, 'subnets': [],
+        full_input = {'network': {'admin_state_up': True,
                       'shared': False, 'tenant_id': tenant_id}}
         full_input['network'].update(initial_input['network'])
 
@@ -806,8 +805,7 @@ class ExtensionTestCase(unittest.TestCase):
         net_id = _uuid()
         initial_input = {'network': {'name': 'net1', 'tenant_id': _uuid(),
                                      'v2attrs:something_else': "abc"}}
-        data = {'network': {'admin_state_up': True, 'subnets': [],
-                            'shared': False}}
+        data = {'network': {'admin_state_up': True, 'shared': False}}
         data['network'].update(initial_input['network'])
 
         return_value = {'subnets': [], 'status': "ACTIVE",