<description>Basic system variables.</description>
<variablelist>
+ <variable id="generic_flavour" type="string">
+ <name>Generic Flavour</name>
+ <value>pl</value>
+ <description>This string refers to a class located in sfa.generic that describes
+ which specific implementation needs to be used for api, manager and driver objects.
+ PlanetLab users do not need to change this setting.
+ </description>
+ </variable>
+
<variable id="interface_hrn" type="string">
<name>Human readable name</name>
<value>plc</value>
<description>The human readable name for this interface.</description>
</variable>
+ <variable id="am_api_version" type="string">
+ <name>Aggregate Manager API Version</name>
+ <value>1</value>
+ <description>The Aggregate API version</description>
+ </variable>
+
<variable id="credential_schema" type="string">
<name>Credential Schema</name>
<value>/etc/sfa/credential.xsd</value>
</description>
</variable>
- <variable id="generic_flavour" type="string">
- <name>Generic Flavour</name>
- <value>pl</value>
- <description>This string refers to a class located in sfa.generic that describes
- which specific implementation needs to be used for api, manager and driver objects.
- PlanetLab users do not need to change this setting.
- </description>
- </variable>
-
</variablelist>
</category>
user_cred = self.get_user_cred().save_to_string(save_parents=True)
server = self.slicemgr
server = self.server_proxy_from_opts(opts)
+
+ options = {'call_id': unique_call_id()}
+ #panos add info options
+ if opts.info:
+ options['info'] = opts.info
if args:
cred = self.get_slice_cred(args[0]).save_to_string(save_parents=True)
hrn = args[0]
- options = {'geni_slice_urn': hrn_to_urn(hrn, 'slice')}
+ options['geni_slice_urn'] = hrn_to_urn(hrn, 'slice')
else:
cred = user_cred
- hrn = None
creds = [cred]
if opts.delegate:
# this must be a protogeni aggregate. We should request a v2 ad rspec
# regardless of what the client user requested
options['rspec_version'] = version_manager.get_version('ProtoGENI 2').to_dict()
- #panos add info options
- if opts.info:
- options['info'] = opts.info
- call_args = [creds]
- if self.server_supports_options_arg(server):
- options = {'call_id': unique_call_id()}
- call_args.append(options)
+ call_args = [creds, options]
result = server.ListResources(*call_args)
if opts.file is None:
display_rspec(result, opts.format)
from sfa.trust.certificate import Keypair, Certificate
from sfa.trust.credential import Credential
from sfa.trust.rights import determine_rights
-
from sfa.server.xmlrpcapi import XmlrpcApi
+from sfa.util.genicode import GENICODE
# thgen xxx fixme this is wrong all right, but temporary, will use generic
from sfa.util.table import SfaTable
# cache version for 24 hours
self.cache.add(cache_key, server_version, ttl= 60*60*24)
return server_version
+
+
+ def get_geni_code(self, result):
+ code = {
+ 'geni_code': GENICODE.SUCCESS,
+ 'am_type': 'sfa',
+ 'am_code': None,
+ }
+ if isinstnace(result, SfaFault):
+ code['geni_code'] = result.faultCode
+ code['am_code'] = result.faultCode
+
+ return code
+
+ def get_geni_value(self, result):
+ value = result
+ if isinstance(result, SfaFault):
+ value = ""
+ return value
+
+ def get_geni_output(self, result):
+ output = ""
+ if isinstance(result, SFaFault):
+ output = result.faultString
+ return output
+
+ def prepare_response_v2_am(self, result):
+ response = {
+ 'code': self.get_geni_code(result),
+ 'value': self.get_geni_value(result),
+ 'output': self.get_geni_output(result),
+ }
+ return response
+
+ def prepare_response(self, result, method=""):
+ """
+ Converts the specified result into a standard GENI compliant
+ response
+ """
+ if self.interface.lower() == 'aggregate':
+ if hasattr(self.config, 'SFA_AM_API_VERSION') and \
+ self.config.SFA_AM_API_VERSION == "2":
+ result = self.prepare_response_v2_am(result)
+ return XmlrpcApi.prepare_response(result, method)
+
INPORGRESS=16,
ALREADYEXISTS=17
)
-