From ebd8fa86b09d7c9527c3b1cccb96803ad3e0f87e Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Mon, 28 Apr 2014 16:34:47 +0200 Subject: [PATCH] new test steps - exercise sfi update to remove/insert a user in a slice --- system/TestAuthSfa.py | 37 ++++++++++++++++++++++++++++++------- system/TestPlc.py | 8 ++++++++ system/macros.py | 7 +++++++ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/system/TestAuthSfa.py b/system/TestAuthSfa.py index 43bc7ba..d792e33 100644 --- a/system/TestAuthSfa.py +++ b/system/TestAuthSfa.py @@ -64,6 +64,11 @@ class TestAuthSfa: def obj_hrn (self, name): return "%s.%s"%(self.auth_hrn(),name) + def regular_user_hrn(self): + return self.obj_hrn(self.auth_sfa_spec['user_spec']['name']) + def slice_hrn(self): + return self.obj_hrn(self.auth_sfa_spec['slice_spec']['name']) + # xxx this needs tweaks with more recent versions of sfa that have pgv2 as the default ? # dir_name is local and will be pushed later on by TestPlc # by default set SFI_USER to the pi, we'll overload this @@ -139,24 +144,42 @@ class TestAuthSfa: @user_sfa_mapper def sfa_delete_user (self, *args, **kwds): pass + def sfa_remove_user_from_slice (self, options): + "remove regular user from slice" + command="update -t slice -x %s -r none"%(self.slice_hrn()) + # xxx should check result other than visually + return self.test_plc.run_in_guest(self.sfi_pi(command))==0 + + def sfa_insert_user_in_slice (self, options): + "defines regular user as unique user in slice" + command="update -t slice -x %s -r %s"%(self.slice_hrn(),self.regular_user_hrn()) + # xxx should check result other than visually + return self.test_plc.run_in_guest(self.sfi_pi(command))==0 + def sfi_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.root_hrn()))==0 and \ self.test_plc.run_in_guest(self.sfi_user("list %s"%(self.auth_hrn())))==0 - def sfi_show_slice (self, options): - "run (as PI) sfi show -n (on Registry)" - slice_spec=self.auth_sfa_spec['slice_spec'] - slice_hrn=self.obj_hrn(slice_spec['name']) - return \ - self.test_plc.run_in_guest(self.sfi_pi("show -n %s"%slice_hrn))==0 - def sfi_show_site (self, options): "run (as regular user) sfi show (on Registry)" return \ self.test_plc.run_in_guest(self.sfi_user("show %s"%(self.auth_hrn())))==0 + + def sfi_show_slice (self, options): + "run (as PI) sfi show -n (on Registry)" + return \ + self.test_plc.run_in_guest(self.sfi_pi("show -n %s"%self.slice_hrn()))==0 + + # checks if self.regular_user is found in registry's reg-researchers + def sfi_show_slice_researchers (self, options): + "run (as PI) sfi show -k researcher -k reg-researchers (on Registry)" + return \ + self.test_plc.run_in_guest(self.sfi_pi("show %s -k researcher -k reg-researchers"%self.slice_hrn()))==0 + + # those are step names exposed as methods of TestPlc, hence the _sfa @slice_sfa_mapper def sfa_add_slice (self, *args, **kwds): pass diff --git a/system/TestPlc.py b/system/TestPlc.py index d642f5b..c589c6e 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -150,6 +150,8 @@ class TestPlc: 'sfa_install_all', 'sfa_configure', 'cross_sfa_configure', 'sfa_start', 'sfa_import', SEPSFA, 'sfi_configure@1', 'sfa_add_site@1','sfa_add_pi@1', SEPSFA, 'sfa_add_user@1', 'sfa_update_user@1', 'sfa_add_slice@1', 'sfa_renew_slice@1', SEPSFA, + 'sfa_remove_user_from_slice@1','sfi_show_slice_researchers@1', + 'sfa_insert_user_in_slice@1','sfi_show_slice_researchers@1', SEPSFA, 'sfa_discover@1', 'sfa_create_slice@1', 'sfa_check_slice_plc@1', 'sfa_update_slice@1', SEPSFA, 'sfi_list@1', 'sfi_show_site@1', 'sfa_utest@1', SEPSFA, # we used to run plcsh_stress_test, and then ssh_node_debug and ssh_node_boot @@ -1630,12 +1632,18 @@ class TestPlc: @auth_sfa_mapper def sfa_update_slice(self): pass @auth_sfa_mapper + def sfa_remove_user_from_slice(self): pass + @auth_sfa_mapper + def sfa_insert_user_in_slice(self): pass + @auth_sfa_mapper def sfi_list(self): pass @auth_sfa_mapper def sfi_show_site(self): pass @auth_sfa_mapper def sfi_show_slice(self): pass @auth_sfa_mapper + def sfi_show_slice_researchers(self): pass + @auth_sfa_mapper def ssh_slice_sfa(self): pass @auth_sfa_mapper def sfa_delete_user(self): pass diff --git a/system/macros.py b/system/macros.py index 37c8e26..e2c5d5f 100644 --- a/system/macros.py +++ b/system/macros.py @@ -52,6 +52,13 @@ sequences['sfa_create'] = [ 'sfa_add_slice', ] +sequences['sfa_user_slice'] = [ + 'sfa_remove_user_from_slice', + 'sfi_show_slice_researchers', + 'sfa_insert_user_in_slice', + 'sfi_show_slice_researchers', +] + sequences['sfa_provision'] = [ 'sfa-discover', 'sfa-create_slice', -- 2.43.0