Sandrine commits:
authorMohamed Larabi <mohamed.larabi@inria.fr>
Tue, 17 Sep 2013 14:07:31 +0000 (16:07 +0200)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Tue, 17 Sep 2013 14:07:31 +0000 (16:07 +0200)
Renaming the testing files.
Adding LDAP check on testsuite.py .
Renaming testsuite as it is now a python file.
Adding more tests to testsuite.

testbeds/iotlab/requirements.txt [moved from testbeds/senslab/requirements.txt with 100% similarity]
testbeds/iotlab/tests/driver_tests.py [moved from testbeds/senslab/tests/TestSuite.py with 97% similarity]
testbeds/iotlab/tests/sfi_client_tests.py [new file with mode: 0755]
testbeds/senslab/tests/bash_testsuite [deleted file]

similarity index 97%
rename from testbeds/senslab/tests/TestSuite.py
rename to testbeds/iotlab/tests/driver_tests.py
index 7f2352d..25fd3fa 100644 (file)
@@ -9,7 +9,6 @@
 from sfa.iotlab.LDAPapi import LDAPapi
 import ldap.modlist as modlist
 
-
 #logger sfa
 from sfa.util.sfalogging import logger
 
@@ -181,13 +180,12 @@ def get_stuff(oar, uri):
     data = json.dumps({})
 
     headers['X-REMOTE_IDENT'] = 'avakian'
-
     headers['content-length'] = '0' #seems that it does not work if we don't add this
 
 
     conn = httplib.HTTPConnection(oar.oarserver['ip'], oar.oarserver['port'])
     conn.request("GET", uri, data , headers )
-    resp = ( conn.getresponse()).read()
+    resp = (conn.getresponse()).read()
 
     conn.close()
 
@@ -261,8 +259,8 @@ def TestIotlabDriver(job_id = None):
     #nodes = iotlabdriver.iotlab_api.GetReservedNodes()
     #print " \r\n \r\n GetReservedNodes", nodes
 
-    #sl = iotlabdriver.iotlab_api.GetSlices(slice_filter='iotlab.avakian_slice', slice_filter_type='slice_hrn')
-    #print "\r\n \r\nGetSlices", sl[0]
+    sl = iotlabdriver.iotlab_api.GetSlices(slice_filter='iotlab.avakian_slice', slice_filter_type='slice_hrn')
+    print "\r\n \r\nGetSlices", sl[0]
 
     #sl = iotlabdriver.iotlab_api.GetSlices(slice_filter='20', slice_filter_type='record_id_user')
     #print "\r\n \r\nGetSlices", sl
@@ -292,7 +290,7 @@ def  TestSfi(filename = None):
     print os.system("sfi.py resources -l all")
 
 
-    print "================ SFI.PY RESOURCES -R SLAB -L ALL ============\r\n", \
+    print "================ SFI.PY RESOURCES -R IOTLAB -L ALL ============\r\n", \
     os.system("sfi.py resources -r iotlab -l all")
 
     print "================ WRITING  sfi.py resources -l all ===========\r\n", \
