From 17a5e564e0c336658e0a6c8c8f2b6eccf17d3fdc Mon Sep 17 00:00:00 2001 From: Mohamed Larabi Date: Mon, 2 Dec 2013 18:39:31 +0100 Subject: [PATCH] sfi.py: use option "interface" to select the SFA interface to talk to (sm or registry), and update "version" and "trusted" accordingly --- sfa/client/sfi.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index 2f47839d..cfacd567 100644 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -387,13 +387,16 @@ class Sfi: help='how myslice config variables as well') if command in ("version"): - parser.add_option("-R","--registry-version", - action="store_true", dest="version_registry", default=False, - help="probe registry version instead of sliceapi") parser.add_option("-l","--local", action="store_true", dest="version_local", default=False, help="display version of the local client") + if command in ("version", "trusted"): + parser.add_option("-I", "--interface", dest="interface", type="choice", + help="Select the SFA interface the call should target (Slice Interface (sm) | Registry Interface (registry))", + choices=("sm", "registry"), + default="sm") + if command in ("add", "update"): parser.add_option('-x', '--xrn', dest='xrn', metavar='', help='object hrn/urn (mandatory)') parser.add_option('-t', '--type', dest='type', metavar='', help='object type', default=None) @@ -878,7 +881,7 @@ use this if you mean an authority instead""") if options.version_local: version=version_core() else: - if options.version_registry: + if options.interface == "registry": server=self.registry() else: server = self.sliceapi() @@ -1616,7 +1619,15 @@ $ sfi m -b http://mymanifold.foo.com:7080/ """ return the trusted certs at this interface (get_trusted_certs) """ - trusted_certs = self.registry().get_trusted_certs() + if options.interface == "registry": + server=self.registry() + else: + server = self.sliceapi() + cred = self.my_authority_credential_string() + trusted_certs = server.get_trusted_certs(cred) + if options.interface != "registry": + trusted_certs = ReturnValue.get_value(trusted_certs) + for trusted_cert in trusted_certs: print "\n===========================================================\n" gid = GID(string=trusted_cert) -- 2.43.0