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.util.sfalogging import logger
7 from sfa.trust.credential import Credential
9 from sfa.storage.parameter import Parameter, Mixed
11 from sfa.rspecs.rspec import RSpec
14 class Provision(Method):
16 Request that the named geni_allocated slivers be made
17 geni_provisioned, instantiating or otherwise realizing the
18 resources, such that they have a valid geni_operational_status
19 and may possibly be made geni_ready for experimenter use. This
20 operation is synchronous, but may start a longer process, such
21 as creating and imaging a virtual machine
23 @param slice urns ([string]) URNs of slivers to provision to
24 @param credentials (dict) of credentials
25 @param options (dict) options
28 interfaces = ['aggregate', 'slicemgr']
30 Parameter(type([str]), "URNs"),
31 Parameter(type([dict]), "Credentials"),
32 Parameter(dict, "options"),
34 returns = Parameter(dict, "Provisioned Resources")
36 def call(self, xrns, creds, options):
37 logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s" %
38 (self.api.interface, xrns, self.name))
40 # Find the valid credentials
41 valid_creds = self.api.auth.checkCredentialsSpeaksFor(
42 creds, 'createsliver', xrns,
43 check_sliver_callback=self.api.driver.check_sliver_credentials,
45 origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn()
46 logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s" %
47 (self.api.interface, origin_hrn, xrns, self.name))
48 result = self.api.manager.Provision(self.api, xrns, creds, options)