git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Workaround export certificate in sfaadmin
[sfa.git]
/
sfa
/
client
/
sfi.py
diff --git
a/sfa/client/sfi.py
b/sfa/client/sfi.py
index
157828e
..
e557537
100644
(file)
--- a/
sfa/client/sfi.py
+++ b/
sfa/client/sfi.py
@@
-392,8
+392,8
@@
class Sfi:
help="display version of the local client")
if command in ("version", "trusted"):
help="display version of the local client")
if command in ("version", "trusted"):
- parser.add_option("-R","--registry
-
interface",
- action="store_true", dest="registry
-
interface", default=False,
+ parser.add_option("-R","--registry
_
interface",
+ action="store_true", dest="registry
_
interface", default=False,
help="target the registry interface instead of slice interface")
if command in ("add", "update"):
help="target the registry interface instead of slice interface")
if command in ("add", "update"):
@@
-880,7
+880,7
@@
use this if you mean an authority instead""")
if options.version_local:
version=version_core()
else:
if options.version_local:
version=version_core()
else:
- if options.registry
-
interface:
+ if options.registry
_
interface:
server=self.registry()
else:
server = self.sliceapi()
server=self.registry()
else:
server = self.sliceapi()
@@
-1144,10
+1144,10
@@
use this if you mean an authority instead""")
return
return
- @register_command("slice_hrn","")
+ @register_command("slice_hrn
[<sliver_urn> ... <sliver_urn>]
","")
def delete(self, options, args):
"""
def delete(self, options, args):
"""
- de-allocate and de-provision all or named slivers of the slice (Delete)
+ de-allocate and de-provision all or named slivers of the
named
slice (Delete)
"""
server = self.sliceapi()
"""
server = self.sliceapi()
@@
-1155,6
+1155,13
@@
use this if you mean an authority instead""")
slice_hrn = args[0]
slice_urn = hrn_to_urn(slice_hrn, 'slice')
slice_hrn = args[0]
slice_urn = hrn_to_urn(slice_hrn, 'slice')
+ if len(args) > 1:
+ # we have sliver urns
+ sliver_urns = args[1:]
+ else:
+ # we provision all the slivers of the slice
+ sliver_urns = [slice_urn]
+
# creds
slice_cred = self.slice_credential(slice_hrn)
creds = [slice_cred]
# creds
slice_cred = self.slice_credential(slice_hrn)
creds = [slice_cred]
@@
-1164,7
+1171,7
@@
use this if you mean an authority instead""")
api_options ['call_id'] = unique_call_id()
if options.show_credential:
show_credentials(creds)
api_options ['call_id'] = unique_call_id()
if options.show_credential:
show_credentials(creds)
- result = server.Delete(
[slice_urn]
, creds, *self.ois(server, api_options ) )
+ result = server.Delete(
sliver_urns
, creds, *self.ois(server, api_options ) )
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
@@
-1229,15
+1236,21
@@
use this if you mean an authority instead""")
return value
return value
- @register_command("slice_hrn","")
+ @register_command("slice_hrn
[<sliver_urn> ... <sliver_urn>]
","")
def provision(self, options, args):
"""
def provision(self, options, args):
"""
- provision al
ready allocated resources of
named slice (Provision)
+ provision al
l or named already allocated slivers of the
named slice (Provision)
"""
server = self.sliceapi()
server_version = self.get_cached_server_version(server)
slice_hrn = args[0]
slice_urn = Xrn(slice_hrn, type='slice').get_urn()
"""
server = self.sliceapi()
server_version = self.get_cached_server_version(server)
slice_hrn = args[0]
slice_urn = Xrn(slice_hrn, type='slice').get_urn()
+ if len(args) > 1:
+ # we have sliver urns
+ sliver_urns = args[1:]
+ else:
+ # we provision all the slivers of the slice
+ sliver_urns = [slice_urn]
# credentials
creds = [self.slice_credential(slice_hrn)]
# credentials
creds = [self.slice_credential(slice_hrn)]
@@
-1278,7
+1291,7
@@
use this if you mean an authority instead""")
users = pg_users_arg(user_records)
api_options['geni_users'] = users
users = pg_users_arg(user_records)
api_options['geni_users'] = users
- result = server.Provision(
[slice_urn]
, creds, api_options)
+ result = server.Provision(
sliver_urns
, creds, api_options)
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
@@
-1291,7
+1304,7
@@
use this if you mean an authority instead""")
@register_command("slice_hrn","")
def status(self, options, args):
"""
@register_command("slice_hrn","")
def status(self, options, args):
"""
- retrieve the status of the slivers belonging to t
n
e named slice (Status)
+ retrieve the status of the slivers belonging to t
h
e named slice (Status)
"""
server = self.sliceapi()
"""
server = self.sliceapi()
@@
-1317,17
+1330,23
@@
use this if you mean an authority instead""")
# Thierry: seemed to be missing
return value
# Thierry: seemed to be missing
return value
- @register_command("slice_hrn action","")
+ @register_command("slice_hrn
[<sliver_urn> ... <sliver_urn>]
action","")
def action(self, options, args):
"""
def action(self, options, args):
"""
- Perform the named operational action on
these slivers
+ Perform the named operational action on
all or named slivers of the named slice
"""
server = self.sliceapi()
api_options = {}
# slice urn
slice_hrn = args[0]
"""
server = self.sliceapi()
api_options = {}
# slice urn
slice_hrn = args[0]
- action = args[1]
- slice_urn = Xrn(slice_hrn, type='slice').get_urn()
+ slice_urn = Xrn(slice_hrn, type='slice').get_urn()
+ if len(args) > 2:
+ # we have sliver urns
+ sliver_urns = args[1:-1]
+ else:
+ # we provision all the slivers of the slice
+ sliver_urns = [slice_urn]
+ action = args[-1]
# cred
slice_cred = self.slice_credential(args[0])
creds = [slice_cred]
# cred
slice_cred = self.slice_credential(args[0])
creds = [slice_cred]
@@
-1335,7
+1354,7
@@
use this if you mean an authority instead""")
delegated_cred = self.delegate_cred(slice_cred, get_authority(self.authority))
creds.append(delegated_cred)
delegated_cred = self.delegate_cred(slice_cred, get_authority(self.authority))
creds.append(delegated_cred)
- result = server.PerformOperationalAction(
[slice_urn]
, creds, action , api_options)
+ result = server.PerformOperationalAction(
sliver_urns
, creds, action , api_options)
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
@@
-1343,18
+1362,26
@@
use this if you mean an authority instead""")
print value
return value
print value
return value
- @register_command("slice_hrn time","")
+ @register_command("slice_hrn
[<sliver_urn> ... <sliver_urn>]
time","")
def renew(self, options, args):
"""
def renew(self, options, args):
"""
- renew slice (Renew
Sliver
)
+ renew slice (Renew)
"""
server = self.sliceapi()
"""
server = self.sliceapi()
- if len(args)
!=
2:
+ if len(args)
<
2:
self.print_help()
sys.exit(1)
self.print_help()
sys.exit(1)
- [ slice_hrn, input_time ] = args
- # slice urn
- slice_urn = hrn_to_urn(slice_hrn, 'slice')
+ slice_hrn = args[0]
+ slice_urn = Xrn(slice_hrn, type='slice').get_urn()
+
+ if len(args) > 2:
+ # we have sliver urns
+ sliver_urns = args[1:-1]
+ else:
+ # we provision all the slivers of the slice
+ sliver_urns = [slice_urn]
+ input_time = args[-1]
+
# time: don't try to be smart on the time format, server-side will
# creds
slice_cred = self.slice_credential(args[0])
# time: don't try to be smart on the time format, server-side will
# creds
slice_cred = self.slice_credential(args[0])
@@
-1364,7
+1391,7
@@
use this if you mean an authority instead""")
api_options['call_id']=unique_call_id()
if options.show_credential:
show_credentials(creds)
api_options['call_id']=unique_call_id()
if options.show_credential:
show_credentials(creds)
- result = server.Renew(
[slice_urn]
, creds, input_time, *self.ois(server,api_options))
+ result = server.Renew(
sliver_urns
, creds, input_time, *self.ois(server,api_options))
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
value = ReturnValue.get_value(result)
if self.options.raw:
save_raw_to_file(result, self.options.raw, self.options.rawformat, self.options.rawbanner)
@@
-1618,13
+1645,13
@@
$ sfi m -b http://mymanifold.foo.com:7080/
"""
return the trusted certs at this interface (get_trusted_certs)
"""
"""
return the trusted certs at this interface (get_trusted_certs)
"""
- if options.registry
-
interface:
+ if options.registry
_
interface:
server=self.registry()
else:
server = self.sliceapi()
cred = self.my_authority_credential_string()
trusted_certs = server.get_trusted_certs(cred)
server=self.registry()
else:
server = self.sliceapi()
cred = self.my_authority_credential_string()
trusted_certs = server.get_trusted_certs(cred)
- if not options.registry
-
interface:
+ if not options.registry
_
interface:
trusted_certs = ReturnValue.get_value(trusted_certs)
for trusted_cert in trusted_certs:
trusted_certs = ReturnValue.get_value(trusted_certs)
for trusted_cert in trusted_certs: