summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5aab161)
trim TestPlc accordingly, have the doc where it belongs
split sfa_view into sfa_list sfa_show and sfa_slices
# Do most of the stuff locally - will be pushed on host_box - *not* the plc - later if needed
def qemu_local_init(self):
# Do most of the stuff locally - will be pushed on host_box - *not* the plc - later if needed
def qemu_local_init(self):
+ "all nodes : init a clean local directory for holding node-dep stuff like iso image..."
utils.system("rm -rf %s"%self.nodedir())
utils.system("mkdir %s"%self.nodedir())
if not self.is_qemu():
utils.system("rm -rf %s"%self.nodedir())
utils.system("mkdir %s"%self.nodedir())
if not self.is_qemu():
return utils.system("rsync -v -a --exclude .svn template-qemu/ %s/"%self.nodedir())==0
def bootcd(self):
return utils.system("rsync -v -a --exclude .svn template-qemu/ %s/"%self.nodedir())==0
def bootcd(self):
+ "all nodes: invoke GetBootMedium and store result locally"
utils.header("Calling GetBootMedium for %s"%self.name())
options = []
if self.is_qemu():
utils.header("Calling GetBootMedium for %s"%self.name())
options = []
if self.is_qemu():
return True
def nodestate_reinstall (self):
return True
def nodestate_reinstall (self):
+ "all nodes: mark PLCAPI boot_state as reinstall"
self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
self.name(),{'boot_state':'reinstall'})
return True
def nodestate_safeboot (self):
self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
self.name(),{'boot_state':'reinstall'})
return True
def nodestate_safeboot (self):
+ "all nodes: mark PLCAPI boot_state as safeboot"
self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
self.name(),{'boot_state':'safeboot'})
return True
def nodestate_boot (self):
self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
self.name(),{'boot_state':'safeboot'})
return True
def nodestate_boot (self):
+ "all nodes: mark PLCAPI boot_state as boot"
self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
self.name(),{'boot_state':'boot'})
return True
def nodestate_show (self):
self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
self.name(),{'boot_state':'boot'})
return True
def nodestate_show (self):
+ "all nodes: show PLCAPI boot_state"
if self.test_plc.options.dry_run:
print "Dry_run: skipped getting current node state"
return True
if self.test_plc.options.dry_run:
print "Dry_run: skipped getting current node state"
return True
return True
def qemu_local_config(self):
return True
def qemu_local_config(self):
+ "all nodes: compute qemu config qemu.conf and store it locally"
if not self.is_qemu():
return
mac=self.node_spec['interface_fields']['mac']
if not self.is_qemu():
return
mac=self.node_spec['interface_fields']['mac']
return True
def qemu_export (self):
return True
def qemu_export (self):
+ "all nodes: push local node-dep directory on the qemu box"
# if relevant, push the qemu area onto the host box
if self.test_box().is_local():
return True
# if relevant, push the qemu area onto the host box
if self.test_box().is_local():
return True
return self.test_box().copy(self.nodedir(),recursive=True)==0
def qemu_start (self):
return self.test_box().copy(self.nodedir(),recursive=True)==0
def qemu_start (self):
+ "all nodes: start the qemu instance (also runs qemu-bridge-init start)"
model=self.node_spec['node_fields']['model']
#starting the Qemu nodes before
if self.is_qemu():
model=self.node_spec['node_fields']['model']
#starting the Qemu nodes before
if self.is_qemu():
return True
def timestamp_qemu (self):
return True
def timestamp_qemu (self):
+ "all nodes: start the qemu instance (also runs qemu-bridge-init start)"
test_box = self.test_box()
test_box.run_in_buildname("mkdir -p %s"%self.nodedir())
now=int(time.time())
test_box = self.test_box()
test_box.run_in_buildname("mkdir -p %s"%self.nodedir())
now=int(time.time())
self.test_box().test_ssh.fetch(remote_log,local_log)
def keys_clear_known_hosts (self):
self.test_box().test_ssh.fetch(remote_log,local_log)
def keys_clear_known_hosts (self):
+ "remove test nodes entries from the local known_hosts file"
TestSsh(self.name()).clear_known_hosts()
return True
TestSsh(self.name()).clear_known_hosts()
return True
if not node_method(test_node, *args, **kwds): overall=False
return overall
# restore the doc text
if not node_method(test_node, *args, **kwds): overall=False
return overall
# restore the doc text
- actual.__doc__=method.__doc__
+ actual.__doc__=TestNode.__dict__[method.__name__].__doc__
return actual
def slice_mapper (method):
return actual
def slice_mapper (method):
if not slice_method(test_slice,self.options): overall=False
return overall
# restore the doc text
if not slice_method(test_slice,self.options): overall=False
return overall
# restore the doc text
- actual.__doc__=method.__doc__
+ actual.__doc__=TestSlice.__dict__[method.__name__].__doc__
return actual
def slice_sfa_mapper (method):
return actual
def slice_sfa_mapper (method):
if not slice_method(test_slice,self.options): overall=False
return overall
# restore the doc text
if not slice_method(test_slice,self.options): overall=False
return overall
# restore the doc text
- actual.__doc__=method.__doc__
+ actual.__doc__=TestSliceSfa.__dict__[method.__name__].__doc__
return actual
SEP='<sep>'
return actual
SEP='<sep>'
'sfi_configure@1', 'sfa_add_site@1','sfa_add_pi@1', SEPSFA,
'sfa_add_user@1', 'sfa_add_slice@1', 'sfa_discover@1', SEPSFA,
'sfa_create_slice@1', 'sfa_check_slice_plc@1', SEPSFA,
'sfi_configure@1', 'sfa_add_site@1','sfa_add_pi@1', SEPSFA,
'sfa_add_user@1', 'sfa_add_slice@1', 'sfa_discover@1', SEPSFA,
'sfa_create_slice@1', 'sfa_check_slice_plc@1', SEPSFA,
- 'sfa_update_user@1', 'sfa_update_slice@1', 'sfa_view@1', 'sfa_utest@1',SEPSFA,
+ 'sfa_update_user@1', 'sfa_update_slice@1', SEPSFA,
+ 'sfa_list@1', 'sfa_show@1', 'sfa_slices@1', 'sfa_utest@1', SEPSFA,
# we used to run plcsh_stress_test, and then ssh_node_debug and ssh_node_boot
# but as the stress test might take a while, we sometimes missed the debug mode..
'ssh_node_debug@1', 'plcsh_stress_test@1', SEP,
# we used to run plcsh_stress_test, and then ssh_node_debug and ssh_node_boot
# but as the stress test might take a while, we sometimes missed the debug mode..
'ssh_node_debug@1', 'plcsh_stress_test@1', SEP,
# write a timestamp in /vservers/<>.timestamp
# cannot be inside the vserver, that causes vserver .. build to cough
def timestamp_vs (self):
# write a timestamp in /vservers/<>.timestamp
# cannot be inside the vserver, that causes vserver .. build to cough
def timestamp_vs (self):
+ "Create a timestamp to remember creation date for this plc"
now=int(time.time())
# TODO-lxc check this one
# a first approx. is to store the timestamp close to the VM root like vs does
now=int(time.time())
# TODO-lxc check this one
# a first approx. is to store the timestamp close to the VM root like vs does
return self.check_nodes_ssh(debug=False,timeout_minutes=40,silent_minutes=38)
@node_mapper
return self.check_nodes_ssh(debug=False,timeout_minutes=40,silent_minutes=38)
@node_mapper
- def qemu_local_init (self):
- "all nodes : init a clean local directory for holding node-dep stuff like iso image..."
- pass
+ def qemu_local_init (self): pass
- def bootcd (self):
- "all nodes: invoke GetBootMedium and store result locally"
- pass
+ def bootcd (self): pass
- def qemu_local_config (self):
- "all nodes: compute qemu config qemu.conf and store it locally"
- pass
+ def qemu_local_config (self): pass
- def nodestate_reinstall (self):
- "all nodes: mark PLCAPI boot_state as reinstall"
- pass
+ def nodestate_reinstall (self): pass
- def nodestate_safeboot (self):
- "all nodes: mark PLCAPI boot_state as safeboot"
- pass
+ def nodestate_safeboot (self): pass
- def nodestate_boot (self):
- "all nodes: mark PLCAPI boot_state as boot"
- pass
+ def nodestate_boot (self): pass
- def nodestate_show (self):
- "all nodes: show PLCAPI boot_state"
- pass
+ def nodestate_show (self): pass
- def qemu_export (self):
- "all nodes: push local node-dep directory on the qemu box"
- pass
+ def qemu_export (self): pass
### check hooks : invoke scripts from hooks/{node,slice}
def check_hooks_node (self):
### check hooks : invoke scripts from hooks/{node,slice}
def check_hooks_node (self):
return True
@slice_mapper
return True
@slice_mapper
- def ssh_slice(self):
- "tries to ssh-enter the slice with the user key, to ensure slice creation"
- pass
-
+ def ssh_slice(self): pass
- def ssh_slice_off (self):
- "tries to ssh-enter the slice with the user key, expecting it to be unreachable"
- pass
+ def ssh_slice_off (self): pass
- def keys_clear_known_hosts (self):
- "remove test nodes entries from the local known_hosts file"
- pass
+ def keys_clear_known_hosts (self): pass
def speed_up_slices (self):
"tweak nodemanager settings on all nodes using a conf file"
def speed_up_slices (self):
"tweak nodemanager settings on all nodes using a conf file"
- def qemu_start (self) :
- "all nodes: start the qemu instance (also runs qemu-bridge-init start)"
- pass
+ def qemu_start (self) : pass
- def timestamp_qemu (self) :
- "all nodes: start the qemu instance (also runs qemu-bridge-init start)"
- pass
+ def timestamp_qemu (self) : pass
def check_tcp (self):
"check TCP connectivity between 2 slices (or in loopback if only one is defined)"
def check_tcp (self):
"check TCP connectivity between 2 slices (or in loopback if only one is defined)"
if first_try: return True
utils.header ("********** Regular yum failed - special workaround in place, 2nd chance")
(code,cached_rpm_path)=utils.output_of(self.actual_command_in_guest('find /var/cache/yum -name sfa-client\*.rpm'))
if first_try: return True
utils.header ("********** Regular yum failed - special workaround in place, 2nd chance")
(code,cached_rpm_path)=utils.output_of(self.actual_command_in_guest('find /var/cache/yum -name sfa-client\*.rpm'))
+ utils.header("rpm_path=<<%s>>"%rpm_path)
# just for checking
self.run_in_guest("rpm -i %s"%cached_rpm_path)
return self.yum_check_installed ("sfa-client")
# just for checking
self.run_in_guest("rpm -i %s"%cached_rpm_path)
return self.yum_check_installed ("sfa-client")
utils.header("DRY RUN - skipping step")
return True
sfa_spec=self.plc_spec['sfa']
utils.header("DRY RUN - skipping step")
return True
sfa_spec=self.plc_spec['sfa']
- # cannot use sfa_slice_mapper to pass dir_name
+ # cannot use slice_sfa_mapper to pass dir_name
for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
test_slice=TestSliceSfa(self,slice_spec)
dir_basename=os.path.basename(test_slice.sfi_path())
for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
test_slice=TestSliceSfa(self,slice_spec)
dir_basename=os.path.basename(test_slice.sfi_path())
return True
@slice_sfa_mapper
return True
@slice_sfa_mapper
- def sfa_add_site (self):
- "bootstrap a site using sfaadmin"
- pass
-
+ def sfa_add_site (self): pass
- def sfa_add_pi (self):
- "bootstrap a PI user for that site"
- pass
-
+ def sfa_add_pi (self): pass
- def sfa_add_user(self):
- "run sfi.py add"
- pass
-
+ def sfa_add_user(self): pass
- def sfa_update_user(self):
- "run sfi.py update"
-
+ def sfa_update_user(self): pass
- def sfa_add_slice(self):
- "run sfi.py add (on Registry) from slice.xml"
- pass
-
+ def sfa_add_slice(self): pass
- def sfa_discover(self):
- "discover resources into resouces_in.rspec"
- pass
-
+ def sfa_discover(self): pass
- def sfa_create_slice(self):
- "run sfi.py create (on SM) - 1st time"
- pass
-
+ def sfa_create_slice(self): pass
- def sfa_check_slice_plc(self):
- "check sfa_create_slice at the plcs - all local nodes should be in slice"
- pass
-
+ def sfa_check_slice_plc(self): pass
- def sfa_update_slice(self):
- "run sfi.py create (on SM) on existing object"
- pass
-
+ def sfa_update_slice(self): pass
- def sfa_view(self):
- "various registry-related calls"
- pass
-
+ def sfa_list(self): pass
- def ssh_slice_sfa(self):
- "tries to ssh-enter the SFA slice"
- pass
-
+ def sfa_show(self): pass
- def sfa_delete_user(self):
- "run sfi.py delete"
- pass
-
+ def sfa_slices(self): pass
- def sfa_delete_slice(self):
- "run sfi.py delete (on SM), sfi.py remove (on Registry) to clean slices"
- pass
+ def ssh_slice_sfa(self): pass
+ @slice_sfa_mapper
+ def sfa_delete_user(self): pass
+ @slice_sfa_mapper
+ def sfa_delete_slice(self): pass
def sfa_stop(self):
"service sfa stop"
def sfa_stop(self):
"service sfa stop"
# trying to reach the slice through ssh - expected to answer
def ssh_slice (self, options, *args, **kwds):
# trying to reach the slice through ssh - expected to answer
def ssh_slice (self, options, *args, **kwds):
+ "tries to ssh-enter the slice with the user key, to ensure slice creation"
return self.do_ssh_slice(options, expected=True, *args, **kwds)
# when we expect the slice is not reachable
def ssh_slice_off (self, options, *args, **kwds):
return self.do_ssh_slice(options, expected=True, *args, **kwds)
# when we expect the slice is not reachable
def ssh_slice_off (self, options, *args, **kwds):
+ "tries to ssh-enter the slice with the user key, expecting it to be unreachable"
return self.do_ssh_slice(options, expected=False, *args, **kwds)
def do_ssh_slice(self,options,expected=True,timeout_minutes=20,silent_minutes=10,period=15):
return self.do_ssh_slice(options, expected=False, *args, **kwds)
def do_ssh_slice(self,options,expected=True,timeout_minutes=20,silent_minutes=10,period=15):
def rspec_style (self): return self.sfa_slice_spec['rspec_style']
def rspec_style (self): return self.sfa_slice_spec['rspec_style']
+ # the hrn for the site
+ def auth_hrn (self):
+ return self.test_plc.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH']
+
# the hrn for the site
def site_hrn (self):
# the hrn for the site
def site_hrn (self):
- return "%s.%s"%(self.test_plc.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH'],
- self.login_base)
+ return "%s.%s"%(self.auth_hrn(),self.login_base)
# something in the site (users typically)
def qualified_hrn (self, name):
# something in the site (users typically)
def qualified_hrn (self, name):
# using sfaadmin to bootstrap
def sfa_add_site (self, options):
# using sfaadmin to bootstrap
def sfa_add_site (self, options):
+ "bootstrap a site using sfaadmin"
command="sfaadmin reg register -t authority -x %s"%self.site_hrn()
return self.test_plc.run_in_guest(command)==0
def sfa_add_pi (self, options):
command="sfaadmin reg register -t authority -x %s"%self.site_hrn()
return self.test_plc.run_in_guest(command)==0
def sfa_add_pi (self, options):
+ "bootstrap a PI user for that site"
pi_hrn=self.qualified_hrn(self.piuser)
pi_mail=self.sfa_slice_spec['pimail']
# as installed by sfi_config
pi_hrn=self.qualified_hrn(self.piuser)
pi_mail=self.sfa_slice_spec['pimail']
# as installed by sfi_config
# user management
def sfa_add_user (self, options):
# user management
def sfa_add_user (self, options):
+ "add a regular user using sfi.py add"
return TestUserSfa(self.test_plc, self.sfa_slice_spec, self).add_user()
def sfa_update_user (self, options):
return TestUserSfa(self.test_plc, self.sfa_slice_spec, self).add_user()
def sfa_update_user (self, options):
+ "update a user record using sfi.py update"
return TestUserSfa(self.test_plc, self.sfa_slice_spec, self).update_user()
def sfa_delete_user (self, options):
return TestUserSfa(self.test_plc, self.sfa_slice_spec, self).update_user()
def sfa_delete_user (self, options):
return TestUserSfa(self.test_plc, self.sfa_slice_spec, self).delete_user()
# run as pi
return TestUserSfa(self.test_plc, self.sfa_slice_spec, self).delete_user()
# run as pi
return "sfi.py -d %s -u %s %s"%(self.sfi_path(),self.qualified_hrn(self.regularuser), command,)
# those are step names exposed as methods of TestPlc, hence the _sfa
return "sfi.py -d %s -u %s %s"%(self.sfi_path(),self.qualified_hrn(self.regularuser), command,)
# those are step names exposed as methods of TestPlc, hence the _sfa
- def sfa_view (self, options):
- "run (as regular user) sfi list and sfi show (both on Registry) and sfi slices (on SM)"
- root_auth=self.test_plc.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH']
+
+ def sfa_list (self, options):
+ "run (as regular user) sfi list (on Registry)"
+ return \
+ self.test_plc.run_in_guest(self.sfi_user("list -r %s"%self.auth_hrn()))==0 and \
+ self.test_plc.run_in_guest(self.sfi_user("list %s"%(self.site_hrn())))==0
+
+ def sfa_show (self, options):
+ "run (as regular user) sfi show (on Registry)"
+ return \
+ self.test_plc.run_in_guest(self.sfi_user("show %s"%(self.site_hrn())))==0
+
+ def sfa_slices (self, options):
+ "run (as regular user) sfi slices (on SM)"
- self.test_plc.run_in_guest(self.sfi_user("list %s"%(self.site_hrn())))==0 and \
- self.test_plc.run_in_guest(self.sfi_user("show %s"%(self.site_hrn())))==0 and \
- self.test_plc.run_in_guest(self.sfi_user("slices"))==0
+ self.test_plc.run_in_guest(self.sfi_user("slices"))==0
# needs to be run as pi
def sfa_add_slice(self,options):
# needs to be run as pi
def sfa_add_slice(self,options):
+ "run sfi.py add (on Registry) from slice.xml"
return self.test_plc.run_in_guest(self.sfi_pi("add %s"%(self.addslicefile())))==0
# run as user
def sfa_discover(self,options):
return self.test_plc.run_in_guest(self.sfi_pi("add %s"%(self.addslicefile())))==0
# run as user
def sfa_discover(self,options):
+ "discover resources into resouces_in.rspec"
return self.test_plc.run_in_guest(self.sfi_user(\
"resources %s -o %s/%s"% (self.discover_option(),self.sfi_path(),self.adfile())))==0
# run sfi create as a regular user
def sfa_create_slice(self,options):
return self.test_plc.run_in_guest(self.sfi_user(\
"resources %s -o %s/%s"% (self.discover_option(),self.sfi_path(),self.adfile())))==0
# run sfi create as a regular user
def sfa_create_slice(self,options):
+ "run sfi.py create (on SM) - 1st time"
commands=[
"sfiListNodes.py -i %s/%s -o %s/%s"%(self.sfi_path(),self.adfile(),self.sfi_path(),self.nodefile()),
"sfiAddSliver.py -i %s/%s -n %s/%s -o %s/%s"%\
commands=[
"sfiListNodes.py -i %s/%s -o %s/%s"%(self.sfi_path(),self.adfile(),self.sfi_path(),self.nodefile()),
"sfiAddSliver.py -i %s/%s -n %s/%s -o %s/%s"%\
# all local nodes in slice ?
def sfa_check_slice_plc (self,options):
# all local nodes in slice ?
def sfa_check_slice_plc (self,options):
+ "check sfa_create_slice at the plcs - all local nodes should be in slice"
slice_fields = self.sfa_slice_spec['slice_fields']
slice_name = slice_fields['name']
slice=self.test_plc.apiserver.GetSlices(self.test_plc.auth_root(), slice_name)[0]
slice_fields = self.sfa_slice_spec['slice_fields']
slice_name = slice_fields['name']
slice=self.test_plc.apiserver.GetSlices(self.test_plc.auth_root(), slice_name)[0]
# actually the same for now
def sfa_update_slice(self,options):
# actually the same for now
def sfa_update_slice(self,options):
+ "run sfi.py create (on SM) on existing object"
return self.sfa_create_slice(options)
# run as pi
def sfa_delete_slice(self,options):
return self.sfa_create_slice(options)
# run as pi
def sfa_delete_slice(self,options):
self.test_plc.run_in_guest(self.sfi_pi("delete %s"%(self.hrn(),)))
return self.test_plc.run_in_guest(self.sfi_pi("remove -t slice %s"%(self.hrn(),)))==0
# check the resulting sliver
def ssh_slice_sfa(self,options,timeout_minutes=40,silent_minutes=30,period=15):
self.test_plc.run_in_guest(self.sfi_pi("delete %s"%(self.hrn(),)))
return self.test_plc.run_in_guest(self.sfi_pi("remove -t slice %s"%(self.hrn(),)))==0
# check the resulting sliver
def ssh_slice_sfa(self,options,timeout_minutes=40,silent_minutes=30,period=15):
+ "tries to ssh-enter the SFA slice"
timeout = datetime.datetime.now()+datetime.timedelta(minutes=timeout_minutes)
graceout = datetime.datetime.now()+datetime.timedelta(minutes=silent_minutes)
# locate a key
timeout = datetime.datetime.now()+datetime.timedelta(minutes=timeout_minutes)
graceout = datetime.datetime.now()+datetime.timedelta(minutes=silent_minutes)
# locate a key
'sfa_update_user', 'sfa_update_slice', 'sfa_view', 'sfa_utest',
]
'sfa_update_user', 'sfa_update_slice', 'sfa_view', 'sfa_utest',
]
+sequences['sfa_view'] = [
+ 'sfa-list',
+ 'sfa-show',
+ 'sfa-slices',
+]
+
# something that can given to the nightly to prepare a standalone sfa setup
# after what you'll want to tweak the config to point to a myplc some place else
sequences['sfa_standalone'] = [
# something that can given to the nightly to prepare a standalone sfa setup
# after what you'll want to tweak the config to point to a myplc some place else
sequences['sfa_standalone'] = [
'vs_delete',
'timestamp_vs',
'vs_create',
'vs_delete',
'timestamp_vs',
'vs_create',
'sfa_configure',
'cross_sfa_configure',
'sfa_start',
'sfa_configure',
'cross_sfa_configure',
'sfa_start',
'sfa-add-pi',
'sfa-add-user',
'sfa-add-slice',
'sfa-add-pi',
'sfa-add-user',
'sfa-add-slice',
'sfa-delete-slice',
'sfa-delete-user',
'sfa-delete-slice',
'sfa-delete-user',