Node is now NodeElement
[sfa.git] / sfa / rspecs / elements / versions / nitosv1Node.py
index c9235d6..9015077 100644 (file)
@@ -3,7 +3,7 @@ from sfa.util.xml import XpathFilter
 from sfa.util.xrn import Xrn
 
 from sfa.rspecs.elements.element import Element
-from sfa.rspecs.elements.node import Node
+from sfa.rspecs.elements.node import NodeElement
 from sfa.rspecs.elements.sliver import Sliver
 from sfa.rspecs.elements.location import Location
 from sfa.rspecs.elements.position_3d import Position3D
@@ -30,6 +30,9 @@ class NITOSv1Node:
         else:
             network_elem = xml
 
+        # needs to be improuved to retreive the gateway addr dynamically.
+        gateway_addr = 'nitlab.inf.uth.gr'
+
         node_elems = []       
         for node in nodes:
             node_fields = ['component_manager_id', 'component_id', 'boot_state']
@@ -62,6 +65,14 @@ class NITOSv1Node:
             if position_3d:
                 node_elem.add_instance('position_3d', position_3d, Position3D.fields)
 
+            # all nitos nodes are exculsive
+            exclusive_elem = node_elem.add_element('exclusive')
+            exclusive_elem.set_text('TRUE')
+            # In order to access nitos nodes, one need to pass through the nitos gateway
+            # here we advertise Nitos access gateway address
+            gateway_elem = node_elem.add_element('gateway')
+            gateway_elem.set_text(gateway_addr)
 
             # add granularity of the reservation system
             granularity = node.get('granularity')['grain']
@@ -136,7 +147,7 @@ class NITOSv1Node:
     def get_node_objs(node_elems):
         nodes = []    
         for node_elem in node_elems:
-            node = Node(node_elem.attrib, node_elem)
+            node = NodeElement(node_elem.attrib, node_elem)
             if 'site_id' in node_elem.attrib:
                 node['authority_id'] = node_elem.attrib['site_id']
             # get location
@@ -158,7 +169,7 @@ class NITOSv1Node:
             # get slivers
             node['slivers'] = NITOSv1Sliver.get_slivers(node_elem)
             # get tags
-            node['tags'] =  NITOSv1PLTag.get_pl_tags(node_elem, ignore=Node.fields+["hardware_type"])
+            node['tags'] =  NITOSv1PLTag.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]