Skip to content

Commit 9457a16

Browse files
authored
Merge pull request #418 from Limmen/cli_command
CLI help command updated
2 parents 42d0d11 + db4276a commit 9457a16

File tree

1 file changed

+75
-9
lines changed
  • simulation-system/libs/csle-cli/src/csle_cli

1 file changed

+75
-9
lines changed

simulation-system/libs/csle-cli/src/csle_cli/cli.py

+75-9
Original file line numberDiff line numberDiff line change
@@ -3197,22 +3197,84 @@ def ls_shell_complete(ctx, param, incomplete) -> List[str]:
31973197
image_names: List[str] = list(map(lambda x: x[0], images))
31983198
active_networks_names: List[str] = ContainerController.list_all_networks()
31993199
return (["containers", "networks", "images", "emulations", "all", "environments", "prometheus", "node_exporter",
3200-
"cadvisor", "pgadmin", "flask", "statsmanager", "--all", "--running", "--stopped"] + emulations
3201-
+ container_names + image_names + active_networks_names + simulations)
3200+
"cadvisor", "pgadmin", "flask", "statsmanager", "simulations", "emulation_executions", "cluster", "nginx",
3201+
"postgresql", "docker", "hostmanagers", "clientmanager", "snortmanagers", "elkmanager", "trafficmanagers",
3202+
"kafkamanager", "ossecmanagers", "ryumanager", "filebeats", "metricbeats", "packetbeats", "logfiles",
3203+
"heartbeats", "logfile", "--ip", "--id", "--name", "--logfile_name", "--all", "--running", "--stopped"]
3204+
+ emulations + container_names + image_names + active_networks_names + simulations)
32023205

32033206

