- node_tag = etree.SubElement(self.xml, 'node')
- node_type_tag = etree.SubElement(node_tag, 'node_type', type_name='pcvm', type_slots='100')
- available_tag = etree.SubElement(node_tag, 'available').text = 'true'
- exclusive_tag = etree.SubElement(node_tag, 'exclusive').text = 'false'
- location_tag = etree.SubElement(node_tag, 'location')
- interface_tag = etree.SubElement(node_tag, 'interface')
+ node_tag = etree.SubElement(self.xml, 'node', exclusive='false')
+ if 'network_urn' in node:
+ node_tag.set('component_manager_id', node['network_urn'])
+ if 'urn' in node:
+ node_tag.set('component_id', node['urn'])
+ if 'hostname' in node:
+ node_tag.set('component_name', node['hostname'])
+ # TODO: should replace plab-pc with pc model
+ node_type_tag = etree.SubElement(node_tag, 'hardware_type', name='plab-pc')
+ node_type_tag = etree.SubElement(node_tag, 'hardware_type', name='pc')
+ available_tag = etree.SubElement(node_tag, 'available', now='true')
+ location_tag = etree.SubElement(node_tag, 'location', country="us")
+ if 'site' in node:
+ if 'longitude' in node['site']:
+ location_tag.set('longitude', str(node['site']['longitude']))
+ if 'latitude' in node['site']:
+ location_tag.set('latitude', str(node['site']['latitude']))
+ #if 'interfaces' in node: