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")
+ 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"):
parser.add_option('-x', '--xrn', dest='xrn', metavar='<xrn>', help='object hrn/urn (mandatory)')
if options.version_local:
version=version_core()
else:
- if options.interface == "registry":
+ if options.registry_interface:
server=self.registry()
else:
server = self.sliceapi()
return
- @register_command("slice_hrn","")
+ @register_command("slice_hrn [<sliver_urn> ... <sliver_urn>]","")
def delete(self, options, args):
"""
de-allocate and de-provision all or named slivers of the slice (Delete)
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]
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)
return value
- @register_command("slice_hrn","")
+ @register_command("slice_hrn [<sliver_urn> ... <sliver_urn>]","")
def provision(self, options, args):
"""
- provision already allocated resources of named slice (Provision)
+ provision already or named 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()
+ 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)]
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)
# 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):
"""
Perform the named operational action on these slivers
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]
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)
"""
return the trusted certs at this interface (get_trusted_certs)
"""
- if options.interface == "registry":
+ if options.registry_interface:
server=self.registry()
else:
server = self.sliceapi()
cred = self.my_authority_credential_string()
trusted_certs = server.get_trusted_certs(cred)
- if options.interface != "registry":
+ if not options.registry_interface:
trusted_certs = ReturnValue.get_value(trusted_certs)
for trusted_cert in trusted_certs: