diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index b2a731395..d83e986b5 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -387,6 +387,9 @@ async def stop(self): # First, change the status to stopping self.get_session().stop() + # First, change the status to stopping + self.get_session().stop() + # Prevent discovering new devices whilst stopping if self.get_net_orc().get_listener() is not None: self.get_net_orc().get_listener().stop_listener() diff --git a/make/DEBIAN/control b/make/DEBIAN/control index c45dd27c9..73c58c6d5 100644 --- a/make/DEBIAN/control +++ b/make/DEBIAN/control @@ -1,5 +1,5 @@ Package: Testrun -Version: 2.2 +Version: 2.2.1 Architecture: amd64 Maintainer: Google Homepage: https://github.com/google/testrun diff --git a/modules/test/dns/README.md b/modules/test/dns/README.md index 4b258b861..5004f1297 100644 --- a/modules/test/dns/README.md +++ b/modules/test/dns/README.md @@ -16,4 +16,4 @@ Within the ```python/src``` directory, the below tests are executed. |---|---|---|---| | dns.network.hostname_resolution | Verifies that the device resolves hostnames | The device sends DNS requests | Required | | dns.network.from_dhcp | Verifies that the device allows for a DNS server to be provided by the DHCP server | The device sends DNS requests to the DNS server provided by the DHCP server | Informational | -| dns.mdns | Does the device has MDNS | Device may send MDNS requests | Informational | \ No newline at end of file +| dns.mdns | Does the device has MDNS | Device may send MDNS requests | Informational | diff --git a/modules/test/ntp/python/requirements.txt b/modules/test/ntp/python/requirements.txt index 4ced40f0d..8db6005a1 100644 --- a/modules/test/ntp/python/requirements.txt +++ b/modules/test/ntp/python/requirements.txt @@ -1,7 +1,7 @@ -# Dependencies to user defined packages -# Package dependencies should always be defined before the user defined -# packages to prevent auto-upgrades of stable dependencies - -# User defined packages -scapy==2.6.0 -pyshark==0.6 +# Dependencies to user defined packages +# Package dependencies should always be defined before the user defined +# packages to prevent auto-upgrades of stable dependencies + +# User defined packages +scapy==2.6.0 +pyshark==0.6 diff --git a/modules/ui/package-lock.json b/modules/ui/package-lock.json index ba5634320..ecff46dbf 100644 --- a/modules/ui/package-lock.json +++ b/modules/ui/package-lock.json @@ -16487,4 +16487,4 @@ "integrity": "sha512-9oxn0IIjbCZkJ67L+LkhYWRyAy7axphb3VgE2MBDlOqnmHMPWGYMxJxBYFueFq/JGY2GMwS0rU+UCLunEmy5UA==" } } -} +} \ No newline at end of file diff --git a/testing/device_configs/bacnet_compliant/device_config.json b/testing/device_configs/bacnet_compliant/device_config.json new file mode 100644 index 000000000..2ac6fc3e2 --- /dev/null +++ b/testing/device_configs/bacnet_compliant/device_config.json @@ -0,0 +1,54 @@ +{ + "mac_addr": "02:42:aa:00:00:01", + "manufacturer": "Google", + "model": "BACnet Compliant", + "type": "IoT Gateway", + "technology": "Hardware - Access Control", + "test_pack": "Pilot Assessment", + "additional_info": [ + { + "question": "What type of device is this?", + "answer": "IoT Gateway" + }, + { + "question": "Please select the technology this device falls into", + "answer": "Hardware - Access Control" + }, + { + "question": "Does your device process any sensitive information?", + "answer": "Yes" + }, + { + "question": "Can all non-essential services be disabled on your device?", + "answer": "Yes" + }, + { + "question": "Is there a second IP port on the device?", + "answer": "Yes" + }, + { + "question": "Can the second IP port on your device be disabled?", + "answer": "Yes" + } + ], + "test_modules": { + "protocol": { + "enabled": true + }, + "services": { + "enabled": false + }, + "ntp": { + "enabled": false + }, + "tls": { + "enabled": false + }, + "connection": { + "enabled": false + }, + "dns": { + "enabled": false + } + } +} diff --git a/testing/docker/ci_test_device1/bacnet_compliant/Dockerfile b/testing/docker/ci_test_device1/bacnet_compliant/Dockerfile new file mode 100644 index 000000000..f2ce5abd1 --- /dev/null +++ b/testing/docker/ci_test_device1/bacnet_compliant/Dockerfile @@ -0,0 +1,24 @@ +# Use Ubuntu base image +FROM ubuntu@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d431118c7dd060a74 + +# Set non-interactive mode for apt +ENV DEBIAN_FRONTEND=noninteractive + +# Install dependencies +RUN apt-get update && \ + apt-get install -y isc-dhcp-client dnsutils netcat-openbsd arping python3 python3-pip && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install dependencies (BAC0) +RUN pip install BAC0==23.7.3 pytz==2024.2 netifaces==0.11.0 + +# Copy scripts +WORKDIR /app +COPY entrypoint.sh /entrypoint.sh +COPY entrypoint.py /entrypoint.py + +# Make script executable +RUN chmod +x /entrypoint.sh /entrypoint.py + +# Start BACnet device +ENTRYPOINT ["/entrypoint.sh"] diff --git a/testing/docker/ci_test_device1/bacnet_compliant/entrypoint.py b/testing/docker/ci_test_device1/bacnet_compliant/entrypoint.py new file mode 100644 index 000000000..9fb2d044f --- /dev/null +++ b/testing/docker/ci_test_device1/bacnet_compliant/entrypoint.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +""" +BACnet/IP Virtual Device that Starts Without an IP (Waits for DHCP Assignment) +""" + +import time +import BAC0 + + +def start_bacnet_device(): + """Starts the BACnet/IP virtual device with no pre-assigned IP.""" + + print("Starting BACnet Virtual Device...") + + bacnet = BAC0.lite(deviceId=999) + + bacnet.iam() + + while True: + time.sleep(10) + + +if __name__ == "__main__": + start_bacnet_device() diff --git a/testing/docker/ci_test_device1/bacnet_compliant/entrypoint.sh b/testing/docker/ci_test_device1/bacnet_compliant/entrypoint.sh new file mode 100755 index 000000000..7983a44b0 --- /dev/null +++ b/testing/docker/ci_test_device1/bacnet_compliant/entrypoint.sh @@ -0,0 +1,28 @@ +#!/bin/bash -x + +# Display network interfaces +ip a + +INTF=eth0 + +# DHCP +ip addr flush dev $INTF +PID_FILE=/var/run/dhclient.pid +if [ -f $PID_FILE ]; then + kill -9 $(cat $PID_FILE) || true + rm -f $PID_FILE +fi +dhclient -v $INTF +DHCP_TPID=$! +echo $DHCP_TPID + +# Start BACnet device +exec python3 /entrypoint.py + +# Keep network monitoring (can refactor later for other network modules) +(while true; do arping 10.10.10.1; sleep 10; done) & +(while true; do ip a | cat; sleep 10; done) & + +# Keep the script running +tail -f /dev/null +