X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Fgeni_am_pl.py;h=87d8a95933703b80be59724610dfb875d2fb1d0e;hb=0f8b7b3ee92d1178e1a726167b3a7290e5d23400;hp=16f6475dba5a2f0bdbc730f77d5197d0b3340fdb;hpb=d742a71a4ee0c580386085afe16d14f08d6d9a13;p=sfa.git diff --git a/sfa/managers/geni_am_pl.py b/sfa/managers/geni_am_pl.py index 16f6475d..87d8a959 100644 --- a/sfa/managers/geni_am_pl.py +++ b/sfa/managers/geni_am_pl.py @@ -2,7 +2,7 @@ from sfa.util.namespace import * from sfa.util.rspec import * from sfa.util.specdict import * from sfa.util.faults import * - +from sfa.trust.credential import Credential from sfa.util.record import * from sfa.plc.slices import * @@ -10,6 +10,7 @@ from sfa.util.sfalogging import * from sfa.util.record import SfaRecord from lxml import etree from StringIO import StringIO +from time import mktime def GetVersion(): version = {} @@ -54,23 +55,37 @@ def ListResources(api, creds, options): def CreateSliver(api, slice_xrn, creds, rspec): - reg_objects = {} hrn, type = urn_to_hrn(slice_xrn) hrn_auth = get_authority(hrn) - #site = SfaRecord(hrn=hrn_auth, type='authority') + # Build up objects that an SFA registry would return if SFA + # could contact the slice's registry directly + reg_objects = {} + site = {} site['site_id'] = 0 - site['name'] = 'geni.%s' % slice_xrn + site['name'] = 'geni.%s' % hrn_auth site['enabled'] = True site['max_slices'] = 100 + + # Note: + # Is it okay if this login base is the same as one already at this myplc site? + # Do we need uniqueness? Should use hrn_auth instead of just the leaf perhaps? site['login_base'] = get_leaf(hrn_auth) site['abbreviated_name'] = hrn - site['max_slivers'] = 1000 - + site['max_slivers'] = 1000 reg_objects['site'] = site + slice = {} + slice['expires'] = int(mktime(Credential(string=creds[0]).get_lifetime().timetuple())) + slice['hrn'] = hrn + slice['name'] = site['login_base'] + "_" + get_leaf(hrn) + slice['url'] = hrn + slice['description'] = hrn + slice['pointer'] = 0 + reg_objects['slice_record'] = slice + manager_base = 'sfa.managers' mgr_type = 'pl' manager_module = manager_base + ".aggregate_manager_%s" % mgr_type