more casting for SFAv1 rspecs
authorMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 20 Sep 2013 08:43:30 +0000 (10:43 +0200)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Wed, 2 Oct 2013 13:32:12 +0000 (15:32 +0200)
sfa/rspecs/elements/versions/sfav1Node.py
sfa/rspecs/elements/versions/sfav1PLTag.py

index 997f395..630fd85 100644 (file)
@@ -143,7 +143,7 @@ class SFAv1Node:
                 node['authority_id'] = node_elem.attrib['site_id']
             # get location
             location_elems = node_elem.xpath('./default:location | ./location')
-            locations = [loc_elem.get_instance(Location) for loc_elem in location_elems]  
+            locations = [dict(loc_elem.get_instance(Location)) for loc_elem in location_elems]  
             if len(locations) > 0:
                 node['location'] = locations[0]
             # get bwlimit
@@ -153,7 +153,7 @@ class SFAv1Node:
                 node['bwlimit'] = bwlimits[0]
             # get interfaces
             iface_elems = node_elem.xpath('./default:interface | ./interface')
-            ifaces = [iface_elem.get_instance(Interface) for iface_elem in iface_elems]
+            ifaces = [dict(iface_elem.get_instance(Interface)) for iface_elem in iface_elems]
             node['interfaces'] = ifaces
             # get services
             node['services'] = PGv2Services.get_services(node_elem) 
@@ -163,7 +163,7 @@ class SFAv1Node:
             node['tags'] =  SFAv1PLTag.get_pl_tags(node_elem, ignore=NodeElement.fields+["hardware_type"])
             # get hardware types
             hardware_type_elems = node_elem.xpath('./default:hardware_type | ./hardware_type')
-            node['hardware_types'] = [hw_type.get_instance(HardwareType) for hw_type in hardware_type_elems]
+            node['hardware_types'] = [dict(hw_type.get_instance(HardwareType)) for hw_type in hardware_type_elems]
 
             # temporary... play nice with old slice manager rspec
             if not node['component_name']:
index a17d502..b523124 100644 (file)
@@ -14,6 +14,6 @@ class SFAv1PLTag:
         for elem in xml.iterchildren():
             if elem.tag not in ignore:
                 pl_tag = PLTag({'tagname': elem.tag, 'value': elem.text})
-                pl_tags.append(pl_tag)    
+                pl_tags.append(dict(pl_tag))    
         return pl_tags