From 479c320a78edf52f0555f2b49c3a36b1c8ae6e26 Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Tue, 13 Jun 2023 14:29:07 -0600 Subject: [PATCH 1/8] Restructure framework and modules --- cmd/install | 4 - cmd/start | 4 +- framework/{ => python/src/common}/logger.py | 123 ++++++++-------- .../python/src/common}/util.py | 110 +++++++-------- framework/{ => python/src/core}/device.py | 2 +- .../{ => python/src/core}/test_runner.py | 2 +- framework/{ => python/src/core}/testrun.py | 24 ++-- .../python/src/net_orc}/listener.py | 4 +- .../python/src/net_orc}/network_device.py | 0 .../python/src/net_orc}/network_event.py | 0 .../src/net_orc}/network_orchestrator.py | 22 +-- .../python/src/net_orc}/network_validator.py | 14 +- .../python/src/net_orc}/ovs_control.py | 10 +- .../python/src/test_orc}/module.py | 0 .../python/src/test_orc}/runner.py | 0 .../python/src/test_orc}/test_orchestrator.py | 20 ++- framework/requirements.txt | 9 +- .../devices/faux-dev/bin/get_default_gateway | 0 .../devices/faux-dev/bin/start_dhcp_client | 0 .../faux-dev/bin/start_network_service | 0 .../devices/faux-dev/conf/module_config.json | 0 .../devices/faux-dev/faux-dev.Dockerfile | 11 +- .../devices/faux-dev/python/src/dhcp_check.py | 0 .../devices/faux-dev/python/src/dns_check.py | 0 .../faux-dev/python/src/gateway_check.py | 0 .../devices/faux-dev/python/src/logger.py | 0 .../devices/faux-dev/python/src/ntp_check.py | 0 .../devices/faux-dev/python/src/run.py | 0 .../devices/faux-dev/python/src/util.py | 0 .../network}/base/base.Dockerfile | 0 .../network}/base/bin/capture | 0 .../network}/base/bin/setup_binaries | 0 .../network}/base/bin/start_grpc | 0 .../network}/base/bin/start_module | 0 .../network}/base/bin/start_network_service | 0 .../network}/base/bin/wait_for_interface | 0 .../network}/base/conf/module_config.json | 0 .../network}/base/python/requirements.txt | 0 .../base/python/src/grpc/start_server.py | 0 .../network}/base/python/src/logger.py | 0 .../network}/dhcp-1/bin/start_network_service | 0 .../network}/dhcp-1/conf/dhcpd.conf | 0 .../network}/dhcp-1/conf/module_config.json | 0 .../network}/dhcp-1/conf/radvd.conf | 0 .../network/dhcp-1/dhcp-1.Dockerfile | 9 +- .../dhcp-1/python/src/grpc/__init__.py | 0 .../dhcp-1/python/src/grpc/dhcp_config.py | 0 .../dhcp-1/python/src/grpc/network_service.py | 0 .../dhcp-1/python/src/grpc/proto/grpc.proto | 0 .../network}/dhcp-2/bin/start_network_service | 0 .../network}/dhcp-2/conf/dhcpd.conf | 0 .../network}/dhcp-2/conf/module_config.json | 0 .../network}/dhcp-2/conf/radvd.conf | 0 .../network/dhcp-2/dhcp-2.Dockerfile | 12 +- .../dhcp-2/python/src/grpc/__init__.py | 0 .../dhcp-2/python/src/grpc/dhcp_config.py | 0 .../dhcp-2/python/src/grpc/network_service.py | 0 .../dhcp-2/python/src/grpc/proto/grpc.proto | 0 .../network}/dns/bin/start_network_service | 0 .../network}/dns/conf/dnsmasq.conf | 0 .../network}/dns/conf/module_config.json | 0 .../network}/dns/dns.Dockerfile | 7 +- .../gateway/bin/start_network_service | 0 .../network}/gateway/conf/module_config.json | 0 .../network}/gateway/gateway.Dockerfile | 7 +- .../network}/ntp/bin/start_network_service | 0 .../network}/ntp/conf/module_config.json | 0 modules/network/ntp/ntp.Dockerfile | 16 +++ .../network}/ntp/python/src/ntp_server.py | 0 .../network}/radius/bin/start_network_service | 0 .../network}/radius/conf/ca.crt | 0 .../network}/radius/conf/eap | 0 .../network}/radius/conf/module_config.json | 0 .../network}/radius/python/requirements.txt | 0 .../radius/python/src/authenticator.py | 0 .../network}/radius/radius.Dockerfile | 9 +- .../template/bin/start_network_service | 0 .../network}/template/conf/module_config.json | 0 .../template/python/src/template_main.py | 0 .../network}/template/template.Dockerfile | 0 .../test}/base/base.Dockerfile | 9 +- .../modules => modules/test}/base/bin/capture | 0 .../test}/base/bin/get_ipv4_addr | 0 .../test}/base/bin/setup_binaries | 0 .../test}/base/bin/start_grpc | 0 .../test}/base/bin/start_module | 0 .../test}/base/bin/wait_for_interface | 0 .../test}/base/conf/module_config.json | 0 .../test}/base/python/requirements.txt | 0 .../base/python/src/grpc/start_server.py | 0 .../test}/base/python/src/logger.py | 0 .../test}/base/python/src/test_module.py | 0 .../test}/base/python/src/util.py | 0 modules/test/baseline/baseline.Dockerfile | 14 ++ .../test}/baseline/bin/start_test_module | 0 .../test}/baseline/conf/module_config.json | 0 .../baseline/python/src/baseline_module.py | 0 .../test}/baseline/python/src/run.py | 0 .../test}/conn/bin/start_test_module | 0 .../test}/conn/conf/module_config.json | 0 .../test}/conn/conn.Dockerfile | 13 +- .../test}/conn/python/requirements.txt | 0 .../conn/python/src/connection_module.py | 0 .../test}/conn/python/src/run.py | 0 .../test}/dns/bin/start_test_module | 0 .../test}/dns/conf/module_config.json | 0 modules/test/dns/dns.Dockerfile | 14 ++ .../test}/dns/python/src/dns_module.py | 0 .../test}/dns/python/src/run.py | 0 .../test}/nmap/bin/start_test_module | 0 .../test}/nmap/conf/module_config.json | 0 modules/test/nmap/nmap.Dockerfile | 14 ++ .../test}/nmap/python/src/nmap_module.py | 0 .../test}/nmap/python/src/run.py | 0 net_orc/.gitignore | 133 ------------------ net_orc/network/modules/ntp/ntp.Dockerfile | 13 -- net_orc/orchestrator.Dockerfile | 22 --- net_orc/python/requirements.txt | 4 - test_orc/modules/baseline/baseline.Dockerfile | 11 -- test_orc/modules/dns/dns.Dockerfile | 11 -- test_orc/modules/nmap/nmap.Dockerfile | 11 -- test_orc/python/requirements.txt | 0 122 files changed, 285 insertions(+), 403 deletions(-) rename framework/{ => python/src/common}/logger.py (57%) rename {net_orc/python/src => framework/python/src/common}/util.py (95%) rename framework/{ => python/src/core}/device.py (91%) rename framework/{ => python/src/core}/test_runner.py (96%) rename framework/{ => python/src/core}/testrun.py (85%) rename {net_orc/python/src => framework/python/src/net_orc}/listener.py (97%) rename {net_orc/python/src => framework/python/src/net_orc}/network_device.py (100%) rename {net_orc/python/src => framework/python/src/net_orc}/network_event.py (100%) rename {net_orc/python/src => framework/python/src/net_orc}/network_orchestrator.py (95%) rename {net_orc/python/src => framework/python/src/net_orc}/network_validator.py (94%) rename {net_orc/python/src => framework/python/src/net_orc}/ovs_control.py (95%) rename {test_orc/python/src => framework/python/src/test_orc}/module.py (100%) rename {test_orc/python/src => framework/python/src/test_orc}/runner.py (100%) rename {test_orc/python/src => framework/python/src/test_orc}/test_orchestrator.py (93%) rename {net_orc/network => modules}/devices/faux-dev/bin/get_default_gateway (100%) rename {net_orc/network => modules}/devices/faux-dev/bin/start_dhcp_client (100%) rename {net_orc/network => modules}/devices/faux-dev/bin/start_network_service (100%) rename {net_orc/network => modules}/devices/faux-dev/conf/module_config.json (100%) rename {net_orc/network => modules}/devices/faux-dev/faux-dev.Dockerfile (65%) rename {net_orc/network => modules}/devices/faux-dev/python/src/dhcp_check.py (100%) rename {net_orc/network => modules}/devices/faux-dev/python/src/dns_check.py (100%) rename {net_orc/network => modules}/devices/faux-dev/python/src/gateway_check.py (100%) rename {net_orc/network => modules}/devices/faux-dev/python/src/logger.py (100%) rename {net_orc/network => modules}/devices/faux-dev/python/src/ntp_check.py (100%) rename {net_orc/network => modules}/devices/faux-dev/python/src/run.py (100%) rename {net_orc/network => modules}/devices/faux-dev/python/src/util.py (100%) rename {net_orc/network/modules => modules/network}/base/base.Dockerfile (100%) rename {net_orc/network/modules => modules/network}/base/bin/capture (100%) rename {net_orc/network/modules => modules/network}/base/bin/setup_binaries (100%) rename {net_orc/network/modules => modules/network}/base/bin/start_grpc (100%) rename {net_orc/network/modules => modules/network}/base/bin/start_module (100%) rename {net_orc/network/modules => modules/network}/base/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/base/bin/wait_for_interface (100%) rename {net_orc/network/modules => modules/network}/base/conf/module_config.json (100%) rename {net_orc/network/modules => modules/network}/base/python/requirements.txt (100%) rename {net_orc/network/modules => modules/network}/base/python/src/grpc/start_server.py (100%) rename {net_orc/network/modules => modules/network}/base/python/src/logger.py (100%) rename {net_orc/network/modules => modules/network}/dhcp-1/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/dhcp-1/conf/dhcpd.conf (100%) rename {net_orc/network/modules => modules/network}/dhcp-1/conf/module_config.json (100%) rename {net_orc/network/modules => modules/network}/dhcp-1/conf/radvd.conf (100%) rename net_orc/network/modules/dhcp-2/dhcp-2.Dockerfile => modules/network/dhcp-1/dhcp-1.Dockerfile (56%) rename {net_orc/network/modules => modules/network}/dhcp-1/python/src/grpc/__init__.py (100%) rename {net_orc/network/modules => modules/network}/dhcp-1/python/src/grpc/dhcp_config.py (100%) rename {net_orc/network/modules => modules/network}/dhcp-1/python/src/grpc/network_service.py (100%) rename {net_orc/network/modules => modules/network}/dhcp-1/python/src/grpc/proto/grpc.proto (100%) rename {net_orc/network/modules => modules/network}/dhcp-2/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/dhcp-2/conf/dhcpd.conf (100%) rename {net_orc/network/modules => modules/network}/dhcp-2/conf/module_config.json (100%) rename {net_orc/network/modules => modules/network}/dhcp-2/conf/radvd.conf (100%) rename net_orc/network/modules/dhcp-1/dhcp-1.Dockerfile => modules/network/dhcp-2/dhcp-2.Dockerfile (55%) rename {net_orc/network/modules => modules/network}/dhcp-2/python/src/grpc/__init__.py (100%) rename {net_orc/network/modules => modules/network}/dhcp-2/python/src/grpc/dhcp_config.py (100%) rename {net_orc/network/modules => modules/network}/dhcp-2/python/src/grpc/network_service.py (100%) rename {net_orc/network/modules => modules/network}/dhcp-2/python/src/grpc/proto/grpc.proto (100%) rename {net_orc/network/modules => modules/network}/dns/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/dns/conf/dnsmasq.conf (100%) rename {net_orc/network/modules => modules/network}/dns/conf/module_config.json (100%) rename {net_orc/network/modules => modules/network}/dns/dns.Dockerfile (67%) rename {net_orc/network/modules => modules/network}/gateway/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/gateway/conf/module_config.json (100%) rename {net_orc/network/modules => modules/network}/gateway/gateway.Dockerfile (59%) rename {net_orc/network/modules => modules/network}/ntp/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/ntp/conf/module_config.json (100%) create mode 100644 modules/network/ntp/ntp.Dockerfile rename {net_orc/network/modules => modules/network}/ntp/python/src/ntp_server.py (100%) rename {net_orc/network/modules => modules/network}/radius/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/radius/conf/ca.crt (100%) rename {net_orc/network/modules => modules/network}/radius/conf/eap (100%) rename {net_orc/network/modules => modules/network}/radius/conf/module_config.json (100%) rename {net_orc/network/modules => modules/network}/radius/python/requirements.txt (100%) rename {net_orc/network/modules => modules/network}/radius/python/src/authenticator.py (100%) rename {net_orc/network/modules => modules/network}/radius/radius.Dockerfile (74%) rename {net_orc/network/modules => modules/network}/template/bin/start_network_service (100%) rename {net_orc/network/modules => modules/network}/template/conf/module_config.json (100%) rename {net_orc/network/modules => modules/network}/template/python/src/template_main.py (100%) rename {net_orc/network/modules => modules/network}/template/template.Dockerfile (100%) rename {test_orc/modules => modules/test}/base/base.Dockerfile (74%) rename {test_orc/modules => modules/test}/base/bin/capture (100%) rename {test_orc/modules => modules/test}/base/bin/get_ipv4_addr (100%) rename {test_orc/modules => modules/test}/base/bin/setup_binaries (100%) rename {test_orc/modules => modules/test}/base/bin/start_grpc (100%) rename {test_orc/modules => modules/test}/base/bin/start_module (100%) rename {test_orc/modules => modules/test}/base/bin/wait_for_interface (100%) rename {test_orc/modules => modules/test}/base/conf/module_config.json (100%) rename {test_orc/modules => modules/test}/base/python/requirements.txt (100%) rename {test_orc/modules => modules/test}/base/python/src/grpc/start_server.py (100%) rename {test_orc/modules => modules/test}/base/python/src/logger.py (100%) rename {test_orc/modules => modules/test}/base/python/src/test_module.py (100%) rename {test_orc/modules => modules/test}/base/python/src/util.py (100%) create mode 100644 modules/test/baseline/baseline.Dockerfile rename {test_orc/modules => modules/test}/baseline/bin/start_test_module (100%) rename {test_orc/modules => modules/test}/baseline/conf/module_config.json (100%) rename {test_orc/modules => modules/test}/baseline/python/src/baseline_module.py (100%) rename {test_orc/modules => modules/test}/baseline/python/src/run.py (100%) rename {test_orc/modules => modules/test}/conn/bin/start_test_module (100%) rename {test_orc/modules => modules/test}/conn/conf/module_config.json (100%) rename {test_orc/modules => modules/test}/conn/conn.Dockerfile (59%) rename {test_orc/modules => modules/test}/conn/python/requirements.txt (100%) rename {test_orc/modules => modules/test}/conn/python/src/connection_module.py (100%) rename {test_orc/modules => modules/test}/conn/python/src/run.py (100%) rename {test_orc/modules => modules/test}/dns/bin/start_test_module (100%) rename {test_orc/modules => modules/test}/dns/conf/module_config.json (100%) create mode 100644 modules/test/dns/dns.Dockerfile rename {test_orc/modules => modules/test}/dns/python/src/dns_module.py (100%) rename {test_orc/modules => modules/test}/dns/python/src/run.py (100%) rename {test_orc/modules => modules/test}/nmap/bin/start_test_module (100%) rename {test_orc/modules => modules/test}/nmap/conf/module_config.json (100%) create mode 100644 modules/test/nmap/nmap.Dockerfile rename {test_orc/modules => modules/test}/nmap/python/src/nmap_module.py (100%) rename {test_orc/modules => modules/test}/nmap/python/src/run.py (100%) delete mode 100644 net_orc/.gitignore delete mode 100644 net_orc/network/modules/ntp/ntp.Dockerfile delete mode 100644 net_orc/orchestrator.Dockerfile delete mode 100644 net_orc/python/requirements.txt delete mode 100644 test_orc/modules/baseline/baseline.Dockerfile delete mode 100644 test_orc/modules/dns/dns.Dockerfile delete mode 100644 test_orc/modules/nmap/nmap.Dockerfile delete mode 100644 test_orc/python/requirements.txt diff --git a/cmd/install b/cmd/install index 23e463158..37c03e113 100755 --- a/cmd/install +++ b/cmd/install @@ -6,8 +6,4 @@ source venv/bin/activate pip3 install -r framework/requirements.txt -pip3 install -r net_orc/python/requirements.txt - -pip3 install -r test_orc/python/requirements.txt - deactivate diff --git a/cmd/start b/cmd/start index d146f413d..55d2e52eb 100755 --- a/cmd/start +++ b/cmd/start @@ -18,7 +18,9 @@ rm -rf runtime source venv/bin/activate # TODO: Execute python code -python -u framework/test_runner.py $@ +# Set the PYTHONPATH to include the "src" directory +export PYTHONPATH="$PWD/framework/python/src" +python -u framework/python/src/core/test_runner.py $@ # TODO: Work in progress code for containerization of OVS module # asyncRun() { diff --git a/framework/logger.py b/framework/python/src/common/logger.py similarity index 57% rename from framework/logger.py rename to framework/python/src/common/logger.py index cb71c9fdd..539767f53 100644 --- a/framework/logger.py +++ b/framework/python/src/common/logger.py @@ -1,63 +1,60 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Manages stream and file loggers.""" -import json -import logging -import os - -LOGGERS = {} -_LOG_FORMAT = '%(asctime)s %(name)-8s %(levelname)-7s %(message)s' -_DATE_FORMAT = '%b %02d %H:%M:%S' -_DEFAULT_LOG_LEVEL = logging.INFO -_LOG_LEVEL = logging.INFO -_CONF_DIR = 'conf' -_CONF_FILE_NAME = 'system.json' -_LOG_DIR = 'runtime/testing/' - -# Set log level -with open(os.path.join(_CONF_DIR, _CONF_FILE_NAME), - encoding='utf-8') as system_conf_file: - system_conf_json = json.load(system_conf_file) -log_level_str = system_conf_json['log_level'] - -temp_log = logging.getLogger('temp') -try: - temp_log.setLevel(logging.getLevelName(log_level_str)) - _LOG_LEVEL = logging.getLevelName(log_level_str) -except ValueError: - print('Invalid log level set in ' + _CONF_DIR + '/' + _CONF_FILE_NAME + - '. Using INFO as log level') - _LOG_LEVEL = _DEFAULT_LOG_LEVEL - -log_format = logging.Formatter(fmt=_LOG_FORMAT, datefmt=_DATE_FORMAT) - -def add_file_handler(log, log_file): - handler = logging.FileHandler(_LOG_DIR + log_file + '.log') - handler.setFormatter(log_format) - log.addHandler(handler) - -def add_stream_handler(log): - handler = logging.StreamHandler() - handler.setFormatter(log_format) - log.addHandler(handler) - -def get_logger(name, log_file=None): - if name not in LOGGERS: - LOGGERS[name] = logging.getLogger(name) - LOGGERS[name].setLevel(_LOG_LEVEL) - add_stream_handler(LOGGERS[name]) - if log_file is not None: - add_file_handler(LOGGERS[name], log_file) - return LOGGERS[name] +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Sets up the logger to be used for the test modules.""" +import json +import logging +import os + +LOGGERS = {} +_LOG_FORMAT = '%(asctime)s %(name)-8s %(levelname)-7s %(message)s' +_DATE_FORMAT = '%b %02d %H:%M:%S' +_DEFAULT_LEVEL = logging.INFO +_CONF_DIR = 'conf' +_CONF_FILE_NAME = 'system.json' + +# Set log level +try: + with open(os.path.join(_CONF_DIR, _CONF_FILE_NAME), + encoding='UTF-8') as config_json_file: + system_conf_json = json.load(config_json_file) + + log_level_str = system_conf_json['log_level'] + log_level = logging.getLevelName(log_level_str) +except OSError: + # TODO: Print out warning that log level is incorrect or missing + log_level = _DEFAULT_LEVEL + +log_format = logging.Formatter(fmt=_LOG_FORMAT, datefmt=_DATE_FORMAT) + +def add_file_handler(log, log_file, log_dir): + handler = logging.FileHandler(log_dir + log_file + '.log') + handler.setFormatter(log_format) + log.addHandler(handler) + + +def add_stream_handler(log): + handler = logging.StreamHandler() + handler.setFormatter(log_format) + log.addHandler(handler) + + +def get_logger(name, log_file=None, log_dir=None): + if name not in LOGGERS: + LOGGERS[name] = logging.getLogger(name) + LOGGERS[name].setLevel(log_level) + add_stream_handler(LOGGERS[name]) + if log_file is not None and log_dir is not None: + add_file_handler(LOGGERS[name], log_file, log_dir) + return LOGGERS[name] diff --git a/net_orc/python/src/util.py b/framework/python/src/common/util.py similarity index 95% rename from net_orc/python/src/util.py rename to framework/python/src/common/util.py index ba9527996..1ffe70651 100644 --- a/net_orc/python/src/util.py +++ b/framework/python/src/common/util.py @@ -1,55 +1,55 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Provides basic utilities for the network orchestrator.""" -import subprocess -import shlex -import logger -import netifaces - -LOGGER = logger.get_logger('util') - - -def run_command(cmd, output=True): - """Runs a process at the os level - By default, returns the standard output and error output - If the caller sets optional output parameter to False, - will only return a boolean result indicating if it was - succesful in running the command. Failure is indicated - by any return code from the process other than zero.""" - - success = False - process = subprocess.Popen(shlex.split(cmd), - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - stdout, stderr = process.communicate() - - if process.returncode != 0 and output: - err_msg = f'{stderr.strip()}. Code: {process.returncode}' - LOGGER.error('Command Failed: ' + cmd) - LOGGER.error('Error: ' + err_msg) - else: - success = True - if output: - return stdout.strip().decode('utf-8'), stderr - else: - return success - - -def interface_exists(interface): - return interface in netifaces.interfaces() - - -def prettify(mac_string): - return ':'.join([f'{ord(b):02x}' for b in mac_string]) +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Provides basic utilities for the network orchestrator.""" +import subprocess +import shlex +from common import logger +import netifaces + +LOGGER = logger.get_logger('util') + + +def run_command(cmd, output=True): + """Runs a process at the os level + By default, returns the standard output and error output + If the caller sets optional output parameter to False, + will only return a boolean result indicating if it was + succesful in running the command. Failure is indicated + by any return code from the process other than zero.""" + + success = False + process = subprocess.Popen(shlex.split(cmd), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stdout, stderr = process.communicate() + + if process.returncode != 0 and output: + err_msg = f'{stderr.strip()}. Code: {process.returncode}' + LOGGER.error('Command Failed: ' + cmd) + LOGGER.error('Error: ' + err_msg) + else: + success = True + if output: + return stdout.strip().decode('utf-8'), stderr + else: + return success + + +def interface_exists(interface): + return interface in netifaces.interfaces() + + +def prettify(mac_string): + return ':'.join([f'{ord(b):02x}' for b in mac_string]) diff --git a/framework/device.py b/framework/python/src/core/device.py similarity index 91% rename from framework/device.py rename to framework/python/src/core/device.py index 53263e6a6..44f275bdf 100644 --- a/framework/device.py +++ b/framework/python/src/core/device.py @@ -14,7 +14,7 @@ """Track device object information.""" -from network_device import NetworkDevice +from net_orc.network_device import NetworkDevice from dataclasses import dataclass diff --git a/framework/test_runner.py b/framework/python/src/core/test_runner.py similarity index 96% rename from framework/test_runner.py rename to framework/python/src/core/test_runner.py index 0ee5e8416..226f874cc 100644 --- a/framework/test_runner.py +++ b/framework/python/src/core/test_runner.py @@ -23,7 +23,7 @@ import argparse import sys from testrun import TestRun -import logger +from common import logger import signal LOGGER = logger.get_logger("runner") diff --git a/framework/testrun.py b/framework/python/src/core/testrun.py similarity index 85% rename from framework/testrun.py rename to framework/python/src/core/testrun.py index 25232f90c..e59b7cda2 100644 --- a/framework/testrun.py +++ b/framework/python/src/core/testrun.py @@ -25,25 +25,18 @@ import json import signal import time -import logger +from common import logger # Locate parent directory current_dir = os.path.dirname(os.path.realpath(__file__)) -parent_dir = os.path.dirname(current_dir) -# Add net_orc to Python path -net_orc_dir = os.path.join(parent_dir, 'net_orc', 'python', 'src') -sys.path.append(net_orc_dir) +# Locate the test-run root directory, 4 levels, src->python->framework->test-run +root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(current_dir)))) -# Add test_orc to Python path -test_orc_dir = os.path.join(parent_dir, 'test_orc', 'python', 'src') -sys.path.append(test_orc_dir) - -from listener import NetworkEvent # pylint: disable=wrong-import-position,import-outside-toplevel -import test_orchestrator as test_orc # pylint: disable=wrong-import-position,import-outside-toplevel -import network_orchestrator as net_orc # pylint: disable=wrong-import-position,import-outside-toplevel - -from device import Device # pylint: disable=wrong-import-position,import-outside-toplevel +from net_orc.listener import NetworkEvent +from test_orc import test_orchestrator as test_orc +from net_orc import network_orchestrator as net_orc +from device import Device LOGGER = logger.get_logger('test_run') CONFIG_FILE = 'conf/system.json' @@ -58,7 +51,6 @@ DEVICE_MAC_ADDR = 'mac_addr' DEVICE_TEST_MODULES = 'test_modules' - class TestRun: # pylint: disable=too-few-public-methods """Test Run controller. @@ -142,7 +134,7 @@ def _exit_handler(self, signum, arg): # pylint: disable=unused-argument def _get_config_abs(self, config_file=None): if config_file is None: # If not defined, use relative pathing to local file - config_file = os.path.join(parent_dir, CONFIG_FILE) + config_file = os.path.join(root_dir, CONFIG_FILE) # Expand the config file to absolute pathing return os.path.abspath(config_file) diff --git a/net_orc/python/src/listener.py b/framework/python/src/net_orc/listener.py similarity index 97% rename from net_orc/python/src/listener.py rename to framework/python/src/net_orc/listener.py index 0bbd2b1c9..4f8e1961f 100644 --- a/net_orc/python/src/listener.py +++ b/framework/python/src/net_orc/listener.py @@ -16,8 +16,8 @@ under test.""" import threading from scapy.all import AsyncSniffer, DHCP, get_if_hwaddr -import logger -from network_event import NetworkEvent +from net_orc.network_event import NetworkEvent +from common import logger LOGGER = logger.get_logger('listener') diff --git a/net_orc/python/src/network_device.py b/framework/python/src/net_orc/network_device.py similarity index 100% rename from net_orc/python/src/network_device.py rename to framework/python/src/net_orc/network_device.py diff --git a/net_orc/python/src/network_event.py b/framework/python/src/net_orc/network_event.py similarity index 100% rename from net_orc/python/src/network_event.py rename to framework/python/src/net_orc/network_event.py diff --git a/net_orc/python/src/network_orchestrator.py b/framework/python/src/net_orc/network_orchestrator.py similarity index 95% rename from net_orc/python/src/network_orchestrator.py rename to framework/python/src/net_orc/network_orchestrator.py index f53b17d15..805bdcd79 100644 --- a/net_orc/python/src/network_orchestrator.py +++ b/framework/python/src/net_orc/network_orchestrator.py @@ -26,13 +26,13 @@ import threading import docker from docker.types import Mount -import logger -import util -from listener import Listener -from network_device import NetworkDevice -from network_event import NetworkEvent -from network_validator import NetworkValidator -from ovs_control import OVSControl +from common import logger +from common import util +from net_orc.listener import Listener +from net_orc.network_device import NetworkDevice +from net_orc.network_event import NetworkEvent +from net_orc.network_validator import NetworkValidator +from net_orc.ovs_control import OVSControl LOGGER = logger.get_logger('net_orc') CONFIG_FILE = 'conf/system.json' @@ -41,7 +41,8 @@ TEST_DIR = 'test' MONITOR_PCAP = 'monitor.pcap' NET_DIR = 'runtime/network' -NETWORK_MODULES_DIR = 'network/modules' +#NETWORK_MODULES_DIR = 'network/modules' +NETWORK_MODULES_DIR = 'modules/network' NETWORK_MODULE_METADATA = 'conf/module_config.json' DEVICE_BRIDGE = 'tr-d' INTERNET_BRIDGE = 'tr-c' @@ -81,8 +82,9 @@ def __init__(self, self.validate = validate self.async_monitor = async_monitor - self._path = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) + self._path = os.path.dirname(os.path.dirname( + os.path.dirname( + os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))) self.validator = NetworkValidator() shutil.rmtree(os.path.join(os.getcwd(), NET_DIR), ignore_errors=True) diff --git a/net_orc/python/src/network_validator.py b/framework/python/src/net_orc/network_validator.py similarity index 94% rename from net_orc/python/src/network_validator.py rename to framework/python/src/net_orc/network_validator.py index 832a154e3..5f9d132b4 100644 --- a/net_orc/python/src/network_validator.py +++ b/framework/python/src/net_orc/network_validator.py @@ -20,12 +20,12 @@ import docker from docker.types import Mount import getpass -import logger -import util +from common import logger +from common import util LOGGER = logger.get_logger('validator') OUTPUT_DIR = 'runtime/validation' -DEVICES_DIR = 'network/devices' +DEVICES_DIR = 'modules/devices' DEVICE_METADATA = 'conf/module_config.json' DEVICE_BRIDGE = 'tr-d' CONF_DIR = 'conf' @@ -38,8 +38,9 @@ class NetworkValidator: def __init__(self): self._net_devices = [] - self._path = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) + self._path = os.path.dirname(os.path.dirname( + os.path.dirname( + os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))) self._device_dir = os.path.join(self._path, DEVICES_DIR) @@ -85,12 +86,13 @@ def _build_device(self, net_device): def _load_devices(self): - LOGGER.info(f'Loading validators from {DEVICES_DIR}') + LOGGER.info(f'Loading validators from {self._device_dir}') loaded_devices = 'Loaded the following validators: ' for module_dir in os.listdir(self._device_dir): + LOGGER.info("Module Dir: " + module_dir) device = FauxDevice() # Load basic module information diff --git a/net_orc/python/src/ovs_control.py b/framework/python/src/net_orc/ovs_control.py similarity index 95% rename from net_orc/python/src/ovs_control.py rename to framework/python/src/net_orc/ovs_control.py index ce316dba7..3c950d4af 100644 --- a/net_orc/python/src/ovs_control.py +++ b/framework/python/src/net_orc/ovs_control.py @@ -14,9 +14,9 @@ """OVS Control Module""" import json -import logger -import util import os +from common import logger +from common import util CONFIG_FILE = 'conf/system.json' DEVICE_BRIDGE = 'tr-d' @@ -146,9 +146,9 @@ def delete_bridge(self, bridge_name): return success def _load_config(self): - path = os.path.dirname( - os.path.dirname( - os.path.dirname(os.path.dirname(os.path.realpath(__file__))))) + path = os.path.dirname(os.path.dirname( + os.path.dirname( + os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))) config_file = os.path.join(path, CONFIG_FILE) LOGGER.debug('Loading configuration: ' + config_file) with open(config_file, 'r', encoding='utf-8') as conf_file: diff --git a/test_orc/python/src/module.py b/framework/python/src/test_orc/module.py similarity index 100% rename from test_orc/python/src/module.py rename to framework/python/src/test_orc/module.py diff --git a/test_orc/python/src/runner.py b/framework/python/src/test_orc/runner.py similarity index 100% rename from test_orc/python/src/runner.py rename to framework/python/src/test_orc/runner.py diff --git a/test_orc/python/src/test_orchestrator.py b/framework/python/src/test_orc/test_orchestrator.py similarity index 93% rename from test_orc/python/src/test_orchestrator.py rename to framework/python/src/test_orc/test_orchestrator.py index 9f0f100ab..4c8a559fa 100644 --- a/test_orc/python/src/test_orchestrator.py +++ b/framework/python/src/test_orc/test_orchestrator.py @@ -20,14 +20,14 @@ import shutil import docker from docker.types import Mount -import logger -from module import TestModule -import util +from common import logger +from test_orc.module import TestModule +from common import util LOG_NAME = "test_orc" LOGGER = logger.get_logger("test_orc") RUNTIME_DIR = "runtime/test" -TEST_MODULES_DIR = "modules" +TEST_MODULES_DIR = "modules/test" MODULE_CONFIG = "conf/module_config.json" @@ -40,11 +40,17 @@ def __init__(self, net_orc): self._net_orc = net_orc self._test_in_progress = False - self._path = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) + self._path = os.path.dirname(os.path.dirname( + os.path.dirname( + os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))) # Resolve the path to the test-run folder - self._root_path = os.path.abspath(os.path.join(self._path, os.pardir)) + #self._root_path = os.path.abspath(os.path.join(self._path, os.pardir)) + + + self._root_path = os.path.dirname(os.path.dirname( + os.path.dirname( + os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))) shutil.rmtree(os.path.join(self._root_path, RUNTIME_DIR), ignore_errors=True) diff --git a/framework/requirements.txt b/framework/requirements.txt index ca56948f4..03eab9796 100644 --- a/framework/requirements.txt +++ b/framework/requirements.txt @@ -1 +1,8 @@ -requests<2.29.0 \ No newline at end of file +# Requirements for the core module +requests<2.29.0 + +# Requirements for the net_orc module +docker +ipaddress +netifaces +scapy \ No newline at end of file diff --git a/net_orc/network/devices/faux-dev/bin/get_default_gateway b/modules/devices/faux-dev/bin/get_default_gateway similarity index 100% rename from net_orc/network/devices/faux-dev/bin/get_default_gateway rename to modules/devices/faux-dev/bin/get_default_gateway diff --git a/net_orc/network/devices/faux-dev/bin/start_dhcp_client b/modules/devices/faux-dev/bin/start_dhcp_client similarity index 100% rename from net_orc/network/devices/faux-dev/bin/start_dhcp_client rename to modules/devices/faux-dev/bin/start_dhcp_client diff --git a/net_orc/network/devices/faux-dev/bin/start_network_service b/modules/devices/faux-dev/bin/start_network_service similarity index 100% rename from net_orc/network/devices/faux-dev/bin/start_network_service rename to modules/devices/faux-dev/bin/start_network_service diff --git a/net_orc/network/devices/faux-dev/conf/module_config.json b/modules/devices/faux-dev/conf/module_config.json similarity index 100% rename from net_orc/network/devices/faux-dev/conf/module_config.json rename to modules/devices/faux-dev/conf/module_config.json diff --git a/net_orc/network/devices/faux-dev/faux-dev.Dockerfile b/modules/devices/faux-dev/faux-dev.Dockerfile similarity index 65% rename from net_orc/network/devices/faux-dev/faux-dev.Dockerfile rename to modules/devices/faux-dev/faux-dev.Dockerfile index 1686341b5..0a4f02f38 100644 --- a/net_orc/network/devices/faux-dev/faux-dev.Dockerfile +++ b/modules/devices/faux-dev/faux-dev.Dockerfile @@ -1,6 +1,9 @@ # Image name: test-run/faux-dev FROM test-run/base:latest +ARG MODULE_NAME=faux-dev +ARG MODULE_DIR=modules/devices/$MODULE_NAME + #Update and get all additional requirements not contained in the base image RUN apt-get update --fix-missing @@ -11,10 +14,10 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get install -y isc-dhcp-client ntp ntpdate # Copy over all configuration files -COPY network/devices/faux-dev/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf -# Load device binary files -COPY network/devices/faux-dev/bin /testrun/bin +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin # Copy over all python files -COPY network/devices/faux-dev/python /testrun/python \ No newline at end of file +COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/net_orc/network/devices/faux-dev/python/src/dhcp_check.py b/modules/devices/faux-dev/python/src/dhcp_check.py similarity index 100% rename from net_orc/network/devices/faux-dev/python/src/dhcp_check.py rename to modules/devices/faux-dev/python/src/dhcp_check.py diff --git a/net_orc/network/devices/faux-dev/python/src/dns_check.py b/modules/devices/faux-dev/python/src/dns_check.py similarity index 100% rename from net_orc/network/devices/faux-dev/python/src/dns_check.py rename to modules/devices/faux-dev/python/src/dns_check.py diff --git a/net_orc/network/devices/faux-dev/python/src/gateway_check.py b/modules/devices/faux-dev/python/src/gateway_check.py similarity index 100% rename from net_orc/network/devices/faux-dev/python/src/gateway_check.py rename to modules/devices/faux-dev/python/src/gateway_check.py diff --git a/net_orc/network/devices/faux-dev/python/src/logger.py b/modules/devices/faux-dev/python/src/logger.py similarity index 100% rename from net_orc/network/devices/faux-dev/python/src/logger.py rename to modules/devices/faux-dev/python/src/logger.py diff --git a/net_orc/network/devices/faux-dev/python/src/ntp_check.py b/modules/devices/faux-dev/python/src/ntp_check.py similarity index 100% rename from net_orc/network/devices/faux-dev/python/src/ntp_check.py rename to modules/devices/faux-dev/python/src/ntp_check.py diff --git a/net_orc/network/devices/faux-dev/python/src/run.py b/modules/devices/faux-dev/python/src/run.py similarity index 100% rename from net_orc/network/devices/faux-dev/python/src/run.py rename to modules/devices/faux-dev/python/src/run.py diff --git a/net_orc/network/devices/faux-dev/python/src/util.py b/modules/devices/faux-dev/python/src/util.py similarity index 100% rename from net_orc/network/devices/faux-dev/python/src/util.py rename to modules/devices/faux-dev/python/src/util.py diff --git a/net_orc/network/modules/base/base.Dockerfile b/modules/network/base/base.Dockerfile similarity index 100% rename from net_orc/network/modules/base/base.Dockerfile rename to modules/network/base/base.Dockerfile diff --git a/net_orc/network/modules/base/bin/capture b/modules/network/base/bin/capture similarity index 100% rename from net_orc/network/modules/base/bin/capture rename to modules/network/base/bin/capture diff --git a/net_orc/network/modules/base/bin/setup_binaries b/modules/network/base/bin/setup_binaries similarity index 100% rename from net_orc/network/modules/base/bin/setup_binaries rename to modules/network/base/bin/setup_binaries diff --git a/net_orc/network/modules/base/bin/start_grpc b/modules/network/base/bin/start_grpc similarity index 100% rename from net_orc/network/modules/base/bin/start_grpc rename to modules/network/base/bin/start_grpc diff --git a/net_orc/network/modules/base/bin/start_module b/modules/network/base/bin/start_module similarity index 100% rename from net_orc/network/modules/base/bin/start_module rename to modules/network/base/bin/start_module diff --git a/net_orc/network/modules/base/bin/start_network_service b/modules/network/base/bin/start_network_service similarity index 100% rename from net_orc/network/modules/base/bin/start_network_service rename to modules/network/base/bin/start_network_service diff --git a/net_orc/network/modules/base/bin/wait_for_interface b/modules/network/base/bin/wait_for_interface similarity index 100% rename from net_orc/network/modules/base/bin/wait_for_interface rename to modules/network/base/bin/wait_for_interface diff --git a/net_orc/network/modules/base/conf/module_config.json b/modules/network/base/conf/module_config.json similarity index 100% rename from net_orc/network/modules/base/conf/module_config.json rename to modules/network/base/conf/module_config.json diff --git a/net_orc/network/modules/base/python/requirements.txt b/modules/network/base/python/requirements.txt similarity index 100% rename from net_orc/network/modules/base/python/requirements.txt rename to modules/network/base/python/requirements.txt diff --git a/net_orc/network/modules/base/python/src/grpc/start_server.py b/modules/network/base/python/src/grpc/start_server.py similarity index 100% rename from net_orc/network/modules/base/python/src/grpc/start_server.py rename to modules/network/base/python/src/grpc/start_server.py diff --git a/net_orc/network/modules/base/python/src/logger.py b/modules/network/base/python/src/logger.py similarity index 100% rename from net_orc/network/modules/base/python/src/logger.py rename to modules/network/base/python/src/logger.py diff --git a/net_orc/network/modules/dhcp-1/bin/start_network_service b/modules/network/dhcp-1/bin/start_network_service similarity index 100% rename from net_orc/network/modules/dhcp-1/bin/start_network_service rename to modules/network/dhcp-1/bin/start_network_service diff --git a/net_orc/network/modules/dhcp-1/conf/dhcpd.conf b/modules/network/dhcp-1/conf/dhcpd.conf similarity index 100% rename from net_orc/network/modules/dhcp-1/conf/dhcpd.conf rename to modules/network/dhcp-1/conf/dhcpd.conf diff --git a/net_orc/network/modules/dhcp-1/conf/module_config.json b/modules/network/dhcp-1/conf/module_config.json similarity index 100% rename from net_orc/network/modules/dhcp-1/conf/module_config.json rename to modules/network/dhcp-1/conf/module_config.json diff --git a/net_orc/network/modules/dhcp-1/conf/radvd.conf b/modules/network/dhcp-1/conf/radvd.conf similarity index 100% rename from net_orc/network/modules/dhcp-1/conf/radvd.conf rename to modules/network/dhcp-1/conf/radvd.conf diff --git a/net_orc/network/modules/dhcp-2/dhcp-2.Dockerfile b/modules/network/dhcp-1/dhcp-1.Dockerfile similarity index 56% rename from net_orc/network/modules/dhcp-2/dhcp-2.Dockerfile rename to modules/network/dhcp-1/dhcp-1.Dockerfile index 989992570..766f18c57 100644 --- a/net_orc/network/modules/dhcp-2/dhcp-2.Dockerfile +++ b/modules/network/dhcp-1/dhcp-1.Dockerfile @@ -1,14 +1,17 @@ # Image name: test-run/dhcp-primary FROM test-run/base:latest +ARG MODULE_NAME=dhcp-1 +ARG MODULE_DIR=modules/network/$MODULE_NAME + # Install dhcp server RUN apt-get install -y isc-dhcp-server radvd # Copy over all configuration files -COPY network/modules/dhcp-2/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files -COPY network/modules/dhcp-2/bin /testrun/bin +COPY $MODULE_DIR/bin /testrun/bin # Copy over all python files -COPY network/modules/dhcp-2/python /testrun/python +COPY $MODULE_DIR/python /testrun/python diff --git a/net_orc/network/modules/dhcp-1/python/src/grpc/__init__.py b/modules/network/dhcp-1/python/src/grpc/__init__.py similarity index 100% rename from net_orc/network/modules/dhcp-1/python/src/grpc/__init__.py rename to modules/network/dhcp-1/python/src/grpc/__init__.py diff --git a/net_orc/network/modules/dhcp-1/python/src/grpc/dhcp_config.py b/modules/network/dhcp-1/python/src/grpc/dhcp_config.py similarity index 100% rename from net_orc/network/modules/dhcp-1/python/src/grpc/dhcp_config.py rename to modules/network/dhcp-1/python/src/grpc/dhcp_config.py diff --git a/net_orc/network/modules/dhcp-1/python/src/grpc/network_service.py b/modules/network/dhcp-1/python/src/grpc/network_service.py similarity index 100% rename from net_orc/network/modules/dhcp-1/python/src/grpc/network_service.py rename to modules/network/dhcp-1/python/src/grpc/network_service.py diff --git a/net_orc/network/modules/dhcp-1/python/src/grpc/proto/grpc.proto b/modules/network/dhcp-1/python/src/grpc/proto/grpc.proto similarity index 100% rename from net_orc/network/modules/dhcp-1/python/src/grpc/proto/grpc.proto rename to modules/network/dhcp-1/python/src/grpc/proto/grpc.proto diff --git a/net_orc/network/modules/dhcp-2/bin/start_network_service b/modules/network/dhcp-2/bin/start_network_service similarity index 100% rename from net_orc/network/modules/dhcp-2/bin/start_network_service rename to modules/network/dhcp-2/bin/start_network_service diff --git a/net_orc/network/modules/dhcp-2/conf/dhcpd.conf b/modules/network/dhcp-2/conf/dhcpd.conf similarity index 100% rename from net_orc/network/modules/dhcp-2/conf/dhcpd.conf rename to modules/network/dhcp-2/conf/dhcpd.conf diff --git a/net_orc/network/modules/dhcp-2/conf/module_config.json b/modules/network/dhcp-2/conf/module_config.json similarity index 100% rename from net_orc/network/modules/dhcp-2/conf/module_config.json rename to modules/network/dhcp-2/conf/module_config.json diff --git a/net_orc/network/modules/dhcp-2/conf/radvd.conf b/modules/network/dhcp-2/conf/radvd.conf similarity index 100% rename from net_orc/network/modules/dhcp-2/conf/radvd.conf rename to modules/network/dhcp-2/conf/radvd.conf diff --git a/net_orc/network/modules/dhcp-1/dhcp-1.Dockerfile b/modules/network/dhcp-2/dhcp-2.Dockerfile similarity index 55% rename from net_orc/network/modules/dhcp-1/dhcp-1.Dockerfile rename to modules/network/dhcp-2/dhcp-2.Dockerfile index 99804e0e3..231d0c558 100644 --- a/net_orc/network/modules/dhcp-1/dhcp-1.Dockerfile +++ b/modules/network/dhcp-2/dhcp-2.Dockerfile @@ -1,14 +1,18 @@ # Image name: test-run/dhcp-primary FROM test-run/base:latest +ARG MODULE_NAME=dhcp-2 +ARG MODULE_DIR=modules/network/$MODULE_NAME + # Install dhcp server RUN apt-get install -y isc-dhcp-server radvd # Copy over all configuration files -COPY network/modules/dhcp-1/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files -COPY network/modules/dhcp-1/bin /testrun/bin - +COPY $MODULE_DIR/bin /testrun/bin + # Copy over all python files -COPY network/modules/dhcp-1/python /testrun/python +COPY $MODULE_DIR/python /testrun/python + diff --git a/net_orc/network/modules/dhcp-2/python/src/grpc/__init__.py b/modules/network/dhcp-2/python/src/grpc/__init__.py similarity index 100% rename from net_orc/network/modules/dhcp-2/python/src/grpc/__init__.py rename to modules/network/dhcp-2/python/src/grpc/__init__.py diff --git a/net_orc/network/modules/dhcp-2/python/src/grpc/dhcp_config.py b/modules/network/dhcp-2/python/src/grpc/dhcp_config.py similarity index 100% rename from net_orc/network/modules/dhcp-2/python/src/grpc/dhcp_config.py rename to modules/network/dhcp-2/python/src/grpc/dhcp_config.py diff --git a/net_orc/network/modules/dhcp-2/python/src/grpc/network_service.py b/modules/network/dhcp-2/python/src/grpc/network_service.py similarity index 100% rename from net_orc/network/modules/dhcp-2/python/src/grpc/network_service.py rename to modules/network/dhcp-2/python/src/grpc/network_service.py diff --git a/net_orc/network/modules/dhcp-2/python/src/grpc/proto/grpc.proto b/modules/network/dhcp-2/python/src/grpc/proto/grpc.proto similarity index 100% rename from net_orc/network/modules/dhcp-2/python/src/grpc/proto/grpc.proto rename to modules/network/dhcp-2/python/src/grpc/proto/grpc.proto diff --git a/net_orc/network/modules/dns/bin/start_network_service b/modules/network/dns/bin/start_network_service similarity index 100% rename from net_orc/network/modules/dns/bin/start_network_service rename to modules/network/dns/bin/start_network_service diff --git a/net_orc/network/modules/dns/conf/dnsmasq.conf b/modules/network/dns/conf/dnsmasq.conf similarity index 100% rename from net_orc/network/modules/dns/conf/dnsmasq.conf rename to modules/network/dns/conf/dnsmasq.conf diff --git a/net_orc/network/modules/dns/conf/module_config.json b/modules/network/dns/conf/module_config.json similarity index 100% rename from net_orc/network/modules/dns/conf/module_config.json rename to modules/network/dns/conf/module_config.json diff --git a/net_orc/network/modules/dns/dns.Dockerfile b/modules/network/dns/dns.Dockerfile similarity index 67% rename from net_orc/network/modules/dns/dns.Dockerfile rename to modules/network/dns/dns.Dockerfile index 84c1c7eb1..edfd4dd03 100644 --- a/net_orc/network/modules/dns/dns.Dockerfile +++ b/modules/network/dns/dns.Dockerfile @@ -1,6 +1,9 @@ # Image name: test-run/dns FROM test-run/base:latest +ARG MODULE_NAME=dns +ARG MODULE_DIR=modules/network/$MODULE_NAME + #Update and get all additional requirements not contained in the base image RUN apt-get update --fix-missing @@ -8,7 +11,7 @@ RUN apt-get update --fix-missing RUN apt-get install -y dnsmasq # Copy over all configuration files -COPY network/modules/dns/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files -COPY network/modules/dns/bin /testrun/bin +COPY $MODULE_DIR/bin /testrun/bin diff --git a/net_orc/network/modules/gateway/bin/start_network_service b/modules/network/gateway/bin/start_network_service similarity index 100% rename from net_orc/network/modules/gateway/bin/start_network_service rename to modules/network/gateway/bin/start_network_service diff --git a/net_orc/network/modules/gateway/conf/module_config.json b/modules/network/gateway/conf/module_config.json similarity index 100% rename from net_orc/network/modules/gateway/conf/module_config.json rename to modules/network/gateway/conf/module_config.json diff --git a/net_orc/network/modules/gateway/gateway.Dockerfile b/modules/network/gateway/gateway.Dockerfile similarity index 59% rename from net_orc/network/modules/gateway/gateway.Dockerfile rename to modules/network/gateway/gateway.Dockerfile index b7085ebac..9bfa77dae 100644 --- a/net_orc/network/modules/gateway/gateway.Dockerfile +++ b/modules/network/gateway/gateway.Dockerfile @@ -1,11 +1,14 @@ # Image name: test-run/gateway FROM test-run/base:latest +ARG MODULE_NAME=gateway +ARG MODULE_DIR=modules/network/$MODULE_NAME + # Install required packages RUN apt-get install -y iptables isc-dhcp-client # Copy over all configuration files -COPY network/modules/gateway/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files -COPY network/modules/gateway/bin /testrun/bin +COPY $MODULE_DIR/bin /testrun/bin diff --git a/net_orc/network/modules/ntp/bin/start_network_service b/modules/network/ntp/bin/start_network_service similarity index 100% rename from net_orc/network/modules/ntp/bin/start_network_service rename to modules/network/ntp/bin/start_network_service diff --git a/net_orc/network/modules/ntp/conf/module_config.json b/modules/network/ntp/conf/module_config.json similarity index 100% rename from net_orc/network/modules/ntp/conf/module_config.json rename to modules/network/ntp/conf/module_config.json diff --git a/modules/network/ntp/ntp.Dockerfile b/modules/network/ntp/ntp.Dockerfile new file mode 100644 index 000000000..1add3178e --- /dev/null +++ b/modules/network/ntp/ntp.Dockerfile @@ -0,0 +1,16 @@ +# Image name: test-run/ntp +FROM test-run/base:latest + +ARG MODULE_NAME=ntp +ARG MODULE_DIR=modules/network/$MODULE_NAME + +# Copy over all configuration files +COPY $MODULE_DIR/conf /testrun/conf + +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin + +# Copy over all python files +COPY $MODULE_DIR/python /testrun/python + +EXPOSE 123/udp diff --git a/net_orc/network/modules/ntp/python/src/ntp_server.py b/modules/network/ntp/python/src/ntp_server.py similarity index 100% rename from net_orc/network/modules/ntp/python/src/ntp_server.py rename to modules/network/ntp/python/src/ntp_server.py diff --git a/net_orc/network/modules/radius/bin/start_network_service b/modules/network/radius/bin/start_network_service similarity index 100% rename from net_orc/network/modules/radius/bin/start_network_service rename to modules/network/radius/bin/start_network_service diff --git a/net_orc/network/modules/radius/conf/ca.crt b/modules/network/radius/conf/ca.crt similarity index 100% rename from net_orc/network/modules/radius/conf/ca.crt rename to modules/network/radius/conf/ca.crt diff --git a/net_orc/network/modules/radius/conf/eap b/modules/network/radius/conf/eap similarity index 100% rename from net_orc/network/modules/radius/conf/eap rename to modules/network/radius/conf/eap diff --git a/net_orc/network/modules/radius/conf/module_config.json b/modules/network/radius/conf/module_config.json similarity index 100% rename from net_orc/network/modules/radius/conf/module_config.json rename to modules/network/radius/conf/module_config.json diff --git a/net_orc/network/modules/radius/python/requirements.txt b/modules/network/radius/python/requirements.txt similarity index 100% rename from net_orc/network/modules/radius/python/requirements.txt rename to modules/network/radius/python/requirements.txt diff --git a/net_orc/network/modules/radius/python/src/authenticator.py b/modules/network/radius/python/src/authenticator.py similarity index 100% rename from net_orc/network/modules/radius/python/src/authenticator.py rename to modules/network/radius/python/src/authenticator.py diff --git a/net_orc/network/modules/radius/radius.Dockerfile b/modules/network/radius/radius.Dockerfile similarity index 74% rename from net_orc/network/modules/radius/radius.Dockerfile rename to modules/network/radius/radius.Dockerfile index a72313826..c44c5f0cc 100644 --- a/net_orc/network/modules/radius/radius.Dockerfile +++ b/modules/network/radius/radius.Dockerfile @@ -1,6 +1,9 @@ # Image name: test-run/radius FROM test-run/base:latest +ARG MODULE_NAME=radius +ARG MODULE_DIR=modules/network/$MODULE_NAME + # Install radius and git RUN apt-get update && apt-get install -y openssl freeradius git @@ -14,13 +17,13 @@ EXPOSE 1812/udp EXPOSE 1813/udp # Copy over all configuration files -COPY network/modules/radius/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf # Copy over all binary files -COPY network/modules/radius/bin /testrun/bin +COPY $MODULE_DIR/bin /testrun/bin # Copy over all python files -COPY network/modules/radius/python /testrun/python +COPY $MODULE_DIR/python /testrun/python # Install all python requirements for the module RUN pip3 install -r /testrun/python/requirements.txt \ No newline at end of file diff --git a/net_orc/network/modules/template/bin/start_network_service b/modules/network/template/bin/start_network_service similarity index 100% rename from net_orc/network/modules/template/bin/start_network_service rename to modules/network/template/bin/start_network_service diff --git a/net_orc/network/modules/template/conf/module_config.json b/modules/network/template/conf/module_config.json similarity index 100% rename from net_orc/network/modules/template/conf/module_config.json rename to modules/network/template/conf/module_config.json diff --git a/net_orc/network/modules/template/python/src/template_main.py b/modules/network/template/python/src/template_main.py similarity index 100% rename from net_orc/network/modules/template/python/src/template_main.py rename to modules/network/template/python/src/template_main.py diff --git a/net_orc/network/modules/template/template.Dockerfile b/modules/network/template/template.Dockerfile similarity index 100% rename from net_orc/network/modules/template/template.Dockerfile rename to modules/network/template/template.Dockerfile diff --git a/test_orc/modules/base/base.Dockerfile b/modules/test/base/base.Dockerfile similarity index 74% rename from test_orc/modules/base/base.Dockerfile rename to modules/test/base/base.Dockerfile index a508caef7..b8398eae9 100644 --- a/test_orc/modules/base/base.Dockerfile +++ b/modules/test/base/base.Dockerfile @@ -1,17 +1,20 @@ # Image name: test-run/base-test FROM ubuntu:jammy +ARG MODULE_NAME=base +ARG MODULE_DIR=modules/test/$MODULE_NAME + # Install common software RUN apt-get update && apt-get install -y net-tools iputils-ping tcpdump iproute2 jq python3 python3-pip dos2unix nmap --fix-missing # Setup the base python requirements -COPY modules/base/python /testrun/python +COPY $MODULE_DIR/python /testrun/python # Install all python requirements for the module RUN pip3 install -r /testrun/python/requirements.txt -# Add the bin files -COPY modules/base/bin /testrun/bin +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin # Remove incorrect line endings RUN dos2unix /testrun/bin/* diff --git a/test_orc/modules/base/bin/capture b/modules/test/base/bin/capture similarity index 100% rename from test_orc/modules/base/bin/capture rename to modules/test/base/bin/capture diff --git a/test_orc/modules/base/bin/get_ipv4_addr b/modules/test/base/bin/get_ipv4_addr similarity index 100% rename from test_orc/modules/base/bin/get_ipv4_addr rename to modules/test/base/bin/get_ipv4_addr diff --git a/test_orc/modules/base/bin/setup_binaries b/modules/test/base/bin/setup_binaries similarity index 100% rename from test_orc/modules/base/bin/setup_binaries rename to modules/test/base/bin/setup_binaries diff --git a/test_orc/modules/base/bin/start_grpc b/modules/test/base/bin/start_grpc similarity index 100% rename from test_orc/modules/base/bin/start_grpc rename to modules/test/base/bin/start_grpc diff --git a/test_orc/modules/base/bin/start_module b/modules/test/base/bin/start_module similarity index 100% rename from test_orc/modules/base/bin/start_module rename to modules/test/base/bin/start_module diff --git a/test_orc/modules/base/bin/wait_for_interface b/modules/test/base/bin/wait_for_interface similarity index 100% rename from test_orc/modules/base/bin/wait_for_interface rename to modules/test/base/bin/wait_for_interface diff --git a/test_orc/modules/base/conf/module_config.json b/modules/test/base/conf/module_config.json similarity index 100% rename from test_orc/modules/base/conf/module_config.json rename to modules/test/base/conf/module_config.json diff --git a/test_orc/modules/base/python/requirements.txt b/modules/test/base/python/requirements.txt similarity index 100% rename from test_orc/modules/base/python/requirements.txt rename to modules/test/base/python/requirements.txt diff --git a/test_orc/modules/base/python/src/grpc/start_server.py b/modules/test/base/python/src/grpc/start_server.py similarity index 100% rename from test_orc/modules/base/python/src/grpc/start_server.py rename to modules/test/base/python/src/grpc/start_server.py diff --git a/test_orc/modules/base/python/src/logger.py b/modules/test/base/python/src/logger.py similarity index 100% rename from test_orc/modules/base/python/src/logger.py rename to modules/test/base/python/src/logger.py diff --git a/test_orc/modules/base/python/src/test_module.py b/modules/test/base/python/src/test_module.py similarity index 100% rename from test_orc/modules/base/python/src/test_module.py rename to modules/test/base/python/src/test_module.py diff --git a/test_orc/modules/base/python/src/util.py b/modules/test/base/python/src/util.py similarity index 100% rename from test_orc/modules/base/python/src/util.py rename to modules/test/base/python/src/util.py diff --git a/modules/test/baseline/baseline.Dockerfile b/modules/test/baseline/baseline.Dockerfile new file mode 100644 index 000000000..c2b32e7b7 --- /dev/null +++ b/modules/test/baseline/baseline.Dockerfile @@ -0,0 +1,14 @@ +# Image name: test-run/baseline-test +FROM test-run/base-test:latest + +ARG MODULE_NAME=baseline +ARG MODULE_DIR=modules/test/$MODULE_NAME + +# Copy over all configuration files +COPY $MODULE_DIR/conf /testrun/conf + +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin + +# Copy over all python files +COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/test_orc/modules/baseline/bin/start_test_module b/modules/test/baseline/bin/start_test_module similarity index 100% rename from test_orc/modules/baseline/bin/start_test_module rename to modules/test/baseline/bin/start_test_module diff --git a/test_orc/modules/baseline/conf/module_config.json b/modules/test/baseline/conf/module_config.json similarity index 100% rename from test_orc/modules/baseline/conf/module_config.json rename to modules/test/baseline/conf/module_config.json diff --git a/test_orc/modules/baseline/python/src/baseline_module.py b/modules/test/baseline/python/src/baseline_module.py similarity index 100% rename from test_orc/modules/baseline/python/src/baseline_module.py rename to modules/test/baseline/python/src/baseline_module.py diff --git a/test_orc/modules/baseline/python/src/run.py b/modules/test/baseline/python/src/run.py similarity index 100% rename from test_orc/modules/baseline/python/src/run.py rename to modules/test/baseline/python/src/run.py diff --git a/test_orc/modules/conn/bin/start_test_module b/modules/test/conn/bin/start_test_module similarity index 100% rename from test_orc/modules/conn/bin/start_test_module rename to modules/test/conn/bin/start_test_module diff --git a/test_orc/modules/conn/conf/module_config.json b/modules/test/conn/conf/module_config.json similarity index 100% rename from test_orc/modules/conn/conf/module_config.json rename to modules/test/conn/conf/module_config.json diff --git a/test_orc/modules/conn/conn.Dockerfile b/modules/test/conn/conn.Dockerfile similarity index 59% rename from test_orc/modules/conn/conn.Dockerfile rename to modules/test/conn/conn.Dockerfile index cf25d0f02..2526b0046 100644 --- a/test_orc/modules/conn/conn.Dockerfile +++ b/modules/test/conn/conn.Dockerfile @@ -1,6 +1,9 @@ # Image name: test-run/conn-test FROM test-run/base-test:latest +ARG MODULE_NAME=conn +ARG MODULE_DIR=modules/test/$MODULE_NAME + # Install all necessary packages RUN apt-get install -y wget @@ -8,16 +11,16 @@ RUN apt-get install -y wget RUN wget http://standards-oui.ieee.org/oui.txt -P /usr/local/etc/ #Load the requirements file -COPY modules/conn/python/requirements.txt /testrun/python +COPY $MODULE_DIR/python/requirements.txt /testrun/python #Install all python requirements for the module RUN pip3 install -r /testrun/python/requirements.txt # Copy over all configuration files -COPY modules/conn/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf -# Load device binary files -COPY modules/conn/bin /testrun/bin +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin # Copy over all python files -COPY modules/conn/python /testrun/python +COPY $MODULE_DIR/python /testrun/python diff --git a/test_orc/modules/conn/python/requirements.txt b/modules/test/conn/python/requirements.txt similarity index 100% rename from test_orc/modules/conn/python/requirements.txt rename to modules/test/conn/python/requirements.txt diff --git a/test_orc/modules/conn/python/src/connection_module.py b/modules/test/conn/python/src/connection_module.py similarity index 100% rename from test_orc/modules/conn/python/src/connection_module.py rename to modules/test/conn/python/src/connection_module.py diff --git a/test_orc/modules/conn/python/src/run.py b/modules/test/conn/python/src/run.py similarity index 100% rename from test_orc/modules/conn/python/src/run.py rename to modules/test/conn/python/src/run.py diff --git a/test_orc/modules/dns/bin/start_test_module b/modules/test/dns/bin/start_test_module similarity index 100% rename from test_orc/modules/dns/bin/start_test_module rename to modules/test/dns/bin/start_test_module diff --git a/test_orc/modules/dns/conf/module_config.json b/modules/test/dns/conf/module_config.json similarity index 100% rename from test_orc/modules/dns/conf/module_config.json rename to modules/test/dns/conf/module_config.json diff --git a/modules/test/dns/dns.Dockerfile b/modules/test/dns/dns.Dockerfile new file mode 100644 index 000000000..f831d0e2b --- /dev/null +++ b/modules/test/dns/dns.Dockerfile @@ -0,0 +1,14 @@ +# Image name: test-run/conn-test +FROM test-run/base-test:latest + +ARG MODULE_NAME=dns +ARG MODULE_DIR=modules/test/$MODULE_NAME + +# Copy over all configuration files +COPY $MODULE_DIR/conf /testrun/conf + +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin + +# Copy over all python files +COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/test_orc/modules/dns/python/src/dns_module.py b/modules/test/dns/python/src/dns_module.py similarity index 100% rename from test_orc/modules/dns/python/src/dns_module.py rename to modules/test/dns/python/src/dns_module.py diff --git a/test_orc/modules/dns/python/src/run.py b/modules/test/dns/python/src/run.py similarity index 100% rename from test_orc/modules/dns/python/src/run.py rename to modules/test/dns/python/src/run.py diff --git a/test_orc/modules/nmap/bin/start_test_module b/modules/test/nmap/bin/start_test_module similarity index 100% rename from test_orc/modules/nmap/bin/start_test_module rename to modules/test/nmap/bin/start_test_module diff --git a/test_orc/modules/nmap/conf/module_config.json b/modules/test/nmap/conf/module_config.json similarity index 100% rename from test_orc/modules/nmap/conf/module_config.json rename to modules/test/nmap/conf/module_config.json diff --git a/modules/test/nmap/nmap.Dockerfile b/modules/test/nmap/nmap.Dockerfile new file mode 100644 index 000000000..dc23866ad --- /dev/null +++ b/modules/test/nmap/nmap.Dockerfile @@ -0,0 +1,14 @@ +# Image name: test-run/nmap-test +FROM test-run/base-test:latest + +ARG MODULE_NAME=nmap +ARG MODULE_DIR=modules/test/$MODULE_NAME + +# Copy over all configuration files +COPY $MODULE_DIR/conf /testrun/conf + +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin + +# Copy over all python files +COPY $MODULE_DIR/python /testrun/python \ No newline at end of file diff --git a/test_orc/modules/nmap/python/src/nmap_module.py b/modules/test/nmap/python/src/nmap_module.py similarity index 100% rename from test_orc/modules/nmap/python/src/nmap_module.py rename to modules/test/nmap/python/src/nmap_module.py diff --git a/test_orc/modules/nmap/python/src/run.py b/modules/test/nmap/python/src/run.py similarity index 100% rename from test_orc/modules/nmap/python/src/run.py rename to modules/test/nmap/python/src/run.py diff --git a/net_orc/.gitignore b/net_orc/.gitignore deleted file mode 100644 index 2d77147eb..000000000 --- a/net_orc/.gitignore +++ /dev/null @@ -1,133 +0,0 @@ -# Runtime folder -runtime/ -.vscode/ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ diff --git a/net_orc/network/modules/ntp/ntp.Dockerfile b/net_orc/network/modules/ntp/ntp.Dockerfile deleted file mode 100644 index 3474a504e..000000000 --- a/net_orc/network/modules/ntp/ntp.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -# Image name: test-run/ntp -FROM test-run/base:latest - -# Copy over all configuration files -COPY network/modules/ntp/conf /testrun/conf - -# Copy over all binary files -COPY network/modules/ntp/bin /testrun/bin - -# Copy over all python files -COPY network/modules/ntp/python /testrun/python - -EXPOSE 123/udp diff --git a/net_orc/orchestrator.Dockerfile b/net_orc/orchestrator.Dockerfile deleted file mode 100644 index f062a33d4..000000000 --- a/net_orc/orchestrator.Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# Image name: test-run/orchestrator -FROM test-run/base:latest - -#Update and get all additional requirements not contained in the base image -RUN apt-get update - -RUN apt-get install -y python3-pip curl openvswitch-switch - -#Download and install docker client -ENV DOCKERVERSION=20.10.2 -RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \ - && tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 -C /usr/local/bin docker/docker \ - && rm docker-${DOCKERVERSION}.tgz - -#Create a directory to load all the app files into -RUN mkdir /python - -#Load the requirements file -COPY python/requirements.txt /python - -#Install all python requirements for the module -RUN pip3 install -r python/requirements.txt diff --git a/net_orc/python/requirements.txt b/net_orc/python/requirements.txt deleted file mode 100644 index 5d8f29214..000000000 --- a/net_orc/python/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -docker -ipaddress -netifaces -scapy \ No newline at end of file diff --git a/test_orc/modules/baseline/baseline.Dockerfile b/test_orc/modules/baseline/baseline.Dockerfile deleted file mode 100644 index 5b634e6ee..000000000 --- a/test_orc/modules/baseline/baseline.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Image name: test-run/baseline-test -FROM test-run/base-test:latest - -# Copy over all configuration files -COPY modules/baseline/conf /testrun/conf - -# Load device binary files -COPY modules/baseline/bin /testrun/bin - -# Copy over all python files -COPY modules/baseline/python /testrun/python \ No newline at end of file diff --git a/test_orc/modules/dns/dns.Dockerfile b/test_orc/modules/dns/dns.Dockerfile deleted file mode 100644 index 7c3497bc3..000000000 --- a/test_orc/modules/dns/dns.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Image name: test-run/baseline-test -FROM test-run/base-test:latest - -# Copy over all configuration files -COPY modules/dns/conf /testrun/conf - -# Load device binary files -COPY modules/dns/bin /testrun/bin - -# Copy over all python files -COPY modules/dns/python /testrun/python \ No newline at end of file diff --git a/test_orc/modules/nmap/nmap.Dockerfile b/test_orc/modules/nmap/nmap.Dockerfile deleted file mode 100644 index 12f23dde7..000000000 --- a/test_orc/modules/nmap/nmap.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Image name: test-run/baseline-test -FROM test-run/base-test:latest - -# Copy over all configuration files -COPY modules/nmap/conf /testrun/conf - -# Load device binary files -COPY modules/nmap/bin /testrun/bin - -# Copy over all python files -COPY modules/nmap/python /testrun/python \ No newline at end of file diff --git a/test_orc/python/requirements.txt b/test_orc/python/requirements.txt deleted file mode 100644 index e69de29bb..000000000 From 1c1f4fd44e1b763ba051727ba4fe102aa9a22850 Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Tue, 13 Jun 2023 14:54:13 -0600 Subject: [PATCH 2/8] Fix CI paths --- testing/test_baseline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_baseline b/testing/test_baseline index d7fc1e5c5..74218e2bd 100755 --- a/testing/test_baseline +++ b/testing/test_baseline @@ -19,7 +19,7 @@ sudo docker network create -d macvlan -o parent=endev0b endev0 sudo /usr/share/openvswitch/scripts/ovs-ctl start # Fix due to ordering -sudo docker build ./net_orc/ -t test-run/base -f net_orc/network/modules/base/base.Dockerfile +sudo docker build ./modules/network -t test-run/base -f modules/network/base/base.Dockerfile # Build Test Container sudo docker build ./testing/docker/ci_baseline -t ci1 -f ./testing/docker/ci_baseline/Dockerfile From 4cf754e1275eb410b4db6abf6b9be80a827dbebc Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Wed, 14 Jun 2023 12:20:47 +0100 Subject: [PATCH 3/8] Fix base module --- modules/network/base/base.Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/network/base/base.Dockerfile b/modules/network/base/base.Dockerfile index 2400fd1c6..31a5e99de 100644 --- a/modules/network/base/base.Dockerfile +++ b/modules/network/base/base.Dockerfile @@ -4,14 +4,14 @@ FROM ubuntu:jammy # Install common software RUN apt-get update && apt-get install -y net-tools iputils-ping tcpdump iproute2 jq python3 python3-pip dos2unix -#Setup the base python requirements -COPY network/modules/base/python /testrun/python +# Setup the base python requirements +COPY modules/network/base/python /testrun/python # Install all python requirements for the module RUN pip3 install -r /testrun/python/requirements.txt # Add the bin files -COPY network/modules/base/bin /testrun/bin +COPY modules/network/base/bin /testrun/bin # Remove incorrect line endings RUN dos2unix /testrun/bin/* From 4064cbdf4c0bf204e2e8b9d4db802d42a30b3908 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Wed, 14 Jun 2023 15:16:03 +0100 Subject: [PATCH 4/8] Add build script --- build/base-test.log | 41 ++++++++ build/base.log | 41 ++++++++ build/baseline-test.log | 32 ++++++ build/conn-test.log | 217 ++++++++++++++++++++++++++++++++++++++++ build/dhcp-1.log | 35 +++++++ build/dhcp-2.log | 35 +++++++ build/dns-test.log | 32 ++++++ build/dns.log | 35 +++++++ build/faux-dev.log | 134 +++++++++++++++++++++++++ build/gateway.log | 32 ++++++ build/nmap-test.log | 32 ++++++ build/ntp.log | 32 ++++++ build/radius.log | 44 ++++++++ cmd/build | 53 ++++++++++ 14 files changed, 795 insertions(+) create mode 100644 build/base-test.log create mode 100644 build/base.log create mode 100644 build/baseline-test.log create mode 100644 build/conn-test.log create mode 100644 build/dhcp-1.log create mode 100644 build/dhcp-2.log create mode 100644 build/dns-test.log create mode 100644 build/dns.log create mode 100644 build/faux-dev.log create mode 100644 build/gateway.log create mode 100644 build/nmap-test.log create mode 100644 build/ntp.log create mode 100644 build/radius.log create mode 100755 cmd/build diff --git a/build/base-test.log b/build/base-test.log new file mode 100644 index 000000000..ddc2d2c27 --- /dev/null +++ b/build/base-test.log @@ -0,0 +1,41 @@ +#1 [internal] load .dockerignore +#1 transferring context: 2B done +#1 DONE 0.0s + +#2 [internal] load build definition from base.Dockerfile +#2 transferring dockerfile: 790B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/library/ubuntu:jammy +#3 DONE 0.0s + +#4 [1/7] FROM docker.io/library/ubuntu:jammy +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 14.57kB done +#5 DONE 0.0s + +#6 [5/7] COPY modules/test/base/bin /testrun/bin +#6 CACHED + +#7 [3/7] COPY modules/test/base/python /testrun/python +#7 CACHED + +#8 [2/7] RUN apt-get update && apt-get install -y net-tools iputils-ping tcpdump iproute2 jq python3 python3-pip dos2unix nmap --fix-missing +#8 CACHED + +#9 [6/7] RUN dos2unix /testrun/bin/* +#9 CACHED + +#10 [4/7] RUN pip3 install -r /testrun/python/requirements.txt +#10 CACHED + +#11 [7/7] RUN chmod u+x /testrun/bin/* +#11 CACHED + +#12 exporting to image +#12 exporting layers done +#12 writing image sha256:b8d1e3b92f47529712192ad769331b06daabcf1f6bfe39f54fd1d48820f2cb9f done +#12 naming to docker.io/test-run/base-test done +#12 DONE 0.0s diff --git a/build/base.log b/build/base.log new file mode 100644 index 000000000..eac1c4753 --- /dev/null +++ b/build/base.log @@ -0,0 +1,41 @@ +#1 [internal] load build definition from base.Dockerfile +#1 transferring dockerfile: 689B done +#1 DONE 0.0s + +#2 [internal] load .dockerignore +#2 transferring context: 2B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/library/ubuntu:jammy +#3 DONE 0.0s + +#4 [1/7] FROM docker.io/library/ubuntu:jammy +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 8.66kB done +#5 DONE 0.0s + +#6 [3/7] COPY modules/network/base/python /testrun/python +#6 CACHED + +#7 [4/7] RUN pip3 install -r /testrun/python/requirements.txt +#7 CACHED + +#8 [2/7] RUN apt-get update && apt-get install -y net-tools iputils-ping tcpdump iproute2 jq python3 python3-pip dos2unix +#8 CACHED + +#9 [6/7] RUN dos2unix /testrun/bin/* +#9 CACHED + +#10 [5/7] COPY modules/network/base/bin /testrun/bin +#10 CACHED + +#11 [7/7] RUN chmod u+x /testrun/bin/* +#11 CACHED + +#12 exporting to image +#12 exporting layers done +#12 writing image sha256:c01bf2973cade6e0bc97993ad3713e29ca4474836e091448058765974237d91c done +#12 naming to docker.io/test-run/base done +#12 DONE 0.0s diff --git a/build/baseline-test.log b/build/baseline-test.log new file mode 100644 index 000000000..5516f1ba3 --- /dev/null +++ b/build/baseline-test.log @@ -0,0 +1,32 @@ +#1 [internal] load .dockerignore +#1 transferring context: 2B done +#1 DONE 0.0s + +#2 [internal] load build definition from baseline.Dockerfile +#2 transferring dockerfile: 402B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base-test:latest +#3 DONE 0.0s + +#4 [internal] load build context +#4 transferring context: 6.10kB done +#4 DONE 0.0s + +#5 [1/4] FROM docker.io/test-run/base-test:latest +#5 DONE 0.0s + +#6 [2/4] COPY modules/test/baseline/conf /testrun/conf +#6 DONE 0.0s + +#7 [3/4] COPY modules/test/baseline/bin /testrun/bin +#7 DONE 0.0s + +#8 [4/4] COPY modules/test/baseline/python /testrun/python +#8 DONE 0.0s + +#9 exporting to image +#9 exporting layers 0.0s done +#9 writing image sha256:6bfc0ffe35bf0bb6b4f400cf8c1d2bcdd4a363a041543bf108f1ed12ffd9fda8 done +#9 naming to docker.io/test-run/baseline-test done +#9 DONE 0.0s diff --git a/build/conn-test.log b/build/conn-test.log new file mode 100644 index 000000000..f727550a9 --- /dev/null +++ b/build/conn-test.log @@ -0,0 +1,217 @@ +#1 [internal] load build definition from conn.Dockerfile +#1 transferring dockerfile: 756B done +#1 DONE 0.0s + +#2 [internal] load .dockerignore +#2 transferring context: 2B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base-test:latest +#3 DONE 0.0s + +#4 [1/8] FROM docker.io/test-run/base-test:latest +#4 CACHED + +#5 [internal] load build context +#5 transferring context: 9.67kB done +#5 DONE 0.0s + +#6 [2/8] RUN apt-get install -y wget +#6 0.321 Reading package lists... +#6 0.749 Building dependency tree... +#6 0.852 Reading state information... +#6 0.950 The following additional packages will be installed: +#6 0.950 libpsl5 publicsuffix +#6 0.972 The following NEW packages will be installed: +#6 0.972 libpsl5 publicsuffix wget +#6 1.020 0 upgraded, 3 newly installed, 0 to remove and 11 not upgraded. +#6 1.020 Need to get 555 kB of archives. +#6 1.020 After this operation, 1443 kB of additional disk space will be used. +#6 1.020 Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libpsl5 amd64 0.21.0-1.2build2 [58.4 kB] +#6 1.046 Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 publicsuffix all 20211207.1025-1 [129 kB] +#6 1.060 Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 wget amd64 1.21.2-2ubuntu1 [367 kB] +#6 1.169 debconf: delaying package configuration, since apt-utils is not installed +#6 1.186 Fetched 555 kB in 0s (5533 kB/s) +#6 1.198 Selecting previously unselected package libpsl5:amd64. +#6 1.198 (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 17538 files and directories currently installed.) +#6 1.206 Preparing to unpack .../libpsl5_0.21.0-1.2build2_amd64.deb ... +#6 1.208 Unpacking libpsl5:amd64 (0.21.0-1.2build2) ... +#6 1.220 Selecting previously unselected package publicsuffix. +#6 1.221 Preparing to unpack .../publicsuffix_20211207.1025-1_all.deb ... +#6 1.222 Unpacking publicsuffix (20211207.1025-1) ... +#6 1.235 Selecting previously unselected package wget. +#6 1.236 Preparing to unpack .../wget_1.21.2-2ubuntu1_amd64.deb ... +#6 1.238 Unpacking wget (1.21.2-2ubuntu1) ... +#6 1.256 Setting up libpsl5:amd64 (0.21.0-1.2build2) ... +#6 1.259 Setting up wget (1.21.2-2ubuntu1) ... +#6 1.264 Setting up publicsuffix (20211207.1025-1) ... +#6 1.267 Processing triggers for libc-bin (2.35-0ubuntu3.1) ... +#6 DONE 1.3s + +#7 [3/8] RUN wget http://standards-oui.ieee.org/oui.txt -P /usr/local/etc/ +#7 0.448 --2023-06-14 13:38:32-- http://standards-oui.ieee.org/oui.txt +#7 0.448 Resolving standards-oui.ieee.org (standards-oui.ieee.org)... 140.98.223.27 +#7 0.611 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:80... connected. +#7 0.694 HTTP request sent, awaiting response... 302 Moved Temporarily +#7 0.781 Location: https://standards-oui.ieee.org/oui.txt [following] +#7 0.781 --2023-06-14 13:38:32-- https://standards-oui.ieee.org/oui.txt +#7 0.786 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:443... connected. +#7 0.955 HTTP request sent, awaiting response... 302 Moved Temporarily +#7 1.120 Location: http://standards-oui.ieee.org/oui/oui.txt [following] +#7 1.120 --2023-06-14 13:38:33-- http://standards-oui.ieee.org/oui/oui.txt +#7 1.120 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:80... connected. +#7 1.201 HTTP request sent, awaiting response... 302 Moved Temporarily +#7 1.283 Location: https://standards-oui.ieee.org/oui/oui.txt [following] +#7 1.284 --2023-06-14 13:38:33-- https://standards-oui.ieee.org/oui/oui.txt +#7 1.284 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:443... connected. +#7 1.456 HTTP request sent, awaiting response... 200 OK +#7 1.835 Length: 5489407 (5.2M) [text/plain] +#7 1.836 Saving to: '/usr/local/etc/oui.txt' +#7 1.836 +#7 1.836 0K .......... .......... .......... .......... .......... 0% 118K 45s +#7 2.259 50K .......... .......... .......... .......... .......... 1% 155K 39s +#7 2.581 100K .......... .......... .......... .......... .......... 2% 224K 34s +#7 2.804 150K .......... .......... .......... .......... .......... 3% 270K 30s +#7 2.990 200K .......... .......... .......... .......... .......... 4% 228K 28s +#7 3.210 250K .......... .......... .......... .......... .......... 5% 266K 26s +#7 3.397 300K .......... .......... .......... .......... .......... 6% 355K 24s +#7 3.538 350K .......... .......... .......... .......... .......... 7% 336K 23s +#7 3.723 400K .......... .......... .......... .......... .......... 8% 283K 22s +#7 3.864 450K .......... .......... .......... .......... .......... 9% 336K 21s +#7 4.013 500K .......... .......... .......... .......... .......... 10% 423K 20s +#7 4.131 550K .......... .......... .......... .......... .......... 11% 399K 19s +#7 4.256 600K .......... .......... .......... .......... .......... 12% 421K 18s +#7 4.375 650K .......... .......... .......... .......... .......... 13% 390K 18s +#7 4.503 700K .......... .......... .......... .......... .......... 13% 436K 17s +#7 4.618 750K .......... .......... .......... .......... .......... 14% 399K 17s +#7 4.783 800K .......... .......... .......... .......... .......... 15% 248K 16s +#7 4.945 850K .......... .......... .......... .......... .......... 16% 399K 16s +#7 5.070 900K .......... .......... .......... .......... .......... 17% 419K 16s +#7 5.189 950K .......... .......... .......... .......... .......... 18% 383K 15s +#7 5.320 1000K .......... .......... .......... .......... .......... 19% 306K 15s +#7 5.483 1050K .......... .......... .......... .......... .......... 20% 445K 15s +#7 5.595 1100K .......... .......... .......... .......... .......... 21% 380K 14s +#7 5.727 1150K .......... .......... .......... .......... .......... 22% 447K 14s +#7 5.882 1200K .......... .......... .......... .......... .......... 23% 309K 14s +#7 6.000 1250K .......... .......... .......... .......... .......... 24% 529K 13s +#7 6.095 1300K .......... .......... .......... .......... .......... 25% 620K 13s +#7 6.176 1350K .......... .......... .......... .......... .......... 26% 431K 13s +#7 6.291 1400K .......... .......... .......... .......... .......... 27% 621K 12s +#7 6.372 1450K .......... .......... .......... .......... .......... 27% 598K 12s +#7 6.455 1500K .......... .......... .......... .......... .......... 28% 434K 12s +#7 6.571 1550K .......... .......... .......... .......... .......... 29% 619K 11s +#7 6.670 1600K .......... .......... .......... .......... .......... 30% 502K 11s +#7 6.751 1650K .......... .......... .......... .......... .......... 31% 396K 11s +#7 6.877 1700K .......... .......... .......... .......... .......... 32% 616K 11s +#7 6.959 1750K .......... .......... .......... .......... .......... 33% 611K 10s +#7 7.041 1800K .......... .......... .......... .......... .......... 34% 618K 10s +#7 7.121 1850K .......... .......... .......... .......... .......... 35% 604K 10s +#7 7.204 1900K .......... .......... .......... .......... .......... 36% 604K 10s +#7 7.287 1950K .......... .......... .......... .......... .......... 37% 610K 9s +#7 7.392 2000K .......... .......... .......... .......... .......... 38% 497K 9s +#7 7.469 2050K .......... .......... .......... .......... .......... 39% 618K 9s +#7 7.550 2100K .......... .......... .......... .......... .......... 40% 614K 9s +#7 7.632 2150K .......... .......... .......... .......... .......... 41% 834K 8s +#7 7.692 2200K .......... .......... .......... .......... .......... 41% 590K 8s +#7 7.776 2250K .......... .......... .......... .......... .......... 42% 802K 8s +#7 7.839 2300K .......... .......... .......... .......... .......... 43% 619K 8s +#7 7.920 2350K .......... .......... .......... .......... .......... 44% 618K 8s +#7 8.026 2400K .......... .......... .......... .......... .......... 45% 560K 7s +#7 8.090 2450K .......... .......... .......... .......... .......... 46% 621K 7s +#7 8.171 2500K .......... .......... .......... .......... .......... 47% 617K 7s +#7 8.252 2550K .......... .......... .......... .......... .......... 48% 1.07M 7s +#7 8.297 2600K .......... .......... .......... .......... .......... 49% 703K 7s +#7 8.368 2650K .......... .......... .......... .......... .......... 50% 607K 7s +#7 8.451 2700K .......... .......... .......... .......... .......... 51% 1.08M 6s +#7 8.496 2750K .......... .......... .......... .......... .......... 52% 983K 6s +#7 8.577 2800K .......... .......... .......... .......... .......... 53% 619K 6s +#7 8.628 2850K .......... .......... .......... .......... .......... 54% 613K 6s +#7 8.709 2900K .......... .......... .......... .......... .......... 55% 732K 6s +#7 8.778 2950K .......... .......... .......... .......... .......... 55% 848K 6s +#7 8.836 3000K .......... .......... .......... .......... .......... 56% 705K 5s +#7 8.907 3050K .......... .......... .......... .......... .......... 57% 1.04M 5s +#7 8.954 3100K .......... .......... .......... .......... .......... 58% 630K 5s +#7 9.033 3150K .......... .......... .......... .......... .......... 59% 713K 5s +#7 9.114 3200K .......... .......... .......... .......... .......... 60% 609K 5s +#7 9.186 3250K .......... .......... .......... .......... .......... 61% 856K 5s +#7 9.244 3300K .......... .......... .......... .......... .......... 62% 286K 5s +#7 9.419 3350K .......... .......... .......... .......... .......... 63% 614K 4s +#7 9.501 3400K .......... .......... .......... .......... .......... 64% 246K 4s +#7 9.704 3450K .......... .......... .......... .......... .......... 65% 409K 4s +#7 9.826 3500K .......... .......... .......... .......... .......... 66% 400K 4s +#7 9.951 3550K .......... .......... .......... .......... .......... 67% 302K 4s +#7 10.15 3600K .......... .......... .......... .......... .......... 68% 293K 4s +#7 10.29 3650K .......... .......... .......... .......... .......... 69% 458K 4s +#7 10.40 3700K .......... .......... .......... .......... .......... 69% 606K 4s +#7 10.48 3750K .......... .......... .......... .......... .......... 70% 817K 4s +#7 10.54 3800K .......... .......... .......... .......... .......... 71% 620K 3s +#7 10.62 3850K .......... .......... .......... .......... .......... 72% 617K 3s +#7 10.70 3900K .......... .......... .......... .......... .......... 73% 568K 3s +#7 10.79 3950K .......... .......... .......... .......... .......... 74% 594K 3s +#7 10.90 4000K .......... .......... .......... .......... .......... 75% 295K 3s +#7 11.04 4050K .......... .......... .......... .......... .......... 76% 453K 3s +#7 11.15 4100K .......... .......... .......... .......... .......... 77% 612K 3s +#7 11.24 4150K .......... .......... .......... .......... .......... 78% 616K 3s +#7 11.32 4200K .......... .......... .......... .......... .......... 79% 426K 3s +#7 11.43 4250K .......... .......... .......... .......... .......... 80% 616K 2s +#7 11.51 4300K .......... .......... .......... .......... .......... 81% 613K 2s +#7 11.60 4350K .......... .......... .......... .......... .......... 82% 599K 2s +#7 11.69 4400K .......... .......... .......... .......... .......... 83% 478K 2s +#7 11.78 4450K .......... .......... .......... .......... .......... 83% 550K 2s +#7 11.88 4500K .......... .......... .......... .......... .......... 84% 879K 2s +#7 11.93 4550K .......... .......... .......... .......... .......... 85% 614K 2s +#7 12.01 4600K .......... .......... .......... .......... .......... 86% 618K 2s +#7 12.09 4650K .......... .......... .......... .......... .......... 87% 716K 1s +#7 12.16 4700K .......... .......... .......... .......... .......... 88% 618K 1s +#7 12.25 4750K .......... .......... .......... .......... .......... 89% 1.02M 1s +#7 12.33 4800K .......... .......... .......... .......... .......... 90% 480K 1s +#7 12.40 4850K .......... .......... .......... .......... .......... 91% 550K 1s +#7 12.49 4900K .......... .......... .......... .......... .......... 92% 504K 1s +#7 12.59 4950K .......... .......... .......... .......... .......... 93% 1.92M 1s +#7 12.61 5000K .......... .......... .......... .......... .......... 94% 617K 1s +#7 12.69 5050K .......... .......... .......... .......... .......... 95% 647K 1s +#7 12.77 5100K .......... .......... .......... .......... .......... 96% 622K 0s +#7 12.85 5150K .......... .......... .......... .......... .......... 97% 689K 0s +#7 12.93 5200K .......... .......... .......... .......... .......... 97% 562K 0s +#7 13.01 5250K .......... .......... .......... .......... .......... 98% 674K 0s +#7 13.09 5300K .......... .......... .......... .......... .......... 99% 700K 0s +#7 13.16 5350K .......... 100% 60.6M=11s +#7 13.16 +#7 13.16 2023-06-14 13:38:45 (473 KB/s) - '/usr/local/etc/oui.txt' saved [5489407/5489407] +#7 13.16 +#7 DONE 13.2s + +#8 [4/8] COPY modules/test/conn/python/requirements.txt /testrun/python +#8 DONE 0.0s + +#9 [5/8] RUN pip3 install -r /testrun/python/requirements.txt +#9 0.759 Collecting scapy +#9 0.859 Downloading scapy-2.5.0.tar.gz (1.3 MB) +#9 0.983 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 10.6 MB/s eta 0:00:00 +#9 1.071 Preparing metadata (setup.py): started +#9 1.167 Preparing metadata (setup.py): finished with status 'done' +#9 1.170 Building wheels for collected packages: scapy +#9 1.171 Building wheel for scapy (setup.py): started +#9 1.479 Building wheel for scapy (setup.py): finished with status 'done' +#9 1.481 Created wheel for scapy: filename=scapy-2.5.0-py2.py3-none-any.whl size=1444349 sha256=4079ac6ed21f4aabd2e20e8cd4e07feac5300410d939dfb330992655f50cbb46 +#9 1.481 Stored in directory: /root/.cache/pip/wheels/82/b7/03/8344d8cf6695624746311bc0d389e9d05535ca83c35f90241d +#9 1.483 Successfully built scapy +#9 1.491 Installing collected packages: scapy +#9 2.112 Successfully installed scapy-2.5.0 +#9 2.112 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv +#9 DONE 2.2s + +#10 [6/8] COPY modules/test/conn/conf /testrun/conf +#10 DONE 0.0s + +#11 [7/8] COPY modules/test/conn/bin /testrun/bin +#11 DONE 0.0s + +#12 [8/8] COPY modules/test/conn/python /testrun/python +#12 DONE 0.0s + +#13 exporting to image +#13 exporting layers 0.1s done +#13 writing image sha256:150a8d555463cffa9dff2fcd3f8dd1b989c043a3eb8b4a5aca1e135415739496 done +#13 naming to docker.io/test-run/conn-test done +#13 DONE 0.1s diff --git a/build/dhcp-1.log b/build/dhcp-1.log new file mode 100644 index 000000000..a5afb76d5 --- /dev/null +++ b/build/dhcp-1.log @@ -0,0 +1,35 @@ +#1 [internal] load .dockerignore +#1 transferring context: 2B done +#1 DONE 0.0s + +#2 [internal] load build definition from dhcp-1.Dockerfile +#2 transferring dockerfile: 451B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base:latest +#3 DONE 0.0s + +#4 [1/5] FROM docker.io/test-run/base:latest +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 17.83kB done +#5 DONE 0.0s + +#6 [2/5] RUN apt-get install -y isc-dhcp-server radvd +#6 CACHED + +#7 [3/5] COPY modules/network/dhcp-1/conf /testrun/conf +#7 CACHED + +#8 [4/5] COPY modules/network/dhcp-1/bin /testrun/bin +#8 CACHED + +#9 [5/5] COPY modules/network/dhcp-1/python /testrun/python +#9 CACHED + +#10 exporting to image +#10 exporting layers done +#10 writing image sha256:13bbcdc5dee7ad09e6e1feeb7f4aa2dc6901ff01e60fefdd74558ab3133f793f done +#10 naming to docker.io/test-run/dhcp-1 done +#10 DONE 0.0s diff --git a/build/dhcp-2.log b/build/dhcp-2.log new file mode 100644 index 000000000..5168a11a1 --- /dev/null +++ b/build/dhcp-2.log @@ -0,0 +1,35 @@ +#1 [internal] load build definition from dhcp-2.Dockerfile +#1 transferring dockerfile: 452B done +#1 DONE 0.0s + +#2 [internal] load .dockerignore +#2 transferring context: 2B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base:latest +#3 DONE 0.0s + +#4 [1/5] FROM docker.io/test-run/base:latest +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 17.78kB done +#5 DONE 0.0s + +#6 [4/5] COPY modules/network/dhcp-2/bin /testrun/bin +#6 CACHED + +#7 [2/5] RUN apt-get install -y isc-dhcp-server radvd +#7 CACHED + +#8 [3/5] COPY modules/network/dhcp-2/conf /testrun/conf +#8 CACHED + +#9 [5/5] COPY modules/network/dhcp-2/python /testrun/python +#9 CACHED + +#10 exporting to image +#10 exporting layers done +#10 writing image sha256:c1177cf17d218724f7bd6e608e80e0525e856cba71ee96b742a6f88685a446ca done +#10 naming to docker.io/test-run/dhcp-2 done +#10 DONE 0.0s diff --git a/build/dns-test.log b/build/dns-test.log new file mode 100644 index 000000000..e028192b0 --- /dev/null +++ b/build/dns-test.log @@ -0,0 +1,32 @@ +#1 [internal] load build definition from dns.Dockerfile +#1 transferring dockerfile: 388B done +#1 DONE 0.0s + +#2 [internal] load .dockerignore +#2 transferring context: 2B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base-test:latest +#3 DONE 0.0s + +#4 [internal] load build context +#4 transferring context: 9.12kB done +#4 DONE 0.0s + +#5 [1/4] FROM docker.io/test-run/base-test:latest +#5 CACHED + +#6 [2/4] COPY modules/test/dns/conf /testrun/conf +#6 DONE 0.0s + +#7 [3/4] COPY modules/test/dns/bin /testrun/bin +#7 DONE 0.0s + +#8 [4/4] COPY modules/test/dns/python /testrun/python +#8 DONE 0.0s + +#9 exporting to image +#9 exporting layers 0.0s done +#9 writing image sha256:47bd055feb9f2181665b6bed5201184f6540a6e5e4bf964b11b1b3e584f578c1 done +#9 naming to docker.io/test-run/dns-test done +#9 DONE 0.0s diff --git a/build/dns.log b/build/dns.log new file mode 100644 index 000000000..69e4c004e --- /dev/null +++ b/build/dns.log @@ -0,0 +1,35 @@ +#1 [internal] load .dockerignore +#1 transferring context: 2B done +#1 DONE 0.0s + +#2 [internal] load build definition from dns.Dockerfile +#2 transferring dockerfile: 458B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base:latest +#3 DONE 0.0s + +#4 [1/5] FROM docker.io/test-run/base:latest +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 1.86kB done +#5 DONE 0.0s + +#6 [4/5] COPY modules/network/dns/conf /testrun/conf +#6 CACHED + +#7 [2/5] RUN apt-get update --fix-missing +#7 CACHED + +#8 [3/5] RUN apt-get install -y dnsmasq +#8 CACHED + +#9 [5/5] COPY modules/network/dns/bin /testrun/bin +#9 CACHED + +#10 exporting to image +#10 exporting layers done +#10 writing image sha256:c6aa585abe7794a1ee2ec67bf29ddd17a734d810b4b355e0b896a70a5e1c38c6 done +#10 naming to docker.io/test-run/dns done +#10 DONE 0.0s diff --git a/build/faux-dev.log b/build/faux-dev.log new file mode 100644 index 000000000..142e4f33e --- /dev/null +++ b/build/faux-dev.log @@ -0,0 +1,134 @@ +#1 [internal] load build definition from faux-dev.Dockerfile +#1 transferring dockerfile: 712B done +#1 DONE 0.0s + +#2 [internal] load .dockerignore +#2 transferring context: 2B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base:latest +#3 DONE 0.0s + +#4 [1/6] FROM docker.io/test-run/base:latest +#4 CACHED + +#5 [internal] load build context +#5 transferring context: 23.71kB done +#5 DONE 0.0s + +#6 [2/6] RUN apt-get update --fix-missing +#6 0.438 Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] +#6 0.588 Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease +#6 0.669 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] +#6 1.063 Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB] +#6 1.344 Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1179 kB] +#6 1.773 Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [862 kB] +#6 1.893 Fetched 2378 kB in 1s (1597 kB/s) +#6 1.893 Reading package lists... +#6 DONE 2.3s + +#7 [3/6] RUN apt-get install -y isc-dhcp-client ntp ntpdate +#7 0.461 Reading package lists... +#7 0.877 Building dependency tree... +#7 0.970 Reading state information... +#7 1.051 The following additional packages will be installed: +#7 1.051 isc-dhcp-common libdns-export1110 libedit2 libevent-core-2.1-7 +#7 1.052 libevent-pthreads-2.1-7 libisc-export1105 libopts25 sntp tzdata +#7 1.052 Suggested packages: +#7 1.052 resolvconf avahi-autoipd isc-dhcp-client-ddns ntp-doc +#7 1.088 The following NEW packages will be installed: +#7 1.088 isc-dhcp-client isc-dhcp-common libdns-export1110 libedit2 +#7 1.089 libevent-core-2.1-7 libevent-pthreads-2.1-7 libisc-export1105 libopts25 ntp +#7 1.089 ntpdate sntp tzdata +#7 1.184 0 upgraded, 12 newly installed, 0 to remove and 11 not upgraded. +#7 1.184 Need to get 2745 kB of archives. +#7 1.184 After this operation, 10.9 MB of additional disk space will be used. +#7 1.184 Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libisc-export1105 amd64 1:9.11.19+dfsg-2.1ubuntu3 [192 kB] +#7 1.237 Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libdns-export1110 amd64 1:9.11.19+dfsg-2.1ubuntu3 [827 kB] +#7 1.269 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 isc-dhcp-client amd64 4.4.1-2.3ubuntu2.4 [235 kB] +#7 1.272 Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 isc-dhcp-common amd64 4.4.1-2.3ubuntu2.4 [45.0 kB] +#7 1.276 Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 tzdata all 2023c-0ubuntu0.22.04.2 [349 kB] +#7 1.287 Get:6 http://archive.ubuntu.com/ubuntu jammy/main amd64 libedit2 amd64 3.1-20210910-1build1 [96.8 kB] +#7 1.288 Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 libevent-core-2.1-7 amd64 2.1.12-stable-1build3 [93.9 kB] +#7 1.290 Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 libevent-pthreads-2.1-7 amd64 2.1.12-stable-1build3 [7642 B] +#7 1.290 Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libopts25 amd64 1:5.18.16-4 [59.5 kB] +#7 1.291 Get:10 http://archive.ubuntu.com/ubuntu jammy/universe amd64 ntp amd64 1:4.2.8p15+dfsg-1ubuntu2 [721 kB] +#7 1.303 Get:11 http://archive.ubuntu.com/ubuntu jammy/universe amd64 ntpdate amd64 1:4.2.8p15+dfsg-1ubuntu2 [51.5 kB] +#7 1.320 Get:12 http://archive.ubuntu.com/ubuntu jammy/universe amd64 sntp amd64 1:4.2.8p15+dfsg-1ubuntu2 [67.1 kB] +#7 1.428 debconf: delaying package configuration, since apt-utils is not installed +#7 1.445 Fetched 2745 kB in 0s (11.1 MB/s) +#7 1.457 Selecting previously unselected package libisc-export1105:amd64. +#7 1.457 (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 16650 files and directories currently installed.) +#7 1.465 Preparing to unpack .../00-libisc-export1105_1%3a9.11.19+dfsg-2.1ubuntu3_amd64.deb ... +#7 1.467 Unpacking libisc-export1105:amd64 (1:9.11.19+dfsg-2.1ubuntu3) ... +#7 1.481 Selecting previously unselected package libdns-export1110. +#7 1.482 Preparing to unpack .../01-libdns-export1110_1%3a9.11.19+dfsg-2.1ubuntu3_amd64.deb ... +#7 1.483 Unpacking libdns-export1110 (1:9.11.19+dfsg-2.1ubuntu3) ... +#7 1.501 Selecting previously unselected package isc-dhcp-client. +#7 1.502 Preparing to unpack .../02-isc-dhcp-client_4.4.1-2.3ubuntu2.4_amd64.deb ... +#7 1.503 Unpacking isc-dhcp-client (4.4.1-2.3ubuntu2.4) ... +#7 1.517 Selecting previously unselected package isc-dhcp-common. +#7 1.518 Preparing to unpack .../03-isc-dhcp-common_4.4.1-2.3ubuntu2.4_amd64.deb ... +#7 1.519 Unpacking isc-dhcp-common (4.4.1-2.3ubuntu2.4) ... +#7 1.532 Selecting previously unselected package tzdata. +#7 1.533 Preparing to unpack .../04-tzdata_2023c-0ubuntu0.22.04.2_all.deb ... +#7 1.534 Unpacking tzdata (2023c-0ubuntu0.22.04.2) ... +#7 1.660 Selecting previously unselected package libedit2:amd64. +#7 1.661 Preparing to unpack .../05-libedit2_3.1-20210910-1build1_amd64.deb ... +#7 1.663 Unpacking libedit2:amd64 (3.1-20210910-1build1) ... +#7 1.677 Selecting previously unselected package libevent-core-2.1-7:amd64. +#7 1.678 Preparing to unpack .../06-libevent-core-2.1-7_2.1.12-stable-1build3_amd64.deb ... +#7 1.679 Unpacking libevent-core-2.1-7:amd64 (2.1.12-stable-1build3) ... +#7 1.692 Selecting previously unselected package libevent-pthreads-2.1-7:amd64. +#7 1.693 Preparing to unpack .../07-libevent-pthreads-2.1-7_2.1.12-stable-1build3_amd64.deb ... +#7 1.694 Unpacking libevent-pthreads-2.1-7:amd64 (2.1.12-stable-1build3) ... +#7 1.706 Selecting previously unselected package libopts25:amd64. +#7 1.707 Preparing to unpack .../08-libopts25_1%3a5.18.16-4_amd64.deb ... +#7 1.708 Unpacking libopts25:amd64 (1:5.18.16-4) ... +#7 1.725 Selecting previously unselected package ntp. +#7 1.726 Preparing to unpack .../09-ntp_1%3a4.2.8p15+dfsg-1ubuntu2_amd64.deb ... +#7 1.728 Unpacking ntp (1:4.2.8p15+dfsg-1ubuntu2) ... +#7 1.753 Selecting previously unselected package ntpdate. +#7 1.754 Preparing to unpack .../10-ntpdate_1%3a4.2.8p15+dfsg-1ubuntu2_amd64.deb ... +#7 1.758 Unpacking ntpdate (1:4.2.8p15+dfsg-1ubuntu2) ... +#7 1.771 Selecting previously unselected package sntp. +#7 1.772 Preparing to unpack .../11-sntp_1%3a4.2.8p15+dfsg-1ubuntu2_amd64.deb ... +#7 1.773 Unpacking sntp (1:4.2.8p15+dfsg-1ubuntu2) ... +#7 1.790 Setting up libedit2:amd64 (3.1-20210910-1build1) ... +#7 1.793 Setting up libopts25:amd64 (1:5.18.16-4) ... +#7 1.796 Setting up ntpdate (1:4.2.8p15+dfsg-1ubuntu2) ... +#7 1.806 Setting up tzdata (2023c-0ubuntu0.22.04.2) ... +#7 1.859 +#7 1.859 Current default time zone: 'Etc/UTC' +#7 1.861 Local time is now: Wed Jun 14 13:38:52 UTC 2023. +#7 1.861 Universal Time is now: Wed Jun 14 13:38:52 UTC 2023. +#7 1.861 Run 'dpkg-reconfigure tzdata' if you wish to change it. +#7 1.861 +#7 1.869 Setting up libisc-export1105:amd64 (1:9.11.19+dfsg-2.1ubuntu3) ... +#7 1.872 Setting up ntp (1:4.2.8p15+dfsg-1ubuntu2) ... +#7 2.092 invoke-rc.d: could not determine current runlevel +#7 2.094 invoke-rc.d: policy-rc.d denied execution of start. +#7 2.095 Setting up libevent-core-2.1-7:amd64 (2.1.12-stable-1build3) ... +#7 2.099 Setting up isc-dhcp-common (4.4.1-2.3ubuntu2.4) ... +#7 2.102 Setting up libevent-pthreads-2.1-7:amd64 (2.1.12-stable-1build3) ... +#7 2.105 Setting up sntp (1:4.2.8p15+dfsg-1ubuntu2) ... +#7 2.110 Setting up libdns-export1110 (1:9.11.19+dfsg-2.1ubuntu3) ... +#7 2.113 Setting up isc-dhcp-client (4.4.1-2.3ubuntu2.4) ... +#7 2.126 Processing triggers for libc-bin (2.35-0ubuntu3.1) ... +#7 DONE 2.2s + +#8 [4/6] COPY modules/devices/faux-dev/conf /testrun/conf +#8 DONE 0.0s + +#9 [5/6] COPY modules/devices/faux-dev/bin /testrun/bin +#9 DONE 0.0s + +#10 [6/6] COPY modules/devices/faux-dev/python /testrun/python +#10 DONE 0.0s + +#11 exporting to image +#11 exporting layers +#11 exporting layers 0.1s done +#11 writing image sha256:cbc362a323757c49cc4853438f8a9fec4c75acbc5b9f1bf8cb4c06c126322aaa done +#11 naming to docker.io/test-run/faux-dev done +#11 DONE 0.1s diff --git a/build/gateway.log b/build/gateway.log new file mode 100644 index 000000000..2cbcfcef9 --- /dev/null +++ b/build/gateway.log @@ -0,0 +1,32 @@ +#1 [internal] load .dockerignore +#1 transferring context: 2B done +#1 DONE 0.0s + +#2 [internal] load build definition from gateway.Dockerfile +#2 transferring dockerfile: 387B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base:latest +#3 DONE 0.0s + +#4 [1/4] FROM docker.io/test-run/base:latest +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 1.59kB done +#5 DONE 0.0s + +#6 [2/4] RUN apt-get install -y iptables isc-dhcp-client +#6 CACHED + +#7 [3/4] COPY modules/network/gateway/conf /testrun/conf +#7 CACHED + +#8 [4/4] COPY modules/network/gateway/bin /testrun/bin +#8 CACHED + +#9 exporting to image +#9 exporting layers done +#9 writing image sha256:d9e0f35fb9e6bb9be901e7776d89c7b9e941ad2f461f361e048e6aee948aeda3 done +#9 naming to docker.io/test-run/gateway done +#9 DONE 0.0s diff --git a/build/nmap-test.log b/build/nmap-test.log new file mode 100644 index 000000000..df5d8856b --- /dev/null +++ b/build/nmap-test.log @@ -0,0 +1,32 @@ +#1 [internal] load build definition from nmap.Dockerfile +#1 transferring dockerfile: 390B done +#1 DONE 0.0s + +#2 [internal] load .dockerignore +#2 transferring context: 2B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base-test:latest +#3 DONE 0.0s + +#4 [internal] load build context +#4 transferring context: 26.25kB done +#4 DONE 0.0s + +#5 [1/4] FROM docker.io/test-run/base-test:latest +#5 CACHED + +#6 [2/4] COPY modules/test/nmap/conf /testrun/conf +#6 DONE 0.0s + +#7 [3/4] COPY modules/test/nmap/bin /testrun/bin +#7 DONE 0.0s + +#8 [4/4] COPY modules/test/nmap/python /testrun/python +#8 DONE 0.0s + +#9 exporting to image +#9 exporting layers 0.0s done +#9 writing image sha256:27b81d6b5f2f54ec12386ba4dd97a9215aba1e816b7a7afa259657fc9469e0f1 done +#9 naming to docker.io/test-run/nmap-test done +#9 DONE 0.0s diff --git a/build/ntp.log b/build/ntp.log new file mode 100644 index 000000000..af323672b --- /dev/null +++ b/build/ntp.log @@ -0,0 +1,32 @@ +#1 [internal] load build definition from ntp.Dockerfile +#1 transferring dockerfile: 384B done +#1 DONE 0.0s + +#2 [internal] load .dockerignore +#2 transferring context: 2B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base:latest +#3 DONE 0.0s + +#4 [1/4] FROM docker.io/test-run/base:latest +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 10.82kB done +#5 DONE 0.0s + +#6 [3/4] COPY modules/network/ntp/bin /testrun/bin +#6 CACHED + +#7 [2/4] COPY modules/network/ntp/conf /testrun/conf +#7 CACHED + +#8 [4/4] COPY modules/network/ntp/python /testrun/python +#8 CACHED + +#9 exporting to image +#9 exporting layers done +#9 writing image sha256:00491819cf4eaab65cb2ae3951646dc391fee0df7cc36dc5a6b2afdc4772a6ac done +#9 naming to docker.io/test-run/ntp done +#9 DONE 0.0s diff --git a/build/radius.log b/build/radius.log new file mode 100644 index 000000000..270f75760 --- /dev/null +++ b/build/radius.log @@ -0,0 +1,44 @@ +#1 [internal] load .dockerignore +#1 transferring context: 2B done +#1 DONE 0.0s + +#2 [internal] load build definition from radius.Dockerfile +#2 transferring dockerfile: 757B done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/test-run/base:latest +#3 DONE 0.0s + +#4 [1/8] FROM docker.io/test-run/base:latest +#4 DONE 0.0s + +#5 [internal] load build context +#5 transferring context: 25.27kB done +#5 DONE 0.0s + +#6 [6/8] COPY modules/network/radius/bin /testrun/bin +#6 CACHED + +#7 [2/8] RUN apt-get update && apt-get install -y openssl freeradius git +#7 CACHED + +#8 [5/8] COPY modules/network/radius/conf /testrun/conf +#8 CACHED + +#9 [3/8] RUN git clone --branch 0.0.25 https://github.com/faucetsdn/chewie +#9 CACHED + +#10 [7/8] COPY modules/network/radius/python /testrun/python +#10 CACHED + +#11 [4/8] RUN pip3 install chewie/ +#11 CACHED + +#12 [8/8] RUN pip3 install -r /testrun/python/requirements.txt +#12 CACHED + +#13 exporting to image +#13 exporting layers done +#13 writing image sha256:444030edb8b7c90668bcea06fd1f7edb0ea121fc233d8baba0522304d97e709e done +#13 naming to docker.io/test-run/radius done +#13 DONE 0.0s diff --git a/cmd/build b/cmd/build new file mode 100755 index 000000000..77c14de74 --- /dev/null +++ b/cmd/build @@ -0,0 +1,53 @@ +#bin/bash + +NET_MODULES_DIR=modules/network +TEST_MODULES_DIR=modules/test +DEVICE_MODULES_DIR=modules/devices +BUILD_LOG_DIR=build + +rm -rf $BUILD_LOG_DIR +mkdir $BUILD_LOG_DIR + +function build_module { + echo Building module $MODULE + MODULE=$1 + MODULE_DIR=$2 + TAG=$3 + + docker build -f $MODULE_DIR/$MODULE.Dockerfile -t test-run/$TAG . &> $BUILD_LOG_DIR/$TAG.log + echo Finished building module $MODULE +} + +# Build network modules +build_module base modules/network/base base + +for f in $NET_MODULES_DIR/*; do + if [ -d "$f" ]; then + MODULE_NAME=$(basename $f) + if [ $MODULE_NAME != "base" ] && [ $MODULE_NAME != "template" ]; then + build_module $MODULE_NAME $NET_MODULES_DIR/$MODULE_NAME $MODULE_NAME + fi + fi +done + +# Build test modules +build_module base modules/test/base base-test + +for f in $TEST_MODULES_DIR/*; do + if [ -d "$f" ]; then + MODULE_NAME=$(basename $f) + if [ $MODULE_NAME != "base" ] && [ $MODULE_NAME != "template" ]; then + build_module $MODULE_NAME $TEST_MODULES_DIR/$MODULE_NAME $MODULE_NAME-test + fi + fi +done + +# Build device modules +for f in $DEVICE_MODULES_DIR/*; do + if [ -d "$f" ]; then + MODULE_NAME=$(basename $f) + if [ $MODULE_NAME != "base" ] && [ $MODULE_NAME != "template" ]; then + build_module $MODULE_NAME $DEVICE_MODULES_DIR/$MODULE_NAME $MODULE_NAME + fi + fi +done \ No newline at end of file From 90f20a78be36afabeb1cdb5657dd68f5c99e14f4 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Wed, 14 Jun 2023 15:16:43 +0100 Subject: [PATCH 5/8] Remove build logs --- .gitignore | 3 +- build/base-test.log | 41 -------- build/base.log | 41 -------- build/baseline-test.log | 32 ------ build/conn-test.log | 217 ---------------------------------------- build/dhcp-1.log | 35 ------- build/dhcp-2.log | 35 ------- build/dns-test.log | 32 ------ build/dns.log | 35 ------- build/faux-dev.log | 134 ------------------------- build/gateway.log | 32 ------ build/nmap-test.log | 32 ------ build/ntp.log | 32 ------ build/radius.log | 44 -------- 14 files changed, 2 insertions(+), 743 deletions(-) delete mode 100644 build/base-test.log delete mode 100644 build/base.log delete mode 100644 build/baseline-test.log delete mode 100644 build/conn-test.log delete mode 100644 build/dhcp-1.log delete mode 100644 build/dhcp-2.log delete mode 100644 build/dns-test.log delete mode 100644 build/dns.log delete mode 100644 build/faux-dev.log delete mode 100644 build/gateway.log delete mode 100644 build/nmap-test.log delete mode 100644 build/ntp.log delete mode 100644 build/radius.log diff --git a/.gitignore b/.gitignore index 5dfc1f6f9..ad8f26d34 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ venv/ error pylint.out local/ -__pycache__/ \ No newline at end of file +__pycache__/ +build/ \ No newline at end of file diff --git a/build/base-test.log b/build/base-test.log deleted file mode 100644 index ddc2d2c27..000000000 --- a/build/base-test.log +++ /dev/null @@ -1,41 +0,0 @@ -#1 [internal] load .dockerignore -#1 transferring context: 2B done -#1 DONE 0.0s - -#2 [internal] load build definition from base.Dockerfile -#2 transferring dockerfile: 790B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/library/ubuntu:jammy -#3 DONE 0.0s - -#4 [1/7] FROM docker.io/library/ubuntu:jammy -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 14.57kB done -#5 DONE 0.0s - -#6 [5/7] COPY modules/test/base/bin /testrun/bin -#6 CACHED - -#7 [3/7] COPY modules/test/base/python /testrun/python -#7 CACHED - -#8 [2/7] RUN apt-get update && apt-get install -y net-tools iputils-ping tcpdump iproute2 jq python3 python3-pip dos2unix nmap --fix-missing -#8 CACHED - -#9 [6/7] RUN dos2unix /testrun/bin/* -#9 CACHED - -#10 [4/7] RUN pip3 install -r /testrun/python/requirements.txt -#10 CACHED - -#11 [7/7] RUN chmod u+x /testrun/bin/* -#11 CACHED - -#12 exporting to image -#12 exporting layers done -#12 writing image sha256:b8d1e3b92f47529712192ad769331b06daabcf1f6bfe39f54fd1d48820f2cb9f done -#12 naming to docker.io/test-run/base-test done -#12 DONE 0.0s diff --git a/build/base.log b/build/base.log deleted file mode 100644 index eac1c4753..000000000 --- a/build/base.log +++ /dev/null @@ -1,41 +0,0 @@ -#1 [internal] load build definition from base.Dockerfile -#1 transferring dockerfile: 689B done -#1 DONE 0.0s - -#2 [internal] load .dockerignore -#2 transferring context: 2B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/library/ubuntu:jammy -#3 DONE 0.0s - -#4 [1/7] FROM docker.io/library/ubuntu:jammy -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 8.66kB done -#5 DONE 0.0s - -#6 [3/7] COPY modules/network/base/python /testrun/python -#6 CACHED - -#7 [4/7] RUN pip3 install -r /testrun/python/requirements.txt -#7 CACHED - -#8 [2/7] RUN apt-get update && apt-get install -y net-tools iputils-ping tcpdump iproute2 jq python3 python3-pip dos2unix -#8 CACHED - -#9 [6/7] RUN dos2unix /testrun/bin/* -#9 CACHED - -#10 [5/7] COPY modules/network/base/bin /testrun/bin -#10 CACHED - -#11 [7/7] RUN chmod u+x /testrun/bin/* -#11 CACHED - -#12 exporting to image -#12 exporting layers done -#12 writing image sha256:c01bf2973cade6e0bc97993ad3713e29ca4474836e091448058765974237d91c done -#12 naming to docker.io/test-run/base done -#12 DONE 0.0s diff --git a/build/baseline-test.log b/build/baseline-test.log deleted file mode 100644 index 5516f1ba3..000000000 --- a/build/baseline-test.log +++ /dev/null @@ -1,32 +0,0 @@ -#1 [internal] load .dockerignore -#1 transferring context: 2B done -#1 DONE 0.0s - -#2 [internal] load build definition from baseline.Dockerfile -#2 transferring dockerfile: 402B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base-test:latest -#3 DONE 0.0s - -#4 [internal] load build context -#4 transferring context: 6.10kB done -#4 DONE 0.0s - -#5 [1/4] FROM docker.io/test-run/base-test:latest -#5 DONE 0.0s - -#6 [2/4] COPY modules/test/baseline/conf /testrun/conf -#6 DONE 0.0s - -#7 [3/4] COPY modules/test/baseline/bin /testrun/bin -#7 DONE 0.0s - -#8 [4/4] COPY modules/test/baseline/python /testrun/python -#8 DONE 0.0s - -#9 exporting to image -#9 exporting layers 0.0s done -#9 writing image sha256:6bfc0ffe35bf0bb6b4f400cf8c1d2bcdd4a363a041543bf108f1ed12ffd9fda8 done -#9 naming to docker.io/test-run/baseline-test done -#9 DONE 0.0s diff --git a/build/conn-test.log b/build/conn-test.log deleted file mode 100644 index f727550a9..000000000 --- a/build/conn-test.log +++ /dev/null @@ -1,217 +0,0 @@ -#1 [internal] load build definition from conn.Dockerfile -#1 transferring dockerfile: 756B done -#1 DONE 0.0s - -#2 [internal] load .dockerignore -#2 transferring context: 2B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base-test:latest -#3 DONE 0.0s - -#4 [1/8] FROM docker.io/test-run/base-test:latest -#4 CACHED - -#5 [internal] load build context -#5 transferring context: 9.67kB done -#5 DONE 0.0s - -#6 [2/8] RUN apt-get install -y wget -#6 0.321 Reading package lists... -#6 0.749 Building dependency tree... -#6 0.852 Reading state information... -#6 0.950 The following additional packages will be installed: -#6 0.950 libpsl5 publicsuffix -#6 0.972 The following NEW packages will be installed: -#6 0.972 libpsl5 publicsuffix wget -#6 1.020 0 upgraded, 3 newly installed, 0 to remove and 11 not upgraded. -#6 1.020 Need to get 555 kB of archives. -#6 1.020 After this operation, 1443 kB of additional disk space will be used. -#6 1.020 Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libpsl5 amd64 0.21.0-1.2build2 [58.4 kB] -#6 1.046 Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 publicsuffix all 20211207.1025-1 [129 kB] -#6 1.060 Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 wget amd64 1.21.2-2ubuntu1 [367 kB] -#6 1.169 debconf: delaying package configuration, since apt-utils is not installed -#6 1.186 Fetched 555 kB in 0s (5533 kB/s) -#6 1.198 Selecting previously unselected package libpsl5:amd64. -#6 1.198 (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 17538 files and directories currently installed.) -#6 1.206 Preparing to unpack .../libpsl5_0.21.0-1.2build2_amd64.deb ... -#6 1.208 Unpacking libpsl5:amd64 (0.21.0-1.2build2) ... -#6 1.220 Selecting previously unselected package publicsuffix. -#6 1.221 Preparing to unpack .../publicsuffix_20211207.1025-1_all.deb ... -#6 1.222 Unpacking publicsuffix (20211207.1025-1) ... -#6 1.235 Selecting previously unselected package wget. -#6 1.236 Preparing to unpack .../wget_1.21.2-2ubuntu1_amd64.deb ... -#6 1.238 Unpacking wget (1.21.2-2ubuntu1) ... -#6 1.256 Setting up libpsl5:amd64 (0.21.0-1.2build2) ... -#6 1.259 Setting up wget (1.21.2-2ubuntu1) ... -#6 1.264 Setting up publicsuffix (20211207.1025-1) ... -#6 1.267 Processing triggers for libc-bin (2.35-0ubuntu3.1) ... -#6 DONE 1.3s - -#7 [3/8] RUN wget http://standards-oui.ieee.org/oui.txt -P /usr/local/etc/ -#7 0.448 --2023-06-14 13:38:32-- http://standards-oui.ieee.org/oui.txt -#7 0.448 Resolving standards-oui.ieee.org (standards-oui.ieee.org)... 140.98.223.27 -#7 0.611 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:80... connected. -#7 0.694 HTTP request sent, awaiting response... 302 Moved Temporarily -#7 0.781 Location: https://standards-oui.ieee.org/oui.txt [following] -#7 0.781 --2023-06-14 13:38:32-- https://standards-oui.ieee.org/oui.txt -#7 0.786 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:443... connected. -#7 0.955 HTTP request sent, awaiting response... 302 Moved Temporarily -#7 1.120 Location: http://standards-oui.ieee.org/oui/oui.txt [following] -#7 1.120 --2023-06-14 13:38:33-- http://standards-oui.ieee.org/oui/oui.txt -#7 1.120 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:80... connected. -#7 1.201 HTTP request sent, awaiting response... 302 Moved Temporarily -#7 1.283 Location: https://standards-oui.ieee.org/oui/oui.txt [following] -#7 1.284 --2023-06-14 13:38:33-- https://standards-oui.ieee.org/oui/oui.txt -#7 1.284 Connecting to standards-oui.ieee.org (standards-oui.ieee.org)|140.98.223.27|:443... connected. -#7 1.456 HTTP request sent, awaiting response... 200 OK -#7 1.835 Length: 5489407 (5.2M) [text/plain] -#7 1.836 Saving to: '/usr/local/etc/oui.txt' -#7 1.836 -#7 1.836 0K .......... .......... .......... .......... .......... 0% 118K 45s -#7 2.259 50K .......... .......... .......... .......... .......... 1% 155K 39s -#7 2.581 100K .......... .......... .......... .......... .......... 2% 224K 34s -#7 2.804 150K .......... .......... .......... .......... .......... 3% 270K 30s -#7 2.990 200K .......... .......... .......... .......... .......... 4% 228K 28s -#7 3.210 250K .......... .......... .......... .......... .......... 5% 266K 26s -#7 3.397 300K .......... .......... .......... .......... .......... 6% 355K 24s -#7 3.538 350K .......... .......... .......... .......... .......... 7% 336K 23s -#7 3.723 400K .......... .......... .......... .......... .......... 8% 283K 22s -#7 3.864 450K .......... .......... .......... .......... .......... 9% 336K 21s -#7 4.013 500K .......... .......... .......... .......... .......... 10% 423K 20s -#7 4.131 550K .......... .......... .......... .......... .......... 11% 399K 19s -#7 4.256 600K .......... .......... .......... .......... .......... 12% 421K 18s -#7 4.375 650K .......... .......... .......... .......... .......... 13% 390K 18s -#7 4.503 700K .......... .......... .......... .......... .......... 13% 436K 17s -#7 4.618 750K .......... .......... .......... .......... .......... 14% 399K 17s -#7 4.783 800K .......... .......... .......... .......... .......... 15% 248K 16s -#7 4.945 850K .......... .......... .......... .......... .......... 16% 399K 16s -#7 5.070 900K .......... .......... .......... .......... .......... 17% 419K 16s -#7 5.189 950K .......... .......... .......... .......... .......... 18% 383K 15s -#7 5.320 1000K .......... .......... .......... .......... .......... 19% 306K 15s -#7 5.483 1050K .......... .......... .......... .......... .......... 20% 445K 15s -#7 5.595 1100K .......... .......... .......... .......... .......... 21% 380K 14s -#7 5.727 1150K .......... .......... .......... .......... .......... 22% 447K 14s -#7 5.882 1200K .......... .......... .......... .......... .......... 23% 309K 14s -#7 6.000 1250K .......... .......... .......... .......... .......... 24% 529K 13s -#7 6.095 1300K .......... .......... .......... .......... .......... 25% 620K 13s -#7 6.176 1350K .......... .......... .......... .......... .......... 26% 431K 13s -#7 6.291 1400K .......... .......... .......... .......... .......... 27% 621K 12s -#7 6.372 1450K .......... .......... .......... .......... .......... 27% 598K 12s -#7 6.455 1500K .......... .......... .......... .......... .......... 28% 434K 12s -#7 6.571 1550K .......... .......... .......... .......... .......... 29% 619K 11s -#7 6.670 1600K .......... .......... .......... .......... .......... 30% 502K 11s -#7 6.751 1650K .......... .......... .......... .......... .......... 31% 396K 11s -#7 6.877 1700K .......... .......... .......... .......... .......... 32% 616K 11s -#7 6.959 1750K .......... .......... .......... .......... .......... 33% 611K 10s -#7 7.041 1800K .......... .......... .......... .......... .......... 34% 618K 10s -#7 7.121 1850K .......... .......... .......... .......... .......... 35% 604K 10s -#7 7.204 1900K .......... .......... .......... .......... .......... 36% 604K 10s -#7 7.287 1950K .......... .......... .......... .......... .......... 37% 610K 9s -#7 7.392 2000K .......... .......... .......... .......... .......... 38% 497K 9s -#7 7.469 2050K .......... .......... .......... .......... .......... 39% 618K 9s -#7 7.550 2100K .......... .......... .......... .......... .......... 40% 614K 9s -#7 7.632 2150K .......... .......... .......... .......... .......... 41% 834K 8s -#7 7.692 2200K .......... .......... .......... .......... .......... 41% 590K 8s -#7 7.776 2250K .......... .......... .......... .......... .......... 42% 802K 8s -#7 7.839 2300K .......... .......... .......... .......... .......... 43% 619K 8s -#7 7.920 2350K .......... .......... .......... .......... .......... 44% 618K 8s -#7 8.026 2400K .......... .......... .......... .......... .......... 45% 560K 7s -#7 8.090 2450K .......... .......... .......... .......... .......... 46% 621K 7s -#7 8.171 2500K .......... .......... .......... .......... .......... 47% 617K 7s -#7 8.252 2550K .......... .......... .......... .......... .......... 48% 1.07M 7s -#7 8.297 2600K .......... .......... .......... .......... .......... 49% 703K 7s -#7 8.368 2650K .......... .......... .......... .......... .......... 50% 607K 7s -#7 8.451 2700K .......... .......... .......... .......... .......... 51% 1.08M 6s -#7 8.496 2750K .......... .......... .......... .......... .......... 52% 983K 6s -#7 8.577 2800K .......... .......... .......... .......... .......... 53% 619K 6s -#7 8.628 2850K .......... .......... .......... .......... .......... 54% 613K 6s -#7 8.709 2900K .......... .......... .......... .......... .......... 55% 732K 6s -#7 8.778 2950K .......... .......... .......... .......... .......... 55% 848K 6s -#7 8.836 3000K .......... .......... .......... .......... .......... 56% 705K 5s -#7 8.907 3050K .......... .......... .......... .......... .......... 57% 1.04M 5s -#7 8.954 3100K .......... .......... .......... .......... .......... 58% 630K 5s -#7 9.033 3150K .......... .......... .......... .......... .......... 59% 713K 5s -#7 9.114 3200K .......... .......... .......... .......... .......... 60% 609K 5s -#7 9.186 3250K .......... .......... .......... .......... .......... 61% 856K 5s -#7 9.244 3300K .......... .......... .......... .......... .......... 62% 286K 5s -#7 9.419 3350K .......... .......... .......... .......... .......... 63% 614K 4s -#7 9.501 3400K .......... .......... .......... .......... .......... 64% 246K 4s -#7 9.704 3450K .......... .......... .......... .......... .......... 65% 409K 4s -#7 9.826 3500K .......... .......... .......... .......... .......... 66% 400K 4s -#7 9.951 3550K .......... .......... .......... .......... .......... 67% 302K 4s -#7 10.15 3600K .......... .......... .......... .......... .......... 68% 293K 4s -#7 10.29 3650K .......... .......... .......... .......... .......... 69% 458K 4s -#7 10.40 3700K .......... .......... .......... .......... .......... 69% 606K 4s -#7 10.48 3750K .......... .......... .......... .......... .......... 70% 817K 4s -#7 10.54 3800K .......... .......... .......... .......... .......... 71% 620K 3s -#7 10.62 3850K .......... .......... .......... .......... .......... 72% 617K 3s -#7 10.70 3900K .......... .......... .......... .......... .......... 73% 568K 3s -#7 10.79 3950K .......... .......... .......... .......... .......... 74% 594K 3s -#7 10.90 4000K .......... .......... .......... .......... .......... 75% 295K 3s -#7 11.04 4050K .......... .......... .......... .......... .......... 76% 453K 3s -#7 11.15 4100K .......... .......... .......... .......... .......... 77% 612K 3s -#7 11.24 4150K .......... .......... .......... .......... .......... 78% 616K 3s -#7 11.32 4200K .......... .......... .......... .......... .......... 79% 426K 3s -#7 11.43 4250K .......... .......... .......... .......... .......... 80% 616K 2s -#7 11.51 4300K .......... .......... .......... .......... .......... 81% 613K 2s -#7 11.60 4350K .......... .......... .......... .......... .......... 82% 599K 2s -#7 11.69 4400K .......... .......... .......... .......... .......... 83% 478K 2s -#7 11.78 4450K .......... .......... .......... .......... .......... 83% 550K 2s -#7 11.88 4500K .......... .......... .......... .......... .......... 84% 879K 2s -#7 11.93 4550K .......... .......... .......... .......... .......... 85% 614K 2s -#7 12.01 4600K .......... .......... .......... .......... .......... 86% 618K 2s -#7 12.09 4650K .......... .......... .......... .......... .......... 87% 716K 1s -#7 12.16 4700K .......... .......... .......... .......... .......... 88% 618K 1s -#7 12.25 4750K .......... .......... .......... .......... .......... 89% 1.02M 1s -#7 12.33 4800K .......... .......... .......... .......... .......... 90% 480K 1s -#7 12.40 4850K .......... .......... .......... .......... .......... 91% 550K 1s -#7 12.49 4900K .......... .......... .......... .......... .......... 92% 504K 1s -#7 12.59 4950K .......... .......... .......... .......... .......... 93% 1.92M 1s -#7 12.61 5000K .......... .......... .......... .......... .......... 94% 617K 1s -#7 12.69 5050K .......... .......... .......... .......... .......... 95% 647K 1s -#7 12.77 5100K .......... .......... .......... .......... .......... 96% 622K 0s -#7 12.85 5150K .......... .......... .......... .......... .......... 97% 689K 0s -#7 12.93 5200K .......... .......... .......... .......... .......... 97% 562K 0s -#7 13.01 5250K .......... .......... .......... .......... .......... 98% 674K 0s -#7 13.09 5300K .......... .......... .......... .......... .......... 99% 700K 0s -#7 13.16 5350K .......... 100% 60.6M=11s -#7 13.16 -#7 13.16 2023-06-14 13:38:45 (473 KB/s) - '/usr/local/etc/oui.txt' saved [5489407/5489407] -#7 13.16 -#7 DONE 13.2s - -#8 [4/8] COPY modules/test/conn/python/requirements.txt /testrun/python -#8 DONE 0.0s - -#9 [5/8] RUN pip3 install -r /testrun/python/requirements.txt -#9 0.759 Collecting scapy -#9 0.859 Downloading scapy-2.5.0.tar.gz (1.3 MB) -#9 0.983 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 10.6 MB/s eta 0:00:00 -#9 1.071 Preparing metadata (setup.py): started -#9 1.167 Preparing metadata (setup.py): finished with status 'done' -#9 1.170 Building wheels for collected packages: scapy -#9 1.171 Building wheel for scapy (setup.py): started -#9 1.479 Building wheel for scapy (setup.py): finished with status 'done' -#9 1.481 Created wheel for scapy: filename=scapy-2.5.0-py2.py3-none-any.whl size=1444349 sha256=4079ac6ed21f4aabd2e20e8cd4e07feac5300410d939dfb330992655f50cbb46 -#9 1.481 Stored in directory: /root/.cache/pip/wheels/82/b7/03/8344d8cf6695624746311bc0d389e9d05535ca83c35f90241d -#9 1.483 Successfully built scapy -#9 1.491 Installing collected packages: scapy -#9 2.112 Successfully installed scapy-2.5.0 -#9 2.112 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv -#9 DONE 2.2s - -#10 [6/8] COPY modules/test/conn/conf /testrun/conf -#10 DONE 0.0s - -#11 [7/8] COPY modules/test/conn/bin /testrun/bin -#11 DONE 0.0s - -#12 [8/8] COPY modules/test/conn/python /testrun/python -#12 DONE 0.0s - -#13 exporting to image -#13 exporting layers 0.1s done -#13 writing image sha256:150a8d555463cffa9dff2fcd3f8dd1b989c043a3eb8b4a5aca1e135415739496 done -#13 naming to docker.io/test-run/conn-test done -#13 DONE 0.1s diff --git a/build/dhcp-1.log b/build/dhcp-1.log deleted file mode 100644 index a5afb76d5..000000000 --- a/build/dhcp-1.log +++ /dev/null @@ -1,35 +0,0 @@ -#1 [internal] load .dockerignore -#1 transferring context: 2B done -#1 DONE 0.0s - -#2 [internal] load build definition from dhcp-1.Dockerfile -#2 transferring dockerfile: 451B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base:latest -#3 DONE 0.0s - -#4 [1/5] FROM docker.io/test-run/base:latest -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 17.83kB done -#5 DONE 0.0s - -#6 [2/5] RUN apt-get install -y isc-dhcp-server radvd -#6 CACHED - -#7 [3/5] COPY modules/network/dhcp-1/conf /testrun/conf -#7 CACHED - -#8 [4/5] COPY modules/network/dhcp-1/bin /testrun/bin -#8 CACHED - -#9 [5/5] COPY modules/network/dhcp-1/python /testrun/python -#9 CACHED - -#10 exporting to image -#10 exporting layers done -#10 writing image sha256:13bbcdc5dee7ad09e6e1feeb7f4aa2dc6901ff01e60fefdd74558ab3133f793f done -#10 naming to docker.io/test-run/dhcp-1 done -#10 DONE 0.0s diff --git a/build/dhcp-2.log b/build/dhcp-2.log deleted file mode 100644 index 5168a11a1..000000000 --- a/build/dhcp-2.log +++ /dev/null @@ -1,35 +0,0 @@ -#1 [internal] load build definition from dhcp-2.Dockerfile -#1 transferring dockerfile: 452B done -#1 DONE 0.0s - -#2 [internal] load .dockerignore -#2 transferring context: 2B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base:latest -#3 DONE 0.0s - -#4 [1/5] FROM docker.io/test-run/base:latest -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 17.78kB done -#5 DONE 0.0s - -#6 [4/5] COPY modules/network/dhcp-2/bin /testrun/bin -#6 CACHED - -#7 [2/5] RUN apt-get install -y isc-dhcp-server radvd -#7 CACHED - -#8 [3/5] COPY modules/network/dhcp-2/conf /testrun/conf -#8 CACHED - -#9 [5/5] COPY modules/network/dhcp-2/python /testrun/python -#9 CACHED - -#10 exporting to image -#10 exporting layers done -#10 writing image sha256:c1177cf17d218724f7bd6e608e80e0525e856cba71ee96b742a6f88685a446ca done -#10 naming to docker.io/test-run/dhcp-2 done -#10 DONE 0.0s diff --git a/build/dns-test.log b/build/dns-test.log deleted file mode 100644 index e028192b0..000000000 --- a/build/dns-test.log +++ /dev/null @@ -1,32 +0,0 @@ -#1 [internal] load build definition from dns.Dockerfile -#1 transferring dockerfile: 388B done -#1 DONE 0.0s - -#2 [internal] load .dockerignore -#2 transferring context: 2B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base-test:latest -#3 DONE 0.0s - -#4 [internal] load build context -#4 transferring context: 9.12kB done -#4 DONE 0.0s - -#5 [1/4] FROM docker.io/test-run/base-test:latest -#5 CACHED - -#6 [2/4] COPY modules/test/dns/conf /testrun/conf -#6 DONE 0.0s - -#7 [3/4] COPY modules/test/dns/bin /testrun/bin -#7 DONE 0.0s - -#8 [4/4] COPY modules/test/dns/python /testrun/python -#8 DONE 0.0s - -#9 exporting to image -#9 exporting layers 0.0s done -#9 writing image sha256:47bd055feb9f2181665b6bed5201184f6540a6e5e4bf964b11b1b3e584f578c1 done -#9 naming to docker.io/test-run/dns-test done -#9 DONE 0.0s diff --git a/build/dns.log b/build/dns.log deleted file mode 100644 index 69e4c004e..000000000 --- a/build/dns.log +++ /dev/null @@ -1,35 +0,0 @@ -#1 [internal] load .dockerignore -#1 transferring context: 2B done -#1 DONE 0.0s - -#2 [internal] load build definition from dns.Dockerfile -#2 transferring dockerfile: 458B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base:latest -#3 DONE 0.0s - -#4 [1/5] FROM docker.io/test-run/base:latest -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 1.86kB done -#5 DONE 0.0s - -#6 [4/5] COPY modules/network/dns/conf /testrun/conf -#6 CACHED - -#7 [2/5] RUN apt-get update --fix-missing -#7 CACHED - -#8 [3/5] RUN apt-get install -y dnsmasq -#8 CACHED - -#9 [5/5] COPY modules/network/dns/bin /testrun/bin -#9 CACHED - -#10 exporting to image -#10 exporting layers done -#10 writing image sha256:c6aa585abe7794a1ee2ec67bf29ddd17a734d810b4b355e0b896a70a5e1c38c6 done -#10 naming to docker.io/test-run/dns done -#10 DONE 0.0s diff --git a/build/faux-dev.log b/build/faux-dev.log deleted file mode 100644 index 142e4f33e..000000000 --- a/build/faux-dev.log +++ /dev/null @@ -1,134 +0,0 @@ -#1 [internal] load build definition from faux-dev.Dockerfile -#1 transferring dockerfile: 712B done -#1 DONE 0.0s - -#2 [internal] load .dockerignore -#2 transferring context: 2B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base:latest -#3 DONE 0.0s - -#4 [1/6] FROM docker.io/test-run/base:latest -#4 CACHED - -#5 [internal] load build context -#5 transferring context: 23.71kB done -#5 DONE 0.0s - -#6 [2/6] RUN apt-get update --fix-missing -#6 0.438 Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] -#6 0.588 Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease -#6 0.669 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] -#6 1.063 Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB] -#6 1.344 Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1179 kB] -#6 1.773 Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [862 kB] -#6 1.893 Fetched 2378 kB in 1s (1597 kB/s) -#6 1.893 Reading package lists... -#6 DONE 2.3s - -#7 [3/6] RUN apt-get install -y isc-dhcp-client ntp ntpdate -#7 0.461 Reading package lists... -#7 0.877 Building dependency tree... -#7 0.970 Reading state information... -#7 1.051 The following additional packages will be installed: -#7 1.051 isc-dhcp-common libdns-export1110 libedit2 libevent-core-2.1-7 -#7 1.052 libevent-pthreads-2.1-7 libisc-export1105 libopts25 sntp tzdata -#7 1.052 Suggested packages: -#7 1.052 resolvconf avahi-autoipd isc-dhcp-client-ddns ntp-doc -#7 1.088 The following NEW packages will be installed: -#7 1.088 isc-dhcp-client isc-dhcp-common libdns-export1110 libedit2 -#7 1.089 libevent-core-2.1-7 libevent-pthreads-2.1-7 libisc-export1105 libopts25 ntp -#7 1.089 ntpdate sntp tzdata -#7 1.184 0 upgraded, 12 newly installed, 0 to remove and 11 not upgraded. -#7 1.184 Need to get 2745 kB of archives. -#7 1.184 After this operation, 10.9 MB of additional disk space will be used. -#7 1.184 Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libisc-export1105 amd64 1:9.11.19+dfsg-2.1ubuntu3 [192 kB] -#7 1.237 Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libdns-export1110 amd64 1:9.11.19+dfsg-2.1ubuntu3 [827 kB] -#7 1.269 Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 isc-dhcp-client amd64 4.4.1-2.3ubuntu2.4 [235 kB] -#7 1.272 Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 isc-dhcp-common amd64 4.4.1-2.3ubuntu2.4 [45.0 kB] -#7 1.276 Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 tzdata all 2023c-0ubuntu0.22.04.2 [349 kB] -#7 1.287 Get:6 http://archive.ubuntu.com/ubuntu jammy/main amd64 libedit2 amd64 3.1-20210910-1build1 [96.8 kB] -#7 1.288 Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 libevent-core-2.1-7 amd64 2.1.12-stable-1build3 [93.9 kB] -#7 1.290 Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 libevent-pthreads-2.1-7 amd64 2.1.12-stable-1build3 [7642 B] -#7 1.290 Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libopts25 amd64 1:5.18.16-4 [59.5 kB] -#7 1.291 Get:10 http://archive.ubuntu.com/ubuntu jammy/universe amd64 ntp amd64 1:4.2.8p15+dfsg-1ubuntu2 [721 kB] -#7 1.303 Get:11 http://archive.ubuntu.com/ubuntu jammy/universe amd64 ntpdate amd64 1:4.2.8p15+dfsg-1ubuntu2 [51.5 kB] -#7 1.320 Get:12 http://archive.ubuntu.com/ubuntu jammy/universe amd64 sntp amd64 1:4.2.8p15+dfsg-1ubuntu2 [67.1 kB] -#7 1.428 debconf: delaying package configuration, since apt-utils is not installed -#7 1.445 Fetched 2745 kB in 0s (11.1 MB/s) -#7 1.457 Selecting previously unselected package libisc-export1105:amd64. -#7 1.457 (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 16650 files and directories currently installed.) -#7 1.465 Preparing to unpack .../00-libisc-export1105_1%3a9.11.19+dfsg-2.1ubuntu3_amd64.deb ... -#7 1.467 Unpacking libisc-export1105:amd64 (1:9.11.19+dfsg-2.1ubuntu3) ... -#7 1.481 Selecting previously unselected package libdns-export1110. -#7 1.482 Preparing to unpack .../01-libdns-export1110_1%3a9.11.19+dfsg-2.1ubuntu3_amd64.deb ... -#7 1.483 Unpacking libdns-export1110 (1:9.11.19+dfsg-2.1ubuntu3) ... -#7 1.501 Selecting previously unselected package isc-dhcp-client. -#7 1.502 Preparing to unpack .../02-isc-dhcp-client_4.4.1-2.3ubuntu2.4_amd64.deb ... -#7 1.503 Unpacking isc-dhcp-client (4.4.1-2.3ubuntu2.4) ... -#7 1.517 Selecting previously unselected package isc-dhcp-common. -#7 1.518 Preparing to unpack .../03-isc-dhcp-common_4.4.1-2.3ubuntu2.4_amd64.deb ... -#7 1.519 Unpacking isc-dhcp-common (4.4.1-2.3ubuntu2.4) ... -#7 1.532 Selecting previously unselected package tzdata. -#7 1.533 Preparing to unpack .../04-tzdata_2023c-0ubuntu0.22.04.2_all.deb ... -#7 1.534 Unpacking tzdata (2023c-0ubuntu0.22.04.2) ... -#7 1.660 Selecting previously unselected package libedit2:amd64. -#7 1.661 Preparing to unpack .../05-libedit2_3.1-20210910-1build1_amd64.deb ... -#7 1.663 Unpacking libedit2:amd64 (3.1-20210910-1build1) ... -#7 1.677 Selecting previously unselected package libevent-core-2.1-7:amd64. -#7 1.678 Preparing to unpack .../06-libevent-core-2.1-7_2.1.12-stable-1build3_amd64.deb ... -#7 1.679 Unpacking libevent-core-2.1-7:amd64 (2.1.12-stable-1build3) ... -#7 1.692 Selecting previously unselected package libevent-pthreads-2.1-7:amd64. -#7 1.693 Preparing to unpack .../07-libevent-pthreads-2.1-7_2.1.12-stable-1build3_amd64.deb ... -#7 1.694 Unpacking libevent-pthreads-2.1-7:amd64 (2.1.12-stable-1build3) ... -#7 1.706 Selecting previously unselected package libopts25:amd64. -#7 1.707 Preparing to unpack .../08-libopts25_1%3a5.18.16-4_amd64.deb ... -#7 1.708 Unpacking libopts25:amd64 (1:5.18.16-4) ... -#7 1.725 Selecting previously unselected package ntp. -#7 1.726 Preparing to unpack .../09-ntp_1%3a4.2.8p15+dfsg-1ubuntu2_amd64.deb ... -#7 1.728 Unpacking ntp (1:4.2.8p15+dfsg-1ubuntu2) ... -#7 1.753 Selecting previously unselected package ntpdate. -#7 1.754 Preparing to unpack .../10-ntpdate_1%3a4.2.8p15+dfsg-1ubuntu2_amd64.deb ... -#7 1.758 Unpacking ntpdate (1:4.2.8p15+dfsg-1ubuntu2) ... -#7 1.771 Selecting previously unselected package sntp. -#7 1.772 Preparing to unpack .../11-sntp_1%3a4.2.8p15+dfsg-1ubuntu2_amd64.deb ... -#7 1.773 Unpacking sntp (1:4.2.8p15+dfsg-1ubuntu2) ... -#7 1.790 Setting up libedit2:amd64 (3.1-20210910-1build1) ... -#7 1.793 Setting up libopts25:amd64 (1:5.18.16-4) ... -#7 1.796 Setting up ntpdate (1:4.2.8p15+dfsg-1ubuntu2) ... -#7 1.806 Setting up tzdata (2023c-0ubuntu0.22.04.2) ... -#7 1.859 -#7 1.859 Current default time zone: 'Etc/UTC' -#7 1.861 Local time is now: Wed Jun 14 13:38:52 UTC 2023. -#7 1.861 Universal Time is now: Wed Jun 14 13:38:52 UTC 2023. -#7 1.861 Run 'dpkg-reconfigure tzdata' if you wish to change it. -#7 1.861 -#7 1.869 Setting up libisc-export1105:amd64 (1:9.11.19+dfsg-2.1ubuntu3) ... -#7 1.872 Setting up ntp (1:4.2.8p15+dfsg-1ubuntu2) ... -#7 2.092 invoke-rc.d: could not determine current runlevel -#7 2.094 invoke-rc.d: policy-rc.d denied execution of start. -#7 2.095 Setting up libevent-core-2.1-7:amd64 (2.1.12-stable-1build3) ... -#7 2.099 Setting up isc-dhcp-common (4.4.1-2.3ubuntu2.4) ... -#7 2.102 Setting up libevent-pthreads-2.1-7:amd64 (2.1.12-stable-1build3) ... -#7 2.105 Setting up sntp (1:4.2.8p15+dfsg-1ubuntu2) ... -#7 2.110 Setting up libdns-export1110 (1:9.11.19+dfsg-2.1ubuntu3) ... -#7 2.113 Setting up isc-dhcp-client (4.4.1-2.3ubuntu2.4) ... -#7 2.126 Processing triggers for libc-bin (2.35-0ubuntu3.1) ... -#7 DONE 2.2s - -#8 [4/6] COPY modules/devices/faux-dev/conf /testrun/conf -#8 DONE 0.0s - -#9 [5/6] COPY modules/devices/faux-dev/bin /testrun/bin -#9 DONE 0.0s - -#10 [6/6] COPY modules/devices/faux-dev/python /testrun/python -#10 DONE 0.0s - -#11 exporting to image -#11 exporting layers -#11 exporting layers 0.1s done -#11 writing image sha256:cbc362a323757c49cc4853438f8a9fec4c75acbc5b9f1bf8cb4c06c126322aaa done -#11 naming to docker.io/test-run/faux-dev done -#11 DONE 0.1s diff --git a/build/gateway.log b/build/gateway.log deleted file mode 100644 index 2cbcfcef9..000000000 --- a/build/gateway.log +++ /dev/null @@ -1,32 +0,0 @@ -#1 [internal] load .dockerignore -#1 transferring context: 2B done -#1 DONE 0.0s - -#2 [internal] load build definition from gateway.Dockerfile -#2 transferring dockerfile: 387B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base:latest -#3 DONE 0.0s - -#4 [1/4] FROM docker.io/test-run/base:latest -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 1.59kB done -#5 DONE 0.0s - -#6 [2/4] RUN apt-get install -y iptables isc-dhcp-client -#6 CACHED - -#7 [3/4] COPY modules/network/gateway/conf /testrun/conf -#7 CACHED - -#8 [4/4] COPY modules/network/gateway/bin /testrun/bin -#8 CACHED - -#9 exporting to image -#9 exporting layers done -#9 writing image sha256:d9e0f35fb9e6bb9be901e7776d89c7b9e941ad2f461f361e048e6aee948aeda3 done -#9 naming to docker.io/test-run/gateway done -#9 DONE 0.0s diff --git a/build/nmap-test.log b/build/nmap-test.log deleted file mode 100644 index df5d8856b..000000000 --- a/build/nmap-test.log +++ /dev/null @@ -1,32 +0,0 @@ -#1 [internal] load build definition from nmap.Dockerfile -#1 transferring dockerfile: 390B done -#1 DONE 0.0s - -#2 [internal] load .dockerignore -#2 transferring context: 2B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base-test:latest -#3 DONE 0.0s - -#4 [internal] load build context -#4 transferring context: 26.25kB done -#4 DONE 0.0s - -#5 [1/4] FROM docker.io/test-run/base-test:latest -#5 CACHED - -#6 [2/4] COPY modules/test/nmap/conf /testrun/conf -#6 DONE 0.0s - -#7 [3/4] COPY modules/test/nmap/bin /testrun/bin -#7 DONE 0.0s - -#8 [4/4] COPY modules/test/nmap/python /testrun/python -#8 DONE 0.0s - -#9 exporting to image -#9 exporting layers 0.0s done -#9 writing image sha256:27b81d6b5f2f54ec12386ba4dd97a9215aba1e816b7a7afa259657fc9469e0f1 done -#9 naming to docker.io/test-run/nmap-test done -#9 DONE 0.0s diff --git a/build/ntp.log b/build/ntp.log deleted file mode 100644 index af323672b..000000000 --- a/build/ntp.log +++ /dev/null @@ -1,32 +0,0 @@ -#1 [internal] load build definition from ntp.Dockerfile -#1 transferring dockerfile: 384B done -#1 DONE 0.0s - -#2 [internal] load .dockerignore -#2 transferring context: 2B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base:latest -#3 DONE 0.0s - -#4 [1/4] FROM docker.io/test-run/base:latest -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 10.82kB done -#5 DONE 0.0s - -#6 [3/4] COPY modules/network/ntp/bin /testrun/bin -#6 CACHED - -#7 [2/4] COPY modules/network/ntp/conf /testrun/conf -#7 CACHED - -#8 [4/4] COPY modules/network/ntp/python /testrun/python -#8 CACHED - -#9 exporting to image -#9 exporting layers done -#9 writing image sha256:00491819cf4eaab65cb2ae3951646dc391fee0df7cc36dc5a6b2afdc4772a6ac done -#9 naming to docker.io/test-run/ntp done -#9 DONE 0.0s diff --git a/build/radius.log b/build/radius.log deleted file mode 100644 index 270f75760..000000000 --- a/build/radius.log +++ /dev/null @@ -1,44 +0,0 @@ -#1 [internal] load .dockerignore -#1 transferring context: 2B done -#1 DONE 0.0s - -#2 [internal] load build definition from radius.Dockerfile -#2 transferring dockerfile: 757B done -#2 DONE 0.0s - -#3 [internal] load metadata for docker.io/test-run/base:latest -#3 DONE 0.0s - -#4 [1/8] FROM docker.io/test-run/base:latest -#4 DONE 0.0s - -#5 [internal] load build context -#5 transferring context: 25.27kB done -#5 DONE 0.0s - -#6 [6/8] COPY modules/network/radius/bin /testrun/bin -#6 CACHED - -#7 [2/8] RUN apt-get update && apt-get install -y openssl freeradius git -#7 CACHED - -#8 [5/8] COPY modules/network/radius/conf /testrun/conf -#8 CACHED - -#9 [3/8] RUN git clone --branch 0.0.25 https://github.com/faucetsdn/chewie -#9 CACHED - -#10 [7/8] COPY modules/network/radius/python /testrun/python -#10 CACHED - -#11 [4/8] RUN pip3 install chewie/ -#11 CACHED - -#12 [8/8] RUN pip3 install -r /testrun/python/requirements.txt -#12 CACHED - -#13 exporting to image -#13 exporting layers done -#13 writing image sha256:444030edb8b7c90668bcea06fd1f7edb0ea121fc233d8baba0522304d97e709e done -#13 naming to docker.io/test-run/radius done -#13 DONE 0.0s From b99270a74169d468c9465232ceb03a933b6e8e5c Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Wed, 14 Jun 2023 09:21:51 -0600 Subject: [PATCH 6/8] Update base and template docker files to fit the new format Implement a template option on network modules Fix skipping of base image build --- framework/python/src/net_orc/network_orchestrator.py | 12 ++++++++++-- modules/network/base/base.Dockerfile | 7 +++++-- modules/network/template/conf/module_config.json | 1 + modules/network/template/template.Dockerfile | 11 +++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/framework/python/src/net_orc/network_orchestrator.py b/framework/python/src/net_orc/network_orchestrator.py index 805bdcd79..255435ad3 100644 --- a/framework/python/src/net_orc/network_orchestrator.py +++ b/framework/python/src/net_orc/network_orchestrator.py @@ -26,6 +26,7 @@ import threading import docker from docker.types import Mount +from collections import OrderedDict from common import logger from common import util from net_orc.listener import Listener @@ -415,6 +416,11 @@ def _load_network_module(self, module_dir): net_module.enable_container = net_module_json['config']['docker'][ 'enable_container'] + # Determine if this is a template + if 'template' in net_module_json['config']['docker']: + net_module.template = net_module_json['config']['docker'][ + 'template'] + # Load network service networking configuration if net_module.enable_container: @@ -434,13 +440,14 @@ def _load_network_module(self, module_dir): net_module.net_config.ip_index] net_module.net_config.ipv6_network = self.network_config.ipv6_network - self._net_modules.append(net_module) + self._net_modules.append(net_module) return net_module def build_network_modules(self): LOGGER.info('Building network modules...') for net_module in self._net_modules: - self._build_module(net_module) + if not net_module.template: + self._build_module(net_module) def _build_module(self, net_module): LOGGER.debug('Building network module ' + net_module.dir_name) @@ -788,6 +795,7 @@ def __init__(self): self.container = None self.container_name = None self.image_name = None + self.template = False # Absolute path self.dir = None diff --git a/modules/network/base/base.Dockerfile b/modules/network/base/base.Dockerfile index 31a5e99de..d14713c59 100644 --- a/modules/network/base/base.Dockerfile +++ b/modules/network/base/base.Dockerfile @@ -1,17 +1,20 @@ # Image name: test-run/base FROM ubuntu:jammy +ARG MODULE_NAME=base +ARG MODULE_DIR=modules/network/$MODULE_NAME + # Install common software RUN apt-get update && apt-get install -y net-tools iputils-ping tcpdump iproute2 jq python3 python3-pip dos2unix # Setup the base python requirements -COPY modules/network/base/python /testrun/python +COPY $MODULE_DIR/python /testrun/python # Install all python requirements for the module RUN pip3 install -r /testrun/python/requirements.txt # Add the bin files -COPY modules/network/base/bin /testrun/bin +COPY $MODULE_DIR/bin /testrun/bin # Remove incorrect line endings RUN dos2unix /testrun/bin/* diff --git a/modules/network/template/conf/module_config.json b/modules/network/template/conf/module_config.json index c767c9ad6..e702e1804 100644 --- a/modules/network/template/conf/module_config.json +++ b/modules/network/template/conf/module_config.json @@ -15,6 +15,7 @@ }, "docker": { "enable_container": false, + "template":true, "depends_on": "base", "mounts": [ { diff --git a/modules/network/template/template.Dockerfile b/modules/network/template/template.Dockerfile index 45f9da6d9..9efbfb230 100644 --- a/modules/network/template/template.Dockerfile +++ b/modules/network/template/template.Dockerfile @@ -1,11 +1,14 @@ # Image name: test-run/template FROM test-run/base:latest +ARG MODULE_NAME=template +ARG MODULE_DIR=modules/network/$MODULE_NAME + # Copy over all configuration files -COPY network/modules/template/conf /testrun/conf +COPY $MODULE_DIR/conf /testrun/conf -# Load device binary files -COPY network/modules/template/bin /testrun/bin +# Copy over all binary files +COPY $MODULE_DIR/bin /testrun/bin # Copy over all python files -COPY network/modules/template/python /testrun/python \ No newline at end of file +COPY $MODULE_DIR/python /testrun/python \ No newline at end of file From e77026d71b74d5b3a6d86272fc2f160829ffa6f1 Mon Sep 17 00:00:00 2001 From: jhughesbiot Date: Wed, 14 Jun 2023 11:42:41 -0600 Subject: [PATCH 7/8] remove base image build in ci --- testing/test_baseline | 3 --- 1 file changed, 3 deletions(-) diff --git a/testing/test_baseline b/testing/test_baseline index 74218e2bd..00ea84ee0 100755 --- a/testing/test_baseline +++ b/testing/test_baseline @@ -18,9 +18,6 @@ sudo docker network create -d macvlan -o parent=endev0b endev0 # Start OVS sudo /usr/share/openvswitch/scripts/ovs-ctl start -# Fix due to ordering -sudo docker build ./modules/network -t test-run/base -f modules/network/base/base.Dockerfile - # Build Test Container sudo docker build ./testing/docker/ci_baseline -t ci1 -f ./testing/docker/ci_baseline/Dockerfile From 129ceefaf847c5dfc3cd155002f39cfd447e2d33 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Thu, 15 Jun 2023 13:06:42 +0100 Subject: [PATCH 8/8] Remove group from chown --- cmd/build | 53 ------------------- .../src/net_orc/network_orchestrator.py | 2 +- .../python/src/net_orc/network_validator.py | 17 +++--- .../python/src/test_orc/test_orchestrator.py | 10 ++-- .../faux-dev/bin/start_network_service | 2 +- modules/network/base/bin/capture | 2 +- .../network/dhcp-1/bin/start_network_service | 4 +- .../network/dhcp-2/bin/start_network_service | 4 +- modules/network/ntp/bin/start_network_service | 2 +- .../network/radius/bin/start_network_service | 2 +- modules/test/base/bin/capture | 2 +- modules/test/base/bin/start_module | 2 +- modules/test/baseline/bin/start_test_module | 4 +- modules/test/conn/bin/start_test_module | 4 +- modules/test/dns/bin/start_test_module | 4 +- modules/test/nmap/bin/start_test_module | 4 +- testing/test_baseline | 2 + 17 files changed, 34 insertions(+), 86 deletions(-) delete mode 100755 cmd/build diff --git a/cmd/build b/cmd/build deleted file mode 100755 index 77c14de74..000000000 --- a/cmd/build +++ /dev/null @@ -1,53 +0,0 @@ -#bin/bash - -NET_MODULES_DIR=modules/network -TEST_MODULES_DIR=modules/test -DEVICE_MODULES_DIR=modules/devices -BUILD_LOG_DIR=build - -rm -rf $BUILD_LOG_DIR -mkdir $BUILD_LOG_DIR - -function build_module { - echo Building module $MODULE - MODULE=$1 - MODULE_DIR=$2 - TAG=$3 - - docker build -f $MODULE_DIR/$MODULE.Dockerfile -t test-run/$TAG . &> $BUILD_LOG_DIR/$TAG.log - echo Finished building module $MODULE -} - -# Build network modules -build_module base modules/network/base base - -for f in $NET_MODULES_DIR/*; do - if [ -d "$f" ]; then - MODULE_NAME=$(basename $f) - if [ $MODULE_NAME != "base" ] && [ $MODULE_NAME != "template" ]; then - build_module $MODULE_NAME $NET_MODULES_DIR/$MODULE_NAME $MODULE_NAME - fi - fi -done - -# Build test modules -build_module base modules/test/base base-test - -for f in $TEST_MODULES_DIR/*; do - if [ -d "$f" ]; then - MODULE_NAME=$(basename $f) - if [ $MODULE_NAME != "base" ] && [ $MODULE_NAME != "template" ]; then - build_module $MODULE_NAME $TEST_MODULES_DIR/$MODULE_NAME $MODULE_NAME-test - fi - fi -done - -# Build device modules -for f in $DEVICE_MODULES_DIR/*; do - if [ -d "$f" ]; then - MODULE_NAME=$(basename $f) - if [ $MODULE_NAME != "base" ] && [ $MODULE_NAME != "template" ]; then - build_module $MODULE_NAME $DEVICE_MODULES_DIR/$MODULE_NAME $MODULE_NAME - fi - fi -done \ No newline at end of file diff --git a/framework/python/src/net_orc/network_orchestrator.py b/framework/python/src/net_orc/network_orchestrator.py index 255435ad3..f1f479742 100644 --- a/framework/python/src/net_orc/network_orchestrator.py +++ b/framework/python/src/net_orc/network_orchestrator.py @@ -185,7 +185,7 @@ def _device_discovered(self, mac_addr): TEST_DIR, device.mac_addr.replace(':', '')) os.makedirs(device_runtime_dir) - util.run_command(f'chown -R {self._host_user}:{self._host_user} {device_runtime_dir}') + util.run_command(f'chown -R {self._host_user} {device_runtime_dir}') packet_capture = sniff(iface=self._dev_intf, timeout=self._startup_timeout, diff --git a/framework/python/src/net_orc/network_validator.py b/framework/python/src/net_orc/network_validator.py index 5f9d132b4..4ee46124d 100644 --- a/framework/python/src/net_orc/network_validator.py +++ b/framework/python/src/net_orc/network_validator.py @@ -49,11 +49,11 @@ def __init__(self): def start(self): """Start the network validator.""" LOGGER.debug('Starting validator') - + # Setup the output directory host_user = self._get_host_user() os.makedirs(OUTPUT_DIR, exist_ok=True) - util.run_command(f'chown -R {host_user}:{host_user} {OUTPUT_DIR}') + util.run_command(f'chown -R {host_user} {OUTPUT_DIR}') self._load_devices() self._build_network_devices() @@ -92,7 +92,6 @@ def _load_devices(self): for module_dir in os.listdir(self._device_dir): - LOGGER.info("Module Dir: " + module_dir) device = FauxDevice() # Load basic module information @@ -177,24 +176,24 @@ def _start_network_device(self, device): def _get_host_user(self): user = self._get_os_user() - + # If primary method failed, try secondary if user is None: user = self._get_user() - LOGGER.debug("Network validator host user: " + user) + LOGGER.debug(f'Network validator host user: {user}') return user def _get_os_user(self): user = None try: user = os.getlogin() - except OSError as e: + except OSError: # Handle the OSError exception - LOGGER.error("An OS error occurred while retrieving the login name.") - except Exception as e: + LOGGER.error('An OS error occurred while retrieving the login name.') + except Exception as error: # Catch any other unexpected exceptions - LOGGER.error("An exception occurred:", e) + LOGGER.error('An exception occurred:', error) return user def _get_user(self): diff --git a/framework/python/src/test_orc/test_orchestrator.py b/framework/python/src/test_orc/test_orchestrator.py index 4c8a559fa..58c1944f8 100644 --- a/framework/python/src/test_orc/test_orchestrator.py +++ b/framework/python/src/test_orc/test_orchestrator.py @@ -57,11 +57,11 @@ def __init__(self, net_orc): def start(self): LOGGER.debug("Starting test orchestrator") - + # Setup the output directory self._host_user = self._get_host_user() os.makedirs(RUNTIME_DIR, exist_ok=True) - util.run_command(f'chown -R {self._host_user}:{self._host_user} {RUNTIME_DIR}') + util.run_command(f'chown -R {self._host_user} {RUNTIME_DIR}') self._load_test_modules() self.build_test_modules() @@ -113,7 +113,7 @@ def _generate_results(self, device): "runtime/test/" + device.mac_addr.replace(":", "") + "/results.json") with open(out_file, "w", encoding="utf-8") as f: json.dump(results, f, indent=2) - util.run_command(f'chown -R {self._host_user}:{self._host_user} {out_file}') + util.run_command(f'chown -R {self._host_user} {out_file}') return results def test_in_progress(self): @@ -149,12 +149,12 @@ def _run_test_module(self, module, device): device_startup_capture = os.path.join( self._root_path, "runtime/test/" + device.mac_addr.replace(":", "") + "/startup.pcap") - util.run_command(f'chown -R {self._host_user}:{self._host_user} {device_startup_capture}') + util.run_command(f'chown -R {self._host_user} {device_startup_capture}') device_monitor_capture = os.path.join( self._root_path, "runtime/test/" + device.mac_addr.replace(":", "") + "/monitor.pcap") - util.run_command(f'chown -R {self._host_user}:{self._host_user} {device_monitor_capture}') + util.run_command(f'chown -R {self._host_user} {device_monitor_capture}') client = docker.from_env() diff --git a/modules/devices/faux-dev/bin/start_network_service b/modules/devices/faux-dev/bin/start_network_service index 13e2f6baf..80a587684 100644 --- a/modules/devices/faux-dev/bin/start_network_service +++ b/modules/devices/faux-dev/bin/start_network_service @@ -27,7 +27,7 @@ LOG_FILE=$OUTPUT_DIR/$MODULE_NAME.log RESULT_FILE=$OUTPUT_DIR/result.json touch $LOG_FILE touch $RESULT_FILE -chown -R $HOST_USER:$HOST_USER $OUTPUT_DIR +chown -R $HOST_USER $OUTPUT_DIR # Start dhclient $BIN_DIR/start_dhcp_client $INTF diff --git a/modules/network/base/bin/capture b/modules/network/base/bin/capture index 8a8430feb..bc6c425e5 100644 --- a/modules/network/base/bin/capture +++ b/modules/network/base/bin/capture @@ -23,7 +23,7 @@ fi # Create the output directory and start the capture mkdir -p $PCAP_DIR -chown $HOST_USER:$HOST_USER $PCAP_DIR +chown $HOST_USER $PCAP_DIR tcpdump -i $INTERFACE -w $PCAP_DIR/$PCAP_FILE -Z $HOST_USER & #Small pause to let the capture to start diff --git a/modules/network/dhcp-1/bin/start_network_service b/modules/network/dhcp-1/bin/start_network_service index e8e0ad06c..a60806684 100644 --- a/modules/network/dhcp-1/bin/start_network_service +++ b/modules/network/dhcp-1/bin/start_network_service @@ -21,8 +21,8 @@ mkdir /var/run/radvd #Create and set permissions on the log files touch $DHCP_LOG_FILE touch $RA_LOG_FILE -chown $HOST_USER:$HOST_USER $DHCP_LOG_FILE -chown $HOST_USER:$HOST_USER $RA_LOG_FILE +chown $HOST_USER $DHCP_LOG_FILE +chown $HOST_USER $RA_LOG_FILE #Move the config files to the correct location diff --git a/modules/network/dhcp-2/bin/start_network_service b/modules/network/dhcp-2/bin/start_network_service index d58174695..ad5ff09e7 100644 --- a/modules/network/dhcp-2/bin/start_network_service +++ b/modules/network/dhcp-2/bin/start_network_service @@ -21,8 +21,8 @@ mkdir /var/run/radvd #Create and set permissions on the log files touch $DHCP_LOG_FILE touch $RA_LOG_FILE -chown $HOST_USER:$HOST_USER $DHCP_LOG_FILE -chown $HOST_USER:$HOST_USER $RA_LOG_FILE +chown $HOST_USER $DHCP_LOG_FILE +chown $HOST_USER $RA_LOG_FILE #Move the config files to the correct location diff --git a/modules/network/ntp/bin/start_network_service b/modules/network/ntp/bin/start_network_service index 4c0c5dc74..b20cf8831 100644 --- a/modules/network/ntp/bin/start_network_service +++ b/modules/network/ntp/bin/start_network_service @@ -7,7 +7,7 @@ echo Starting ntp #Create and set permissions on the log file touch $LOG_FILE -chown $HOST_USER:$HOST_USER $LOG_FILE +chown $HOST_USER $LOG_FILE #Start the NTP server python3 -u $PYTHON_SRC_DIR/ntp_server.py > $LOG_FILE diff --git a/modules/network/radius/bin/start_network_service b/modules/network/radius/bin/start_network_service index e27a828dd..399a90ae5 100644 --- a/modules/network/radius/bin/start_network_service +++ b/modules/network/radius/bin/start_network_service @@ -15,6 +15,6 @@ python3 -u $PYTHON_SRC_DIR/authenticator.py & #Create and set permissions on the log file touch $LOG_FILE -chown $HOST_USER:$HOST_USER $LOG_FILE +chown $HOST_USER $LOG_FILE freeradius -f -X &> $LOG_FILE \ No newline at end of file diff --git a/modules/test/base/bin/capture b/modules/test/base/bin/capture index facb6acf7..45cfcd42f 100644 --- a/modules/test/base/bin/capture +++ b/modules/test/base/bin/capture @@ -12,7 +12,7 @@ INTERFACE=$2 # Create the output directory and start the capture mkdir -p $PCAP_DIR -chown $HOST_USER:$HOST_USER $PCAP_DIR +chown $HOST_USER $PCAP_DIR tcpdump -i $INTERFACE -w $PCAP_DIR/$PCAP_FILE -Z $HOST_USER & # Small pause to let the capture to start diff --git a/modules/test/base/bin/start_module b/modules/test/base/bin/start_module index c179668ba..3e4737d8b 100644 --- a/modules/test/base/bin/start_module +++ b/modules/test/base/bin/start_module @@ -15,7 +15,7 @@ IFACE=veth0 useradd $HOST_USER # Set permissions on the output files -chown -R $HOST_USER:$HOST_USER $OUTPUT_DIR +chown -R $HOST_USER $OUTPUT_DIR # Enable IPv6 for all containers sysctl net.ipv6.conf.all.disable_ipv6=0 diff --git a/modules/test/baseline/bin/start_test_module b/modules/test/baseline/bin/start_test_module index 2938eb0f8..a09349cf9 100644 --- a/modules/test/baseline/bin/start_test_module +++ b/modules/test/baseline/bin/start_test_module @@ -31,8 +31,8 @@ LOG_FILE=/runtime/output/$MODULE_NAME.log RESULT_FILE=/runtime/output/$MODULE_NAME-result.json touch $LOG_FILE touch $RESULT_FILE -chown $HOST_USER:$HOST_USER $LOG_FILE -chown $HOST_USER:$HOST_USER $RESULT_FILE +chown $HOST_USER $LOG_FILE +chown $HOST_USER $RESULT_FILE # Run the python scrip that will execute the tests for this module # -u flag allows python print statements diff --git a/modules/test/conn/bin/start_test_module b/modules/test/conn/bin/start_test_module index 4550849ce..8290c0764 100644 --- a/modules/test/conn/bin/start_test_module +++ b/modules/test/conn/bin/start_test_module @@ -28,8 +28,8 @@ LOG_FILE=/runtime/output/$MODULE_NAME.log RESULT_FILE=/runtime/output/$MODULE_NAME-result.json touch $LOG_FILE touch $RESULT_FILE -chown $HOST_USER:$HOST_USER $LOG_FILE -chown $HOST_USER:$HOST_USER $RESULT_FILE +chown $HOST_USER $LOG_FILE +chown $HOST_USER $RESULT_FILE # Run the python scrip that will execute the tests for this module # -u flag allows python print statements diff --git a/modules/test/dns/bin/start_test_module b/modules/test/dns/bin/start_test_module index 2938eb0f8..a09349cf9 100644 --- a/modules/test/dns/bin/start_test_module +++ b/modules/test/dns/bin/start_test_module @@ -31,8 +31,8 @@ LOG_FILE=/runtime/output/$MODULE_NAME.log RESULT_FILE=/runtime/output/$MODULE_NAME-result.json touch $LOG_FILE touch $RESULT_FILE -chown $HOST_USER:$HOST_USER $LOG_FILE -chown $HOST_USER:$HOST_USER $RESULT_FILE +chown $HOST_USER $LOG_FILE +chown $HOST_USER $RESULT_FILE # Run the python scrip that will execute the tests for this module # -u flag allows python print statements diff --git a/modules/test/nmap/bin/start_test_module b/modules/test/nmap/bin/start_test_module index 4bb7e9f96..333566342 100644 --- a/modules/test/nmap/bin/start_test_module +++ b/modules/test/nmap/bin/start_test_module @@ -31,8 +31,8 @@ LOG_FILE=/runtime/output/$MODULE_NAME.log RESULT_FILE=/runtime/output/$MODULE_NAME-result.json touch $LOG_FILE touch $RESULT_FILE -chown $HOST_USER:$HOST_USER $LOG_FILE -chown $HOST_USER:$HOST_USER $RESULT_FILE +chown $HOST_USER $LOG_FILE +chown $HOST_USER $RESULT_FILE # Run the python scrip that will execute the tests for this module # -u flag allows python print statements diff --git a/testing/test_baseline b/testing/test_baseline index 00ea84ee0..bf191b88f 100755 --- a/testing/test_baseline +++ b/testing/test_baseline @@ -3,6 +3,8 @@ TESTRUN_OUT=/tmp/testrun.log +ifconfig + # Setup requirements sudo apt-get update sudo apt-get install openvswitch-common openvswitch-switch tcpdump jq moreutils coreutils