X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Fdriver.py;h=1985e0eefee2ec9b5a6923a847c576512cde9366;hb=11ec71d6e665c53ef3cf9cf1797cc3f3c77f2b1b;hp=cdd6faeb22fed43830c1b0f08942d71158a8eb7a;hpb=7e9dbaf688d09c48759c849c4fd12267ad1ec6c3;p=sfa.git diff --git a/sfa/managers/driver.py b/sfa/managers/driver.py index cdd6faeb..1985e0ee 100644 --- a/sfa/managers/driver.py +++ b/sfa/managers/driver.py @@ -5,9 +5,10 @@ class Driver: - def __init__ (self, config): + def __init__ (self, api): + self.api = api # this is the hrn attached to the running server - self.hrn = config.SFA_INTERFACE_HRN + self.hrn = api.config.SFA_INTERFACE_HRN ######################################## ########## registry oriented @@ -20,11 +21,9 @@ class Driver: # 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 - # as this information is then used to compute rights - # roadmap: there is an intention to redesign the SFA database so as to clear up - # this constraint, based on the principle that SFA should not rely on the - # testbed database to perform such a core operation (i.e. getting rights right) + # 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 @@ -57,6 +56,15 @@ class Driver: 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 ######################################## @@ -68,46 +76,70 @@ class Driver: # 'geni_request_rspec_versions' and 'geni_ad_rspec_versions' are mandatory def aggregate_version (self): return {} - # the answer to ListSlices, a list of slice urns - def list_slices (self, creds, options): - return [] - # answer to ListResources - # first 2 args are None in case of resource discovery - # expected : rspec (xml string) - def list_resources (self, slice_urn, slice_hrn, creds, options): + # returns : advertisment rspec (xml string) + def list_resources (self, version=None, options=None): + if options is None: options={} return "dummy Driver.list_resources needs to be redefined" - # the answer to SliverStatus on a given slice - def sliver_status (self, slice_urn, slice_hrn): return {} - - # the answer to CreateSliver on a given slice - # expected to return a valid rspec - # identical to ListResources after the slice was modified - def create_sliver (self, slice_urn, slice_hrn, creds, rspec_string, users, options): - return "dummy Driver.create_sliver needs to be redefined" - - # the answer to DeleteSliver on a given slice - def delete_sliver (self, slice_urn, slice_hrn, creds, options): - return "dummy Driver.delete_sliver needs to be redefined" - - # the answer to RenewSliver - # expected to return a boolean to indicate success - def renew_sliver (self, slice_urn, slice_hrn, creds, expiration_time, options): + # 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=None): + if options is None: 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=None): + if options is None: 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=None): + if options is None: 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=None): + if options is None: 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=None): + if options is None: 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=None): + if options is None: 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=None): + if options is None: options={} + return "dummy Driver.delete needs to be redefined" + + # the answer to Shutdown on a given slice + # returns: boolean + def shutdown (self, xrn, options=None): + if options is None: options={} return False - - # the answer to start_slice/stop_slice - # 1 means success, otherwise raise exception - def start_slice (self, slice_urn, slice_xrn, creds): - return 1 - def stop_slice (self, slice_urn, slice_xrn, creds): - return 1 - # somehow this one does not have creds - not implemented in PL anyways - def reset_slice (self, slice_urn, slice_xrn, creds): - return 1 - - # the answer to GetTicket - # expected is a ticket, i.e. a certificate, as a string - def get_ticket (self, slice_urn, slice_xrn, creds, rspec, options): - return "dummy Driver.get_ticket needs to be redefined" -