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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"mac_addr": "02:42:aa:00:00:01",
"manufacturer": "Google",
"model": "BACnet Compliant",
"model": "Protocol Compliant",
"type": "IoT Gateway",
"technology": "Hardware - Access Control",
"test_pack": "Pilot Assessment",
Expand Down
26 changes: 0 additions & 26 deletions testing/docker/ci_test_device1/bacnet_compliant/entrypoint.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN apt-get update && \
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
RUN pip install BAC0==23.7.3 pytz==2024.2 netifaces==0.11.0 pymodbus==3.0.0 pyserial pyserial-asyncio

# Copy scripts
WORKDIR /app
Expand Down
55 changes: 55 additions & 0 deletions testing/docker/ci_test_device1/protocol_compliant/entrypoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
BACnet/IP Virtual Device that Starts Without an IP (Waits for DHCP Assignment)
"""

import time
import BAC0
import threading

from pymodbus.server import StartTcpServer
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext

LISTEN_ADDRESS = '0.0.0.0'
MODBUS_PORT = 502

def run_modbus_device():
"""Starts the Modbus TCP server"""

print('Starting Modbus Virtual Device...')

# Initialize the modbus server data store
store = ModbusSlaveContext(
hr=ModbusSequentialDataBlock(0, [10] * 100),
di=ModbusSequentialDataBlock(0, [False]*100),
co=ModbusSequentialDataBlock(0, [False]*100),
ir=ModbusSequentialDataBlock(0, [20]*100),
zero_mode=True
)
context = ModbusServerContext(slaves=store, single=True)

StartTcpServer(context=context,
address=(LISTEN_ADDRESS, MODBUS_PORT))

def run_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__':

modbus_thread = threading.Thread(target=run_modbus_device, daemon=True)
modbus_thread.start()

# Run the BACnet device in the main thread
run_bacnet_device()
2 changes: 1 addition & 1 deletion testing/tests/test_tests
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TEST_DIR=/tmp/results
MATRIX=testing/tests/test_tests.json

TEST_CONTAINERS=(
bacnet_compliant
protocol_compliant
dns_compliant
dns_non_compliant
services_compliant
Expand Down
6 changes: 3 additions & 3 deletions testing/tests/test_tests.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"bacnet_compliant": {
"image": "testrun/bacnet_compliant",
"protocol_compliant": {
"image": "testrun/protocol_compliant",
"ethmac": "02:42:aa:00:00:01",
"expected_results": {
"protocol.valid_bacnet": "Compliant",
"protocol.bacnet.version": "Compliant",
"protocol.valid_modbus": "Feature Not Detected"
"protocol.valid_modbus": "Compliant"
}
},

Expand Down