test that a slice resources can be released using an empty rspec to allocate and...
[tests.git] / system / TestAuthSfa.py
index 43bc7ba..6d3d542 100644 (file)
@@ -54,7 +54,7 @@ class TestAuthSfa:
 
     # the hrn for the root authority
     def root_hrn (self):
-        return self.test_plc.plc_spec['sfa']['SFA_REGISTRY_ROOT_AUTH']
+        return self.test_plc.plc_spec['sfa']['settings']['SFA_REGISTRY_ROOT_AUTH']
 
     # the hrn for the auth/site
     def auth_hrn (self):
@@ -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
@@ -95,22 +100,22 @@ class TestAuthSfa:
        SFI_USER=self.obj_hrn(self.auth_sfa_spec['pi_spec']['name'])
         fileconf.write ("SFI_USER='%s'"%SFI_USER)
        fileconf.write('\n')
-       SFI_REGISTRY='http://' + sfa_spec['SFA_REGISTRY_HOST'] + ':12345/'
+       SFI_REGISTRY='http://%s:%s/'%(sfa_spec['settings']['SFA_REGISTRY_HOST'],12345)
         fileconf.write ("SFI_REGISTRY='%s'"%SFI_REGISTRY)
        fileconf.write('\n')
-       SFI_SM='http://' + sfa_spec['SFA_SM_HOST'] + ':12347/'
+       SFI_SM='http://%s:%s/'%(sfa_spec['settings']['SFA_SM_HOST'],sfa_spec['sfi-connects-to-port'])
         fileconf.write ("SFI_SM='%s'"%SFI_SM)
        fileconf.write('\n')
         fileconf.close()
         utils.header ("(Over)wrote %s"%file_name)
 
     # using sfaadmin to bootstrap
-    def sfa_add_site (self, options):
+    def sfa_register_site (self, options):
         "bootstrap a site using sfaadmin"
         command="sfaadmin reg register -t authority -x %s"%self.auth_hrn()
         return self.test_plc.run_in_guest(command)==0
 
-    def sfa_add_pi (self, options):
+    def sfa_register_pi (self, options):
         "bootstrap a PI user for that site"
         pi_spec = self.auth_sfa_spec['pi_spec']
         pi_hrn=self.obj_hrn(pi_spec['name'])
@@ -133,42 +138,72 @@ class TestAuthSfa:
 
     # user management
     @user_sfa_mapper
-    def sfa_add_user (self, *args, **kwds): pass
+    def sfa_register_user (self, *args, **kwds): pass
     @user_sfa_mapper
     def sfa_update_user (self, *args, **kwds): pass
     @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 <slice> (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 <slice> (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 <slice> -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
+    def sfa_register_slice (self, *args, **kwds): pass
     @slice_sfa_mapper
     def sfa_renew_slice (self, *args, **kwds): pass
     @slice_sfa_mapper
+    def sfa_get_expires (self, *args, **kwds): pass
+    @slice_sfa_mapper
     def sfa_discover (self, *args, **kwds): pass
     @slice_sfa_mapper
-    def sfa_create_slice (self, *args, **kwds): pass
+    def sfa_rspec (self, *args, **kwds): pass
+    @slice_sfa_mapper
+    def sfa_allocate (self, *args, **kwds): pass
+    @slice_sfa_mapper
+    def sfa_allocate_empty (self, *args, **kwds): pass
+    @slice_sfa_mapper
+    def sfa_provision (self, *args, **kwds): pass
+    @slice_sfa_mapper
+    def sfa_provision_empty (self, *args, **kwds): pass
     @slice_sfa_mapper
     def sfa_check_slice_plc (self, *args, **kwds): pass
     @slice_sfa_mapper
+    def sfa_check_slice_plc_empty (self, *args, **kwds): pass
+    @slice_sfa_mapper
     def sfa_update_slice (self, *args, **kwds): pass
     @slice_sfa_mapper
     def sfa_delete_slice (self, *args, **kwds): pass