Skip to content

Commit

Permalink
Merge branch 'new_megalos'
Browse files Browse the repository at this point in the history
  • Loading branch information
Skazza94 committed Nov 11, 2020
2 parents 85c806c + f2bcb21 commit 31b4fd8
Show file tree
Hide file tree
Showing 114 changed files with 3,675 additions and 1,988 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ In particular we suggest [Netkit Lab Generator](https://github.com/KatharaFramew
* Download and unpack "BGP, OSPF and RIP interplay" from [here](https://github.com/KatharaFramework/Kathara-Labs/raw/master/Labs%20Integrating%20Several%20Technologies/BGP%2C%20OSPF%20and%20RIP%20interplay/kathara-lab_bgp-ospf-rip.zip).
* The topology of this lab can be found [here](https://github.com/KatharaFramework/Kathara-Labs/blob/master/Labs%20Integrating%20Several%20Technologies/BGP%2C%20OSPF%20and%20RIP%20interplay/kathara-lab_bgp-ospf-rip.pdf).
* `cd` inside "BGP, OSPF and RIP interplay" and run `kathara lstart`
* Kathará will read the configuration of the lab from `lab.conf`, `lab.dep` and the various `*.startup` files and start the machines, opening terminal windows to interact with the virtual network nodes.
* Kathará will read the configuration of the lab from `lab.conf`, `lab.dep` and the various `*.startup` files and start the devices, opening terminal windows to interact with the virtual network nodes.
* After you're done experimenting, simply run `kathara lclean`
* This will kill and remove all the machines.
* This will kill and remove all the devices.
4 changes: 2 additions & 2 deletions docs/footer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When reporting a bug, remember to write used commands, eventually attach your la

## AUTHORS

Kathara was born from Netkit. Its first version was developed by Gaetano Bonofiglio and Veronica Iovinella. Currently it is mantained by Lorenzo Ariemma and Mariano Scazzariello.
Kathara was born from Netkit. Its first version was developed by Gaetano Bonofiglio and Veronica Iovinella. Currently it is mantained by Mariano Scazzariello, Tommaso Caiazzi and Lorenzo Ariemma.

People involved also include:

Expand All @@ -18,5 +18,5 @@ People involved also include:

## COPYRIGHT

Copyright © 2017-2019 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
Copyright © 2017-2020 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
1 change: 1 addition & 0 deletions docs/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ kathara-wipe(1) kathara-wipe.1.ronn
kathara-list(1) kathara-list.1.ronn
kathara-settings(1) kathara-settings.1.ronn
kathara-check(1) kathara-check.1.ronn
kathara-exec(1) kathara-exec.1.ronn

# Files man pages
kathara.conf(5) kathara.conf.5.ronn
Expand Down
6 changes: 3 additions & 3 deletions docs/kathara-connect.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Open a shell in device DEVICE_NAME.

This option cannot be used in conjuction with `-d` or `--directory`.

* `--shell` <SHELL>:
Set the shell (sh, bash, etc.) that should be used inside the device.
* `--command` <SHELL>:
Command that should be executed inside the device.

As an example: `bash`(1). Override the default setting specified in `kathara.conf`(5) file.
By default, the shell specified in `kathara.conf`(5) file is executed. This option overrides this setting.

* `-l`, `--logs`:
Print device startup logs before launching the shell.
Expand Down
59 changes: 59 additions & 0 deletions docs/kathara-exec.1.ronn
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
m4_changequote()
kathara-exec(1) -- Execute a command in a Kathara device
=============================================

## SYNOPSIS

`kathara exec`
> [`-h`] [`-d` <DIRECTORY> | `-v`]
> [`--no-stdout`] [`--no-stderr`]
> <DEVICE_NAME> <COMMAND> [<COMMAND> ...]
## DESCRIPTION

Execute a command in the Kathara device DEVICE_NAME.

## OPTIONS

* `-h`, `--help`:
Show an help message and exit.

* `-d` <DIRECTORY>, `--directory` <DIRECTORY>:
Specify the folder containing the lab.

Execute the specified command in a Kathara device belonging to a lab that is located inside DIRECTORY.
If no `-d` option is provided, assume the lab is located in the current directory.
This option cannot be used in conjuction with `-v` or `--vmachine`.

* `-v`, `--vmachine`:
The device has been started with vstart command.

This option cannot be used in conjuction with `-d` or `--directory`.

* `--no-stdout`:
Disable stdout of the executed command.

* `--no-stderr`:
Disable stderr of the executed command.

* `<DEVICE_NAME>:
Name of the device to execute the command into.

* `<COMMAND>:
Shell command that will be executed inside the device.

## EXAMPLES

kathara exec -v pc1 -- ping 127.0.0.1

Execute the command ping into a device called `pc1`, started with `kathara-vstart`(1).

kathara exec as1r1 "ping 127.0.0.1"

Execute the command ping into a device called `as1r1` belonging to a lab located in current folder and started with `kathara-lstart`(1).

m4_include(footer.txt)

## SEE ALSO

`kathara`(1), `kathara-vstart`(1), `kathara-lstart`(1)
19 changes: 14 additions & 5 deletions docs/kathara-lab.conf.5.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If `arg` is an option name, then `device` will be launched with option `arg` set

In order to establish a uniform convention, comment lines should always start with a hash character (`#`).

## MACHINE OPTIONS
## DEVICE OPTIONS

* `image` (string):
Docker image used for this device.
Expand All @@ -35,24 +35,32 @@ In order to establish a uniform convention, comment lines should always start wi
* `bridged` (boolean):
Connect the device to the host network by adding an additional network interface. This interface will be connected to the host network through a NAT connection.

* `ipv6` (boolean):
Enable or disable IPv6 on this device.

* `exec` (string):
Run a specific shell command inside the device during the startup phase.

* `sysctl` (string):
Sets a sysctl option for this device. Only the `net.` namespace is allowed to be set. Can be set multiple times per machine, each will add a new entry (unless the same config item is used again).
Sets a sysctl option for this device. Only the `net.` namespace is allowed to be set. Can be set multiple times per device, each will add a new entry (unless the same config item is used again).

* `shell` (string):
Use the specified shell to connect to the device, e.g., when `kathara connect` is called.

## LAB META INFORMATION

It is also possible to provide descriptive information about a lab by using one of the following special assignments:

+ LAB_NAME=string (a word as identifier for the lab)
+ LAB_DESCRIPTION=string (a brief description of the purpose of the lab)
+ LAB_VERSION=string (the version of the lab)
+ LAB_AUTHOR=string (people who have written the lab)
+ LAB_EMAIL=string (contacts of lab authors)
+ LAB_WEB=string (useful web reources related to the lab)
+ LAB_WEB=string (useful web resources related to the lab)

## EXAMPLE

LAB_NAME="Example"
LAB_DESCRIPTION="A simple example of lab.conf"
LAB_VERSION=1.0
LAB_AUTHOR="Kathara Authors"
Expand All @@ -74,11 +82,12 @@ It is also possible to provide descriptive information about a lab by using one

pc2[0]="C"
pc2[mem]=128m

pc2[shell]="/bin/sh"

Example of a `lab.conf`(5) file.

m4_include(footer.txt)

## SEE ALSO

`kathara`(1), `kathara-lstart`(1), [Kathara official site](https://www.kathara.org)
`kathara`(1), `kathara-lstart`(1), [Kathara official site](https://www.kathara.org)
19 changes: 18 additions & 1 deletion docs/kathara-list.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kathara-list(1) -- Show all running Kathara devices of the current user

## SYNOPSIS

`kathara list` [`-h`] [`-a`] [`-n` <DEVICE_NAME>]
`kathara list` [`-h`] [`-a`] [`-l`] [`-n` <DEVICE_NAME>]


## DESCRIPTION
Expand All @@ -31,6 +31,23 @@ The following information are displayed:

This option can be run only by `root` user.

* `-l`, `--live`:
Live mode, can be used only when a lab is launched.

Show exhaustive live status of each device of the current lab. Can only be used when after the lab is started. This overrides the default behavior of the command described above.

The following information are displayed:

+ `LAB_HASH`: autogenerated hash associated with a lab
+ `DEVICE_NAME`: name of the device
+ `STATUS`: status of the device
+ `CPU %`: the percentage of the host's CPU the device is using
+ `MEM USAGE / LIMIT`: the total memory the device is using, and the total amount of memory it is allowed to use
+ `MEM %`: the percentage of the host's memory the device is using
+ `NET I/O`: the amount of data the device has sent and received over its network interfaces

To quit the live screen, pass the `SIGINT` `signal`(7) to the process (usually CTRL+C).

* `-n` <DEVICE_NAME>, `--name` <DEVICE_NAME>:
Show only information about a specified device.

Expand Down
4 changes: 2 additions & 2 deletions docs/kathara-wipe.1.ronn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
m4_changequote()
kathara-wipe(1) -- Delete all Kathara devices and links, optionally also delete settings
kathara-wipe(1) -- Delete all Kathara devices and collision domains, optionally also delete settings
=============================================

## SYNOPSIS
Expand Down Expand Up @@ -28,7 +28,7 @@ Using optional parameters, it is also possible to delete the current user settin
Delete the `kathara.config`(5) file and create it again with default settings.

* `-a`, `--all`:
Wipe all Kathara devices and links of all users. MUST BE ROOT FOR THIS OPTION.
Wipe all Kathara devices and collision domains of all users. MUST BE ROOT FOR THIS OPTION.

This option can be run only by `root` user. Cannot be used with `-s` or `--settings`.

Expand Down
5 changes: 4 additions & 1 deletion docs/kathara.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ The possible kathara commands are:
* `kathara-connect`(1):
Connect to a Kathara device

* `kathara-exec`(1):
Execute a command in a Kathara device

* `kathara-wipe`(1):
Delete all Kathara devices and links, optionally also delete settings
Delete all Kathara devices and collision domains, optionally also delete settings

* `kathara-list`(1):
Show all running Kathara devices
Expand Down
85 changes: 58 additions & 27 deletions docs/kathara.conf.5.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Checks on the correctness of the configuration are performed each time a Kathara
Default to `docker`.

* `terminal` (string):
This parameter determines the terminal emulator application to be used for device terminals. The application must be correctly installed in the host system.
This parameter determines the terminal emulator application to be used for device terminals. The application must be correctly installed in the host system. This option is only visible on Linux and macOS.

Default to `/usr/bin/xterm`.

Expand All @@ -30,16 +30,6 @@ Checks on the correctness of the configuration are performed each time a Kathara

Default to `true`.

* `hosthome_mount` (boolean):
This parameter specifies if the `/hosthome` dir will be mounted inside the device. The home directory of the current user is made available for reading/writing inside the device under the special directory `/hosthome`.

Default to `false`.

* `shared_mount` (boolean):
This parameter specifies if the `/shared` dir will be mounted inside the device. The "shared" folder inside the lab folder is made available for reading/writing inside the device under the special directory `/shared`.

Default to `true`.

* `device_shell` (string):
This parameter determines the shell to use inside the device. The application must be correctly installed in the Docker image used for the device. Possible examples are: bash, sh, fish, and so on.

Expand Down Expand Up @@ -74,26 +64,67 @@ Checks on the correctness of the configuration are performed each time a Kathara
Unix time (in milliseconds) of the last online check for Kathara updates. Each week, when the first Kathara command is launched, the system will check if the system and the default image are up-to-date.

Default to `time of the file creation - one week`, so the check will always run after a fresh.


## ADDITIONAL MANAGER PARAMETERS

Each Manager specifies additional parameters which are used only when the Manager is currently active.

### KATHARA (Docker)

* `hosthome_mount` (boolean):
This parameter specifies if the `/hosthome` dir will be mounted inside the device. The home directory of the current user is made available for reading/writing inside the device under the special directory `/hosthome`.

Default to `false`.

* `shared_mount` (boolean):
This parameter specifies if the `/shared` dir will be mounted inside the device. The "shared" folder inside the lab folder is made available for reading/writing inside the device under the special directory `/shared`.

Default to `true`.

### MEGALOS (Kubernetes)

* `api_server_url` (string):
This parameter specifies the remote Kubernetes API server url. If not specified Megalos will try to connect to a local API server.

Default to null.

* `api_token` (string):
This parameter specifies the authentication token used for the remote API server. If the remote API server is not used, this parameter is useless.

Default to null.

* `host_shared` (boolean):
Each Kubernetes worker node creates a '/home/shared` directory and this directory will be mounted in read/write mode on each device under the path `/shared`.
This will allow to save files from the device to the Kubernetes worker node locally. Note that the content of those folders (one on each worker node) are not shared between them nor between the worker and the Kathara host.

Default to `true`.

* `image_pull_policy` (string):
Specify the image pull policy for Docker images used by devices.

Possible values are `Always`, `IfNotPresent`, `Never`. Please refer to the [official Kubernetes page](https://kubernetes.io/docs/concepts/configuration/overview/#container-images) for further details on how this mode works.

Default to `IfNotPresent`.

## EXAMPLE

{
"image": "kathara/quagga",
"deployer_type": "docker",
"terminal": "/usr/bin/xterm",
"open_terminals": true,
"hosthome_mount": true,
"device_shell": "bash",
"net_prefix": "kathara",
"device_prefix": "kathara",
"debug_level": "INFO",
"print_startup_log": true,
"enable_ipv6": false,
"last_checked": 1570724309.2402148
}
{
"image": "kathara/quagga",
"manager_type": "docker",
"terminal": "/usr/bin/xterm",
"open_terminals": true,
"device_shell": "/bin/bash",
"net_prefix": "kathara",
"device_prefix": "kathara",
"debug_level": "INFO",
"print_startup_log": true,
"enable_ipv6": true,
"last_checked": 1600087624.6843708,
"hosthome_mount": false,
"shared_mount": true
}

Example of the default `kathara.conf`(5) file.
Example of the default `kathara.conf`(5) file using Docker Manager.

m4_include(footer.txt)

Expand Down
13 changes: 8 additions & 5 deletions scripts/Linux/Docker-Linux-Build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM debian:9
FROM ubuntu:focal

ENV TZ=Europe/Rome

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt update \
&& DEBIAN_FRONTEND=noninteractive apt upgrade -y \
Expand All @@ -15,16 +19,15 @@ RUN apt update \
lintian \
devscripts \
git \
ruby-full
ruby-full \
bash-completion

RUN gem install nokogiri mustache kramdown rubocop sinatra rack rake test-unit
RUN gem install ronn-ng

COPY dput.cf /root/.dput.cf

WORKDIR /opt

RUN git clone https://github.com/apjanke/ronn-ng.git
ENV PATH="/opt/ronn-ng/bin:${PATH}"
ENV RUBYOPT="-KU -E utf-8:utf-8"

WORKDIR /opt/kathara/scripts/Linux
Loading

0 comments on commit 31b4fd8

Please sign in to comment.