Fixing issue in view builders concerning attachment identifiers

This commit is contained in:
Salvatore Orlando 2011-08-23 00:57:33 +01:00
parent 4fc835dca3
commit f1e464d9e6
4 changed files with 7 additions and 7 deletions

View File

@ -31,7 +31,7 @@ class ViewBuilder(object):
def build(self, attachment_data):
"""Generic method used to generate an attachment entity."""
if attachment_data['attachment-id']:
return dict(attachment=dict(id=attachment_data['attachment-id']))
if attachment_data['attachment']:
return dict(attachment=dict(id=attachment_data['attachment']))
else:
return dict(attachment={})

View File

@ -54,6 +54,6 @@ class ViewBuilder(object):
"""Return details about a specific logical port."""
port_dict = dict(id=port_data['port-id'],
state=port_data['port-state'])
if port_data['attachment-id']:
port_dict['attachment'] = dict(id=port_data['attachment-id'])
if port_data['attachment']:
port_dict['attachment'] = dict(id=port_data['attachment'])
return port_dict

View File

@ -34,6 +34,6 @@ class ViewBuilder(object):
port = dict(port=dict(id=port_data['port-id']))
if port_details:
port['port']['state'] = port_data['port-state']
if att_details and port_data['attachment-id']:
port['port']['attachment'] = dict(id=port_data['attachment-id'])
if att_details and port_data['attachment']:
port['port']['attachment'] = dict(id=port_data['attachment'])
return port

View File

@ -352,7 +352,7 @@ class FakePlugin(object):
LOG.debug("FakePlugin.get_port_details() called")
port = self._get_port(tenant_id, net_id, port_id)
return {'port-id': str(port.uuid),
'attachment-id': port.interface_id,
'attachment': port.interface_id,
'port-state': port.state}
def create_port(self, tenant_id, net_id, port_state=None):