[PATCH] osmo-ttcn3-hacks[master]: re-organize configuration files; add tcpdump integration

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Feb 14 19:06:40 UTC 2018


Review at  https://gerrit.osmocom.org/6454

re-organize configuration files; add tcpdump integration

Let's make sure we share common configuration between the test
suites and split the config file into a "default" part which is
used (but not copied) in the Docker images, and a "local" part
which is basically those overrides that the user (or docker image)
wants to do from the default.

Change-Id: I3db452e24e5238aa05254d903739c64d202e61db
---
A Common.cfg
M bsc/BSC_Tests.cfg
A bsc/BSC_Tests.default
M mgw/MGCP_Test.cfg
A mgw/MGCP_Test.default
M msc/MSC_Tests.cfg
A msc/MSC_Tests.default
A ttcn3-tcpdump-start.sh
A ttcn3-tcpdump-stop.sh
9 files changed, 180 insertions(+), 102 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/54/6454/1

diff --git a/Common.cfg b/Common.cfg
new file mode 100644
index 0000000..4a50420
--- /dev/null
+++ b/Common.cfg
@@ -0,0 +1,17 @@
+# common config file, relevant to all projects
+
+[DEFINE]
+TTCN3_HACKS_PATH := ".."
+TCPDUMP_START := $TTCN3_HACKS_PATH"/ttcn3-tcpdump-start.sh"
+TCPDUMP_STOP := $TTCN3_HACKS_PATH"/ttcn3-tcpdump-stop.sh"
+
+[LOGGING]
+SourceInfoFormat := Single;
+LogSourceInfo := Yes;
+LoggerPlugins := { JUnitLogger := "libjunitlogger2" }
+#FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
+#ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
+
+[EXTERNAL_COMMANDS]
+BeginTestCase := $TCPDUMP_START
+EndTestCase := $TCPDUMP_STOP
diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index 44bbf61..0294fa0 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -1,49 +1,21 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./BSC_Tests.default"
+
+# Local configuration below
+
 [LOGGING]
-SourceInfoFormat := Single;
-#FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
-#ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
-#FileMask := LOG_ALL | TTCN_MATCHING;
-BSSAP.FileMask := LOG_NOTHING;
-"VirtMSC-M3UA".FileMask := ERROR | WARNING;
-"VirtMSC-SCCP".FileMask := ERROR | WARNING;
-"IPA0-RSL-IPA".FileMask := ERROR | WARNING;
-"IPA0-CTRL-IPA".FileMask := ERROR | WARNING;
-mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
 
 [TESTPORT_PARAMETERS]
-#*.*.udpReuseAddress := "yes";
-*.BSCVTY.CTRL_MODE := "client"
-*.BSCVTY.CTRL_HOSTNAME := "127.0.0.1"
-*.BSCVTY.CTRL_PORTNUM := "4242"
-*.BSCVTY.CTRL_LOGIN_SKIPPED := "yes"
-*.BSCVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
-*.BSCVTY.CTRL_READMODE := "buffered"
-*.BSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
-*.BSCVTY.PROMPT1 := "OsmoBSC> "
 
 [MODULE_PARAMETERS]
-#mp_bsc_rsl_port := 3003;
-#mp_bsc_ctrl_port := 4249;
-#mp_bsc_ip   := "127.0.0.1";
-#mp_test_ip   := "127.0.0.1";
-
-#BSC_Tests.mp_bssap_cfg := {
-#	sccp_service_type := "mtp3_itu",
-#	sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" },
-#	own_pc := 185,
-#	own_ssn := 254,
-#	peer_pc := 187,
-#	peer_ssn := 254,
-#	sio := '83'O
-#};
-
-#mp_ipa_mgcp_uses_osmo_ext := true;
-Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBSC";
 
 [MAIN_CONTROLLER]
 
 [EXECUTE]
-BSC_Tests.control
+#BSC_Tests.control
 #BSC_Tests.TC_chan_act_noreply
 #BSC_Tests.TC_chan_act_ack_noest
 #BSC_Tests.TC_chan_act_ack_est_ind_noreply
diff --git a/bsc/BSC_Tests.default b/bsc/BSC_Tests.default
new file mode 100644
index 0000000..baa3b54
--- /dev/null
+++ b/bsc/BSC_Tests.default
@@ -0,0 +1,23 @@
+[LOGGING]
+BSSAP.FileMask := LOG_NOTHING;
+"VirtMSC-M3UA".FileMask := ERROR | WARNING;
+"VirtMSC-SCCP".FileMask := ERROR | WARNING;
+"IPA0-RSL-IPA".FileMask := ERROR | WARNING;
+"IPA0-CTRL-IPA".FileMask := ERROR | WARNING;
+mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
+
+[TESTPORT_PARAMETERS]
+*.BSCVTY.CTRL_MODE := "client"
+*.BSCVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.BSCVTY.CTRL_PORTNUM := "4242"
+*.BSCVTY.CTRL_LOGIN_SKIPPED := "yes"
+*.BSCVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
+*.BSCVTY.CTRL_READMODE := "buffered"
+*.BSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.BSCVTY.PROMPT1 := "OsmoBSC> "
+
+[MODULE_PARAMETERS]
+Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBSC";
+
+[EXECUTE]
+BSC_Tests.control
diff --git a/mgw/MGCP_Test.cfg b/mgw/MGCP_Test.cfg
index da45761..b936fe1 100644
--- a/mgw/MGCP_Test.cfg
+++ b/mgw/MGCP_Test.cfg
@@ -1,40 +1,39 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./MSC_Tests.default"
+
+# Local configuration below
+
 [LOGGING]
