nvflare.fuel.hci.client.cli module

class AdminClient(host=None, port: Optional[int] = None, prompt: str = '> ', ca_cert=None, client_cert=None, client_key=None, upload_dir='', download_dir='', server_cn=None, require_login: bool = False, credential_type: str = CredentialType.PASSWORD, cmd_modules: Optional[List] = None, overseer_agent: Optional[OverseerAgent] = None, debug: bool = False)[source]

Bases: Cmd

Admin command prompt for submitting admin commands to the server through the CLI.

Parameters
  • host – cn provisioned for the server, with this fully qualified domain name resolving to the IP of the FL server. This may be set by the OverseerAgent.

  • port – port provisioned as admin_port for FL admin communication, by default provisioned as 8003, must be int if provided. This may be set by the OverseerAgent.

  • prompt – prompt to use for the command prompt

  • ca_cert – path to CA Cert file, by default provisioned rootCA.pem

  • client_cert – path to admin client Cert file, by default provisioned as client.crt

  • client_key – path to admin client Key file, by default provisioned as client.key

  • server_cn – server cn

  • require_login – whether to require login

  • credential_type – what type of credential to use

  • cmd_modules – command modules to load and register

  • overseer_agent – initialized OverseerAgent to obtain the primary service provider to set the host and port of the active server

  • debug – whether to print debug messages. False by default.

Instantiate a line-oriented interpreter framework.

The optional argument ‘completekey’ is the readline name of a completion key; it defaults to the Tab key. If completekey is not None and the readline module is available, command completion is done automatically. The optional arguments stdin and stdout specify alternate input and output file objects; if not specified, sys.stdin and sys.stdout are used.

cmdloop(intro=None)[source]

Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.

Overriding what is in cmd.Cmd to handle exiting client on Ctrl+D (EOF).

complete(text, state)[source]

Return the next possible completion for ‘text’.

If a command has not been entered, then complete against command list. Otherwise try to call complete_<command> to get list of completions.

default(line)[source]

Called on an input line when the command prefix is not recognized.

If this method is not overridden, it prints an error message and returns.

do_bye(arg)[source]

Exit from the client.

If the arg is not logout, in other words, the user is issuing the bye command to shut down the client, or it is called by inputting the EOF character, a message will display that the admin client is shutting down.

do_help(arg)[source]

List available commands with “help” or detailed help with “help cmd”.

do_lpwd(arg)[source]

print local current work dir

emptyline()[source]

Called when an empty line is entered in response to the prompt.

If this method is not overridden, it repeats the last nonempty command entered.

flush()[source]
print_resp(resp: dict)[source]

Prints the server response

Parameters

resp (dict) – The server response.

run()[source]
session_ended(message)[source]
session_signal_handler(signum, frame)[source]
write_dict(data: dict)[source]
write_error(err: str)[source]
write_stdout(data: str)[source]
write_string(data: str)[source]
write_table(table: Table)[source]
class CredentialType(value)[source]

Bases: str, Enum

An enumeration.

CERT = 'cert'
PASSWORD = 'password'