Skip to content

Commit

Permalink
Merge pull request #274 from KatharaFramework/develop
Browse files Browse the repository at this point in the history
Kathará v3.7.3
  • Loading branch information
tcaiazzi committed Mar 18, 2024
2 parents d72dbda + 7ac01a4 commit d9d60aa
Show file tree
Hide file tree
Showing 67 changed files with 2,236 additions and 817 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.1"
placeholder: "3.7.3"
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.1 | :white_check_mark: |
| 3.7.3 | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kathara"
version = "3.7.1"
version = "3.7.3"
description = "A lightweight container-based network emulation tool."
readme = "README.md"
requires-python = ">=3.9"
Expand Down Expand Up @@ -33,12 +33,10 @@ dependencies = [
"docker>=7.0.0",
"kubernetes>=23.3.0",
"requests>=2.22.0",
"coloredlogs>=10.0",
"terminaltables>=3.1.0",
"slug>=2.0",
"deepdiff==6.2.2",
"pyroute2",
"progressbar2>=1.14.0",
"rich",
"fs>=2.4.16",
"chardet",
"libtmux>=0.8.2; platform_system == 'darwin' or platform_system == 'linux'",
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.1
VERSION=3.7.3
DEBIAN_PACKAGE_VERSION=1
LAUNCHPAD_NAME=user
NO_BINARY_PACKAGES=pyroute2|pyuv|deepdiff
Expand Down
10 changes: 5 additions & 5 deletions scripts/Linux-Deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
kathara (__VERSION__-__DEBIAN_PACKAGE_VERSION____UBUNTU_VERSION__) __UBUNTU_VERSION__; urgency=low

* It is now possible to specify a MAC Address for a network interface
* (Docker) Collision domains are now created per-network-scenario by default
* (Docker) If a ".shutdown" file is present in the network scenario, Kathara now correctly waits for the script termination before removing the container
* Several fixes of "lconfig" and "vconfig" commands
* Minor fixes and improvements
* New CLI UI using "rich" library!
* (Docker) Show progress during Docker image pull, similarly to the official "docker pull" command
* (Docker) It is now correctly possible to specify a "linux/amd64" image on Apple Silicon (which can be run using Rosetta)
* Add "gnome-terminal" as official supported terminal emulator
* Several API improvements and bug fixes

-- Kathara Team <contact@kathara.org> __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.1
VERSION=3.7.3
PACKAGE_VERSION=1
AUR_NAME=user
AUR_MAIL=contact@kathara.org
Expand Down
10 changes: 5 additions & 5 deletions scripts/Linux-Pkg/pkginfo/kathara.changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
__DATE__ Kathara Team <******@kathara.org>

* Release v__VERSION__
* It is now possible to specify a MAC Address for a network interface
* (Docker) Collision domains are now created per-network-scenario by default
* (Docker) If a ".shutdown" file is present in the network scenario, Kathara now correctly waits for the script termination before removing the container
* Several fixes of "lconfig" and "vconfig" commands
* Minor fixes and improvements
* New CLI UI using "rich" library!
* (Docker) Show progress during Docker image pull, similarly to the official "docker pull" command
* (Docker) It is now correctly possible to specify a "linux/amd64" image on Apple Silicon (which can be run using Rosetta)
* Add "gnome-terminal" as official supported terminal emulator
* Several API improvements and bug 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.1
VERSION=3.7.3
PACKAGE_VERSION=1

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

%changelog
* __DATE__ Kathara Team <******@kathara.org> - __VERSION__-__PACKAGE_VERSION__
- It is now possible to specify a MAC Address for a network interface
- (Docker) Collision domains are now created per-network-scenario by default
- (Docker) If a ".shutdown" file is present in the network scenario, Kathara now correctly waits for the script termination before removing the container
- Several fixes of "lconfig" and "vconfig" commands
- Minor fixes and improvements
- New CLI UI using "rich" library!
- (Docker) Show progress during Docker image pull, similarly to the official "docker pull" command
- (Docker) It is now correctly possible to specify a "linux/amd64" image on Apple Silicon (which can be run using Rosetta)
- Add "gnome-terminal" as official supported terminal emulator
- Several API improvements and bug 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.1
VERSION=3.7.3
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.1"
#define MyAppVersion "3.7.3"
#define MyAppPublisher "Kathara Team"
#define MyAppURL "https://www.kathara.org"
#define MyAppExeName "kathara.exe"
Expand Down
14 changes: 7 additions & 7 deletions scripts/autocompletion/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
binaryornot>=0.4.4;
requests>=2.22.0;
terminaltables>=3.1.0;
slug>=2.0;
deepdiff>=4.0.9;
kubernetes>=23.3.0;
fs>=2.4.16;
binaryornot>=0.4.4
requests>=2.22.0
slug>=2.0
deepdiff>=4.0.9
kubernetes>=23.3.0
fs>=2.4.16
rich
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.1
version = 3.7.3
author = Kathara Framework
author_email = contact@kathara.org
description = A lightweight container-based network emulation tool.
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,23 @@
package_dir={'': 'src'},
packages=find_packages('src'),
py_modules=['kathara'],
version='3.7.1',
version='3.7.3',
license='gpl-3.0',
description='A lightweight container-based network emulation tool.',
author='Kathara Framework',
author_email='contact@kathara.org',
url='https://www.kathara.org',
download_url='https://github.com/KatharaFramework/Kathara/archive/refs/tags/3.7.1.tar.gz',
download_url='https://github.com/KatharaFramework/Kathara/archive/refs/tags/3.7.3.tar.gz',
keywords=['NETWORK-EMULATION', 'CONTAINERS', 'NFV'],
install_requires=[
"binaryornot>=0.4.4",
"docker>=7.0.0",
"kubernetes>=23.3.0",
"requests>=2.22.0",
"coloredlogs>=10.0",
"terminaltables>=3.1.0",
"slug>=2.0",
"deepdiff==6.2.2",
"pyroute2",
"progressbar2>=1.14.0",
"rich",
"fs>=2.4.16",
"chardet",
"libtmux>=0.8.2; platform_system == 'darwin' or platform_system == 'linux'",
Expand Down
46 changes: 29 additions & 17 deletions src/Kathara/cli/command/CheckCommand.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import argparse
import logging
import os
import platform
import sys
from typing import List

from ..ui.utils import create_panel
from ... import utils
from ... import version
from ...foundation.cli.command.Command import Command
Expand Down Expand Up @@ -35,10 +35,19 @@ def __init__(self) -> None:
def run(self, current_path: str, argv: List[str]) -> None:
self.parse_args(argv)

print(f"*\tCurrent Manager is: {Kathara.get_instance().get_formatted_manager_name()}")
print(f"*\tManager version is: {Kathara.get_instance().get_release_version()}")
print("*\tPython version is: %s" % sys.version.replace("\n", "- "))
print(f"*\tKathara version is: {version.CURRENT_VERSION}")
self.console.print(create_panel("System Check", style="blue bold", justify="center"))
self.console.print(
f"Current Manager is:\t\t[bold dark_orange3]{Kathara.get_instance().get_formatted_manager_name()}"
)
self.console.print(
f"Manager version is:\t\t[bold dark_orange3]{Kathara.get_instance().get_release_version()}"
)
self.console.print(
"Python version is:\t\t[bold dark_orange3]%s" % sys.version.replace("\n", "- ")
)
self.console.print(
f"Kathara version is:\t\t[bold dark_orange3]{version.CURRENT_VERSION}"
)

def linux_platform_info():
info = os.uname()
Expand All @@ -47,18 +56,21 @@ def linux_platform_info():
platform_info = utils.exec_by_platform(
linux_platform_info, lambda: platform.platform(), lambda: platform.platform()
)
print(f"*\tOperating System version is: {str(platform_info)}")
self.console.print(f"Operating System version is:\t[bold dark_orange3]{str(platform_info)}")

print(f"*\tTrying to run container with `{Setting.get_instance().image}` image...")
Setting.get_instance().open_terminals = False
with self.console.status(
f"Trying to run container with `{Setting.get_instance().image}` image...",
spinner="dots"
) as _:
Setting.get_instance().open_terminals = False

lab = Lab("kathara_test")
lab.add_option('hosthome_mount', False)
lab = Lab("kathara_test")
lab.add_option('hosthome_mount', False)

machine = lab.get_or_new_machine("hello_world")
try:
Kathara.get_instance().deploy_machine(machine)
print("*\tContainer run successfully.")
Kathara.get_instance().undeploy_machine(machine)
except Exception as e:
logging.exception(f"\t! Running container failed: {str(e)}")
machine = lab.get_or_new_machine("hello_world")
try:
Kathara.get_instance().deploy_machine(machine)
Kathara.get_instance().undeploy_machine(machine)
self.console.print("[bold green]\u2713 Container run successfully.")
except Exception as e:
self.console.print(f"[bold red]\u00d7 Running container failed: {str(e)}")
7 changes: 4 additions & 3 deletions src/Kathara/cli/command/ConnectCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def run(self, current_path: str, argv: List[str]) -> None:
except (Exception, IOError):
lab = Lab(None, path=lab_path)

logging.debug("Executing `connect` command with hash `%s`..." % lab.hash)
logging.debug(f"Executing `connect` command with hash `{lab.hash}`...")

Kathara.get_instance().connect_tty(machine_name=args['machine_name'], lab_hash=lab.hash, shell=args['shell'],
logs=args['logs'])
Kathara.get_instance().connect_tty(
machine_name=args['machine_name'], lab_hash=lab.hash, shell=args['shell'], logs=args['logs']
)
12 changes: 6 additions & 6 deletions src/Kathara/cli/command/LcleanCommand.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import argparse
import logging
from typing import List

from ..ui.utils import format_headers
from ..ui.utils import create_panel
from ... import utils
from ...foundation.cli.command.Command import Command
from ...manager.Kathara import Kathara
Expand Down Expand Up @@ -52,8 +51,9 @@ def run(self, current_path: str, argv: List[str]) -> None:
except (Exception, IOError):
lab = Lab(None, path=lab_path)

logging.info(format_headers("Stopping Network Scenario"))
self.console.print(create_panel("Stopping Network Scenario", style="blue bold", justify="center"))

Kathara.get_instance().undeploy_lab(lab_hash=lab.hash,
selected_machines=set(args['machine_names']) if args['machine_names']
else None)
Kathara.get_instance().undeploy_lab(
lab_hash=lab.hash,
selected_machines=set(args['machine_names']) if args['machine_names'] else None
)
17 changes: 11 additions & 6 deletions src/Kathara/cli/command/LconfigCommand.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import argparse
import logging
from typing import List

from ..ui.utils import alphanumeric, cd_mac
from ..ui.utils import alphanumeric, cd_mac, create_panel
from ... import utils
from ...foundation.cli.command.Command import Command
from ...manager.Kathara import Kathara
Expand Down Expand Up @@ -73,10 +72,16 @@ def run(self, current_path: str, argv: List[str]) -> None:
machine_name = args['name']
device = lab.get_machine(machine_name)

self.console.print(
create_panel(
f"Updating Network Scenario Device `{machine_name}`", style="blue bold", justify="center"
)
)

if args['to_add']:
for cd_name, mac_address in args['to_add']:
logging.info(
f"Adding interface to device `{machine_name}` on collision domain `{cd_name}`" +
self.console.print(
f"[green]+ Adding interface to device `{machine_name}` on collision domain `{cd_name}`" +
(f" with MAC Address {mac_address}" if mac_address else "") +
f"..."
)
Expand All @@ -85,7 +90,7 @@ def run(self, current_path: str, argv: List[str]) -> None:

if args['to_remove']:
for cd_to_remove in args['to_remove']:
logging.info(
"Removing interface on collision domain `%s` from device `%s`..." % (cd_to_remove, machine_name)
self.console.print(
f"[red]- Removing interface on collision domain `{cd_to_remove}` from device `{machine_name}`..."
)
Kathara.get_instance().disconnect_machine_from_link(device, lab.get_link(cd_to_remove))
Loading

0 comments on commit d9d60aa

Please sign in to comment.