osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40450?usp=email )
Change subject: testenv: support using multiple titan versions
......................................................................
testenv: support using multiple titan versions
Install eclipse-titan versions 9.0.0 and 11.1.0 into
/opt/eclipse-titan-$version inside the podman container by using the new
optdir packages. Choose the appropriate version by setting related
environment variables. Use the version in $PATH on the host, unless
/opt/eclipse-titan-$version is also present on the host system.
Add a new --titan-version argument to explicitly set a version to use
when running a testsuite.
Rewrite the version check code to take titan_min, --titan-version and
the host version (if not using optdir) into account.
Related: OS#6490
Change-Id: I48d711da57c874cf7cd557480a163eea1a4167bd
---
M _testenv/README.md
M _testenv/data/podman/Dockerfile
M _testenv/testenv.py
M _testenv/testenv/__init__.py
M _testenv/testenv/podman.py
M _testenv/testenv/requirements.py
M _testenv/testenv/testenv_cfg.py
M _testenv/testenv/testsuite.py
8 files changed, 119 insertions(+), 34 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/50/40450/1
diff --git a/_testenv/README.md b/_testenv/README.md
index a712dc8..ecc8701 100644
--- a/_testenv/README.md
+++ b/_testenv/README.md
@@ -66,7 +66,8 @@
#### Testsuite section
* `titan_min=`: the minimum required eclipse-titan version for building and
- running this testsuite.
+ running this testsuite. See the eclipse-titan versions section below for
+ details.
* `program=`: the executable for starting the testsuite, without arguments.
@@ -275,6 +276,17 @@
* `TERM`:
Is set to the same `TERM` passed to testenv with fallback to `dumb`.
+## Eclipse-titan versions
+
+It is possible to change the eclipse-titan version that is used to build and
+run a testsuite if multiple versions are installed. This is the case when
+running in podman (see `testenv/data/podman/Dockerfile`) or if multiple
+versions are installed as `/opt/eclipse-titan-$VERSION` paths on the host
+system.
+
+Switching between the versions is done either by setting a `titan_min` version
+in the `[testsuite]` section, or by using `-T` / `--titan-version`.
+
## Troubleshooting
### Timeout waiting for RESET-ACK after sending RESET
diff --git a/_testenv/data/podman/Dockerfile b/_testenv/data/podman/Dockerfile
index dca8a75..84aa0db 100644
--- a/_testenv/data/podman/Dockerfile
+++ b/_testenv/data/podman/Dockerfile
@@ -147,7 +147,8 @@
RUN set -x && \
apt-get update && \
apt-get install -y --no-install-recommends \
- eclipse-titan \
+ eclipse-titan-optdir-9.0.0 \
+ eclipse-titan-optdir-11.1.0 \
&& \
apt-get clean && \
rm /etc/apt/sources.list.d/osmocom-latest.list
diff --git a/_testenv/testenv.py b/_testenv/testenv.py
index f852c0c..2aac11e 100755
--- a/_testenv/testenv.py
+++ b/_testenv/testenv.py
@@ -43,6 +43,7 @@
if testenv.args.podman:
testenv.podman.init()
testenv.podman.start()
+ testenv.podman.check_titan_version()
if not testenv.args.binary_repo:
testenv.osmo_dev.init()
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py
index cb4a02c..511ec58 100644
--- a/_testenv/testenv/__init__.py
+++ b/_testenv/testenv/__init__.py
@@ -86,6 +86,7 @@
help="which testenv.cfg to use (supports * wildcards via fnmatch)",
)
group.add_argument("-i", "--io-uring", action="store_true", help="set LIBOSMO_IO_BACKEND=IO_URING")
+ group.add_argument("-T", "--titan-version", help="which eclipse-titan version to use")
group = sub_run.add_argument_group("source/binary options", "All components are built from source by default.")
group.add_argument(
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index f8812e4..5099a95 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -12,6 +12,7 @@
import testenv.testdir
import testenv.coredump
import time
+import sys
image_name = None
distro = None
@@ -283,6 +284,20 @@
exec_cmd(["apt-get", "-q", "update"])
+def check_titan_version():
+ version, _ = testenv.testenv_cfg.get_titan_version_first_cfg()
+ if not testenv.cmd.run(["test", "-d", f"/opt/eclipse-titan-{version}"], check=False).returncode:
+ return
+
+ up_to_date = testenv.podman.image_up_to_date()
+ logging.error(f"/opt/eclipse-titan-{version} not found in the podman container!")
+ if up_to_date:
+ logging.error("Consider modifying _testenv/data/podman/Dockerfile.")
+ else:
+ logging.error("Try './testenv.py init podman' to update the container.")
+ sys.exit(1)
+
+
def distro_to_repo_dir(distro):
if distro == "debian:bookworm":
return "Debian_12"
diff --git a/_testenv/testenv/requirements.py b/_testenv/testenv/requirements.py
index 6e7c32c..540fe55 100644
--- a/_testenv/testenv/requirements.py
+++ b/_testenv/testenv/requirements.py
@@ -1,10 +1,8 @@
# Copyright 2024 sysmocom - s.f.m.c. GmbH
# SPDX-License-Identifier: GPL-3.0-or-later
-from packaging.version import Version
import logging
import os.path
import shutil
-import subprocess
import sys
import testenv
import testenv.cmd
@@ -71,30 +69,6 @@
sys.exit(1)
-def check_ttcn3_compiler_version():
- if testenv.args.podman:
- return
-
- ttcn3_min_version = "9.0.0"
-
- v = subprocess.run(["ttcn3_compiler", "-v"], capture_output=True, text=True)
- current = None
- for line in v.stderr.split("\n"):
- if not line.startswith("Version: "):
- continue
-
- current = line.split(":", 1)[1].strip()
- if Version(current) >= Version(ttcn3_min_version):
- return
-
- logging.error(f"Found ttcn3_compiler version {current}, but {ttcn3_min_version} or higher is required.")
-
- if not current:
- logging.error("Could not parse ttcn3_compiler version.")
- logging.error(f"Please install at least version {ttcn3_min_version} and try again.")
- sys.exit(1)
-
-
def check_fftranscode():
cmd = [
"grep",
@@ -124,7 +98,6 @@
def check():
check_programs()
- check_ttcn3_compiler_version()
if not testenv.args.podman:
check_fftranscode()
diff --git a/_testenv/testenv/testenv_cfg.py b/_testenv/testenv/testenv_cfg.py
index 5b1d32f..84176d7 100644
--- a/_testenv/testenv/testenv_cfg.py
+++ b/_testenv/testenv/testenv_cfg.py
@@ -1,5 +1,6 @@
# Copyright 2024 sysmocom - s.f.m.c. GmbH
# SPDX-License-Identifier: GPL-3.0-or-later
+from packaging.version import Version
import configparser
import fnmatch
import glob
@@ -10,6 +11,8 @@
cfgs = {}
current = None
+titan_version_in_path = None
+titan_min_previous = None
def set_current(cfg_name, loop_count=0):
@@ -74,6 +77,76 @@
return host, port
+def get_titan_version_in_path():
+ global titan_version_in_path
+
+ if titan_version_in_path:
+ return titan_version_in_path
+
+ ret = None
+ v = testenv.cmd.run(["ttcn3_compiler", "-v"], capture_output=True, text=True)
+ for line in v.stderr.split("\n"):
+ if line.startswith("Version: "):
+ ret = line.split(":", 1)[1].strip()
+ logging.debug(f"eclipse-titan version: {ret}")
+ break
+ titan_version_in_path = ret
+ return ret
+
+
+def get_titan_version(cfg, path=None):
+ global titan_min_previous
+
+ ret_version = cfg["testsuite"]["titan_min"]
+ ret_reason = "from titan_min= in testenv.cfg"
+
+ if titan_min_previous and titan_min_previous["version"] != ret_version:
+ logging.error("Found different titan_min= versions in testenv.cfg files of the same directory:")
+ logging.error(f" titan_min={ret_version} in {path}")
+ logging.error(f" titan_min={titan_min_previous['version']} in {titan_min_previous['path']}")
+ logging.error("This is not supported, please fix it.")
+ sys.exit(1)
+ titan_min_previous = {"version": ret_version, "path": path}
+
+ if testenv.args.titan_version:
+ if Version(ret_version) > Version(testenv.args.titan_version):
+ logging.error(
+ f"--titan-version={testenv.args.titan_version} is lower than titan_min={ret_version} in {path}"
+ )
+ sys.exit(1)
+ ret_version = testenv.args.titan_version
+ ret_reason = "from --titan-version"
+
+ if not testenv.args.podman and not os.path.exists(f"/opt/eclipse-titan-{ret_version}"):
+ path_version = get_titan_version_in_path()
+ if not path_version:
+ logging.error("Failed to parse the ttcn3_compiler version.")
+ logging.error(f"Install eclipse-titan {ret_version} or higher or use --podman.")
+ sys.exit(1)
+ if testenv.args.titan_version and ret_version != path_version:
+ logging.error(
+ f"Installed eclipse-titan version {path_version} is not the same as --titan-version={ret_version}."
+ )
+ sys.exit(1)
+ if Version(ret_version) > Version(path_version):
+ logging.error(
+ f"Installed eclipse-titan version {path_version} is lower than titan_min={ret_version} in {path}."
+ )
+ logging.error(f"Install eclipse-titan {ret_version} or higher or use --podman.")
+ sys.exit(1)
+ ret_version = path_version
+ ret_reason = "installed on host system"
+
+ return ret_version, ret_reason
+
+
+def get_titan_version_first_cfg():
+ """The titan version is the same for all testenv.cfg files in the same
+ testsuite directory, this is enforced in get_titan_version()."""
+ _, cfg = next(iter(cfgs.items()))
+ return get_titan_version(cfg)
+
+
def verify_qemu_cfgs():
"""Check if passed -C or -K args make sense with the testenv configs."""
testsuite = testenv.args.testsuite
@@ -194,6 +267,7 @@
sys.exit(1)
get_vty_host_port(cfg, path)
+ get_titan_version(cfg, path)
def raise_error_config_arg(glob_result, config_arg):
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index 753773f..b7ffb43 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -11,6 +11,7 @@
import subprocess
import testenv
import testenv.cmd
+import testenv.testenv_cfg
import time
builddir_env = {}
@@ -35,15 +36,21 @@
atexit.register(stop)
update_deps()
- if testenv.args.podman:
- builddir = os.path.join(testenv.args.cache, "podman", "ttcn3")
- builddir_env = {"BUILDDIR": builddir}
+ titan_version, _ = testenv.testenv_cfg.get_titan_version_first_cfg()
+ ttcn3_dir = f"/opt/eclipse-titan-{titan_version}"
+
+ if testenv.args.podman or os.path.exists(ttcn3_dir):
+ cache_dir = "podman" if testenv.args.podman else "host"
+ builddir = os.path.join(testenv.args.cache, cache_dir, f"titan-{titan_version}")
+ path_old = testenv.cmd.generate_env(podman=testenv.args.podman)["PATH"]
+ builddir_env = {"BUILDDIR": builddir, "TTCN3_DIR": ttcn3_dir, "PATH": f"{ttcn3_dir}/bin:{path_old}"}
prepare_testsuite_dir()
def build():
- logging.info("Building testsuite")
+ titan_version, titan_reason = testenv.testenv_cfg.get_titan_version_first_cfg()
+ logging.info(f"Building testsuite (eclipse-titan {titan_version}, {titan_reason})")
env = copy.copy(builddir_env)
if testenv.args.jobs:
@@ -151,7 +158,8 @@
else:
cmd += [f"{section_data['program']}.{test_arg}"]
- logging.info("Running testsuite")
+ titan_version, titan_reason = testenv.testenv_cfg.get_titan_version_first_cfg()
+ logging.info(f"Running testsuite (eclipse-titan {titan_version}, {titan_reason})")
if testenv.podman.is_running():
testsuite_proc = testenv.podman.exec_cmd_background(cmd, cwd=cwd, env=env)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40450?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I48d711da57c874cf7cd557480a163eea1a4167bd
Gerrit-Change-Number: 40450
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, pespin.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40437?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Code-Review+1 by pespin, Verified+1 by Jenkins Builder
Change subject: enft_kpi: support different UL/DL GTP-U addresses
......................................................................
enft_kpi: support different UL/DL GTP-U addresses
Change-Id: Icd4a17790062bfcaf2bccb01fa94dcdb65c0872c
Related: SYS#7307
---
M src/enft_kpi.erl
M src/s1ap_proxy.erl
2 files changed, 156 insertions(+), 113 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/37/40437/3
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40437?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Icd4a17790062bfcaf2bccb01fa94dcdb65c0872c
Gerrit-Change-Number: 40437
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, laforge, pespin.
Hello Jenkins Builder, laforge, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40439?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review+1 by laforge, Code-Review+1 by pespin, Verified+1 by Jenkins Builder
Change subject: enft_kpi: use command/expression templates from enftables
......................................................................
enft_kpi: use command/expression templates from enftables
Change-Id: I421ba5ccc8956586136466d5eb50d6ace69eeb67
Related: SYS#7307
---
M src/enft_kpi.erl
1 file changed, 22 insertions(+), 116 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/39/40439/4
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40439?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: I421ba5ccc8956586136466d5eb50d6ace69eeb67
Gerrit-Change-Number: 40439
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40443?usp=email )
Change subject: NGAP_Emulation: Fix match on DownlinkNASTransport with different list of IEs
......................................................................
NGAP_Emulation: Fix match on DownlinkNASTransport with different list of IEs
The existing receive templates match only a given set of parameters.
Some of them are optional, so they wouldn't match the template if added.
Match based on procedureCode instead.
Change-Id: Iaec861f8c0d55a2897896d695b9f70bca64af339
---
M library/NGAP_Emulation.ttcn
M library/NGAP_Functions.ttcn
2 files changed, 21 insertions(+), 16 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
jolly: Looks good to me, but someone else must approve
diff --git a/library/NGAP_Emulation.ttcn b/library/NGAP_Emulation.ttcn
index 1dcae70..178d6cd 100644
--- a/library/NGAP_Emulation.ttcn
+++ b/library/NGAP_Emulation.ttcn
@@ -426,6 +426,11 @@
mw_ngap_unsuccMsg({procedureCode := tr_NGAP_ProcedureCode_non_UErelated,
criticality := ?,
value_ := ?}));
+template (present) NGAP_PDU
+tr_NGAP_DownlinkNASTransport := mw_ngap_initMsg({procedureCode := id_DownlinkNASTransport,
+ criticality := ?,
+ value_ := { DownlinkNASTransport := ? }
+ });
function main(NGAPOps ops, NGAP_conn_parameters p, charstring id) runs on NGAP_Emulation_CT {
var Result res;
@@ -557,7 +562,7 @@
dl_nas := f_NG_NAS_try_decaps_dl(NGapAssociationTable[assoc_id].nus, dl_nas);
}
/* DL/UlNasTransport are not interesting, don't send them */
- if (not match(mrf.msg, mw_ngap_initMsg(mw_n2_DownlinkNASTransport))) {
+ if (not match(mrf.msg, tr_NGAP_DownlinkNASTransport)) {
/* send raw NGAP */
NGAP_CLIENT.send(mrf.msg) to vc_conn;
}
diff --git a/library/NGAP_Functions.ttcn b/library/NGAP_Functions.ttcn
index 70d8941..523754e 100644
--- a/library/NGAP_Functions.ttcn
+++ b/library/NGAP_Functions.ttcn
@@ -21,18 +21,18 @@
{
if (ischosen(ngap.initiatingMessage)) {
var InitiatingMessage im := ngap.initiatingMessage;
- select (im) {
- case (mw_n2_DownlinkNASTransport) {
+ select (im.procedureCode) {
+ case (id_DownlinkNASTransport) {
return im.value_.downlinkNASTransport.protocolIEs[0].value_.aMF_UE_NGAP_ID;
}
- case (mw_n2_UEContextReleaseCommand) {
+ case (id_UEContextRelease) {
return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_NGAP_IDs.uE_NGAP_ID_pair.aMF_UE_NGAP_ID;
}
/* TODO */
}
} else if (ischosen(ngap.successfulOutcome)) {
var SuccessfulOutcome so := ngap.successfulOutcome;
- select (so) {
+ select (so.procedureCode) {
case (?) {
return omit;
/* TODO */
@@ -42,7 +42,7 @@
}
} else if (ischosen(ngap.unsuccessfulOutcome)) {
var UnsuccessfulOutcome uo := ngap.unsuccessfulOutcome;
- select (uo) {
+ select (uo.procedureCode) {
case (?) {
return omit;
/* TODO */
@@ -58,21 +58,21 @@
{
if (ischosen(ngap.initiatingMessage)) {
var InitiatingMessage im := ngap.initiatingMessage;
- select (im) {
- case (mw_n2_initialUeMessage) {
+ select (im.procedureCode) {
+ case (id_InitialUEMessage) {
return im.value_.InitialUEMessage.protocolIEs[0].value_.RAN_UE_NGAP_ID;
}
- case (mw_n2_DownlinkNASTransport) {
+ case (id_DownlinkNASTransport) {
return im.value_.downlinkNASTransport.protocolIEs[1].value_.RAN_UE_NGAP_ID;
}
- case (mw_n2_UEContextReleaseCommand) {
+ case (id_UEContextRelease) {
return im.value_.uEContextReleaseCommand.protocolIEs[0].value_.uE_NGAP_IDs.uE_NGAP_ID_pair.rAN_UE_NGAP_ID;
}
/* TODO */
}
} else if (ischosen(ngap.successfulOutcome)) {
var SuccessfulOutcome so := ngap.successfulOutcome;
- select (so) {
+ select (so.procedureCode) {
case (?) {
return omit;
/* TODO */
@@ -82,7 +82,7 @@
}
} else if (ischosen(ngap.unsuccessfulOutcome)) {
var UnsuccessfulOutcome uo := ngap.unsuccessfulOutcome;
- select (uo) {
+ select (uo.procedureCode) {
case (?) {
return omit;
/* TODO */
@@ -100,8 +100,8 @@
if (ischosen(ngap.initiatingMessage)) {
var InitiatingMessage im := ngap.initiatingMessage;
- select (im) {
- case (mw_n2_DownlinkNASTransport) {
+ select (im.procedureCode) {
+ case (id_DownlinkNASTransport) {
var DownlinkNASTransport msg := im.value_.DownlinkNASTransport;
for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) {
if (msg.protocolIEs[i].id == id_NAS_PDU) {
@@ -109,7 +109,7 @@
}
}
}
- case (mw_n2_UplinkNASTransport) {
+ case (id_UplinkNASTransport) {
var UplinkNASTransport msg := im.value_.UplinkNASTransport;
for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) {
if (msg.protocolIEs[i].id == id_NAS_PDU) {
@@ -117,7 +117,7 @@
}
}
}
- case (mw_n2_initialUeMessage) {
+ case (id_InitialUEMessage) {
var InitialUEMessage msg := im.value_.InitialUEMessage;
for (i := 0; i < lengthof(msg.protocolIEs); i := i+1) {
if (msg.protocolIEs[i].id == id_NAS_PDU) {
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40443?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iaec861f8c0d55a2897896d695b9f70bca64af339
Gerrit-Change-Number: 40443
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>