git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix nitos add_nodes
[sfa.git]
/
sfa
/
rspecs
/
elements
/
versions
/
nitosv1Node.py
diff --git
a/sfa/rspecs/elements/versions/nitosv1Node.py
b/sfa/rspecs/elements/versions/nitosv1Node.py
index
0154214
..
44b9b52
100644
(file)
--- a/
sfa/rspecs/elements/versions/nitosv1Node.py
+++ b/
sfa/rspecs/elements/versions/nitosv1Node.py
@@
-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.util.xrn import Xrn
from sfa.rspecs.elements.element import Element
-from sfa.rspecs.elements.node import Node
+from sfa.rspecs.elements.node import Node
Element
from sfa.rspecs.elements.sliver import Sliver
from sfa.rspecs.elements.location import Location
from sfa.rspecs.elements.position_3d import Position3D
from sfa.rspecs.elements.sliver import Sliver
from sfa.rspecs.elements.location import Location
from sfa.rspecs.elements.position_3d import Position3D
@@
-20,7
+20,7
@@
from sfa.rspecs.elements.versions.pgv2Services import PGv2Services
class NITOSv1Node:
@staticmethod
class NITOSv1Node:
@staticmethod
- def add_nodes(xml, nodes):
+ def add_nodes(xml, nodes
, rspec_content_type=None
):
network_elems = xml.xpath('//network')
if len(network_elems) > 0:
network_elem = network_elems[0]
network_elems = xml.xpath('//network')
if len(network_elems) > 0:
network_elem = network_elems[0]
@@
-30,6
+30,9
@@
class NITOSv1Node:
else:
network_elem = xml
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']
node_elems = []
for node in nodes:
node_fields = ['component_manager_id', 'component_id', 'boot_state']
@@
-65,6
+68,11
@@
class NITOSv1Node:
# all nitos nodes are exculsive
exclusive_elem = node_elem.add_element('exclusive')
exclusive_elem.set_text('TRUE')
# 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']
# add granularity of the reservation system
granularity = node.get('granularity')['grain']
@@
-94,6
+102,10
@@
class NITOSv1Node:
tag_elem = node_elem.add_element(tag['tagname'])
tag_elem.set_text(tag['value'])
NITOSv1Sliver.add_slivers(node_elem, node.get('slivers', []))
tag_elem = node_elem.add_element(tag['tagname'])
tag_elem.set_text(tag['value'])
NITOSv1Sliver.add_slivers(node_elem, node.get('slivers', []))
+
+ # add sliver tag in Request Rspec
+ if rspec_content_type == "request":
+ node_elem.add_instance('sliver', '', [])
@staticmethod
def add_slivers(xml, slivers):
@staticmethod
def add_slivers(xml, slivers):
@@
-139,7
+151,7
@@
class NITOSv1Node:
def get_node_objs(node_elems):
nodes = []
for node_elem in node_elems:
def get_node_objs(node_elems):
nodes = []
for node_elem in node_elems:
- node = Node(node_elem.attrib, node_elem)
+ node = Node
Element
(node_elem.attrib, node_elem)
if 'site_id' in node_elem.attrib:
node['authority_id'] = node_elem.attrib['site_id']
# get location
if 'site_id' in node_elem.attrib:
node['authority_id'] = node_elem.attrib['site_id']
# get location
@@
-161,7
+173,7
@@
class NITOSv1Node:
# get slivers
node['slivers'] = NITOSv1Sliver.get_slivers(node_elem)
# get tags
# 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=Node
Element
.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]
# 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]