pushing the resources output to a file
[tests.git] / system / TestPlc.py
index 377c4a4..341c142 100644 (file)
@@ -477,8 +477,9 @@ class TestPlc:
             raise Exception, "Unsupported personality %r"%self.options.personality
         return \
             self.run_in_guest("yum -y install myplc")==0 and \
-            self.run_in_guest("yum -y install noderepo-%s-%s"%(self.options.pldistro,arch))==0 and \
-            self.run_in_guest("yum -y install bootstrapfs-%s-%s-plain"%(self.options.pldistro,arch))==0 
+            nodefamily="%s-%s-%s"%(self.options.pldistro,self.options.fcdistro,arch)
+            self.run_in_guest("yum -y install noderepo-%s"%nodefamily)==0 and \
+                self.run_in_guest("yum -y install bootstrapfs-%s-plain"%nodefamily)==0 
 
     ### 
     def configure(self):
@@ -728,9 +729,9 @@ class TestPlc:
         return True
 
     def nodes_booted(self):
-        return self.nodes_check_boot_state('boot',timeout_minutes=20,silent_minutes=15)
+        return self.nodes_check_boot_state('boot',timeout_minutes=30,silent_minutes=20)
 
-    def check_nodes_ssh(self,debug,timeout_minutes,silent_minutes,period=20):
+    def check_nodes_ssh(self,debug,timeout_minutes,silent_minutes,period=15):
         # compute timeout
         timeout = datetime.datetime.now()+datetime.timedelta(minutes=timeout_minutes)
         graceout = datetime.datetime.now()+datetime.timedelta(minutes=silent_minutes)
@@ -750,18 +751,7 @@ class TestPlc:
                 # try to run 'hostname' in the node
                 command = TestSsh (hostname,key=local_key).actual_command("hostname;uname -a")
                 # don't spam logs - show the command only after the grace period 
-                if datetime.datetime.now() > graceout:
-                    success=utils.system(command)
-                else:
-                    # truly silent, just print out a dot to show we're alive
-                    print '.',
-                    sys.stdout.flush()
-                    command += " 2>/dev/null"
-                    if self.options.dry_run:
-                        print 'dry_run',command
-                        success=0
-                    else:
-                        success=os.system(command)
+                success = utils.system ( command, silent=datetime.datetime.now() < graceout)
                 if success==0:
                     utils.header('Successfully entered root@%s (%s)'%(hostname,message))
                     # refresh tocheck
@@ -944,26 +934,27 @@ class TestPlc:
             arch = "x86_64"
         else:
             raise Exception, "Unsupported personality %r"%self.options.personality
-        return \
-            self.run_in_guest("yum -y install sfa")==0 and \
-            self.run_in_guest("yum -y install sfa-client")==0 and \
-            self.run_in_guest("yum -y install sfa-plc")==0 and \
-            self.run_in_guest("yum -y install sfa-sfatables")==0
+        return self.run_in_guest("yum -y install sfa sfa-client sfa-plc sfa-sfatables")==0
+
     ###
     def configure_sfa(self):
         "run sfa-config-tty"
         tmpname='%s.sfa-config-tty'%(self.name())
         fileconf=open(tmpname,'w')
-        fileconf.write ('u\n')
         for var in [ 'SFA_REGISTRY_ROOT_AUTH',
                      'SFA_REGISTRY_LEVEL1_AUTH',
+                    'SFA_REGISTRY_HOST',
+                    'SFA_AGGREGATE_HOST',
+                     'SFA_SM_HOST',
                      'SFA_PLC_USER',
                      'SFA_PLC_PASSWORD',
                      'SFA_PLC_DB_HOST',
                      'SFA_PLC_DB_USER',
-                     'SFA_PLC_DB_PASSWORD']:
-            fileconf.write ('%s\n'%(self.plc_spec['sfa'][var]))
+                     'SFA_PLC_DB_PASSWORD',
+                    'SFA_PLC_URL']:
+            fileconf.write ('e %s\n%s\n'%(var,self.plc_spec['sfa'][var]))
         fileconf.write('w\n')
+        fileconf.write('R\n')
         fileconf.write('q\n')
         fileconf.close()
         utils.system('cat %s'%tmpname)
@@ -975,7 +966,8 @@ class TestPlc:
         "sfa-import-plc"
        auth=self.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH']
         self.run_in_guest('sfa-import-plc.py')
-        self.run_in_guest('cp /etc/sfa/authorities/%s/%s.pkey /etc/sfa/authorities/server.key'%(auth,auth))
+# not needed anymore
+#        self.run_in_guest('cp /etc/sfa/authorities/%s/%s.pkey /etc/sfa/authorities/server.key'%(auth,auth))
         return True
 
     def start_sfa(self):
@@ -1002,9 +994,11 @@ class TestPlc:
        SFI_USER=SFI_AUTH+'.fake-pi1'
         fileconf.write ("SFI_USER='%s'"%SFI_USER)
        fileconf.write('\n')
-        fileconf.write ("SFI_REGISTRY='http://localhost:12345/'")
+       SFI_REGISTRY='http://' + self.plc_spec['sfa']['SFA_PLC_DB_HOST'] + ':12345/'
+        fileconf.write ("SFI_REGISTRY='%s'"%SFI_REGISTRY)
        fileconf.write('\n')
-        fileconf.write ("SFI_SM='http://localhost:12347/'")
+       SFI_SM='http://' + self.plc_spec['sfa']['SFA_PLC_DB_HOST'] + ':12347/'
+        fileconf.write ("SFI_SM='%s'"%SFI_SM)
        fileconf.write('\n')
         fileconf.close()
 
@@ -1075,7 +1069,7 @@ class TestPlc:
        self.run_in_guest("sfi.py -d /root/.sfi/ list %s.main"%auth)==0 and \
        self.run_in_guest("sfi.py -d /root/.sfi/ show %s.main"%auth)==0 and \
        self.run_in_guest("sfi.py -d /root/.sfi/ slices")==0 and \
-       self.run_in_guest("sfi.py -d /root/.sfi/ resources")==0
+       self.run_in_guest("sfi.py -d /root/.sfi/ resources -o resources")==0
 
     @slice_mapper_options_sfa
     def check_slice_sfa(self):