X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Fdriver.py;h=fa25a83fca405f9646b7462c53f41e030de2ad50;hb=8f91a75912df7fce175100403caf3c3ae02104d9;hp=7d4b5b236f3d96a23265f8c03c5c441d11025234;hpb=90ab94deecf2371c199d56cd35f0fd4fd20233e4;p=sfa.git diff --git a/sfa/managers/driver.py b/sfa/managers/driver.py index 7d4b5b23..fa25a83f 100644 --- a/sfa/managers/driver.py +++ b/sfa/managers/driver.py @@ -5,19 +5,24 @@ class Driver: - def __init__ (self): pass + def __init__ (self, config): + # this is the hrn attached to the running server + self.hrn = config.SFA_INTERFACE_HRN - # redefine this if you want to check again records - # when running GetCredential - # This is to reflect the 'enabled' user field in planetlab testbeds - # expected retcod boolean - def is_enabled (self, record) : - return True + ######################################## + ########## registry oriented + ######################################## + + # NOTE: the is_enabled method is deprecated + # it was only making things confusing, as the (PL) import mechanism would + # ignore not enabled users anyway.. # the following is used in Resolve (registry) when run in full mode # after looking up the sfa db, we wish to be able to display # testbed-specific info as well - # this at minima should fill in the 'researcher' field for slice records + # based on the principle that SFA should not rely on the testbed database + # to perform such a core operation (i.e. getting rights right) + # this is no longer in use when performing other SFA operations def augment_records_with_testbed_info (self, sfa_records): return sfa_records @@ -25,7 +30,6 @@ class Driver: # expected retcod 'pointer' # 'pointer' is typically an int db id, that makes sense in the testbed environment # -1 if this feature is not relevant - # here type will be 'authority' def register (self, sfa_record, hrn, pub_key) : return -1 @@ -50,3 +54,82 @@ class Driver: # should anything be passed back to the caller in this case ? def update (self, old_sfa_record, new_sfa_record, hrn, new_key): return True + + # callack for register/update + # this allows to capture changes in the relations between objects + # the ids below are the ones found in the 'pointer' field + # this can get typically called with + # 'slice' 'user' 'researcher' slice_id user_ids + # 'authority' 'user' 'pi' authority_id user_ids + def update_relation (self, subject_type, target_type, relation_name, subject_id, link_ids): + pass + + ######################################## + ########## aggregate oriented + ######################################## + + # a name for identifying the kind of testbed + def testbed_name (self): return "undefined" + + # a dictionary that gets appended to the generic answer to GetVersion + # 'geni_request_rspec_versions' and 'geni_ad_rspec_versions' are mandatory + def aggregate_version (self): return {} + + # answer to ListResources + # returns : advertisment rspec (xml string) + def list_resources (self, version=None, options={}): + return "dummy Driver.list_resources needs to be redefined" + + # the answer to Describe on a slice or a set of the slivers in a slice + # returns: a struct: + #{ + # geni_rspec: + # geni_urn: + # geni_slivers: [ + # { + # geni_sliver_urn: + # geni_expires: , + # geni_allocation_status: , + # geni_operational_status: , + # geni_error: + # }, + # ... + # ] + #} + def describe (self, urns, version, options={}): + return "dummy Driver.describe needs to be redefined" + + # the answer to Allocate on a given slicei or a set of the slivers in a slice + # returns: same struct as for describe. + def allocate (self, urn, rspec_string, expiration, options={}): + return "dummy Driver.allocate needs to be redefined" + + # the answer to Provision on a given slice or a set of the slivers in a slice + # returns: same struct as for describe. + def provision(self, urns, options={}): + return "dummy Driver.provision needs to be redefined" + + # the answer to PerformOperationalAction on a given slice or a set of the slivers in a slice + # returns: struct containing "geni_slivers" list of the struct returned by describe. + def perform_operational_action (self, urns, action, options={}): + return "dummy Driver.perform_operational_action needs to be redefined" + + # the answer to Status on a given slice or a set of the slivers in a slice + # returns: struct containing "geni_urn" and "geni_slivers" list of the struct returned by describe. + def status (self, urns, options={}): + return "dummy Driver.status needs to be redefined" + + # the answer to Renew on a given slice or a set of the slivers in a slice + # returns: struct containing "geni_slivers" list of the struct returned by describe. + def renew (self, urns, expiration_time, options={}): + return "dummy Driver.renew needs to be redefined" + + # the answer to Delete on a given slice + # returns: struct containing "geni_slivers" list of the struct returned by describe. + def delete(self, urns, options={}): + return "dummy Driver.delete needs to be redefined" + + # the answer to Shutdown on a given slice + # returns: boolean + def shutdown (self, xrn, options={}): + return False