diff --git a/testbeds/iotlab/tests/sfi_client_tests.py b/testbeds/iotlab/tests/sfi_client_tests.py
new file mode 100755 (executable)
index 0000000..a4032de
--- /dev/null
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+
+import os
+from sfa.iotlab.LDAPapi import LDAPapi
+from difflib import SequenceMatcher
+
+# check if the firexp user (uid user) is already in LDAP
+# in this is the case, delete it :
+ldap_server = LDAPapi()
+dn = 'uid=' + 'user' + ',' + ldap_server.baseDN
+result = ldap_server.LdapSearch('(uid=user)', [])
+
+if result != []:
+       retval = ldap_server.LDAPDelete(dn)
+       print "deleting firexp user : %s " , retval
+
+
+print "config sfi"
+with open ("/root/.sfi/sfi_config", "r") as sfi_config:
+       sfi_config_txt = [line for line in sfi_config]
+
+with open("/root/.sfi/sfi_config_iotlab", "r") as sfi_config_iotlab:
+       sfi_config_iotlab_txt = [line for line in sfi_config_iotlab]
+
+with open("/root/.sfi/sfi_config_firexp", "r") as sfi_config_firexp:
+       sfi_config_firexp_txt  =  [line for line in sfi_config_firexp]
+# check that we are using the iotlab sfi configuration
+result1 = SequenceMatcher(None, sfi_config_txt, sfi_config_iotlab_txt)
+
+result2 = SequenceMatcher(None, sfi_config_txt, sfi_config_firexp_txt)
+
+if result1.ratio() != 1.0:
+       os.system('cp /root/.sfi/sfi_config_iotlab /root/.sfi/sfi_config')
+
+os.system('cat /root/.sfi/sfi_config')
+os.system('rm /root/tests_rspecs/iotlab_devlille_OUTPUT.rspec')
+
+print " =================    SFI.PY LIST IOTLAB        ============="
+os.system('sfi.py list iotlab')
+
+
+print " =================    SFI.PY RESOURCES          ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources')
+
+
+print " ================= SFI.PY RESOURCES -R IOTLAB        ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources -r iotlab')
+
+
+print " =================    SFI.PY RESOURCES -L ALL      ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources -l all')
+
+print " ================= SFI.PY RESOURCES -R IOTLAB -L ALL ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources -r iotlab -l all')
+
+print " ================= SFI.PY RESOURCES -O  output rspec ==========="
+os.system('sfi.py resources -o /root/tests_rspecs/iotlab_devlille_OUTPUT.rspec')
+
+print " ================= SFI.PY RESOURCES -L LEASES  ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources -l leases')
+
+
+print " =================    SFI.PY SHOW USER   ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py show iotlab.avakian')
+
+print " =================    SFI.PY SHOW NODE   ============="
+os.system('sfi.py show iotlab.node6.devlille.senslab.info')
+
+print " =================    SFI.PY SLICES       ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py slices')
+
+print " =================    SFI.PY STATUS SLICE   ============="
+os.system('sfi.py status iotlab.avakian_slice')
+
+print " =================    SFI.PY CREATE SLICE  on iotlab only  ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py create iotlab.avakian_slice /root/tests_rspecs/iotlab_devlille.rspec')
+
+
+print " ================= SFI.PY RESOURCES -l all iotlab.avakian_slice ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources -l all iotlab.avakian_slice')
+
+
+print " =================    SFI.PY DELETE SLICE   ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py delete iotlab.avakian_slice')
+
+
+print " =================    SFI.PY CREATE SLICE  on iotlab and firexp  ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py create iotlab.avakian_slice /root/tests_rspecs/test_bidir.rspec')
+
+
+print " ================= SFI.PY RESOURCES -l all -r iotlab iotlab.avakian_slice ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources -l all -r iotlab iotlab.avakian_slice')
+
+
+print " =================SFI.PY RESOURCES -L LEASES -R IOTLAB ============== "
+os.system('sfi.py resources -r iotlab -l leases')
+
+
+print " =================    SFI.PY DELETE SLICE   ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py delete iotlab.avakian_slice')
+
+print "\r\n \r\n"
+
+print " *********changing to firexp sfi config ***************"
+os.system('cp /root/.sfi/sfi_config_firexp /root/.sfi/sfi_config')
+
+
+
+print " =================    SFI.PY CREATE SLICE  on iotlab and firexp  ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py create firexp.flab.iotlab_slice /root/tests_rspecs/mynodes.rspec')
+
+
+print " =================    SFI.PY SHOW SLICE   ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py show firexp.flab.iotlab_slice')
+
+
+print " ================= SFI.PY RESOURCES -l leases firexp.flab.iotlab_slice ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources -l leases firexp.flab.iotlab_slice')
+
+
+print " ================= SFI.PY RESOURCES firexp.flab.iotlab_slice  ============="
+raw_input("Press Enter to continue...")
+os.system('sfi.py resources firexp.flab.iotlab_slice')
+
+
+
+
diff --git a/testbeds/senslab/tests/bash_testsuite b/testbeds/senslab/tests/bash_testsuite
deleted file mode 100755 (executable)
index 55c363c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-if (( ! $# == 2 ))
-then
-    echo " Usage : bash_test takes 2 arguments : one jobid and one of the following:"
-    echo " LDAP/ OAR / driver "
-    echo  $#
-    exit
-fi
-
-sfi.py list senslab2
-echo " =================    SFI.PY RESOURCES            ============="
-sfi.py resources
-
-echo " ================= SFI.PY RESOURCES -R SLAB        ============="
-sfi.py resources -r iotlab
-
-echo " =================    SFI.PY RESOURCES -L ALL      ============="
-sfi.py resources -l all
-
-echo " ================= SFI.PY RESOURCES -R SLAB -L ALL ============="
-sfi.py resources -r iotlab -l all
-
-echo " ================= SFI.PY RESOURCES -L ALL > avakian_adv.rspec ============="
-sfi.py resources -l all > /home/savakian/flab-sfa/avakian_adv.rspec
-
-echo " ================= SFI.PY RESOURCES avakian_adv.rspec ============="
-sfi.py resources senslab2.avakian_slice
-
-
-echo " =================    SFI.PY SHOW SLICE   ============="
-sfi.py show senslab2.avakian_slice
-
-echo " =================    SFI.PY SHOW USER   ============="
-sfi.py show senslab2.avakian
-
-echo " =================    SFI.PY SHOW NODE   ============="
-sfi.py show senslab2.node67.grenoble.senslab.info
-
-echo " =================    SFI.PY SLICES       ============="
-sfi.py slices
-
-echo " =================    SFI.PY STATUS SLICE   ============="
-sfi.py status senslab2.avakian_slice
-
-echo " =================    SFI.PY CREATE SLICE   ============="
-sfi.py create senslab2.avakian_slice /home/savakian/flab-sfa/avakian_adv.rspec
-
-# echo " =================    SFI.PY DELETE SLICE   ============="
-# sfi.py delete senslab2.avakian_slice
-
-echo "\r\n"
-echo " PYTHON TEST ", $1, $2