- node['hardware_types'] = Element.get_elements(node_elem, './default:hardwate_type | ./hardware_type', HardwareType)
- lolocation_elems = Element.get_elements(node_elem, './default:location | ./location', Location)
- if len(location_elems) > 0:
- node['location'] = location_elems[0]
- node['interfaces'] = Element.get_elements(node_elem, './default:interface | ./interface', Interface)
+ # get hardware types
+ hardware_type_elems = node_elem.xpath(
+ './default:hardware_type | ./hardware_type')
+ node['hardware_types'] = [dict(hw_type.get_instance(
+ HardwareType)) for hw_type in hardware_type_elems]
+
+ # get location
+ location_elems = node_elem.xpath('./default:location | ./location')
+ locations = [dict(location_elem.get_instance(Location))
+ for location_elem in location_elems]
+ if len(locations) > 0:
+ node['location'] = locations[0]
+
+ # get granularity
+ granularity_elems = node_elem.xpath(
+ './default:granularity | ./granularity')
+ if len(granularity_elems) > 0:
+ node['granularity'] = granularity_elems[
+ 0].get_instance(Granularity)
+
+ # get interfaces
+ iface_elems = node_elem.xpath('./default:interface | ./interface')
+ node['interfaces'] = [dict(iface_elem.get_instance(
+ Interface)) for iface_elem in iface_elems]
+
+ # get services