cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prasanna Santhanam (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-989) marvin: jsonHelper deserialization results in unfilled attributes
Date Tue, 19 Mar 2013 12:49:15 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13606289#comment-13606289
] 

Prasanna Santhanam commented on CLOUDSTACK-989:
-----------------------------------------------

Edison - just saw your comment. API refactor doesn't (should not have) changed the api responses
in order to retain backward compatibility. I've worked around that with the fix on marvin-refactor
branch. 
                
> marvin: jsonHelper deserialization results in unfilled attributes
> -----------------------------------------------------------------
>
>                 Key: CLOUDSTACK-989
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-989
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Test Tools
>    Affects Versions: 4.0.0
>            Reporter: Prasanna Santhanam
>            Assignee: Prasanna Santhanam
>             Fix For: 4.1.0
>
>
> marvin:jsonHelper.py deserializes the entire object into entity.entity field when 'entity'
is present as an attribute in the response and failing to fill in other attributes in the
response class of entity.
> For instance when the associateIpAddress is called to acquire ip address in a zone. the
response has the following:
> result =  '{ "queryasyncjobresultresponse": { "accountid": "2", "userid": "2", "cmd":
"com.cloud.api.commands.AssociateIPAddrCmd", "jobstatus": 1, "jobprocstatus": 0, "jobresultcode":
0, "jobresulttype": "object", "jobresult": { "ipaddress": { "id": "25065307-673a-4047-9a85-10b520674fb7",
"ipaddress": "10.223.137.67", "allocated": "2013-01-02T13:39:33-0800", "zoneid": "b2aeb0e8-7c32-4564-80d6-631e745dd745",
"zonename": "zone1", "issourcenat": false, "account": "test-KE15DK", "domainid": "1", "domain":
"ROOT", "forvirtualnetwork": true, "vlanid": "953c4b02-bbde-48e1-98c5-20c0888016d5", "vlanname":
"1371", "isstaticnat": false, "issystem": false, "associatednetworkid": "1968a6e1-42c3-4d5d-ace4-f692e8d62ba8",
"associatednetworkname": "test-KE15DK-network", "networkid": "8366fd1e-5c79-42b8-81fb-031ddafa589d",
"state": "Allocating", "physicalnetworkid": "cea412ae-d62c-45d6-903b-81e8b2b926a0", "tags":
[] } }, "created": "2013-01-02T13:39:33-0800", "jobid": "14f3f4e8-edbe-424f-93f8-5118f4f90939"
} }'
>     result = getResultObj(result, associateIpAddress.associateIpAddressResponse())
>     ipaddr = result.jobresult
>     print ipaddr.id
>     print ipaddr.ipaddress.id
>     print ipaddr.ipaddress.zonename 
>     print ipaddr.ipaddress.ipaddress
>     print ipaddr.ipaddress.zoneid
> >> None
> >> 25065307-673a-4047-9a85-10b520674fb7
> >> zone1
> >> 10.223.137.67
> >> b2aeb0e8-7c32-4564-80d6-631e745dd745
> The response object is as follows:
> class associateIpAddressResponse (baseResponse):
>     def __init__(self):
>         """public IP address id"""
>         self.id = None
>         """the account the public IP address is associated with"""
>         self.account = None
>         """date the public IP address was acquired"""
>         self.allocated = None
>         """the ID of the Network associated with the IP address"""
>         self.associatednetworkid = None
>         """the name of the Network associated with the IP address"""
>         self.associatednetworkname = None
>         """the domain the public IP address is associated with"""
>         self.domain = None
>         """the domain ID the public IP address is associated with"""
>         self.domainid = None
>         """the virtual network for the IP address"""
>         self.forvirtualnetwork = None
>         """public IP address"""
>         self.ipaddress = None
>         """true if the IP address is a source nat address, false otherwise"""
>         self.issourcenat = None
>         """true if this ip is for static nat, false otherwise"""
>         self.isstaticnat = None
>         """true if this ip is system ip (was allocated as a part of deployVm or createLbRule)"""
>         self.issystem = None
>         """the ID of the Network where ip belongs to"""
>         self.networkid = None
>         """the physical network this belongs to"""
>         self.physicalnetworkid = None
>         """the project name of the address"""
>         self.project = None
> <snip>
> Because the response contains an attribute by the name 'ipaddress' we fill in the result
of the deserialization into that attribute and fail to fill in the rest of the response object.
> This results in confusion when inspecting the response:
> In some places we have:
> account.account.name and in others we have virtualmachine.id
> It is logical and intuitive to not have to make a second indirection from the resulting
object that came back as response. The corresponding tests will also need to be corrected.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message