1 from sfa.util.faults import SfaInvalidArgument, InvalidRSpec
2 from sfa.util.xrn import urn_to_hrn
3 from sfa.util.method import Method
4 from sfa.util.sfatablesRuntime import run_sfatables
5 from sfa.trust.credential import Credential
6 from sfa.storage.parameter import Parameter, Mixed
7 from sfa.rspecs.rspec import RSpec
9 class Provision(Method):
11 Request that the named geni_allocated slivers be made
12 geni_provisioned, instantiating or otherwise realizing the
13 resources, such that they have a valid geni_operational_status
14 and may possibly be made geni_ready for experimenter use. This
15 operation is synchronous, but may start a longer process, such
16 as creating and imaging a virtual machine
18 @param slice urns ([string]) URNs of slivers to provision to
19 @param credentials (dict) of credentials
20 @param options (dict) options
23 interfaces = ['aggregate', 'slicemgr']
25 Parameter(type([str]), "URNs"),
26 Parameter(type([dict]), "Credentials"),
27 Parameter(dict, "options"),
29 returns = Parameter(dict, "Provisioned Resources")
31 def call(self, xrns, creds, options):
32 self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name))
34 # Find the valid credentials
35 valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrns,
36 check_sliver_callback = self.api.driver.check_sliver_credentials)
37 origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn()
38 self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, xrns, self.name))
39 result = self.api.manager.Provision(self.api, xrns, creds, options)