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
6 changes: 6 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ py_library(
srcs = [
"//itf/plugins:docker",
],
data = [
"//config",
],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"//itf/plugins/base",
"//itf/plugins/com",
"//itf/plugins/dlt",
"//itf/plugins/utils",
],
)

Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,27 @@ Specify additionally:
- ```--test_arg="-s"``` to get stdout/err from pytest
- ```--test_output=all``` to get stdout/err from bazel
- ```--nocache_test_results``` not to cache test runs

### Running test against QNX Qemu
ITF can be run against running Qemu defined here https://github.com/eclipse-score/reference_integration/tree/main/qnx_qemu.
Steps:
* Checkout repository https://github.com/eclipse-score/reference_integration
* Run ssh test with qemu started with bridge network
* Start Qemu with bridge network from `reference_integration/qnx_qemu` folder:
```
$ bazel run --config=x86_64-qnx //:run_qemu
```
* Run ITF test from `itf` folder:
```
$ bazel test //:test_ssh_bridge_network
```
* Note: If it fails check IP Address of started Qemu with `ifconfig` and update IP addresses in `itf/config/target_config.json` for `S_CORE_ECU_QEMU_BRIDGE_NETWORK`
* Run ssh test with qemu started with port forwarding
* Start Qemu with bridge network from `reference_integration/qnx_qemu` folder:
```
$ bazel run --config=x86_64-qnx //:run_qemu_portforward
```
* Run ITF test from `itf` folder:
```
$ bazel test //:test_ssh_port_forwarding
```
19 changes: 19 additions & 0 deletions config/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
filegroup(
name = "config",
srcs = [
"target_config.json",
],
visibility = ["//visibility:public"],
)
44 changes: 44 additions & 0 deletions config/target_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"S_CORE_ECU_QEMU_BRIDGE_NETWORK": {
"performance_processor": {
"name": "S_CORE_ECU_QEMU_BRIDGE_NETWORK_PP",
"ip_address": "192.168.122.77",
"ext_ip_address": "192.168.122.77",
"diagnostic_ip_address": "192.168.122.77",
"diagnostic_address": "0x91",
"serial_device": "",
"network_interfaces": [],
"ecu_name": "s_core_ecu_qemu_bridge_network_pp"
},
"safety_processor": {
"name": "S_CORE_ECU_QEMU_BRIDGE_NETWORK_SC",
"ip_address": "192.168.122.77",
"diagnostic_ip_address": "192.168.122.77",
"diagnostic_address": "0x90",
"serial_device": "",
"use_doip": true
},
"other_processors": {}
},
"S_CORE_ECU_QEMU_PORT_FORWARDING": {
"performance_processor": {
"name": "S_CORE_ECU_QEMU_PORT_FORWARDING_PP",
"ip_address": "localhost",
"ext_ip_address": "localhost",
"diagnostic_ip_address": "localhost",
"diagnostic_address": "0x91",
"serial_device": "",
"network_interfaces": [],
"ecu_name": "s_core_ecu_qemu_port_forwarding_pp"
},
"safety_processor": {
"name": "CORE_ECU_QEMU_PORT_FORWARDING_SC",
"ip_address": "localhost",
"diagnostic_ip_address": "localhost",
"diagnostic_address": "0x90",
"serial_device": "",
"use_doip": true
},
"other_processors": {}
}
}
28 changes: 28 additions & 0 deletions itf/plugins/base/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
py_library(
name = "base",
srcs = [
"__init__.py",
"base_plugin.py",
"constants.py",
],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"//itf/plugins/base/os",
"//itf/plugins/base/target",
"//itf/plugins/base/test",
"//itf/plugins/utils",
],
)
25 changes: 25 additions & 0 deletions itf/plugins/base/os/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
py_library(
name = "os",
srcs = [
"__init__.py",
"config.py",
"operating_system.py",
],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"//itf/plugins/utils",
],
)
12 changes: 12 additions & 0 deletions itf/plugins/base/os/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
30 changes: 30 additions & 0 deletions itf/plugins/base/target/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
py_library(
name = "target",
srcs = [
"__init__.py",
"base_target.py",
"hw_target.py",
"qemu_target.py",
"qvp_target.py",
],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"//itf/plugins/base/os",
"//itf/plugins/base/target/config",
"//itf/plugins/base/target/processors",
"//itf/plugins/dlt",
],
)
25 changes: 25 additions & 0 deletions itf/plugins/base/target/config/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
py_library(
name = "config",
srcs = [
"__init__.py",
"base_processor.py",
"config.py",
"ecu.py",
"performance_processor.py",
"safety_processor.py",
],
imports = ["."],
visibility = ["//visibility:public"],
)
30 changes: 30 additions & 0 deletions itf/plugins/base/target/processors/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
py_library(
name = "processors",
srcs = [
"__init__.py",
"qemu_processor.py",
"qvp_processor.py",
"safety_processor.py",
"target_processor.py",
],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"//itf/plugins/base/os",
"//itf/plugins/base/target/config",
"//itf/plugins/com:ping",
"//itf/plugins/com:ssh",
],
)
3 changes: 2 additions & 1 deletion itf/plugins/base/target/processors/target_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ def ext_ip_address(self):
def uses_doip(self):
return self.__config.use_doip

