# """
# tuplelist.append(('radio', str(value)))
+ def AddMobilityType(self, tuplelist, value):
+ """Adds which kind of mobility it is, train or roomba robot.
+
+ :param tuplelist: tuple list on which to add the node's mobility status.
+ The tuplelist is the value associated with the node's id in the
+ OARGETParser's dictionary node_dictlist.
+ :param value: tells if a node is a mobile node or not. The value is
+ found in the json.
+
+ :type tuplelist: list
+ :type value: integer
+
+ """
+ tuplelist.append(('mobility-type', str(value)))
+
def AddMobility(self, tuplelist, value):
"""Add if the node is a mobile node or not to the tuple list.
- will also add which kind of mobility it is if the information
- is available, supposing the information is formatted as a string
- with the 2 information separated by a colon.
-
:param tuplelist: tuple list on which to add the node's mobility status.
The tuplelist is the value associated with the node's id in the
OARGETParser's dictionary node_dictlist.
"""
# future support of mobility type
- if ":" in value:
- value_list = value.split(':')
- if value_list[0] is 0:
- tuplelist.append(('mobile', 'False'))
- else:
- tuplelist.append(('mobile', 'True'))
- tuplelist.append(('type', value_list[1]))
if value is 0:
tuplelist.append(('mobile', 'False'))
from sfa.rspecs.version_manager import VersionManager
from sfa.rspecs.elements.versions.iotlabv1Node import IotlabPosition, \
- IotlabNode, IotlabLocation
+ IotlabNode, IotlabLocation, IotlabMobility
from sfa.util.sfalogging import logger
from sfa.util.xrn import Xrn
logger.debug("IOTLABAGGREGATE api get_nodes slice_nodes_list %s "
% (slices))
-
reserved_nodes = self.driver.iotlab_api.GetNodesCurrentlyInUse()
logger.debug("IOTLABAGGREGATE api get_nodes slice_nodes_list %s "
% (slice_nodes_list))
#site_id=node['site_id']
#site=sites_dict[site_id]
- rspec_node['mobile'] = node['mobile']
+ # rspec_node['mobile'] = node['mobile']
rspec_node['archi'] = node['archi']
rspec_node['radio'] = node['radio']
# do not include boot state (<available> element)
#in the manifest rspec
-
rspec_node['boot_state'] = node['boot_state']
if node['hostname'] in reserved_nodes:
rspec_node['boot_state'] = "Reserved"
rspec_node['exclusive'] = 'true'
- rspec_node['hardware_types'] = [HardwareType({'name': \
- 'iotlab-node'})]
+ rspec_node['hardware_types'] = [HardwareType({'name':
+ 'iotlab-node'})]
- location = IotlabLocation({'country':'France', 'site': \
+ location = IotlabLocation({'country':'France', 'site':
node['site']})
rspec_node['location'] = location
+ # Adding mobility of the node in the rspec
+ mobility = IotlabMobility()
+ for field in mobility:
+ try:
+ mobility[field] = node[field]
+ except KeyError, error:
+ logger.log_exc("IOTLABAGGREGATE\t get_nodes \
+ mobility %s " % (error))
+ rspec_node['mobility'] = mobility
position = IotlabPosition()
- for field in position :
+ for field in position:
try:
position[field] = node[field]
- except KeyError, error :
+ except KeyError, error:
logger.log_exc("IOTLABAGGREGATE\t get_nodes \
- position %s "% (error))
+ position %s " % (error))
rspec_node['position'] = position
#rspec_node['interfaces'] = []
rspec_node['slivers'] = [sliver]
# slivers always provide the ssh service
- login = Login({'authentication': 'ssh-keys', \
- 'hostname': node['hostname'], 'port':'22', \
- 'username': sliver['name']})
+ login = Login({'authentication': 'ssh-keys',
+ 'hostname': node['hostname'], 'port': '22',
+ 'username': sliver['name']})
service = Services({'login': login})
rspec_node['services'] = [service]
rspec_nodes.append(rspec_node)
class IotlabMobility(Element):
""" Class to give information of a node's mobility, and what kind of
mobility it is (train, roomba robot ...) """
- fields = ['mobile', 'type']
+ fields = ['mobile', 'mobility-type']
node_elem.add_instance('hardware_types', node, fields)
# set mobility
- if attribute is 'mobile':
- node.elem.add_instance('mobile', node['mobile'],
+ if attribute is 'mobility':
+ node_elem.add_instance('mobility', node['mobility'],
IotlabMobility.fields)
-
# set location
if attribute is 'location':
node_elem.add_instance('location', node['location'],
# add granularity of the reservation system
#TODO put the granularity in network instead SA 18/07/12
- if attribute is 'granularity' :
+ if attribute is 'granularity':
granularity = node['granularity']
if granularity:
node_elem.add_instance('granularity',
now='false')
#set position
+ logger.debug("Iotlabv1Node position node_elem %s" % (node_elem))
if attribute is 'position':
node_elem.add_instance('position', node['position'],
IotlabPosition.fields)
+ logger.debug("Iotlabv1Node position node[position] %s "
+ % (node['position']))
## add services
#PGv2Services.add_services(node_elem, node.get('services', []))
# add slivers