def add_sfa(self):
"run sfi.py add (on Registry) and sfi.py create (on SM) to form new objects"
- test_plc=self
- test_user_sfa=TestUserSfa(test_plc,self.plc_spec['sfa'])
+ test_user_sfa=TestUserSfa(self)
if not test_user_sfa.add_user(): return False
for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
site_spec = self.locate_site (slice_spec['sitename'])
test_site = TestSite(self,site_spec)
- test_slice_sfa=TestSliceSfa(test_plc,test_site,slice_spec)
+ test_slice_sfa=TestSliceSfa(self,test_site,slice_spec)
if not test_slice_sfa.add_slice(): return False
if not test_slice_sfa.create_slice(): return False
return True
def update_sfa(self):
"run sfi.py update (on Registry) and sfi.py create (on SM) on existing objects"
- test_plc=self
- test_user_sfa=TestUserSfa(test_plc,self.plc_spec['sfa'])
+ test_user_sfa=TestUserSfa(self)
if not test_user_sfa.update_user(): return False
for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
site_spec = self.locate_site (slice_spec['sitename'])
test_site = TestSite(self,site_spec)
- test_slice_sfa=TestSliceSfa(test_plc,test_site,slice_spec)
+ test_slice_sfa=TestSliceSfa(self,test_site,slice_spec)
if not test_slice_sfa.update_slice(): return False
return True
def delete_sfa(self):
"run sfi.py delete (on SM), sfi.py remove (on Registry)"
- test_plc=self
- test_user_sfa=TestUserSfa(test_plc,self.plc_spec['sfa'])
+ test_user_sfa=TestUserSfa(self)
success1=test_user_sfa.delete_user()
for slice_spec in self.plc_spec['sfa']['sfa_slice_specs']:
site_spec = self.locate_site (slice_spec['sitename'])
test_site = TestSite(self,site_spec)
- test_slice_sfa=TestSliceSfa(test_plc,test_site,slice_spec)
+ test_slice_sfa=TestSliceSfa(self,test_site,slice_spec)
success2=test_slice_sfa.delete_slice()
return success1 and success2
class TestUserSfa:
- def __init__ (self,test_plc,plc_spec_sfa):
+ def __init__ (self,test_plc):
self.test_plc=test_plc
- self.spec_sfa=plc_spec_sfa
-
- def name(self):
- return self.user_spec['user_fields']['email']
+ # shortcuts
+ self.sfa_spec=test_plc.plc_spec['sfa']
+ self.piuser=self.sfa_spec['piuser']
+ self.regularuser=self.sfa_spec['regularuser']
+ self.slicename=self.sfa_spec['slicename']
+ self.login_base=self.sfa_spec['login_base']
def add_user (self):
- return \
- self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ add person.xml")==0
+ return self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ add person.xml")==0
def update_user (self):
- return \
- self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ update person.xml")==0
+ return self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ update person.xml")==0
def delete_user(self):
- auth=self.spec_sfa['SFA_REGISTRY_ROOT_AUTH']
+ auth=self.sfa_spec['SFA_REGISTRY_ROOT_AUTH']
return \
- self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ remove -t user %s.main.sfafakeuser1"%auth)==0
+ self.test_plc.run_in_guest("sfi.py -d /root/.sfi/ remove -t user %s.%s.%s"%(auth,self.login_base,self.regularuser))==0