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
12 class PerformOperationalAction(Method):
14 Request that the named geni_allocated slivers be made
15 geni_provisioned, instantiating or otherwise realizing the
16 resources, such that they have a valid geni_operational_status
17 and may possibly be made geni_ready for experimenter use. This
18 operation is synchronous, but may start a longer process, such
19 as creating and imaging a virtual machine
21 @param slice urns ([string]) URNs of slivers to provision to
22 @param credentials (dict) of credentials
23 @param options (dict) options
26 interfaces = ['aggregate']
28 Parameter(type([str]), "URNs"),
29 Parameter(type([dict]), "Credentials"),
30 Parameter(str, "Action"),
31 Parameter(dict, "Options"),
33 returns = Parameter(dict, "Provisioned Resources")
35 def call(self, xrns, creds, action, options):
36 logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s" %
37 (self.api.interface, xrns, self.name))
39 (speaking_for, _) = urn_to_hrn(options.get('geni_speaking_for'))
41 # Find the valid credentials
42 valid_creds = self.api.auth.checkCredentialsSpeaksFor(
43 creds, 'createsliver', xrns,
44 check_sliver_callback=self.api.driver.check_sliver_credentials,
46 origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn()
47 logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s" %
48 (self.api.interface, origin_hrn, xrns, self.name))
49 result = self.api.manager.PerformOperationalAction(
50 self.api, xrns, creds, action, options)