make subnets attribute of a network read-only

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
This commit is contained in:
Dan Wendlandt 2012-09-11 01:26:57 -07:00
parent 8d1259c1e6
commit 56483b6fbe
2 changed files with 4 additions and 6 deletions

View 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,

View 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",