- location_elems = Element.add(node_elem, 'location', node.get('location', []), Location.fields)
- interface_elems = Element.add(node_elem, 'interface', node.get('interfaces', []), Interface.fields)
-
- #if 'bw_unallocated' in node and node['bw_unallocated']:
+ # add locaiton
+ location = node.get('location')
+ if location:
+ node_elem.add_instance('location', location, Location.fields)
+
+ # add exclusive tag to distinguish between Reservable and Shared
+ # nodes
+ exclusive_elem = node_elem.add_element('exclusive')
+ if node.get('exclusive') and node.get('exclusive') == 'true':
+ exclusive_elem.set_text('TRUE')
+ # add granularity of the reservation system
+ granularity = node.get('granularity')
+ if granularity:
+ node_elem.add_instance(
+ 'granularity', granularity, granularity.fields)
+ else:
+ exclusive_elem.set_text('FALSE')
+
+ if isinstance(node.get('interfaces'), list):
+ for interface in node.get('interfaces', []):
+ node_elem.add_instance('interface', interface, [
+ 'component_id', 'client_id', 'ipv4'])
+
+ # if 'bw_unallocated' in node and node['bw_unallocated']: