4 from sfa.util.faults import *
5 from sfa.util.misc import *
6 from sfa.util.method import Method
7 from sfa.util.parameter import Parameter, Mixed
8 from sfa.trust.auth import Auth
9 from sfa.plc.slices import Slices
10 # RSpecManager_pl is not used. This is just to resolve issues with the dynamic __import__ that comes later.
11 import sfa.rspecs.aggregates.rspec_manager_pl
14 class create_slice(Method):
16 Instantiate the specified slice according to whats defined in the specified rspec
18 @param cred credential string specifying the rights of the caller
19 @param hrn human readable name of slice to instantiate
20 @param rspec resource specification
21 @return 1 is successful, faults otherwise
24 interfaces = ['aggregate', 'slicemgr']
27 Parameter(str, "Credential string"),
28 Parameter(str, "Human readable name of slice to instantiate"),
29 Parameter(str, "Resource specification"),
32 returns = Parameter(int, "1 if successful")
34 def call(self, cred, hrn, rspec):
35 sfa_aggregate_type = Config().get_aggregate_rspec_type()
36 if (sfa_aggregate_type == 'pl'):
37 self.api.auth.check(cred, 'createslice')
38 slices = Slices(self.api)
39 slices.create_slice(hrn, rspec)
41 # To clean up after July 21 - SB
42 rspec_manager = __import__("sfa.rspecs.aggregates.rspec_manager_"+sfa_aggregate_type)
43 rspec = rspec_manager.create_slice(hrn, rspec)