comnetsemu.cli module

About: ComNetsEmu simple command-line interface

This module sub-class the Mininet’s CLI class to add some ComNetsEmu’s specific properly for DockerHost instances. commands, and also add fixes to some Mininet’s default methods to make it work

ISSUE: Current approach has too much Mininet codes included… Make it dependent

on the upstream. A better solution should be added.

class comnetsemu.cli.CLI(mininet, stdin=<_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>, script=None, **kwargs)

Bases: CLI

Mininet’s CLI subclass with support for Docker containers.

default(line)

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

  • Show warning message if first parameter is a DockerHost

do_appcontainers(_)

List deployed app containers.

do_help(line)

Describe available CLI commands.

do_xterm(line, term='xterm')

Spawn xterm(s) for the given node(s). Usage: xterm node1 node2 …

helpStr = 'You can send commands to Docker hosts with the same method of Mininet.\nYou can open xterm(s) to have interactive shells of Docker hostswith xterm command:\n  mininet> xterm h1 h2\n'
waitForNode(node)

Wait for a node to finish, and print its output.

  • Force to break the while loop if KeyboardInterrupt is detected.

comnetsemu.cli.spawnXtermDocker(dcontainer_name: str)

Spawn the xterm and attach to a Docker container with docker exec -it container. Bash is used as the interactive shell.

Parameters:

(str) (dcontainer_name) – Name of a Docker container.