def privatepath(self):
return "keys/%s.rsa"%(self.name())
- def store_remote_key(self,hostname):
- #Not tested yet, don't know if needed
- pub=self.publicpath()
- priv=self.privatepath()
- utils.header("Storing key %s in %s into %s "%(self.name(),pub,hostname))
- dir=os.path.dirname(pub)
- self.test_ssh.run("mkdir %s"%dir)
- self.test_ssh.run("cat %s >> %s"%(self.key_spec['key_fields']['key'],pub))
- self.test_ssh.run("cat %s >> %s"%(self.key_spec['private'],priv))
- self.test_ssh.run("chmod %s 0400"%priv)
- self.test_ssh.run("chmod %s 0444"%pub)
+#Not tested yet, don't know if needed
+# def store_remote_key(self,hostname):
+# pub=self.publicpath()
+# priv=self.privatepath()
+# utils.header("Storing key %s in %s into %s "%(self.name(),pub,hostname))
+# dir=os.path.dirname(pub)
+# self.test_ssh.run("mkdir %s"%dir)
+# self.test_ssh.run("cat %s >> %s"%(self.key_spec['key_fields']['key'],pub))
+# self.test_ssh.run("cat %s >> %s"%(self.key_spec['private'],priv))
+# self.test_ssh.run("chmod %s 0400"%priv)
+# self.test_ssh.run("chmod %s 0444"%pub)
def store_key(self):
pub=self.publicpath()
-import os, sys, time, base64
+import sys, os, os.path, time, base64
import xmlrpclib
import utils
def clear_known_hosts (self):
TestSsh(self.name()).clear_known_hosts()
return True
+
+ def check_sanity_node_script (self,local_script):
+ # get the plc's keys for entering the node
+ vservername=self.test_plc.vservername
+ key = "keys/%(vservername)s.rsa"%locals()
+ # push the script on the node's root context
+ ssh_handle = TestSsh(self.name(),
+ buildname=self.buildname(),
+ key=key)
+ ssh_handle.copy_home(local_script)
+ if ssh_handle.run("./"+os.path.basename(local_script)) != 0:
+ print "WARNING: sanity check script %s FAILED"
+ # xxx - temporary : always return true for now
+ #return False
+ return True
+
+ def check_sanity_node (self):
+ # locate the relevant scripts - xxx
+ scripts = [ 'tests/qaapi/qa/tests/node/vsys_launch.pl' ]
+ overall = True
+ for script in scripts:
+ if not self.check_sanity_node_script (script):
+ overall = False
+ return overall
class TestPlc:
default_steps = ['uninstall','install','install_rpm',
- 'configure', 'start', SEP,
+ 'configure', 'start', 'fetch_keys', SEP,
'store_keys', 'clear_known_hosts', 'initscripts', SEP,
'sites', 'nodes', 'slices', 'nodegroups', SEP,
'init_node','bootcd', 'configure_qemu', 'export_qemu',
'kill_all_qemus', 'reinstall_node','start_node', SEP,
- 'nodes_booted', 'nodes_ssh', 'check_slice',
- 'check_initscripts', 'check_tcp', 'plcsh_stress_test', SEP,
+ 'nodes_booted', 'nodes_ssh', 'check_slice', 'check_initscripts', SEP,
+ 'check_sanity', 'check_tcp', 'plcsh_stress_test', SEP,
'force_gather_logs', 'force_kill_qemus', 'force_record_tracker','force_free_tracker' ]
other_steps = [ 'stop_all_vservers','fresh_install', 'cache_rpm', 'stop', 'vs_start', SEP,
'clean_initscripts', 'clean_nodegroups','clean_all_sites', SEP,
self.start_guest()
return True
- # could use a TestKey class
+ # stores the keys from the config for further use
def store_keys(self):
for key_spec in self.plc_spec['keys']:
TestKey(self,key_spec).store_key()
def clean_keys(self):
utils.system("rm -rf %s/keys/"%os.path(sys.argv[0]))
+ # fetches the ssh keys in the plc's /etc/planetlab and stores them in keys/
+ # for later direct access to the nodes
+ def fetch_keys(self):
+ prefix = 'root_ssh_key'
+ vservername=self.vservername
+ for ext in [ 'pub', 'rsa' ] :
+ src="/vservers/%(vservername)s/etc/planetlab/%(prefix)s.%(ext)s"%locals()
+ dst="keys/%(vservername)s.%(ext)s"%locals()
+ self.run_in_guest_piped
+ self.test_ssh.fetch(src,dst)
+
def sites (self):
return self.do_sites()
@node_mapper
def export_qemu (self): pass
+ @node_mapper
+ def check_sanity_node (self): pass
+ @slice_mapper_options
+ def check_sanity_slice (self) : pass
+
+ def check_sanity (self):
+ return self.check_sanity_node() and self.check_sanity_slice()
+
def do_check_initscripts(self):
overall = True
for slice_spec in self.plc_spec['slices']: