Skip to content

Commit

Permalink
Merge pull request #297 from KatharaFramework/develop
Browse files Browse the repository at this point in the history
Kathará v3.7.6
  • Loading branch information
tcaiazzi authored Jun 17, 2024
2 parents dcb48fa + bb0b5f9 commit 8f63323
Show file tree
Hide file tree
Showing 37 changed files with 1,141 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ body:
attributes:
label: Kathará Version
description: "Please provide the Kathará version you are using (`kathara -v`)."
placeholder: "3.7.5"
placeholder: "3.7.6"
validations:
required: true
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We release patches for security vulnerabilities only for the last version:

| Version | Supported Versions |
|---------|--------------------|
| 3.7.5 | :white_check_mark: |
| 3.7.6 | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
5 changes: 4 additions & 1 deletion docs/kathara-lclean.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kathara-lclean(1) -- Stop a Kathara network scenario

## SYNOPSIS

`kathara lclean` [`-h`] [`-d` <DIRECTORY>] [<DEVICE_NAME> [<DEVICE_NAME> ...]]
`kathara lclean` [`-h`] [`-d` <DIRECTORY>] [`--exclude` <DEVICE_NAME> [<DEVICE_NAME> ...]] [<DEVICE_NAME> [<DEVICE_NAME> ...]]

## DESCRIPTION

Expand All @@ -22,6 +22,9 @@ By default, stops all the devices of the network scenario. If a list of <DEVICE_
Cleans the Kathara network scenario that is located inside <DIRECTORY>.
If no `-d` option is provided, assume the network scenario is located in the current directory.

* `--exclude` [<DEVICE_NAME> [<DEVICE_NAME> ...]]
A list of device names. You can exclude certain devices of the network scenario from being shut down.

* `DEVICE_NAME`:
A list of device names. Instead of shutting down the whole network scenario, only specified devices are stopped.

Expand Down
6 changes: 5 additions & 1 deletion docs/kathara-lrestart.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ kathara-lrestart(1) -- Restart a Kathara network scenario
`kathara lrestart` [`-h`] [`-F`] [`-l`]
[`--noterminals` | `--terminals` | `--privileged`] [`-d` <DIRECTORY>]
[`-o` [<OPTION> [<OPTION> ...]]] [`--xterm` <XTERM>]
[`--no-hosthome` \| `--hosthome`] [`--no-shared` \| `--shared`] [<DEVICE_NAME> [<DEVICE_NAME> ...]]
[`--no-hosthome` \| `--hosthome`] [`--no-shared` \| `--shared`] [`--exclude` <DEVICE_NAME> [<DEVICE_NAME> ...]]
[<DEVICE_NAME> [<DEVICE_NAME> ...]]


## DESCRIPTION
Expand Down Expand Up @@ -75,6 +76,9 @@ Mainly it has the same options of `lstart` with the lack of some options (e.g. `

Mount the `shared` directory inside the network scenario folder inside all devices on the special directory `/shared`. This is the default specified in `kathara.conf`(5) file.

* `--exclude` [<DEVICE_NAME> [<DEVICE_NAME> ...]]
A list of device names. You can exclude certain devices of the network scenario from being restarted.

* `DEVICE_NAME`:
A list of device names. Instead of restarting the whole network scenario, only specified devices are restarted.

Expand Down
8 changes: 6 additions & 2 deletions docs/kathara-lstart.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ kathara-lstart(1) -- Start a Kathara network scenario

`kathara lstart` [`-h`] [`--noterminals` \| `--terminals` \| `--privileged`]
[`-d` <DIRECTORY>] [`-F`] [`-l`] [`-o` [<OPTION> [<OPTION> ...]]] [`--xterm` <XTERM>]
[`--print`] [`--no-hosthome` \| `--hosthome`] [`--no-shared` \| `--shared`] [<DEVICE_NAME> [<DEVICE_NAME> ...]]
[`--print`] [`--no-hosthome` \| `--hosthome`] [`--no-shared` \| `--shared`] [`--exclude` <DEVICE_NAME> [<DEVICE_NAME> ...]]
[<DEVICE_NAME> [<DEVICE_NAME> ...]]


## DESCRIPTION
Expand Down Expand Up @@ -86,11 +87,14 @@ The configuration of a Kathara network scenario consists of some files described

Mount the `shared` directory inside the network scenario folder inside all devices on the special directory `/shared`. This is the default specified in `kathara.conf`(5) file.

* `--exclude` [<DEVICE_NAME> [<DEVICE_NAME> ...]]
A list of device names. You can exclude certain devices of the network scenario from being started.

* `DEVICE_NAME`:
A list of device names. Instead of starting the whole network scenario, only specified devices are started.

m4_include(footer.txt)

## SEE ALSO

`kathara`(1), `kathara-lclean`(1), `kathara-lrestart`(1), `kathara-ltest`(1), `kathara-linfo`(1), `kathara-lab.conf`(5), `kathara-lab.dep`(5), `kathara-lab.ext`(5)
`kathara`(1), `kathara-lclean`(1), `kathara-lrestart`(1), `kathara-ltest`(1), `kathara-linfo`(1), `kathara-lab.conf`(5), `kathara-lab.dep`(5), `kathara-lab.ext`(5)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kathara"
version = "3.7.5"
version = "3.7.6"
description = "A lightweight container-based network emulation tool."
readme = "README.md"
requires-python = ">=3.9"
Expand Down
2 changes: 1 addition & 1 deletion scripts/Linux-Deb/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/make -f

VERSION=3.7.5
VERSION=3.7.6
DEBIAN_PACKAGE_VERSION=1
LAUNCHPAD_NAME=user
NO_BINARY_PACKAGES=pyroute2|pyuv|deepdiff
Expand Down
4 changes: 2 additions & 2 deletions scripts/Linux-Deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kathara (__VERSION__-__DEBIAN_PACKAGE_VERSION____UBUNTU_VERSION__) __UBUNTU_VERSION__; urgency=low

* (Docker) Fix "rp_filter" issue on all platforms and Docker versions
* (Docker) Fix Docker API objects reloading
* Fix IPv6 disabling issue
* Add the possibility to exclude machines while deploying a network scenario, both from CLI and Python APIs
* Minor fixes

-- Kathara Team <[email protected]> __DATE__
2 changes: 1 addition & 1 deletion scripts/Linux-Pkg/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/make -f

VERSION=3.7.5
VERSION=3.7.6
PACKAGE_VERSION=1
AUR_NAME=user
AUR_MAIL[email protected]
Expand Down
4 changes: 2 additions & 2 deletions scripts/Linux-Pkg/pkginfo/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ prepare() {
$srcdir/venv/bin/pip install --upgrade setuptools
$srcdir/venv/bin/pip install -r $srcdir/Kathara-$pkgver/src/requirements.txt
$srcdir/venv/bin/pip install -r $srcdir/Kathara-$pkgver/scripts/autocompletion/requirements.txt
$srcdir/venv/bin/pip install nuitka
$srcdir/venv/bin/pip install nuitka==2.3.3
$srcdir/venv/bin/pip install pytest
}

build() {
cd $srcdir/Kathara-$pkgver/docs && make roff-build
cd $srcdir/Kathara-$pkgver/scripts/autocompletion/ && $srcdir/venv/bin/python generate_autocompletion.py $srcdir/Kathara-$pkgver/scripts/autocompletion/kathara.bash-completion
cd $srcdir/Kathara-$pkgver/ && $srcdir/venv/bin/python -m pytest tests
cd $srcdir/Kathara-$pkgver/src/ && $srcdir/venv/bin/python -m nuitka --lto=no --plugin-enable=pylint-warnings --plugin-enable=multiprocessing --follow-imports --standalone --include-plugin-directory=Kathara --output-filename=kathara kathara.py
cd $srcdir/Kathara-$pkgver/src/ && $srcdir/venv/bin/python -m nuitka --lto=yes --plugin-enable=pylint-warnings --plugin-enable=multiprocessing --follow-imports --standalone --include-plugin-directory=Kathara --output-filename=kathara kathara.py
}

package() {
Expand Down
4 changes: 2 additions & 2 deletions scripts/Linux-Pkg/pkginfo/kathara.changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__DATE__ Kathara Team <******@kathara.org>

* Release v__VERSION__
* (Docker) Fix "rp_filter" issue on all platforms and Docker versions
* (Docker) Fix Docker API objects reloading
* Fix IPv6 disabling issue
* Add the possibility to exclude machines while deploying a network scenario, both from CLI and Python APIs
* Minor fixes
2 changes: 1 addition & 1 deletion scripts/Linux-Rpm/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/make -f

VERSION=3.7.5
VERSION=3.7.6
PACKAGE_VERSION=1

.PHONY: all clean docker-build-image prepare-source prepare-man-pages prepare-bash-completion pack-source build
Expand Down
4 changes: 2 additions & 2 deletions scripts/Linux-Rpm/rpm/kathara.spec
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ chmod g+s %{_libdir}/kathara/kathara

%changelog
* __DATE__ Kathara Team <******@kathara.org> - __VERSION__-__PACKAGE_VERSION__
- (Docker) Fix "rp_filter" issue on all platforms and Docker versions
- (Docker) Fix Docker API objects reloading
- Fix IPv6 disabling issue
- Add the possibility to exclude machines while deploying a network scenario, both from CLI and Python APIs
- Minor fixes
2 changes: 1 addition & 1 deletion scripts/OSX/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/make -s

PRODUCT=Kathara
VERSION=3.7.5
VERSION=3.7.6
TARGET_DIRECTORY=Output
APPLE_DEVELOPER_CERTIFICATE_ID=FakeID
ROFF_DIR=../../docs/Roff
Expand Down
2 changes: 1 addition & 1 deletion scripts/Windows/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Kathara"
#define MyAppVersion "3.7.5"
#define MyAppVersion "3.7.6"
#define MyAppPublisher "Kathara Team"
#define MyAppURL "https://www.kathara.org"
#define MyAppExeName "kathara.exe"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = kathara
version = 3.7.5
version = 3.7.6
author = Kathara Framework
author_email = [email protected]
description = A lightweight container-based network emulation tool.
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
package_dir={'': 'src'},
packages=find_packages('src'),
py_modules=['kathara'],
version='3.7.5',
version='3.7.6',
license='gpl-3.0',
description='A lightweight container-based network emulation tool.',
author='Kathara Framework',
author_email='[email protected]',
url='https://www.kathara.org',
download_url='https://github.com/KatharaFramework/Kathara/archive/refs/tags/3.7.5.tar.gz',
download_url='https://github.com/KatharaFramework/Kathara/archive/refs/tags/3.7.6.tar.gz',
keywords=['NETWORK-EMULATION', 'CONTAINERS', 'NFV'],
install_requires=[
"binaryornot>=0.4.4",
Expand Down
11 changes: 10 additions & 1 deletion src/Kathara/cli/command/LcleanCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ def __init__(self) -> None:
required=False,
help='Specify the folder containing the network scenario.'
)
self.parser.add_argument(
'--exclude',
dest='excluded_machines',
metavar='DEVICE_NAME',
nargs='+',
default=[],
help='Exclude specified devices from clean.'
)
self.parser.add_argument(
'machine_names',
metavar='DEVICE_NAME',
Expand All @@ -55,5 +63,6 @@ def run(self, current_path: str, argv: List[str]) -> None:

Kathara.get_instance().undeploy_lab(
lab_hash=lab.hash,
selected_machines=set(args['machine_names']) if args['machine_names'] else None
selected_machines=set(args['machine_names']) if args['machine_names'] else None,
excluded_machines=set(args['excluded_machines']) if args['excluded_machines'] else None,
)
10 changes: 10 additions & 0 deletions src/Kathara/cli/command/LrestartCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ def __init__(self) -> None:
const=True,
help='Mount "/shared" directory inside devices.'
)
self.parser.add_argument(
'--exclude',
dest='excluded_machines',
metavar='DEVICE_NAME',
nargs='+',
default=[],
help='Exclude specified devices.'
)
self.parser.add_argument(
'machine_name',
metavar='DEVICE_NAME',
Expand All @@ -125,6 +133,8 @@ def run(self, current_path: str, argv: List[str]) -> None:

if args['machine_name']:
lclean_argv.extend(args['machine_name'])
if args['excluded_machines']:
lclean_argv.extend(['--exclude'] + args['excluded_machines'])

LcleanCommand().run(current_path, lclean_argv)
LstartCommand().run(current_path, argv)
12 changes: 11 additions & 1 deletion src/Kathara/cli/command/LstartCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ def __init__(self) -> None:
const=True,
help='Mount "/shared" directory inside devices.'
)
self.parser.add_argument(
'--exclude',
dest='excluded_machines',
metavar='DEVICE_NAME',
nargs='+',
default=[],
help='Exclude specified devices from startup.'
)
self.parser.add_argument(
'machine_name',
metavar='DEVICE_NAME',
Expand Down Expand Up @@ -216,7 +224,9 @@ def run(self, current_path: str, argv: List[str]) -> Lab:
self.console.print("[yellow]\u26a0 Running devices with privileged capabilities, terminals won't open!")
Setting.get_instance().open_terminals = False

Kathara.get_instance().deploy_lab(lab, selected_machines=set(args['machine_name']))
Kathara.get_instance().deploy_lab(
lab, selected_machines=set(args['machine_name']), excluded_machines=set(args['excluded_machines'])
)

if args['list']:
with self.console.status(
Expand Down
10 changes: 7 additions & 3 deletions src/Kathara/foundation/manager/IManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ def deploy_link(self, link: Link) -> None:
raise NotImplementedError("You must implement `deploy_link` method.")

@abstractmethod
def deploy_lab(self, lab: Lab, selected_machines: Set[str] = None) -> None:
def deploy_lab(self, lab: Lab, selected_machines: Optional[Set[str]] = None,
excluded_machines: Optional[Set[str]] = None) -> None:
"""Deploy a Kathara network scenario.
Args:
lab (Kathara.model.Lab): A Kathara network scenario.
selected_machines (Set[str]): If not None, deploy only the specified devices.
selected_machines (Optional[Set[str]]): If not None, deploy only the specified devices.
excluded_machines (Optional[Set[str]]): If not None, exclude devices from being deployed.
Returns:
None
Expand Down Expand Up @@ -123,7 +125,8 @@ def undeploy_link(self, link: Link) -> None:

@abstractmethod
def undeploy_lab(self, lab_hash: Optional[str] = None, lab_name: Optional[str] = None, lab: Optional[Lab] = None,
selected_machines: Optional[Set[str]] = None) -> None:
selected_machines: Optional[Set[str]] = None,
excluded_machines: Optional[Set[str]] = None) -> None:
"""Undeploy a Kathara network scenario.
Args:
Expand All @@ -134,6 +137,7 @@ def undeploy_lab(self, lab_hash: Optional[str] = None, lab_name: Optional[str] =
lab (Optional[Kathara.model.Lab]): The network scenario object.
Can be used as an alternative to lab_hash and lab_name. If None, lab_hash or lab_name should be set.
selected_machines (Optional[Set[str]]): If not None, undeploy only the specified devices.
excluded_machines (Optional[Set[str]]): If not None, exclude devices from being undeployed.
Returns:
None
Expand Down
14 changes: 9 additions & 5 deletions src/Kathara/manager/Kathara.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,19 @@ def deploy_link(self, link: Link) -> None:
"""
self.manager.deploy_link(link)

def deploy_lab(self, lab: Lab, selected_machines: Set[str] = None) -> None:
def deploy_lab(self, lab: Lab, selected_machines: Optional[Set[str]] = None,
excluded_machines: Optional[Set[str]] = None) -> None:
"""Deploy a Kathara network scenario.
Args:
lab (Kathara.model.Lab): A Kathara network scenario.
selected_machines (Set[str]): If not None, deploy only the specified devices.
selected_machines (Optional[Set[str]]): If not None, deploy only the specified devices.
excluded_machines (Optional[Set[str]]): If not None, exclude devices from being deployed.
Returns:
None
"""
self.manager.deploy_lab(lab, selected_machines)
self.manager.deploy_lab(lab, selected_machines, excluded_machines)

def connect_machine_to_link(self, machine: Machine, link: Link, mac_address: Optional[str] = None) -> None:
"""Connect a Kathara device to a collision domain.
Expand Down Expand Up @@ -151,7 +153,8 @@ def undeploy_link(self, link: Link) -> None:
self.manager.undeploy_link(link)

def undeploy_lab(self, lab_hash: Optional[str] = None, lab_name: Optional[str] = None, lab: Optional[Lab] = None,
selected_machines: Optional[Set[str]] = None) -> None:
selected_machines: Optional[Set[str]] = None,
excluded_machines: Optional[Set[str]] = None) -> None:
"""Undeploy a Kathara network scenario.
Args:
Expand All @@ -162,14 +165,15 @@ def undeploy_lab(self, lab_hash: Optional[str] = None, lab_name: Optional[str] =
lab (Optional[Kathara.model.Lab]): The network scenario object.
Can be used as an alternative to lab_hash and lab_name. If None, lab_hash or lab_name should be set.
selected_machines (Optional[Set[str]]): If not None, undeploy only the specified devices.
excluded_machines (Optional[Set[str]]): If not None, exclude devices from being undeployed.
Returns:
None
Raises:
InvocationError: If a running network scenario hash or name is not specified.
"""
self.manager.undeploy_lab(lab_hash, lab_name, lab, selected_machines)
self.manager.undeploy_lab(lab_hash, lab_name, lab, selected_machines, excluded_machines)

def wipe(self, all_users: bool = False) -> None:
"""Undeploy all the running network scenarios.
Expand Down
Loading

0 comments on commit 8f63323

Please sign in to comment.