-SourceInfoFormat := Single;
-#FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
-#ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
-FileMask := LOG_ALL | TTCN_MATCHING;
 
 [TESTPORT_PARAMETERS]
-#*.*.udpReuseAddress := "yes";
 
 [MODULE_PARAMETERS]
-mp_local_udp_port := 2727;
-mp_local_ip:= "127.0.0.1";
-mp_remote_udp_port := 2427;
-mp_remote_ip:= "127.0.0.1";
 
 [MAIN_CONTROLLER]
 
 [EXECUTE]
 #MGCP_Test.TC_selftest
-MGCP_Test.TC_crcx
-MGCP_Test.TC_crcx_noprefix
-MGCP_Test.TC_crcx_unsupp_mode
-MGCP_Test.TC_crcx_early_bidir_mode
-MGCP_Test.TC_crcx_unsupp_param
-MGCP_Test.TC_crcx_missing_callid
-MGCP_Test.TC_crcx_missing_mode
-MGCP_Test.TC_crcx_unsupp_packet_intv
-MGCP_Test.TC_crcx_sdp
-MGCP_Test.TC_crcx_wildcarded
-MGCP_Test.TC_crcx_wildcarded_exhaust
-MGCP_Test.TC_mdcx_without_crcx
-MGCP_Test.TC_dlcx_without_crcx
-MGCP_Test.TC_mdcx_wildcarded
-MGCP_Test.TC_dlcx_wildcarded
-MGCP_Test.TC_crcx_and_dlcx_ep_callid_connid
-MGCP_Test.TC_crcx_and_dlcx_ep_callid
-MGCP_Test.TC_crcx_and_dlcx_ep
-MGCP_Test.TC_crcx_and_dlcx_ep_callid_inval
-MGCP_Test.TC_crcx_and_dlcx_ep_callid_connid_inval
-MGCP_Test.TC_crcx_and_dlcx_retrans
+##MGCP_Test.TC_crcx
+#MGCP_Test.TC_crcx_noprefix
+#MGCP_Test.TC_crcx_unsupp_mode
+#MGCP_Test.TC_crcx_early_bidir_mode
+#MGCP_Test.TC_crcx_unsupp_param
+#MGCP_Test.TC_crcx_missing_callid
+#MGCP_Test.TC_crcx_missing_mode
+#MGCP_Test.TC_crcx_unsupp_packet_intv
+#MGCP_Test.TC_crcx_sdp
+#MGCP_Test.TC_crcx_wildcarded
+#MGCP_Test.TC_crcx_wildcarded_exhaust
+#MGCP_Test.TC_mdcx_without_crcx
+#MGCP_Test.TC_dlcx_without_crcx
+#MGCP_Test.TC_mdcx_wildcarded
+#MGCP_Test.TC_dlcx_wildcarded
+#MGCP_Test.TC_crcx_and_dlcx_ep_callid_connid
+#MGCP_Test.TC_crcx_and_dlcx_ep_callid
+#MGCP_Test.TC_crcx_and_dlcx_ep
+#MGCP_Test.TC_crcx_and_dlcx_ep_callid_inval
+#MGCP_Test.TC_crcx_and_dlcx_ep_callid_connid_inval
+#MGCP_Test.TC_crcx_and_dlcx_retrans
diff --git a/mgw/MGCP_Test.default b/mgw/MGCP_Test.default
new file mode 100644
index 0000000..c9d6129
--- /dev/null
+++ b/mgw/MGCP_Test.default
@@ -0,0 +1,15 @@
+[LOGGING]
+FileMask := LOG_ALL | TTCN_MATCHING;
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+mp_local_udp_port := 2727;
+mp_local_ip:= "127.0.0.1";
+mp_remote_udp_port := 2427;
+mp_remote_ip:= "127.0.0.1";
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+MGCP_Test.control
diff --git a/msc/MSC_Tests.cfg b/msc/MSC_Tests.cfg
index a7605ab..6fb3523 100644
--- a/msc/MSC_Tests.cfg
+++ b/msc/MSC_Tests.cfg
@@ -1,42 +1,16 @@
-[LOGGING]
-SourceInfoFormat := Single;
-#FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
-#ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
-FileMask := LOG_ALL | TTCN_MATCHING;
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./MSC_Tests.default"
 
-#BSSAP.FileMask := LOG_NOTHING;
-"MSC_Test-M3UA".FileMask := ERROR | WARNING;
-"MSC_Test-SCCP".FileMask := ERROR | WARNING;
-"MSC_Test-GSUP-IPA".FileMask := ERROR | WARNING;
-"MSC_Test-GSUP".FileMask := ERROR | WARNING;
-"IPA-CTRL-IPA".FileMask := ERROR | WARNING;
-mtc.FileMask := ERROR | WARNING;
+# Local configuration below
+
+[LOGGING]
 
 [TESTPORT_PARAMETERS]
