Change in osmo-gsm-tester[master]: ttcn3: Support running tests without PCU socket avail

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Oct 11 15:57:57 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11322


Change subject: ttcn3: Support running tests without PCU socket avail
......................................................................

ttcn3: Support running tests without PCU socket avail

Change-Id: I902af460b798ffdba09d77d457bac672db606368
---
M src/osmo_gsm_tester/bts.py
A ttcn3/scenarios/sysmo.conf
M ttcn3/suites/ttcn3_bts_tests/scripts/BTS_Tests.cfg.tmpl
M ttcn3/suites/ttcn3_bts_tests/scripts/run_ttcn3_docker.sh
M ttcn3/suites/ttcn3_bts_tests/ttcn3_bts_tests.py
5 files changed, 23 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/22/11322/1

diff --git a/src/osmo_gsm_tester/bts.py b/src/osmo_gsm_tester/bts.py
index 041b2bc..f05a1ba 100644
--- a/src/osmo_gsm_tester/bts.py
+++ b/src/osmo_gsm_tester/bts.py
@@ -157,6 +157,10 @@
         'Get the Pcu object associated with the BTS'
         pass
 
+    def bts_type(self):
+        'Get the type of BTS'
+        return self.conf.get('type')
+
     def set_bsc(self, bsc):
         self.bsc = bsc
 
diff --git a/ttcn3/scenarios/sysmo.conf b/ttcn3/scenarios/sysmo.conf
new file mode 120000
index 0000000..5374081
--- /dev/null
+++ b/ttcn3/scenarios/sysmo.conf
@@ -0,0 +1 @@
+../../example/scenarios/sysmo.conf
\ No newline at end of file
diff --git a/ttcn3/suites/ttcn3_bts_tests/scripts/BTS_Tests.cfg.tmpl b/ttcn3/suites/ttcn3_bts_tests/scripts/BTS_Tests.cfg.tmpl
index 7379528..03d2721 100644
--- a/ttcn3/suites/ttcn3_bts_tests/scripts/BTS_Tests.cfg.tmpl
+++ b/ttcn3/suites/ttcn3_bts_tests/scripts/BTS_Tests.cfg.tmpl
@@ -10,7 +10,11 @@
 [MODULE_PARAMETERS]
 BTS_Tests.mp_rsl_ip := "172.18.9.10"
 BTS_Tests.mp_bb_trxc_ip := "127.0.0.1"
+%if pcu_available:
 BTS_Tests.mp_pcu_socket := "/data/unix_pcu/pcu_bts"
+%else:
+BTS_Tests.mp_pcu_socket := ""
+%endif
 BTS_Tests.mp_bb_trxc_port := -1
 L1CTL_PortType.m_l1ctl_sock_path := "/data/unix_l2/osmocom_l2"
 BTS_Tests.mp_ctrl_ip   := "${btsvty_ctrl_hostname}"
diff --git a/ttcn3/suites/ttcn3_bts_tests/scripts/run_ttcn3_docker.sh b/ttcn3/suites/ttcn3_bts_tests/scripts/run_ttcn3_docker.sh
index 64987b3..d583f90 100755
--- a/ttcn3/suites/ttcn3_bts_tests/scripts/run_ttcn3_docker.sh
+++ b/ttcn3/suites/ttcn3_bts_tests/scripts/run_ttcn3_docker.sh
@@ -63,12 +63,17 @@
 
 echo Starting container with BTS testsuite
 docker kill ${DOCKER_NAME}
+if [ "x$PCU_SOCKET_PATH" != "x" ]; then
+	MOUNT_PCU_SOCKET_OPT="--mount type=bind,source=\"$(dirname "$PCU_SOCKET_PATH")\",destination=/data/unix_pcu"
+else
+	MOUNT_PCU_SOCKET_OPT=""
+fi
 docker run	--rm \
 		--network $NET_NAME --ip 172.18.9.10 \
 		-e "TTCN3_PCAP_PATH=/data" \
 		--mount type=bind,source=$VOL_BASE_DIR/bts-tester,destination=/data \
 		--mount type=bind,source="$(dirname "$L2_SOCKET_PATH")",destination=/data/unix_l2 \
-		--mount type=bind,source="$(dirname "$PCU_SOCKET_PATH")",destination=/data/unix_pcu \
+		$MOUNT_PCU_SOCKET_OPT \
 		--name ${DOCKER_NAME} \
 		$REPO_USER/${SUITE_NAME} &
 child_ps=$!
diff --git a/ttcn3/suites/ttcn3_bts_tests/ttcn3_bts_tests.py b/ttcn3/suites/ttcn3_bts_tests/ttcn3_bts_tests.py
index b3ca946..f36b023 100755
--- a/ttcn3/suites/ttcn3_bts_tests/ttcn3_bts_tests.py
+++ b/ttcn3/suites/ttcn3_bts_tests/ttcn3_bts_tests.py
@@ -46,11 +46,17 @@
 script_run_dir = test.get_run_dir().new_dir('ttcn3')
 bts_cfg_file = os.path.join(str(script_run_dir), 'BTS_Tests.cfg')
 junit_ttcn3_dst_file = os.path.join(str(suite.trial.get_run_dir()), 'trial-') + suite.name() + '.xml'
-docker_cmd = (script_file, str(script_run_dir), junit_ttcn3_dst_file, osmocon.l2_socket_path(), bts.pcu_socket_path())
+if bts.bts_type() == 'osmo-bts-trx':
+    pcu_available = True
+    pcu_sk = bts.pcu_socket_path()
+else: # PCU unix socket not available locally
+    pcu_available = False
+    pcu_sk = ''
+docker_cmd = (script_file, str(script_run_dir), junit_ttcn3_dst_file, osmocon.l2_socket_path(), pcu_sk)
 
 print('Creating template')
 mytemplate = Template(filename=bts_tmpl_file)
-r = mytemplate.render(btsvty_ctrl_hostname=bts.remote_addr())
+r = mytemplate.render(btsvty_ctrl_hostname=bts.remote_addr(), pcu_available=pcu_available)
 with open(bts_cfg_file, 'w') as f:
     f.write(r)
 

-- 
To view, visit https://gerrit.osmocom.org/11322
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I902af460b798ffdba09d77d457bac672db606368
Gerrit-Change-Number: 11322
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181011/55184c69/attachment.htm>


More information about the gerrit-log mailing list