def ssh(self, timeout=15, n_retries=5, retry_interval=1, pkey_path="", password="", ext_ip=False):
def ssh(self, timeout=15, port=22, n_retries=5, retry_interval=1, pkey_path="", password="", ext_ip=False):
ssh_ip = self.ext_ip_address if ext_ip else self.ip_address
return Ssh(
target_ip=ssh_ip,
port=port,
timeout=timeout,
n_retries=n_retries,
retry_interval=retry_interval,
Expand Down
4 changes: 4 additions & 0 deletions itf/plugins/base/target/qemu_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def qemu_target(target_config, test_config):
target_ip=target_config.ip_address,
protocol=Protocol.UDP,
binary_path="./itf/plugins/dlt/dlt-receive",
drconfig={ # TODO make this configurable
"vlan_addr": "127.0.0.1",
"mcast_addrs": [],
},
):
target = TargetQemu(test_config.ecu, test_config.os)
target.register_processors(qemu_process)
Expand Down
21 changes: 21 additions & 0 deletions itf/plugins/base/test/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
py_library(
name = "test",
srcs = [
"__init__.py",
"utils.py",
],
imports = ["."],
visibility = ["//visibility:public"],
)
43 changes: 43 additions & 0 deletions itf/plugins/com/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
py_library(
name = "ssh",
srcs = [
"__init__.py",
"sftp.py",
"ssh.py",
"ssh_command.py",
],
imports = ["."],
visibility = ["//visibility:public"],
)

py_library(
name = "ping",
srcs = [
"__init__.py",
"ping.py",
],
imports = ["."],
visibility = ["//visibility:public"],
)

py_library(
name = "com",
imports = ["."],
visibility = ["//visibility:public"],
deps = [
":ping",
":ssh",
],
)
14 changes: 8 additions & 6 deletions itf/plugins/com/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ class Ssh:
def __init__(
self,
target_ip,
port=22,
timeout=15,
n_retries=5,
retry_interval=1,
pkey_path="platform/aas/tools/itf/itf/ssh_keys/id_mPAD",
password="",
pkey_path=None,
password=None,
):
self._target_ip = target_ip
self._port = port
self._timeout = timeout
self._retries = n_retries
self._retry_interval = retry_interval
self._ssh = None
self._pkey = paramiko.ECDSAKey.from_private_key_file(pkey_path)
self._pkey = paramiko.ECDSAKey.from_private_key_file(pkey_path) if pkey_path else None
self._password = password

def __enter__(self):
Expand All @@ -45,7 +47,8 @@ def __enter__(self):
for _ in range(self._retries):
try:
self._ssh.connect(
self._target_ip,
hostname=self._target_ip,
port=self._port,
timeout=self._timeout,
username="root",
password=self._password,
Expand Down Expand Up @@ -240,8 +243,7 @@ def execute_command_output(ssh_connection, cmd, timeout=30, max_exec_time=180, l


def execute_command(ssh_connection, cmd, timeout=30, max_exec_time=180, logger_in=None, verbose=True):
logger.debug(f"Executing command.")
logger.debug(f"cmd: {cmd}")
logger.debug(f"Executing command: {cmd}")
logger.debug(f"timeout: {timeout}; max_exec_time: {max_exec_time}; logger_in: {logger_in}; verbose: {verbose};")
exit_code, stdout_lines, stderr_lines = execute_command_output(
ssh_connection, cmd, timeout, max_exec_time, logger_in, verbose
Expand Down
Loading