From 0dc00e2717f31eef80476907f2d6f599acc3f2ef Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 19 Dec 2013 15:41:48 +0100 Subject: [PATCH] Documenting and cleaning test scripts in /testbeds/iotlab/tests. Adding documentation in sphinx file index.rst. --- sfa/importer/iotlabimporter.py | 20 +- sfa/iotlab/docs/source/index.rst | 93 ++++++-- testbeds/iotlab/tests/driver_tests.py | 274 ++++++++++------------ testbeds/iotlab/tests/sfi_client_tests.py | 3 +- 4 files changed, 209 insertions(+), 181 deletions(-) diff --git a/sfa/importer/iotlabimporter.py b/sfa/importer/iotlabimporter.py index 17891cf3..9c957b31 100644 --- a/sfa/importer/iotlabimporter.py +++ b/sfa/importer/iotlabimporter.py @@ -145,18 +145,17 @@ class IotlabImporter: def locate_by_type_pointer(self, record_type, pointer): """ - - Returns the record corresponding to the key pointer and record - type. Returns None if the record does not exist and is not in the - records_by_type_pointer dictionnary. + Returns the record corresponding to the key pointer and record type. + Returns None if the record does not exist and is not in the + records_by_type_pointer dictionnary. :param record_type: the record's type (slice, node, authority...) :type record_type: string - :param pointer:Pointer to where the record is in the origin db, + :param pointer: Pointer to where the record is in the origin db, used in case the record comes from a trusted authority. :type pointer: integer - :rtype: RegUser if user, RegSlice if slice, RegNode if node... - or None if record does not exist. + :rtype: RegUser if user, RegSlice if slice, RegNode if node, or None if + record does not exist. """ return self.records_by_type_pointer.get((record_type, pointer), None) @@ -310,15 +309,14 @@ class IotlabImporter: def init_person_key(self, person, iotlab_key): """ - Returns a tuple pubkey and pkey. :param person Person's data. :type person: dict - :param iotlab_key: SSH public key, from LDAP user's data. - RSA type supported. + :param iotlab_key: SSH public key, from LDAP user's data. RSA type + supported. :type iotlab_key: string - :rtype (string, Keypair) + :rtype: (string, Keypair) """ pubkey = None diff --git a/sfa/iotlab/docs/source/index.rst b/sfa/iotlab/docs/source/index.rst index 6cdc13e7..b7772694 100644 --- a/sfa/iotlab/docs/source/index.rst +++ b/sfa/iotlab/docs/source/index.rst @@ -10,18 +10,32 @@ Welcome to Iotlab SFA driver's documentation! Code tree overview =================== +------------ +Installation +------------ +**Using git** + +git clone git://git.onelab.eu/sfa.git +cd sfa +git checkout +make version +python setup.py install + + can be either geni-v2 or geni-v3. ------ Driver ------ +**Folder**:/sfa/sfa/iotlab/ The Iotlab driver source code is under the folder /sfa, along with the other testbeds driver folders. The /iotlab directory contains the necessary files -defining API for OAR, LDAP, the postgresql database as well as for the SFA -managers. +defining API for OAR, LDAP, the postgresql table which is hosted in the SFA +database as well as for the SFA managers. The OAR API enables the user to get information regarding nodes and jobs: -nodes and their properties (hostnames, radio and so on), jobs and the associated -username and nodes. These are used when querying the testbed about resources +nodes properties (hostnames, radio, mobility type, position with GPS +coordinates and so on), jobs and the associated username and nodes. +These are used when querying the testbed about resources and leases. In order to add a new node property in the iotlab Rspec format, the new property must be defined and parsed beforehand from OAR in the OAR API file. @@ -31,20 +45,22 @@ If this class is reused in another context, it might not work without some bit of customization. The naming (turning a hostname into a sfa hrn, a LDAP login into a hrn ) is also done in this class. -The iotlabpostgres file defines a dedicated iotlab database, separated from the -SFA database. Its purpose is to hold information that we can't store anywhere -given the Iotlab architecture with OAR and LDAP, namely the association of a -job and the slice hrn for which the job is supposed to run. Indeed, one user -may register on another federated testbed then use his federated slice to book -iotlab nodes. In this case, an Iotlab LDAP account will be created. Later on, -when new users will be imported from the LDAP to the SFA database, an Iotlab -slice will be created for each new user found in the LDAP. Thus leading us to -the situation where one user may have the possibility to use different slices -to book Iotlab nodes. +The iotlabpostgres file defines a dedicated lease table, hosted in the SFA +database (in SFA version geni-v3) or in a separated and dedicated Iotlab +database(in SFA geni-v2). Its purpose is to hold information that we +can't store anywhere given the Iotlab architecture with OAR and LDAP, namely the +association of a job and the slice hrn for which the job is supposed to run. +Indeed, one user may register on another federated testbed then use his +federated slice to book iotlab nodes. In this case, an Iotlab LDAP account will +be created. Later on, when new users will be imported from the LDAP to the SFA +database, an Iotlab slice will be created for each new user found in the LDAP. +Thus leading us to the situation where one user may have the possibility to use +different slices to book Iotlab nodes. ---------------------------- RSpec specific Iotlab format ---------------------------- +**Folder**:/sfa/rspecs/versions , /sfa/rpecs/elements There is a specific Iotlab Rspec format. It aims at displaying information that is not hadled in the SFA Rspec format. Typically, it adds the nodes' mobility @@ -55,15 +71,64 @@ are done in the associated files under /rspecs/elements/versions. If a property has to be added to the nodes in the Iotlab Rspec format, it should be added in the iotlabv1Node file, using the other properties as example. +Future work: +The Rspec format has to be validated and stored on a website, as the header +of the return Rspec defines it, which is not the case with the Iotlab rspec +format. It has been discussed with Mohamed Larabi (Inria Sophia) once, never to +be mentionned again. Although this does not prevent the SFA server from working, +maybe it would be nice to be completely compliantand clean in this aspect also. +-SA Dec 2013- + -------- Importer -------- +**Folder**: /sfa/importer/ The iotlab importer task is to populate the SFA database with records created from the information given by OAR and LDAP. Running the importer periodically enables the SFA database to be in sync with the LDAP by deleting/ adding records in the database corresponding to newly deleted/ added users in LDAP. +-------------- +Documentation +-------------- +**Folder** : /sfa/sfa/iotlab/docs + +Thsi folder contains the sphinx files needed to generate this documentation. +As of Dec 2013, and because of the SFA database connexion methods, generating +the documentation fails if the database is not accessible. In this case, +Iotlabimporter will not be documented. +A possible workaround is to build the documentation on the SFA server hosting +the SFA database (which is not a really clean way to this...). +To ngenerate the documentation, do "make html" in the /docs folder, where the +Makefile is located. The package python-sphinx must be installed in order +for this command to work. + + +-------- +Testing +-------- +Two scripts have been written to help with the testing. One is dedicated for +testing the Iotlab driver, OAR and LDAP classes. The second is to check if the +client commands work well. + +**Folder** : /sfa/testbeds/iotlab/tests + +* driver_tests.py : python script to test OAR, LDAP and Iotlabdriver/ IotlabShell + methods. Modify the script to add more tests if needed. + + **starting the script** :python ./driver_tests <-option value>