Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cmd/build
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ fi

# Build network modules
echo Building network modules
mkdir -p build/network
for dir in modules/network/* ; do
module=$(basename $dir)
echo Building network module $module...
Expand All @@ -74,7 +73,6 @@ done

# Build validators
echo Building network validators
mkdir -p build/devices
for dir in modules/devices/* ; do
module=$(basename $dir)
echo Building validator module $module...
Expand All @@ -88,7 +86,6 @@ done

# Build test modules
echo Building test modules
mkdir -p build/test
for dir in modules/test/* ; do
module=$(basename $dir)
echo Building test module $module...
Expand Down
9 changes: 8 additions & 1 deletion framework/python/src/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Provides basic utilities for the network orchestrator."""
"""Provides basic utilities for Testrun."""
import getpass
import os
import subprocess
Expand Down Expand Up @@ -52,12 +52,15 @@ def run_command(cmd, output=True, timeout=None):


def interface_exists(interface):
"""Checks whether an interface is available"""
return interface in netifaces.interfaces()

def prettify(mac_string):
"""Formats a MAC address with colons"""
return ':'.join([f'{ord(b):02x}' for b in mac_string])

def get_host_user():
"""Returns the username of the host user"""
user = get_os_user()

# If primary method failed, try secondary
Expand All @@ -67,6 +70,7 @@ def get_host_user():
return user

def get_os_user():
"""Attempts to get the username using os library"""
user = None
try:
user = os.getlogin()
Expand All @@ -79,6 +83,7 @@ def get_os_user():
return user

def get_user():
"""Attempts to get the host user using the getpass library"""
user = None
try:
user = getpass.getuser()
Expand All @@ -97,9 +102,11 @@ def get_user():
return user

def set_file_owner(path, owner):
"""Change the owner of a file"""
run_command(f'chown -R {owner} {path}')

def get_module_display_name(search):
"""Returns the display name of a test module"""
modules = {
'ntp': 'NTP',
'dns': 'DNS',
Expand Down
2 changes: 1 addition & 1 deletion modules/devices/faux-dev/bin/start_network_service
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ else
INTF=$DEFINED_IFACE
fi

#Create and set permissions on the output files
# Create and set permissions on the output files
OUTPUT_DIR=/runtime/validation/
LOG_FILE=$OUTPUT_DIR/$MODULE_NAME.log
RESULT_FILE=$OUTPUT_DIR/result.json
Expand Down
5 changes: 3 additions & 2 deletions modules/devices/faux-dev/faux-dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ FROM testrun/base:latest

ARG MODULE_NAME=faux-dev
ARG MODULE_DIR=modules/devices/$MODULE_NAME
ARG COMMON_DIR=framework/python/src/common

#Update and get all additional requirements not contained in the base image
# Update and get all additional requirements not contained in the base image
RUN apt-get update --fix-missing

# NTP requireds interactive installation so we're going to turn that off
Expand All @@ -34,4 +35,4 @@ COPY $MODULE_DIR/conf /testrun/conf
COPY $MODULE_DIR/bin /testrun/bin

# Copy over all python files
COPY $MODULE_DIR/python /testrun/python
COPY $MODULE_DIR/python /testrun/python
61 changes: 0 additions & 61 deletions modules/devices/faux-dev/python/src/logger.py

This file was deleted.

48 changes: 0 additions & 48 deletions modules/devices/faux-dev/python/src/util.py

This file was deleted.

2 changes: 1 addition & 1 deletion modules/network/base/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ RUN dos2unix /testrun/bin/*
# Make sure all the bin files are executable
RUN chmod u+x /testrun/bin/*

#Start the network module
# Start the network module
ENTRYPOINT [ "/testrun/bin/start_module" ]
Loading