1 from sfa.util.version import version_core
2 from sfa.util.xrn import Xrn
3 from sfa.util.callids import Callids
4 from sfa.managers import aggregate_manager
6 class AggregateManager(aggregate_manager.AggregateManager):
8 def __init__ (self, config): pass
10 # essentially a union of the core version, the generic version (this code) and
11 # whatever the driver needs to expose
12 def GetVersion(self, api, options):
15 version = version_core()
17 'interface':'aggregate',
20 'geni_api_versions': {'2': 'http://%s:%s' % (api.config.SFA_AGGREGATE_HOST, api.config.SFA_AGGREGATE_PORT)},
24 version.update(version_generic)
25 testbed_version = self.driver.aggregate_version()
26 version.update(testbed_version)
29 def ListSlices(self, api, creds, options):
30 call_id = options.get('call_id')
31 if Callids().already_handled(call_id): return []
32 return self.driver.list_slices (creds, options)
34 def ListResources(self, api, creds, options):
35 call_id = options.get('call_id')
36 if Callids().already_handled(call_id): return ""
38 # get slice's hrn from options
39 slice_xrn = options.get('geni_slice_urn', None)
40 # pass None if no slice is specified
42 slice_hrn, slice_urn = None, None
45 slice_urn=xrn.get_urn()
46 slice_hrn=xrn.get_hrn()
48 return self.driver.list_resources (slice_urn, slice_hrn, creds, options)
50 def SliverStatus (self, api, xrn, creds, options):
51 call_id = options.get('call_id')
52 if Callids().already_handled(call_id): return {}
55 slice_urn=xrn.get_urn()
56 slice_hrn=xrn.get_hrn()
57 return self.driver.sliver_status (slice_urn, slice_hrn)
59 def CreateSliver(self, api, xrn, creds, rspec_string, users, options):
61 Create the sliver[s] (slice) at this aggregate.
62 Verify HRN and initialize the slice record in PLC if necessary.
64 call_id = options.get('call_id')
65 if Callids().already_handled(call_id): return ""
68 slice_urn=xrn.get_urn()
69 slice_hrn=xrn.get_hrn()
71 return self.driver.create_sliver (slice_urn, slice_hrn, creds, rspec_string, users, options)
73 def DeleteSliver(self, api, xrn, creds, options):
74 call_id = options.get('call_id')
75 if Callids().already_handled(call_id): return True
78 slice_urn=xrn.get_urn()
79 slice_hrn=xrn.get_hrn()
80 return self.driver.delete_sliver (slice_urn, slice_hrn, creds, options)
82 def RenewSliver(self, api, xrn, creds, expiration_time, options):
83 call_id = options.get('call_id')
84 if Callids().already_handled(call_id): return True
87 slice_urn=xrn.get_urn()
88 slice_hrn=xrn.get_hrn()
89 return self.driver.renew_sliver (slice_urn, slice_hrn, creds, expiration_time, options)
91 ### these methods could use an options extension for at least call_id
92 def start_slice(self, api, xrn, creds):
94 slice_urn=xrn.get_urn()
95 slice_hrn=xrn.get_hrn()
96 return self.driver.start_slice (slice_urn, slice_hrn, creds)
98 def stop_slice(self, api, xrn, creds):
100 slice_urn=xrn.get_urn()
101 slice_hrn=xrn.get_hrn()
102 return self.driver.stop_slice (slice_urn, slice_hrn, creds)
104 def reset_slice(self, api, xrn):
106 slice_urn=xrn.get_urn()
107 slice_hrn=xrn.get_hrn()
108 return self.driver.reset_slice (slice_urn, slice_hrn)
110 def GetTicket(self, api, xrn, creds, rspec, users, options):
113 slice_urn=xrn.get_urn()
114 slice_hrn=xrn.get_hrn()
116 return self.driver.get_ticket (slice_urn, slice_hrn, creds, rspec, options)