32043207
@click.command("ls", help="containers | networks | images | emulations | all | environments | prometheus "
32053208
"| node_exporter | cadvisor | pgadmin | statsmanager | flask | "
32063209
"simulations | emulation_executions | cluster | nginx | postgresql | docker | hostmanagers | "
32073210
"clientmanager | snortmanagers | elkmanager | trafficmanagers | kafkamanager | "
3208-
"ossecmanagers | ryumanager | filebeats | metricbeats | heartbeats | logfiles | logfile")
3211+
"ossecmanagers | ryumanager | filebeats | metricbeats | heartbeats| packetbeats | logfiles | "
3212+
"logfile \n\n"
3213+
"\b\n"
3214+
"- \033[95mcontainers\033[0m: list all|stopped|running containers. \n"
3215+
"- \033[95mnetworks\033[0m: list active networks. \n"
3216+
"- \033[95mimages\033[0m: list all images in CSLE. \n"
3217+
"- \033[95memulations\033[0m: list all|stopped|running emulations.\n"
3218+
"- \033[95mall\033[0m: list all cluster, networks, containers, images, emulations, emulation"
3219+
" executions, simulations, and CSLE gym environments.\n"
3220+
"- \033[95menvironments\033[0m: list all registered Open AI gym environments.\n"
3221+
"- \033[95mprometheus\033[0m: list status of prometheus. \n"
3222+
"- \033[95mnode_exporter\033[0m: list status of node exporter. \n"
3223+
"- \033[95mcadvisor\033[0m: list status of cadvisor. \n"
3224+
"- \033[95mpgadmin\033[0m: list status of pgadmin. \n"
3225+
"- \033[95mstatsmanager\033[0m: list status of the docker stats manager.\n"
3226+
"- \033[95mflask\033[0m: list status of the management system.\n"
3227+
"- \033[95msimulations\033[0m: list all simulations. \n"
3228+
"- \033[95memulation_executions\033[0m: list all emulation executions. \n"
3229+
"- \033[95mcluster\033[0m: list all clusters. \n"
3230+
"- \033[95mnginx\033[0m: lists status of nginx. \n"
3231+
"- \033[95mpostgresql\033[0m: lists status of PostgreSQL. \n"
3232+
"- \033[95mdocker\033[0m: lists status of the docker engine. \n"
3233+
"- \033[95mhostmanagers\033[0m: displays the status and IP addresses of host managers running"
3234+
" on a node with the specified --ip option for the emulation identified by the specified"
3235+
" --name and --id.\n"
3236+
"- \033[95mclientmanager\033[0m: list the information about the client manager and its status"
3237+
" for a node with the specified --ip option for the emulation identified by the specified"
3238+
" --name and --id.\n"
3239+
"- \033[95msnortmanagers\033[0m: list the ip address and status of snortmangers for a "
3240+
"node with the specified --ip option for the emulation identified by the specified"
3241+
" --name and --id.\n"
3242+
"- \033[95melkmanager\033[0m: list information and status of elk manager for a node with the"
3243+
" specified --ip option for the emulation identified by the specified --name and --id.\n"
3244+
"- \033[95mtrafficmanagers\033[0m: list ip address and status of trafficmangers for a "
3245+
"node with the specified --ip option for the emulation identified by the specified"
3246+
" --name and --id.\n"
3247+
"- \033[95mkafkamanager\033[0m: list information and status of the kafka manager for "
3248+
"a node with the specified --ip option for the emulation identified by the specified "
3249+
"--name and --id.\n"
3250+
"- \033[95mossecmanagers\033[0m: list ip address and status of ossec managers for a node with"
3251+
" the specified --ip option for the emulation identified by the specified --name and --id.\n"
3252+
"- \033[95mryumanager\033[0m: list information about ryu managers for a node with"
3253+
" the specified --ip option for the emulation identified by the specified --name and --id."
3254+
"The emulation should include SDN for this command.\n"
3255+
"- \033[95mfilebeats\033[0m: list ip address and status of filebeats for the running "
3256+
"containers for a node with the specified --ip option for the emulation identified by the"
3257+
" specified --name and --id.\n"
3258+
"- \033[95mmetricbeats\033[0m: list ip address and status of metricbeats for the running"
3259+
" containers for a node with the specified --ip option for the emulation identified by"
3260+
" the specified --name and --id.\n"
3261+
"- \033[95mheartbeats\033[0m: list ip address and status of heartbeats for the running "
3262+
"containers for a node with the specified --ip option for the emulation identified by the "
3263+
"specified --name and --id.\n"
3264+
"- \033[95mpacketbeats\033[0m: list ip address and status of packetbeats for the running"
3265+
" containers for a node with the specified --ip option for the emulation identified by the"
3266+
" specified --name and --id.\n"
3267+
"- \033[95mlogfiles\033[0m: list all CSLE log files with their path for a node with "
3268+
"the specified --ip option.\n"
3269+
"- \033[95mlogfile\033[0m: show the logs in a file with the path specified with "
3270+
"--logfile_name option for a node with the specified --ip option.\n")
32093271
@click.argument('entity', default='all', type=str, shell_complete=ls_shell_complete)
32103272
@click.option('--all', is_flag=True, help='list all')
32113273
@click.option('--running', is_flag=True, help='list running only (default)')
32123274
@click.option('--stopped', is_flag=True, help='list stopped only')
3213-
@click.option('--ip', default="", type=str)
3214-
@click.option('--id', default=None, type=int)
3215-
@click.option('--name', default="", type=str)
3275+
@click.option('--ip', default="", type=str, help='node IP address to run the command')
3276+
@click.option('--id', default=None, type=int, help="emulation id")
3277+
@click.option('--name', default="", type=str, help='name of the emulation')
32163278
@click.option('--logfile_name', default="", type=str, help='name of the logfile to to retrieve')
32173279
def ls(entity: str, all: bool, running: bool, stopped: bool, ip: str, name: str, id: int, logfile_name: str) -> None:
32183280
"""
@@ -3222,6 +3284,10 @@ def ls(entity: str, all: bool, running: bool, stopped: bool, ip: str, name: str,
32223284
:param all: flag that indicates whether all containers/emulations should be listed
32233285
:param running: flag that indicates whether running containers/emulations should be listed (default)
32243286
:param stopped: flag that indicates whether stopped containers/emulations should be listed
3287+
:param ip: node IP address to run the command
3288+
:param id: id of the emulation that we run ls command for
3289+
:param name: name of the emulation that we run ls command for
3290+
:param logfile_name: name of the log file to be shown
32253291
:return: None
32263292
"""
32273293
import csle_common.constants.constants as constants
@@ -4045,7 +4111,7 @@ def list_all(all: bool = False, running: bool = True, stopped: bool = False) ->
40454111

40464112
def list_statsmanager() -> None:
40474113
"""
4048-
List status of the docker host manager
4114+
List status of the docker stats manager
40494115
40504116
:return: None
40514117
"""
@@ -4718,9 +4784,9 @@ def help() -> None:
47184784
click.secho(f"{click.style('init', fg='magenta')} Initializes CSLE and sets up mgmt accounts ",
47194785
bold=False)
47204786
click.secho(f"{click.style('ls', fg='magenta')} Lists information about CSLE ", bold=False)
4721-
click.secho(f"{click.style('start', fg='magenta')} Starts en emulation, a job,"
4787+
click.secho(f"{click.style('start', fg='magenta')} Starts an emulation, a job,"
47224788
f" or a container ", bold=False)
4723-
click.secho(f"{click.style('stop', fg='magenta')} Stops en entity, eg. emulation, a job,"
4789+
click.secho(f"{click.style('stop', fg='magenta')} Stops an entity, eg. emulation, a job,"
47244790
f" or a container ", bold=False)
47254791
click.secho(f"{click.style('rm', fg='magenta')} Removes a container, a network, an image, "
47264792
f"all networks, all images, or all containers ", bold=False)

0 commit comments

Comments
 (0)