-#*.*.udpReuseAddress := "yes";
-"MSC_Test-MNCC".MNCC.socket_type := "SEQPACKET";
-*.MSCVTY.CTRL_MODE := "client"
-*.MSCVTY.CTRL_HOSTNAME := "127.0.0.1"
-*.MSCVTY.CTRL_PORTNUM := "4254"
-*.MSCVTY.CTRL_LOGIN_SKIPPED := "yes"
-*.MSCVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
-*.MSCVTY.CTRL_READMODE := "buffered"
-*.MSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
-*.MSCVTY.PROMPT1 := "OsmoMSC> "
-
 
 [MODULE_PARAMETERS]
-M3UA_Emulation.tsp_logVerbose := true;
-MSC_Tests.mp_bssap_cfg := {
-	sccp_service_type := "mtp3_itu",
-	sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" },
-	own_pc := 193,
-	own_ssn := 254,
-	peer_pc := 185,
-	peer_ssn := 254,
-	sio := '83'O
-};
-Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoMSC";
 
 [MAIN_CONTROLLER]
 
@@ -45,4 +19,4 @@
 #MSC_Tests.TC_cmserv_imsi_unknown
 #MSC_Tests.TC_lu_imsi_noauth_tmsi
 #MSC_Tests.TC_lu_imsi_noauth_notmsi
-MSC_Tests.TC_lu_imsi_reject
+#MSC_Tests.TC_lu_imsi_reject
diff --git a/msc/MSC_Tests.default b/msc/MSC_Tests.default
new file mode 100644
index 0000000..6c3e29c
--- /dev/null
+++ b/msc/MSC_Tests.default
@@ -0,0 +1,40 @@
+[LOGGING]
+FileMask := LOG_ALL | TTCN_MATCHING;
+
+BSSAP.FileMask := LOG_NOTHING;
+"MSC_Test-M3UA".FileMask := ERROR | WARNING;
+"MSC_Test-SCCP".FileMask := ERROR | WARNING;
+"MSC_Test-GSUP-IPA".FileMask := ERROR | WARNING;
+"MSC_Test-GSUP".FileMask := ERROR | WARNING;
+"IPA-CTRL-IPA".FileMask := ERROR | WARNING;
+mtc.FileMask := ERROR | WARNING;
+
+[TESTPORT_PARAMETERS]
+"MSC_Test-MNCC".MNCC.socket_type := "SEQPACKET";
+*.MSCVTY.CTRL_MODE := "client"
+*.MSCVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.MSCVTY.CTRL_PORTNUM := "4254"
+*.MSCVTY.CTRL_LOGIN_SKIPPED := "yes"
+*.MSCVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
+*.MSCVTY.CTRL_READMODE := "buffered"
+*.MSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.MSCVTY.PROMPT1 := "OsmoMSC> "
+
+
+[MODULE_PARAMETERS]
+M3UA_Emulation.tsp_logVerbose := true;
+MSC_Tests.mp_bssap_cfg := {
+	sccp_service_type := "mtp3_itu",
+	sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" },
+	own_pc := 193,
+	own_ssn := 254,
+	peer_pc := 185,
+	peer_ssn := 254,
+	sio := '83'O
+};
+Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoMSC";
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+MSC_Tests.control
diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh
new file mode 100755
index 0000000..1349cd7
--- /dev/null
+++ b/ttcn3-tcpdump-start.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+PIDFILE=/tmp/tcpdump.pid
+TESTCASE=$1
+
+if [ "z$TTCN3_PCAP_PATH" = "z" ]; then
+	TTCN3_PCAP_PATH=/tmp
+fi
+
+if [ -e $PIDFILE ]; then
+	kill "$(cat "$PIDFILE")"
+	rm $PIDFILE
+fi
+
+# NOTE: This requires you to be root or something like
+# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
+if [ "$(id -u)" = "0" ]; then
+	CMD=/usr/sbin/tcpdump
+else
+	CMD="sudo /usr/sbin/tcpdump"
+fi
+$CMD -s 0 -n -i any -w "$TTCN3_PCAP_PATH/$TESTCASE.pcap" >/dev/null 2>&1 &
+PID=$!
+echo $PID > $PIDFILE
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
new file mode 100755
index 0000000..575c0ef
--- /dev/null
+++ b/ttcn3-tcpdump-stop.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+PIDFILE=/tmp/tcpdump.pid
+
+if [ -e $PIDFILE ]; then
+	# NOTE: This requires you to be root or something like
+	# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
+	if [ "$(id -u)" = "0" ]; then
+		kill "$(cat "$PIDFILE")"
+	else
+		sudo kill "$(cat "$PIDFILE")"
+	fi
+	rm $PIDFILE
+fi

-- 
To view, visit https://gerrit.osmocom.org/6454
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3db452e24e5238aa05254d903739c64d202e61db
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list