2 File used to handle all the nodes querying:
3 - get nodes list along with their properties
6 class CortexlabQueryNodes:
11 def get_all_nodes(self, node_filter_dict=None, return_fields_list=None):
13 Get all the nodes and their properties. Called by GetNodes.
14 Filtering on nodes properties can be done here or in GetNodes.
15 Search for specific nodes if some filters are
16 specified.Returns all the nodes properties if no return_fields_list
18 TODO: Define which properties have to be listed here. Useful ones:
19 node architecture, radio type, position (x,y,z)
21 :param node_filter_dict: dictionary of lists with node properties. For
22 instance, if you want to look for a specific node with its hrn,
23 the node_filter_dict should be {'hrn': [hrn_of_the_node]}
24 :type node_filter_dict: dict
25 :param return_fields_list: list of specific fields the user wants to be
27 :type return_fields_list: list
28 :returns: list of dictionaries with node properties
32 # Get the nodes here, eventually filter here
33 # See iotlabapi.py GetNodes to get the filtering (node_filter_dict and
34 # return_fields_list ) part, if necessary
36 {'hrn': 'iotlab.wsn430-11.devlille.iot-lab.info',
37 'archi': 'wsn430', 'mobile': 'True',
38 'hostname': 'wsn430-11.devlille.iot-lab.info',
39 'site': 'devlille', 'mobility_type': 'None',
40 'boot_state': 'Suspected',
41 'node_id': 'wsn430-11.devlille.iot-lab.info',
42 'radio': 'cc2420', 'posx': '2.3', 'posy': '2.3',
43 'node_number': 11, 'posz': '1'},
44 {'hrn': 'iotlab.wsn430-10.devlille.iot-lab.info',
45 'archi': 'wsn430', 'mobile': 'True',
46 'hostname': 'wsn430-10.devlille.iot-lab.info',
47 'site': 'devlille', 'mobility_type': 'None',
48 'boot_state': 'Alive', 'node_id': 'wsn430-10.devlille.iot-lab.info',
49 'radio': 'cc2420', 'posx': '1.3', 'posy': '2.3', 'node_number': 10,
51 {'hrn': 'iotlab.wsn430-1.devlille.iot-lab.info',
52 'archi': 'wsn430', 'mobile': 'False',
53 'hostname': 'wsn430-1.devlille.iot-lab.info',
54 'site': 'devlille', 'mobility_type': 'None',
55 'boot_state': 'Alive', 'node_id': 'wsn430-1.devlille.iot-lab.info',
56 'radio': 'cc2420', 'posx': '0.3', 'posy': '0.3', 'node_number': 1,
63 def get_sites(self, site_filter_name_list=None, return_fields_list=None):
65 """Get the different cortexlab sites and for each sites, the nodes
66 hostnames on this site.
68 :param site_filter_name_list: used to specify specific sites
69 :param return_fields_list: fields that has to be returned
70 :type site_filter_name_list: list
71 :type return_fields_list: list
75 {'address_ids': [], 'slice_ids': [], 'name': 'iotlab',
76 'node_ids': [u'wsn430-11.devlille.iot-lab.info',
77 u'wsn430-10.devlille.iot-lab.info', u'wsn430-1.devlille.iot-lab.info'],
78 'url': 'https://portal.senslab.info', 'person_ids': [],
79 'site_tag_ids': [], 'enabled': True, 'site': 'devlille',
80 'longitude': '- 2.10336', 'pcu_ids': [], 'max_slivers': None,
81 'max_slices': None, 'ext_consortium_id': None, 'date_created': None,
82 'latitude': '48.83726', 'is_public': True, 'peer_site_id': None,
83 'peer_id': None, 'abbreviated_name': 'iotlab'}]
84 # list of dict with mandatory keys ['name', 'node_ids', 'longitude',
85 # 'site' ]. Value for key node_ids is a hostname list.
86 # See iotlabapi.py GetSites to get the filtering
90 def get_reserved_nodes(self, username):
91 """Get list of leases. Get the leases for the username if specified,
92 otherwise get all the leases.
93 :param username: user's LDAP login
94 :type username: string
95 :returns: list of reservations dict
99 reserved_nodes_list_dict = None
100 return reserved_nodes_list_dict
102 def schedule_experiment(self, lease_dict):
103 """Schedule/ run an experiment based on the information provided in the
106 :param lease_dict: contains lease_start_time,
107 lease_duration, added_nodes, slice_name , slice_user, grain:
108 :type lease_dict: dictionary
112 answer['id'] = None #experiment id
113 answer['msg'] = None #message in case of error
115 # Launch the experiment here
119 def delete_experiment(self, experiment_id, username):
121 Delete the experiment designated by its experiment id and its
123 TODO: If the username is not necessary to delete the lease, then you can
124 remove it from the parameters, given that you propagate the changes
126 :param experiment_id: experiment identifier
127 :type experiment_id : integer
128 :param username: user's LDAP login
129 :type username: string
130 :returns: dict with delete status {'status': True of False}
133 # Delete the experiment here. Ret['status'] should be True or False
134 # depending if the delete was effective or not.