X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fclient%2Fsfi.py;h=73d009976fbaa50aab4c66a1f4a8ae6956faf551;hb=e67041c37b86490c71d2f0b4d4b9c27b283141de;hp=cdd628dd92a7d3dbd2877428e82a9b89a49ac5c0;hpb=04272d0520e5a90b2457420d163eb545e57ffc36;p=sfa.git diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index cdd628dd..73d00997 100644 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -340,8 +340,6 @@ class Sfi: parser.add_option("-D", "--debug", action="store_true", dest="debug", default=False, help="Debug (xml-rpc) protocol messages") - parser.add_option("-p", "--protocol", dest="protocol", default="xmlrpc", - help="RPC protocol (xmlrpc or soap)") # would it make sense to use ~/.ssh/id_rsa as a default here ? parser.add_option("-k", "--private-key", action="store", dest="user_private_key", default=None, @@ -817,41 +815,30 @@ or with an slice hrn, shows currently provisioned resources creds.append(self.my_credential_string) if options.delegate: creds.append(self.delegate_cred(cred, get_authority(self.authority))) - - # V2 API - if self.server_supports_options_arg(server): - # with v2 everything goes in options inclusing the subject slice - api_options = {} - if args: - hrn = args[0] - api_options['geni_slice_urn'] = hrn_to_urn(hrn, 'slice') - if options.info: - api_options['info'] = options.info - if options.rspec_version: - version_manager = VersionManager() - server_version = self.get_cached_server_version(server) - if 'sfa' in server_version: - # just request the version the client wants - api_options['geni_rspec_version'] = version_manager.get_version(options.rspec_version).to_dict() - else: - # this must be a protogeni aggregate. We should request a v2 ad rspec - # regardless of what the client user requested - api_options['geni_rspec_version'] = version_manager.get_version('ProtoGENI 2').to_dict() + + # no need to check if server accepts the options argument since the options has + # been a required argument since v1 API + api_options = {} + # always send call_id to v2 servers + api_options ['call_id'] = unique_call_id() + # ask for cached value if available + api_options ['cached'] = True + if args: + hrn = args[0] + api_options['geni_slice_urn'] = hrn_to_urn(hrn, 'slice') + if options.info: + api_options['info'] = options.info + if options.rspec_version: + version_manager = VersionManager() + server_version = self.get_cached_server_version(server) + if 'sfa' in server_version: + # just request the version the client wants + api_options['geni_rspec_version'] = version_manager.get_version(options.rspec_version).to_dict() else: api_options['geni_rspec_version'] = {'type': 'geni', 'version': '3.0'} - api_options ['call_id'] = unique_call_id() - # the V2 form - result = server.ListResources (creds, api_options) - # V1 else: - # with an argument - if args: - hrn = args[0] - # xxx looks like we can pass a hrn and not a urn here ?? - # last arg. is a raw call_id when supported - result = server.ListResources (creds, hrn, *self.cis(server)) - else: - result = server.ListResources (creds, *self.cis(server)) + api_options['geni_rspec_version'] = {'type': 'geni', 'version': '3.0'} + result = server.ListResources (creds, api_options) value = ReturnValue.get_value(result) if options.file is None: display_rspec(value, options.format)