1 from sfa.util.version import version_core
2 from sfa.util.xrn import Xrn
3 from sfa.util.callids import Callids
5 class AggregateManager:
7 def __init__ (self, config): pass
9 # essentially a union of the core version, the generic version (this code) and
10 # whatever the driver needs to expose
11 def GetVersion(self, api, options):
14 version = version_core()
16 'interface':'aggregate',
19 'geni_api_versions': {'2': 'http://%s:%s' % (api.config.SFA_AGGREGATE_HOST, api.config.SFA_AGGREGATE_PORT)},
23 version.update(version_generic)
24 testbed_version = self.driver.aggregate_version()
25 version.update(testbed_version)
28 def ListSlices(self, api, creds, options):
29 call_id = options.get('call_id')
30 if Callids().already_handled(call_id): return []
31 return self.driver.list_slices (creds, options)
33 def ListResources(self, api, creds, options):
34 call_id = options.get('call_id')
35 if Callids().already_handled(call_id): return ""
37 # get slice's hrn from options
38 slice_xrn = options.get('geni_slice_urn', None)
39 # pass None if no slice is specified
41 slice_hrn, slice_urn = None, None
44 slice_urn=xrn.get_urn()
45 slice_hrn=xrn.get_hrn()
47 return self.driver.list_resources (slice_urn, slice_hrn, creds, options)
49 def SliverStatus (self, api, xrn, creds, options):
50 call_id = options.get('call_id')
51 if Callids().already_handled(call_id): return {}
54 slice_urn=xrn.get_urn()
55 slice_hrn=xrn.get_hrn()
56 return self.driver.sliver_status (slice_urn, slice_hrn)
58 def CreateSliver(self, api, xrn, creds, rspec_string, users, options):
60 Create the sliver[s] (slice) at this aggregate.
61 Verify HRN and initialize the slice record in PLC if necessary.
63 call_id = options.get('call_id')
64 if Callids().already_handled(call_id): return ""
67 slice_urn=xrn.get_urn()
68 slice_hrn=xrn.get_hrn()
70 return self.driver.create_sliver (slice_urn, slice_hrn, creds, rspec_string, users, options)
72 def DeleteSliver(self, api, xrn, creds, options):
73 call_id = options.get('call_id')
74 if Callids().already_handled(call_id): return True
77 slice_urn=xrn.get_urn()
78 slice_hrn=xrn.get_hrn()
79 return self.driver.delete_sliver (slice_urn, slice_hrn, creds, options)
81 def RenewSliver(self, api, xrn, creds, expiration_time, options):
82 call_id = options.get('call_id')
83 if Callids().already_handled(call_id): return True
86 slice_urn=xrn.get_urn()
87 slice_hrn=xrn.get_hrn()
88 return self.driver.renew_sliver (slice_urn, slice_hrn, creds, expiration_time, options)
90 ### these methods could use an options extension for at least call_id
91 def start_slice(self, api, xrn, creds):
93 slice_urn=xrn.get_urn()
94 slice_hrn=xrn.get_hrn()
95 return self.driver.start_slice (slice_urn, slice_hrn, creds)
97 def stop_slice(self, api, xrn, creds):
99 slice_urn=xrn.get_urn()
100 slice_hrn=xrn.get_hrn()
101 return self.driver.stop_slice (slice_urn, slice_hrn, creds)
103 def reset_slice(self, api, xrn):
105 slice_urn=xrn.get_urn()
106 slice_hrn=xrn.get_hrn()
107 return self.driver.reset_slice (slice_urn, slice_hrn)
109 def GetTicket(self, api, xrn, creds, rspec, users, options):
112 slice_urn=xrn.get_urn()
113 slice_hrn=xrn.get_hrn()
115 return self.driver.get_ticket (slice_urn, slice_hrn, creds, rspec, options)