osmo-gsm-tester[master]: fix name of local var, to not shadow 'suite' module

2017-05-14 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic9aa383f5cdc9818c5a21b101fb6ddea4132d9fb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-gsm-tester[master]: fix: exception outside of trial run should be logged and cau...

2017-05-14 Thread Pau Espin Pedrol

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/2604/1/src/osmo-gsm-tester.py
File src/osmo-gsm-tester.py:

Line 216: log.log_exn()
could it be an issue: if at some early stage before log object is initialized 
there is an exception, then you go here and it may trigger a new exception when 
this line is executed, masking the real exception (the failure in this line 
will be shown instead.) You know better the log code than me, so please have a 
look if that's possible. In that case, we may want to "try: log.log_exn() 
except: pass, then raise"


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8085318c91b06a3e8f7d3f8cfdd15a99650666e2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: Yes


osmo-gsm-tester[master]: cosmetic: contrib: add 'build-' to script names

2017-05-14 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0c3b0c06210f5cb6a936c5e90ebc9167b57eeae2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-gsm-tester[master]: log: tweak osmo-gsm-tester.py stdout: all_origins=False, src...

2017-05-14 Thread Pau Espin Pedrol

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24a600f67f7a9f3d1235abfceb86f311ffa97746
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-gsm-tester[master]: checkout dependencies from script

2017-05-14 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie05cb9cd2bd884f72cbdbcc96d9c4389ffca7357
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-gsm-tester[master]: log the location of the detailed log file

2017-05-14 Thread Pau Espin Pedrol

Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/2600/2/src/osmo_gsm_tester/trial.py
File src/osmo_gsm_tester/trial.py:

Line 77: self.log('Detailed log at', detailed_log)
join this logging with the one above it?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id5f443f1af0dc774d4d4c588a238b786a83e44d3
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: Yes


osmo-gsm-tester[master]: pcap recorder: filter out SSH

2017-05-14 Thread Pau Espin Pedrol

Patch Set 1: Code-Review-1

I'm already doing this in https://gerrit.osmocom.org/#/c/2586/

I think it's better not to hardcode that inside pcap recorder because we may 
want to listen for port 22 in some other place later on.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icbb0f8d2058fa7ebb7f0f731645f9266cacdb120
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-gsm-tester[master]: cosmetic: rather have an underscore in pcap_recorder.py

2017-05-14 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4886cb3fe0cb9c66d170097b98b4d1eb67cab81
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] libosmo-sccp[master]: stp: Add test scripts for executing m3ua-testtool and sua-te...

2017-05-14 Thread Harald Welte

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

stp: Add test scripts for executing m3ua-testtool and sua-testtool

You will need to have
* GNU/Linux with support for [network] namespaces
* the 'unshare' command line tool
* m3ua-testtool and sua-testtool repositories
  from git.osmocom.org/nplab installed adjacent to libosmo-sccp
* their requirements, i.e.
** guile
** guile-sctp from https://github.com/nplab/guile-sctp

When those are installed, you can do things like

(cd contrib/test && ./run-in-ns.sh test-m3ua.sh)
(cd contrib/test && ./run-in-ns.sh test-sua.sh)

to execute the test suite.

Change-Id: Ic36eafbb9868b2ec9ae2173f8d1b651b976ccf88
---
A contrib/test/osmo-stp.cfg
A contrib/test/run-in-ns.sh
A contrib/test/test-m3ua.sh
A contrib/test/test-sua.sh
4 files changed, 123 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/11/2611/1

diff --git a/contrib/test/osmo-stp.cfg b/contrib/test/osmo-stp.cfg
new file mode 100644
index 000..bf059a9
--- /dev/null
+++ b/contrib/test/osmo-stp.cfg
@@ -0,0 +1,48 @@
+!
+! osmo-stp (0.0.6.3.179-b248) configuration saved from vty
+!!
+!
+log stderr
+  logging filter all 1
+  logging color 1
+  logging print category 1
+  logging timestamp 0
+  logging level all everything
+  logging level lglobal notice
+  logging level llapd notice
+  logging level linp info
+  logging level lmux notice
+  logging level lmi notice
+  logging level lmib notice
+  logging level lsms notice
+  logging level lctrl notice
+  logging level lgtp notice
+  logging level lstats notice
+  logging level lgsup notice
+  logging level loap notice
+  logging level lss7 debug
+  logging level lsccp debug
+  logging level lsua debug
+  logging level lm3ua debug
+!
+line vty
+ no login
+!
+cs7 instance 0
+ asp asp0 0 2905 m3ua
+  remote-ip 172.18.0.2
+ asp asp-s-0 0 14001 sua
+  remote-ip 172.18.0.3
+ as as0 m3ua
+  asp asp0
+  routing-key 23 0.2.7
+ as as-s-0 sua
+  asp asp-s-0
+  routing-key 24 0.3.0
+ route-table system
+  update route 0.2.7 0.2.7 linkset as0
+  update route 0.3.0 0.3.0 linkset as-s-0
+ listen m3ua 2905
+  local-ip 172.18.0.200
+ listen sua 14001
+  local-ip 172.18.0.200
diff --git a/contrib/test/run-in-ns.sh b/contrib/test/run-in-ns.sh
new file mode 100755
index 000..a961f78
--- /dev/null
+++ b/contrib/test/run-in-ns.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# small helper script to run the specified command inside a network
+# namespace while remapping the real PID to root inside the namespace,
+# so the program inside the namespace can do things like setting
+# interface addresses
+
+if [ $# -eq 0 ]; then
+   echo "You have to specify the command you want to execute in the new 
namespace"
+   exit 1
+fi
+
+unshare --map-root-user --user -i -m -p -f -u -U -n $1
diff --git a/contrib/test/test-m3ua.sh b/contrib/test/test-m3ua.sh
new file mode 100755
index 000..0f81fe8
--- /dev/null
+++ b/contrib/test/test-m3ua.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# this script executes m3ua-testtool against osmo-stp.  It assumes that
+# it is called from within libosmo-sccp/contrib/test and also assumes
+# that adjacent to the libosmo-sccp, there's a check-out of
+# git://git.osmocom.org/nplab/m3ua-testtool
+
+# the top of the libosmo-sccp git repository
+TOPDIR=../../
+
+# the directory in which we can find the osmo-stp binary
+STP_DIR=$TOPDIR/stp
+
+# the directory in which we can find the m3ua-testtool.git
+M3UA_DIR=$TOPDIR/../m3ua-testtool
+
+# osmo-stp config file, used from CWD
+STP_CONFIG=./osmo-stp.cfg
+
+# we're pesudo-root but inherit the path from a non-root user
+PATH=/sbin:/usr/sbin:$PATH
+
+# set up the ip addresses
+ip link set lo up
+ip addr add 172.18.0.2/32 dev lo
+ip addr add 172.18.0.200/32 dev lo
+
+$STP_DIR/osmo-stp -c $STP_CONFIG &
+STP_PID=$!
+(cd $M3UA_DIR && ./run-all-sgp-tests)
+kill $!
diff --git a/contrib/test/test-sua.sh b/contrib/test/test-sua.sh
new file mode 100755
index 000..0cb4e35
--- /dev/null
+++ b/contrib/test/test-sua.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# this script executes m3ua-testtool against osmo-stp.  It assumes that
+# it is called from within libosmo-sccp/contrib/test and also assumes
+# that adjacent to the libosmo-sccp, there's a check-out of
+# git://git.osmocom.org/nplab/m3ua-testtool
+
+# the top of the libosmo-sccp git repository
+TOPDIR=../../
+
+# the directory in which we can find the osmo-stp binary
+STP_DIR=$TOPDIR/stp
+
+# the directory in which we can find the sua-testtool.git
+SUA_DIR=$TOPDIR/../sua-testtool
+
+# osmo-stp config file, used from CWD
+STP_CONFIG=./osmo-stp.cfg
+
+# we're pesudo-root but inherit the path from a non-root user
+PATH=/sbin:/usr/sbin:$PATH
+
+# set up the ip addresses
+ip link set lo up
+ip addr add 172.18.0.3/32 dev lo
+ip addr add 172.18.0.200/32 dev lo
+
+$STP_DIR/osmo-stp -c $STP_CONFIG &
+STP_PID=$!
+(cd $SUA_DIR && ./run-some-sua-sgp-tests)
+kill $!

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

[PATCH] libosmo-netif[master]: somo_stream_srv_fd_cb(): close socket if NODELAY fails

2017-05-14 Thread Harald Welte

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

somo_stream_srv_fd_cb(): close socket if NODELAY fails

We didn't check for cases where setsockopt_nodelay() fails.  Let's check
for that and bail out + close the socket.

Change-Id: I0adbc4cec35be7c36bdf01d4d8fefd6097e9be5d
Fixes: coverity CID#166970
---
M src/stream.c
1 file changed, 14 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/10/2610/1

diff --git a/src/stream.c b/src/stream.c
index add08b8..b96293e 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -431,17 +431,23 @@
osmo_stream_cli_reconnect(cli);
return ret;
}
-
-   if (cli->flags & OSMO_STREAM_CLI_F_NODELAY)
-   setsockopt_nodelay(cli->ofd.fd, cli->proto, 1);
-
cli->ofd.fd = ret;
-   if (osmo_fd_register(&cli->ofd) < 0) {
-   close(ret);
-   cli->ofd.fd = -1;
-   return -EIO;
+
+   if (cli->flags & OSMO_STREAM_CLI_F_NODELAY) {
+   ret = setsockopt_nodelay(cli->ofd.fd, cli->proto, 1);
+   if (ret < 0)
+   goto error_close_socket;
}
+
+   if (osmo_fd_register(&cli->ofd) < 0)
+   goto error_close_socket;
+
return 0;
+
+error_close_socket:
+   close(ret);
+   cli->ofd.fd = -1;
+   return -EIO;
 }
 
 /*! \brief Set the NODELAY socket option to avoid Nagle-like behavior

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0adbc4cec35be7c36bdf01d4d8fefd6097e9be5d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-gsm-tester[master]: trial: always use abspath

2017-05-14 Thread Neels Hofmeyr
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/2607

to look at the new patch set (#2).

trial: always use abspath

No actual failure known, but using the abspath will prevent further problems
when running a binary in its own run dir and passing trial paths to it.

Adjust test expectations.

Change-Id: Ia2ba876a42eef9122a92645edd1f28ddb56e6be3
---
M selftest/trial_test.ok
M selftest/trial_test.ok.ign
M src/osmo_gsm_tester/trial.py
3 files changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/07/2607/2

diff --git a/selftest/trial_test.ok b/selftest/trial_test.ok
index 66dcff0..6ad39a9 100644
--- a/selftest/trial_test.ok
+++ b/selftest/trial_test.ok
@@ -11,6 +11,6 @@
 None
 - test checksum verification
 - detect wrong checksum
-ok, got RuntimeError("Checksum mismatch for 
'trial_test/invalid_checksum/file2' vs. 
'trial_test/invalid_checksum/checksums.md5' line 2",)
+ok, got RuntimeError("Checksum mismatch for 
'[PATH]/trial_test/invalid_checksum/file2' vs. 
'[PATH]/trial_test/invalid_checksum/checksums.md5' line 2",)
 - detect missing file
-ok, got RuntimeError("File listed in checksums file but missing in trials dir: 
'trial_test/missing_file/file2' vs. 'trial_test/missing_file/checksums.md5' 
line 2",)
+ok, got RuntimeError("File listed in checksums file but missing in trials dir: 
'[PATH]/trial_test/missing_file/file2' vs. 
'[PATH]/trial_test/missing_file/checksums.md5' line 2",)
diff --git a/selftest/trial_test.ok.ign b/selftest/trial_test.ok.ign
index 38a82ce..1a969de 100644
--- a/selftest/trial_test.ok.ign
+++ b/selftest/trial_test.ok.ign
@@ -1,2 +1,3 @@
 /tmp/[^/]* [TMP]
 -..-.._..-..-..[TIMESTAMP]
+'[^']*/trial_test  '[PATH]/trial_test
diff --git a/src/osmo_gsm_tester/trial.py b/src/osmo_gsm_tester/trial.py
index 73e5322..6d507fb 100644
--- a/src/osmo_gsm_tester/trial.py
+++ b/src/osmo_gsm_tester/trial.py
@@ -52,7 +52,7 @@
 return Trial(trials_dir.child(next_trial)).take()
 
 def __init__(self, trial_dir):
-self.path = trial_dir
+self.path = os.path.abspath(trial_dir)
 self.set_name(os.path.basename(self.path))
 self.set_log_category(log.C_TST)
 self.dir = util.Dir(self.path)

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia2ba876a42eef9122a92645edd1f28ddb56e6be3
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-gsm-tester[master]: log state dir

2017-05-14 Thread Neels Hofmeyr
Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

https://gerrit.osmocom.org/2598

to look at the new patch set (#2).

log state dir

On the log output, clearly show which state dir is used. Since all runs should
use the same state dir, this is important and/or reassuring to see.

Change-Id: Ie92f1879a35d8bb399ee916b7ef72f9ee7d47409
---
M selftest/suite_test.ok
M src/osmo_gsm_tester/suite.py
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/98/2598/2

diff --git a/selftest/suite_test.ok b/selftest/suite_test.ok
index bb04e49..fda77dc 100644
--- a/selftest/suite_test.ok
+++ b/selftest/suite_test.ok
@@ -25,7 +25,7 @@
 cnf -: DBG: Found config file resources.conf as 
[PATH]/selftest/suite_test/resources.conf in ./suite_test which is 
[PATH]/selftest/suite_test
 cnf -: DBG: Found path state_dir as 
[PATH]/selftest/suite_test/test_work/state_dir
 tst test_suite: Suite run start
-tst test_suite: reserving resources...
+tst test_suite: reserving resources in 
[PATH]/selftest/suite_test/test_work/state_dir ...
 tst test_suite: DBG: {combining='resources'}  [test_suite↪test_suite]
 tst test_suite: DBG: {definition_conf={bts=[{'times': '1'}], modem=[{'times': 
'2'}], nitb_iface=[{'times': '1'}]}}  
[test_suite↪(combining_scenarios='resources')↪test_suite]
 tst test_suite: Reserving 1 x bts (candidates: 3)  [test_suite↪test_suite]
diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index affb9ad..43e55af 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -186,7 +186,7 @@
 def reserve_resources(self):
 if self.reserved_resources:
 raise RuntimeError('Attempt to reserve resources twice for a 
SuiteRun')
-self.log('reserving resources...')
+self.log('reserving resources in', self.resources_pool.state_dir, 
'...')
 with self:
 self.reserved_resources = self.resources_pool.reserve(self, 
self.resource_requirements())
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie92f1879a35d8bb399ee916b7ef72f9ee7d47409
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-gsm-tester[master]: debug suite: add test that deliberately fails

2017-05-14 Thread Neels Hofmeyr

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

debug suite: add test that deliberately fails

Change-Id: I42ab624f8dd8e91ee62b8eccfa451e01fd3694d0
---
A suites/debug/fail.py
1 file changed, 5 insertions(+), 0 deletions(-)


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

diff --git a/suites/debug/fail.py b/suites/debug/fail.py
new file mode 100644
index 000..1b412b5
--- /dev/null
+++ b/suites/debug/fail.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python3
+from osmo_gsm_tester.test import *
+
+# This can be used to verify that a test failure is reported properly.
+assert False

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42ab624f8dd8e91ee62b8eccfa451e01fd3694d0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: trial: always use abspath

2017-05-14 Thread Neels Hofmeyr

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

trial: always use abspath

No actual failure known, but using the abspath will prevent further problems
when running a binary in its own run dir and passing trial paths to it.

Change-Id: Ia2ba876a42eef9122a92645edd1f28ddb56e6be3
---
M src/osmo_gsm_tester/trial.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/src/osmo_gsm_tester/trial.py b/src/osmo_gsm_tester/trial.py
index 73e5322..6d507fb 100644
--- a/src/osmo_gsm_tester/trial.py
+++ b/src/osmo_gsm_tester/trial.py
@@ -52,7 +52,7 @@
 return Trial(trials_dir.child(next_trial)).take()
 
 def __init__(self, trial_dir):
-self.path = trial_dir
+self.path = os.path.abspath(trial_dir)
 self.set_name(os.path.basename(self.path))
 self.set_log_category(log.C_TST)
 self.dir = util.Dir(self.path)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2ba876a42eef9122a92645edd1f28ddb56e6be3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: jenkins-run: clean up also upon error

2017-05-14 Thread Neels Hofmeyr

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

jenkins-run: clean up also upon error

Change-Id: I949849d85d93cb47c839cd738788cf6f9b22fc12
---
M contrib/jenkins-run.sh
1 file changed, 7 insertions(+), 1 deletion(-)


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

diff --git a/contrib/jenkins-run.sh b/contrib/jenkins-run.sh
index 87d29bf..3931ddb 100755
--- a/contrib/jenkins-run.sh
+++ b/contrib/jenkins-run.sh
@@ -16,10 +16,16 @@
 
 # OSMO_GSM_TESTER_OPTS is a way to pass in e.g. logging preferences from the
 # jenkins build job.
-python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS
+# On failure, first clean up below and then return the exit code.
+exit_code="1"
+if python3 -u "$(which osmo-gsm-tester.py)" "$trial_dir" $OSMO_GSM_TESTER_OPTS 
; then
+  exit_code="0"
+fi
 
 # no need to keep extracted binaries
 rm -rf "$trial_dir/inst" || true
 
 # tar up all results for archiving (optional)
 tar czf "$trial_dir"-run.tgz "$trial_dir"
+
+exit $exit_code

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I949849d85d93cb47c839cd738788cf6f9b22fc12
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: cosmetic: contrib: add 'build-' to script names

2017-05-14 Thread Neels Hofmeyr

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

cosmetic: contrib: add 'build-' to script names

Distinguish the scripts that build binaries from the others by adding "build-"
to their names.

Change-Id: I0c3b0c06210f5cb6a936c5e90ebc9167b57eeae2
---
R contrib/jenkins-build-osmo-bts-octphy.sh
R contrib/jenkins-build-osmo-bts-sysmo.sh
R contrib/jenkins-build-osmo-bts-trx.sh
R contrib/jenkins-build-osmo-nitb.sh
4 files changed, 0 insertions(+), 0 deletions(-)


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

diff --git a/contrib/jenkins-osmo-bts-octphy.sh 
b/contrib/jenkins-build-osmo-bts-octphy.sh
similarity index 100%
rename from contrib/jenkins-osmo-bts-octphy.sh
rename to contrib/jenkins-build-osmo-bts-octphy.sh
diff --git a/contrib/jenkins-osmo-bts-sysmo.sh 
b/contrib/jenkins-build-osmo-bts-sysmo.sh
similarity index 100%
rename from contrib/jenkins-osmo-bts-sysmo.sh
rename to contrib/jenkins-build-osmo-bts-sysmo.sh
diff --git a/contrib/jenkins-osmo-bts-trx.sh 
b/contrib/jenkins-build-osmo-bts-trx.sh
similarity index 100%
rename from contrib/jenkins-osmo-bts-trx.sh
rename to contrib/jenkins-build-osmo-bts-trx.sh
diff --git a/contrib/jenkins-osmo-nitb.sh b/contrib/jenkins-build-osmo-nitb.sh
similarity index 100%
rename from contrib/jenkins-osmo-nitb.sh
rename to contrib/jenkins-build-osmo-nitb.sh

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c3b0c06210f5cb6a936c5e90ebc9167b57eeae2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: checkout dependencies from script

2017-05-14 Thread Neels Hofmeyr

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

checkout dependencies from script

The jenkins jobs used to have multiple source repositories configured, but it
is really cumbersome to add all the SCM links to a jenkins job.

Instead, clone the git sources from the script, as we also do in various other
contrib/ scripts.

This partly duplicates the osmo-ci scripts, but since this code is much more
intended to run on other peoples' jenkins instances, rather keep the osmo-ci
dependency out of here.

Change-Id: Ie05cb9cd2bd884f72cbdbcc96d9c4389ffca7357
---
M contrib/jenkins-osmo-bts-octphy.sh
M contrib/jenkins-osmo-bts-sysmo.sh
M contrib/jenkins-osmo-bts-trx.sh
M contrib/jenkins-osmo-nitb.sh
4 files changed, 21 insertions(+), 20 deletions(-)


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

diff --git a/contrib/jenkins-osmo-bts-octphy.sh 
b/contrib/jenkins-osmo-bts-octphy.sh
index 49560ca..a4a57e4 100755
--- a/contrib/jenkins-osmo-bts-octphy.sh
+++ b/contrib/jenkins-osmo-bts-octphy.sh
@@ -15,14 +15,14 @@
 have_repo() {
repo="$1"
cd "$base"
-   if [ ! -e "$repo" ]; then
-   set +x
-   echo "MISSING REPOSITORY: $repo"
-   echo "should be provided by the jenkins workspace"
-   exit 1
+   if [ ! -d "$repo" ]; then
+   git clone "git://git.osmocom.org/$repo" "$repo"
fi
cd "$repo"
git clean -dxf
+   git fetch origin
+   git reset --hard origin/master
+   git rev-parse HEAD
cd "$base"
 }
 
diff --git a/contrib/jenkins-osmo-bts-sysmo.sh 
b/contrib/jenkins-osmo-bts-sysmo.sh
index 52f7593..5e6c9d9 100755
--- a/contrib/jenkins-osmo-bts-sysmo.sh
+++ b/contrib/jenkins-osmo-bts-sysmo.sh
@@ -13,14 +13,14 @@
 have_repo() {
repo="$1"
cd "$base"
-   if [ ! -e "$repo" ]; then
-   set +x
-   echo "MISSING REPOSITORY: $repo"
-   echo "should be provided by the jenkins workspace"
-   exit 1
+   if [ ! -d "$repo" ]; then
+   git clone "git://git.osmocom.org/$repo" "$repo"
fi
cd "$repo"
git clean -dxf
+   git fetch origin
+   git reset --hard origin/master
+   git rev-parse HEAD
cd "$base"
 }
 
diff --git a/contrib/jenkins-osmo-bts-trx.sh b/contrib/jenkins-osmo-bts-trx.sh
index e44cf0a..fb49a75 100755
--- a/contrib/jenkins-osmo-bts-trx.sh
+++ b/contrib/jenkins-osmo-bts-trx.sh
@@ -16,14 +16,14 @@
 have_repo() {
repo="$1"
cd "$base"
-   if [ ! -e "$repo" ]; then
-   set +x
-   echo "MISSING REPOSITORY: $repo"
-   echo "should be provided by the jenkins workspace"
-   exit 1
+   if [ ! -d "$repo" ]; then
+   git clone "git://git.osmocom.org/$repo" "$repo"
fi
cd "$repo"
git clean -dxf
+   git fetch origin
+   git reset --hard origin/master
+   git rev-parse HEAD
cd "$base"
 }
 
diff --git a/contrib/jenkins-osmo-nitb.sh b/contrib/jenkins-osmo-nitb.sh
index 05d2041..61d6e2f 100755
--- a/contrib/jenkins-osmo-nitb.sh
+++ b/contrib/jenkins-osmo-nitb.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 set -e -x
 
 base="$PWD"
@@ -18,14 +19,14 @@
 have_repo() {
repo="$1"
cd "$base"
-   if [ ! -e "$repo" ]; then
-   set +x
-   echo "MISSING REPOSITORY: $repo"
-   echo "should be provided by the jenkins workspace"
-   exit 1
+   if [ ! -d "$repo" ]; then
+   git clone "git://git.osmocom.org/$repo" "$repo"
fi
cd "$repo"
git clean -dxf
+   git fetch origin
+   git reset --hard origin/master
+   git rev-parse HEAD
cd "$base"
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie05cb9cd2bd884f72cbdbcc96d9c4389ffca7357
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: sysmo: use abspath of run dir, to fix scp of cfg to sysmobts

2017-05-14 Thread Neels Hofmeyr

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

sysmo: use abspath of run dir, to fix scp of cfg to sysmobts

Fixes error:

03:10:40 run   scp-cfg-to-sysmobts(pid=13723): stderr:
 | (launched: 2017-05-14_03:10:36)
| trial-10/run.2017-05-14_03-09-38/osmo-bts-sysmo/osmo-bts-sysmo.cfg: No such 
file or directory

Change-Id: Ib430657fd0d83a1a59b4b4b0ad6186c95347cb7b
---
M src/osmo_gsm_tester/bts_sysmo.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/src/osmo_gsm_tester/bts_sysmo.py b/src/osmo_gsm_tester/bts_sysmo.py
index 1c36fb8..065a1fb 100644
--- a/src/osmo_gsm_tester/bts_sysmo.py
+++ b/src/osmo_gsm_tester/bts_sysmo.py
@@ -47,7 +47,7 @@
 if self.nitb is None:
 raise RuntimeError('BTS needs to be added to a NITB before it 
can be started')
 self.log('Starting sysmoBTS to connect to', self.nitb)
-self.run_dir = 
util.Dir(self.suite_run.trial.get_run_dir().new_dir(self.name()))
+self.run_dir = 
util.Dir(os.path.abspath(self.suite_run.trial.get_run_dir().new_dir(self.name(
 self.configure()
 
 self.inst = 
util.Dir(os.path.abspath(self.suite_run.trial.get_inst(SysmoBts.BTS_SYSMO_BIN)))

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib430657fd0d83a1a59b4b4b0ad6186c95347cb7b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: fix: exception outside of trial run should be logged and cau...

2017-05-14 Thread Neels Hofmeyr

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

fix: exception outside of trial run should be logged and cause nonzero rc

>From an earlier stage of the code, there was still an exception catcher that
makes no sense. Remove it.

Change-Id: I8085318c91b06a3e8f7d3f8cfdd15a99650666e2
---
M src/osmo-gsm-tester.py
1 file changed, 10 insertions(+), 6 deletions(-)


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

diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py
index e38fae6..7f53750 100755
--- a/src/osmo-gsm-tester.py
+++ b/src/osmo-gsm-tester.py
@@ -70,7 +70,7 @@
 from osmo_gsm_tester import __version__
 from osmo_gsm_tester import trial, suite, log, config
 
-if __name__ == '__main__':
+def main():
 import argparse
 
 parser = argparse.ArgumentParser(epilog=__doc__, 
formatter_class=argparse.RawTextHelpFormatter)
@@ -166,11 +166,8 @@
 trials = []
 for trial_package in args.trial_package:
 t = trial.Trial(trial_package)
-try:
-t.verify()
-trials.append(t)
-except:
-t.log_exn()
+t.verify()
+trials.append(t)
 
 trials_passed = []
 trials_failed = []
@@ -212,4 +209,11 @@
 print('FAIL:', suite)
 exit(1)
 
+if __name__ == '__main__':
+try:
+main()
+except:
+log.log_exn()
+raise
+
 # vim: expandtab tabstop=4 shiftwidth=4

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8085318c91b06a3e8f7d3f8cfdd15a99650666e2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: contrib: rethink jenkins jobs with build slave approach

2017-05-14 Thread Neels Hofmeyr

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

contrib: rethink jenkins jobs with build slave approach

Previously, the idea was to run a test remotely via SSH. This has moved to
operating an actual jenkins build slave on the main unit, which simplifies
things.

Also, previously (in the old osmo-gsm-tester), there was a daemon running,
accepting new trials by a directory appearing. Now, we're directly launching a
test run, which simplifies things.

Remove all SSH stuff from the "run" script.

Compose the checksums of the built binary-tars in the actual build jobs. In the
"run" job, only combine those checksums to one file. (Otherwise we would
compose the sums after transmitting over the network to the build slave.)

Instead of storing trials in a common location on the system, just keep one
trial in the workspace per run. After the run, tar up the trial dir to enable
easy archiving of build results.

The common location on the system might still be a good idea if we're one day
going to move to concurrent runs with scheduling of hardware resources, but so
far we're having simple one-shot runs.

Change-Id: I129f5189ce2bebd761bc752b158fb8778b31010e
---
M contrib/jenkins-osmo-bts-octphy.sh
M contrib/jenkins-osmo-bts-sysmo.sh
M contrib/jenkins-osmo-bts-trx.sh
M contrib/jenkins-osmo-nitb.sh
M contrib/jenkins-run.sh
5 files changed, 41 insertions(+), 37 deletions(-)


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

diff --git a/contrib/jenkins-osmo-bts-octphy.sh 
b/contrib/jenkins-osmo-bts-octphy.sh
index a4a57e4..4045948 100755
--- a/contrib/jenkins-osmo-bts-octphy.sh
+++ b/contrib/jenkins-osmo-bts-octphy.sh
@@ -61,6 +61,10 @@
 done
 
 # build the archive that is going to be copied to the tester
-rm "$base"/*.tgz || true
+rm "$base"/*.tgz "$base"/*.md5 || true
 cd "$prefix"
-tar czf "$base/osmo-bts-octphy.build-${BUILD_NUMBER}.tgz" *
+this="osmo-bts-octphy.build-${BUILD_NUMBER}"
+tar="${this}.tgz"
+tar czf "$base/$tar" *
+cd "$base"
+md5sum "$tar" > "${this}.md5"
diff --git a/contrib/jenkins-osmo-bts-sysmo.sh 
b/contrib/jenkins-osmo-bts-sysmo.sh
index 5e6c9d9..f321b8c 100755
--- a/contrib/jenkins-osmo-bts-sysmo.sh
+++ b/contrib/jenkins-osmo-bts-sysmo.sh
@@ -65,6 +65,10 @@
 done
 
 # build the archive that is going to be copied to the tester and then to the 
BTS
-rm "$base"/*.tgz || true
+rm "$base"/*.tgz "$base"/*.md5 || true
 cd "$prefix_real"
-tar cvzf "$base/osmo-bts-sysmo.build-${BUILD_NUMBER}.tgz" *
+this="osmo-bts-sysmo.build-${BUILD_NUMBER}"
+tar="${this}.tgz"
+tar czf "$base/$tar" *
+cd "$base"
+md5sum "$tar" > "${this}.md5"
diff --git a/contrib/jenkins-osmo-bts-trx.sh b/contrib/jenkins-osmo-bts-trx.sh
index fb49a75..652913f 100755
--- a/contrib/jenkins-osmo-bts-trx.sh
+++ b/contrib/jenkins-osmo-bts-trx.sh
@@ -60,6 +60,10 @@
 done
 
 # build the archive that is going to be copied to the tester
-rm "$base"/*.tgz || true
+rm "$base"/*.tgz "$base"/*.md5 || true
 cd "$prefix"
-tar czf "$base/osmo-bts-trx.build-${BUILD_NUMBER}.tgz" *
+this="osmo-bts-trx.build-${BUILD_NUMBER}"
+tar="${this}.tgz"
+tar czf "$base/$tar" *
+cd "$base"
+md5sum "$tar" > "${this}.md5"
diff --git a/contrib/jenkins-osmo-nitb.sh b/contrib/jenkins-osmo-nitb.sh
index 61d6e2f..6a2420b 100755
--- a/contrib/jenkins-osmo-nitb.sh
+++ b/contrib/jenkins-osmo-nitb.sh
@@ -60,6 +60,10 @@
 done
 
 # build the archive that is going to be copied to the tester
-rm "$base"/*.tgz || true
+rm "$base"/*.tgz "$base"/*.md5 || true
 cd "$prefix"
-tar czf "$base/osmo-nitb.build-${BUILD_NUMBER}.tgz" *
+this="osmo-nitb.build-${BUILD_NUMBER}"
+tar="${this}.tgz"
+tar czf "$base/$tar" *
+cd "$base"
+md5sum "$tar" > "${this}.md5"
diff --git a/contrib/jenkins-run.sh b/contrib/jenkins-run.sh
index 7d796b5..87d29bf 100755
--- a/contrib/jenkins-run.sh
+++ b/contrib/jenkins-run.sh
@@ -1,37 +1,25 @@
 #!/bin/sh
 set -e -x
 
-if [ -z "$OSMO_GSM_TESTER_REMOTE_MAIN_UNIT" ]; then
-  echo "To run the tests from jenkins, a main unit host must be defined."
-  echo "e.g. OSMO_GSM_TESTER_REMOTE_MAIN_UNIT=\"user@10.9.8.7\""
-fi
+# remove older trial dirs and *-run.tgz, if any
+trial_dir_prefix="trial-"
+rm -rf "$trial_dir_prefix"* || true
 
-osmo_gsm_tester_host="$OSMO_GSM_TESTER_REMOTE_MAIN_UNIT"
-osmo_gsm_tester_src="${OSMO_GSM_TESTER_REMOTE_SRC:-/usr/local/src/osmo-gsm-tester}"
-osmo_gsm_tester_dir="/var/tmp/osmo-gsm-tester/trials"
-tmp_dir="/var/tmp/osmo-gsm-tester/.prep-trials"
+# Expecting *.tgz artifacts to be copied to this workspace from the various
+# jenkins-*.sh runs, via jenkins job configuration. Compose a trial dir:
+trial_dir="${trial_dir_prefix}$BUILD_NUMBER"
+mkdir -p "$trial_dir"
 
-#trial_name="$NODE_NAME-$BUILD_TAG"
-trial_name="trial-$BUILD_NUMBER"
-local_trial_base="./compose_trial"
-local_trial_dir="$local_trial_base/$trial_name"
+mv *.tgz "$trial_dir"
+cat *.md5 >> "$trial_dir/checksums.md5"
+rm *.md5
 
-rm -rf "$local_trial_base" || true
-mkdir -p "$local_trial_dir"
+# OSMO_GSM_TESTER_OPTS is a way to pass in e.g. logging pre

[PATCH] osmo-gsm-tester[master]: fix name of local var, to not shadow 'suite' module

2017-05-14 Thread Neels Hofmeyr

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

fix name of local var, to not shadow 'suite' module

This caused "UnboundLocalError: local variable 'suite' referenced before
assignment".

Change-Id: Ic9aa383f5cdc9818c5a21b101fb6ddea4132d9fb
---
M src/osmo-gsm-tester.py
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py
index 7f53750..86a9e7e 100755
--- a/src/osmo-gsm-tester.py
+++ b/src/osmo-gsm-tester.py
@@ -67,11 +67,11 @@
 '''
 
 import sys
+import argparse
 from osmo_gsm_tester import __version__
 from osmo_gsm_tester import trial, suite, log, config
 
 def main():
-import argparse
 
 parser = argparse.ArgumentParser(epilog=__doc__, 
formatter_class=argparse.RawTextHelpFormatter)
 # Note: since we're using RawTextHelpFormatter to keep nicely separate
@@ -205,8 +205,8 @@
 print('Trials failed:')
 for trial_name, suites_passed, suites_failed in trials_failed:
 print('  %s (%d of %d suite runs failed)' % (trial_name, 
len(suites_failed), len(suites_failed) + len(suites_passed)))
-for suite in suites_failed:
-print('FAIL:', suite)
+for suite_failed in suites_failed:
+print('FAIL:', suite_failed)
 exit(1)
 
 if __name__ == '__main__':

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9aa383f5cdc9818c5a21b101fb6ddea4132d9fb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: log: tweak osmo-gsm-tester.py stdout: all_origins=False, src...

2017-05-14 Thread Neels Hofmeyr

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

log: tweak osmo-gsm-tester.py stdout: all_origins=False, src=False

Change-Id: I24a600f67f7a9f3d1235abfceb86f311ffa97746
---
M src/osmo-gsm-tester.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py
index e38fae6..2d02021 100755
--- a/src/osmo-gsm-tester.py
+++ b/src/osmo-gsm-tester.py
@@ -117,7 +117,7 @@
 print('tests:', repr(args.test))
 
 # create a default log to stdout
-log.LogTarget()
+log.LogTarget().style(all_origins=False, src=False)
 
 if args.log_level:
 log.set_all_levels(log.LEVEL_STRS.get(args.log_level))

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24a600f67f7a9f3d1235abfceb86f311ffa97746
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: log state dir

2017-05-14 Thread Neels Hofmeyr

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

log state dir

On the log output, clearly show which state dir is used. Since all runs should
use the same state dir, this is important and/or reassuring to see.

Change-Id: Ie92f1879a35d8bb399ee916b7ef72f9ee7d47409
---
M src/osmo_gsm_tester/suite.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index affb9ad..43e55af 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -186,7 +186,7 @@
 def reserve_resources(self):
 if self.reserved_resources:
 raise RuntimeError('Attempt to reserve resources twice for a 
SuiteRun')
-self.log('reserving resources...')
+self.log('reserving resources in', self.resources_pool.state_dir, 
'...')
 with self:
 self.reserved_resources = self.resources_pool.reserve(self, 
self.resource_requirements())
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie92f1879a35d8bb399ee916b7ef72f9ee7d47409
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: log the location of the detailed log file

2017-05-14 Thread Neels Hofmeyr

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

log the location of the detailed log file

The idea is that if someone reads the short log and scratches her head, she can
notice that there is a more detailed log available.

Change-Id: Id5f443f1af0dc774d4d4c588a238b786a83e44d3
---
M src/osmo_gsm_tester/trial.py
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/src/osmo_gsm_tester/trial.py b/src/osmo_gsm_tester/trial.py
index 73e5322..a7c74c4 100644
--- a/src/osmo_gsm_tester/trial.py
+++ b/src/osmo_gsm_tester/trial.py
@@ -65,14 +65,16 @@
 def __enter__(self):
 # add a log target to log to the run dir
 run_dir = self.get_run_dir()
+detailed_log = run_dir.new_child(FILE_LOG)
 self.log_targets = [
-log.FileLogTarget(run_dir.new_child(FILE_LOG))
+log.FileLogTarget(detailed_log)
   .set_all_levels(log.L_DBG)
   .style_change(trace=True),
 log.FileLogTarget(run_dir.new_child(FILE_LOG_BRIEF))
   .style_change(src=False, all_origins=False)
 ]
 self.log('Trial start')
+self.log('Detailed log at', detailed_log)
 self.take()
 super().__enter__()
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5f443f1af0dc774d4d4c588a238b786a83e44d3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: cosmetic: rather have an underscore in pcap_recorder.py

2017-05-14 Thread Neels Hofmeyr

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

cosmetic: rather have an underscore in pcap_recorder.py

Change-Id: Ib4886cb3fe0cb9c66d170097b98b4d1eb67cab81
---
M src/osmo_gsm_tester/osmo_nitb.py
R src/osmo_gsm_tester/pcap_recorder.py
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index b81d612..6ead67a 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -22,7 +22,7 @@
 import re
 import socket
 
-from . import log, util, config, template, process, osmo_ctrl, pcaprecorder
+from . import log, util, config, template, process, osmo_ctrl, pcap_recorder
 
 class OsmoNitb(log.Origin):
 suite_run = None
@@ -52,8 +52,8 @@
 raise RuntimeError('No lib/ in %r' % inst)
 
 iface = util.ip_to_iface(self.addr())
-pcaprecorder.PcapRecorder(self.suite_run, self.run_dir.new_dir('pcap'),
-  iface, self.addr())
+pcap_recorder.PcapRecorder(self.suite_run, 
self.run_dir.new_dir('pcap'),
+   iface, self.addr())
 
 env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
 
diff --git a/src/osmo_gsm_tester/pcaprecorder.py 
b/src/osmo_gsm_tester/pcap_recorder.py
similarity index 100%
rename from src/osmo_gsm_tester/pcaprecorder.py
rename to src/osmo_gsm_tester/pcap_recorder.py

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4886cb3fe0cb9c66d170097b98b4d1eb67cab81
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: pcap recorder: include vim indenting rules as comment

2017-05-14 Thread Neels Hofmeyr

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

pcap recorder: include vim indenting rules as comment

Change-Id: Idbc4521053610d55c9c32eff950ed8fa68dda171
---
M src/osmo_gsm_tester/pcaprecorder.py
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/src/osmo_gsm_tester/pcaprecorder.py 
b/src/osmo_gsm_tester/pcaprecorder.py
index 8020f40..1410f97 100644
--- a/src/osmo_gsm_tester/pcaprecorder.py
+++ b/src/osmo_gsm_tester/pcaprecorder.py
@@ -58,3 +58,5 @@
 
 def running(self):
 return not self.process.terminated()
+
+# vim: expandtab tabstop=4 shiftwidth=4

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbc4521053610d55c9c32eff950ed8fa68dda171
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-tester[master]: pcap recorder: filter out SSH

2017-05-14 Thread Neels Hofmeyr

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

pcap recorder: filter out SSH

The dump so far includes SSH to sysmoBTS, with binaries sent and log output
read, making the dump like 20 Mb in size for no reason; filter this out by
tcpdump expression.

Compose the expression in gen_filter() by joining a list of expressions with
'and'.

Change-Id: Icbb0f8d2058fa7ebb7f0f731645f9266cacdb120
Related: OS#2255
---
M src/osmo_gsm_tester/pcaprecorder.py
1 file changed, 4 insertions(+), 3 deletions(-)


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

diff --git a/src/osmo_gsm_tester/pcaprecorder.py 
b/src/osmo_gsm_tester/pcaprecorder.py
index 8a63b30..8020f40 100644
--- a/src/osmo_gsm_tester/pcaprecorder.py
+++ b/src/osmo_gsm_tester/pcaprecorder.py
@@ -50,10 +50,11 @@
 self.process.launch()
 
 def gen_filter(self):
-filter = ""
+filters = []
 if self.addr:
-filter += 'host ' + self.addr
-return filter
+filters.append('host ' + self.addr)
+filters.append('not port 22')
+return ' and '.join(['(%s)' % f for f in filters])
 
 def running(self):
 return not self.process.terminated()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbb0f8d2058fa7ebb7f0f731645f9266cacdb120
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[MERGED] libosmocore[master]: kasumi_test.c: fix incomplete check

2017-05-14 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged.

Change subject: kasumi_test.c: fix incomplete check
..


kasumi_test.c: fix incomplete check

Previously the 'passed' variable in test_expansion() was being
overwritten on every call of _compare_mem(), so only the result
of last call influenced the test result.

Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
---
M tests/kasumi/kasumi_test.c
1 file changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/kasumi/kasumi_test.c b/tests/kasumi/kasumi_test.c
index a4b1f8d..f0f173b 100644
--- a/tests/kasumi/kasumi_test.c
+++ b/tests/kasumi/kasumi_test.c
@@ -24,14 +24,14 @@
 {
_kasumi_key_expand(test_key, _KLi1, _KLi2, _KOi1, _KOi2, _KOi3, _KIi1, 
_KIi2, _KIi3);
int passed = 1;
-   passed = _compare_mem((uint8_t *)_KLi1, (uint8_t *)_KLi1_r, 16);
-   passed = _compare_mem((uint8_t *)_KLi2, (uint8_t *)_KLi2_r, 16);
-   passed = _compare_mem((uint8_t *)_KOi1, (uint8_t *)_KOi1_r, 16);
-   passed = _compare_mem((uint8_t *)_KOi2, (uint8_t *)_KOi2_r, 16);
-   passed = _compare_mem((uint8_t *)_KOi3, (uint8_t *)_KOi3_r, 16);
-   passed = _compare_mem((uint8_t *)_KIi1, (uint8_t *)_KIi1_r, 16);
-   passed = _compare_mem((uint8_t *)_KIi2, (uint8_t *)_KIi2_r, 16);
-   passed = _compare_mem((uint8_t *)_KIi3, (uint8_t *)_KIi3_r, 16);
+   passed &= _compare_mem((uint8_t *)_KLi1, (uint8_t *)_KLi1_r, 16);
+   passed &= _compare_mem((uint8_t *)_KLi2, (uint8_t *)_KLi2_r, 16);
+   passed &= _compare_mem((uint8_t *)_KOi1, (uint8_t *)_KOi1_r, 16);
+   passed &= _compare_mem((uint8_t *)_KOi2, (uint8_t *)_KOi2_r, 16);
+   passed &= _compare_mem((uint8_t *)_KOi3, (uint8_t *)_KOi3_r, 16);
+   passed &= _compare_mem((uint8_t *)_KIi1, (uint8_t *)_KIi1_r, 16);
+   passed &= _compare_mem((uint8_t *)_KIi2, (uint8_t *)_KIi2_r, 16);
+   passed &= _compare_mem((uint8_t *)_KIi3, (uint8_t *)_KIi3_r, 16);
printf(passed ? " OK. " : "FAILED!");
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: tnt 


[PATCH] osmo-gsm-manuals[master]: all manuals: number paragraphs up to level 5 depth

2017-05-14 Thread Neels Hofmeyr

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

all manuals: number paragraphs up to level 5 depth

Change-Id: Ic03ff99df4d655ce0b2dbc5a042a3a62f07cfef7
---
M build/custom-dblatex.sty
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals 
refs/changes/93/2593/1

diff --git a/build/custom-dblatex.sty b/build/custom-dblatex.sty
index 66cf9a1..a3822b5 100644
--- a/build/custom-dblatex.sty
+++ b/build/custom-dblatex.sty
@@ -27,6 +27,9 @@
 % ensure the section is called just HISTORY as required by GFDL
 \def\DBKrevtitle{HISTORY}
 
+% put numbers in section headers up to depth 5 (instead of just 3 by default)
+\setcounter{secnumdepth}{5}
+
 % interligne double
 \setlength{\oldbaselineskip}{\baselineskip}
 \setlength{\baselineskip}{2\oldbaselineskip}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic03ff99df4d655ce0b2dbc5a042a3a62f07cfef7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-gsm-manuals[master]: OsmoGSMTester: add install docs; fixes and tweaks

2017-05-14 Thread Neels Hofmeyr

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

OsmoGSMTester: add install docs; fixes and tweaks

Change-Id: I574937dbf31bce49cfb7523f91041c20fecb421e
---
M OsmoGSMTester/chapters/config.adoc
A OsmoGSMTester/chapters/install.adoc
M OsmoGSMTester/chapters/test_api.adoc
M OsmoGSMTester/chapters/trial.adoc
M OsmoGSMTester/osmo-gsm-tester-manual.adoc
5 files changed, 624 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals 
refs/changes/94/2594/1

diff --git a/OsmoGSMTester/chapters/config.adoc 
b/OsmoGSMTester/chapters/config.adoc
index 66f4b71..f264284 100644
--- a/OsmoGSMTester/chapters/config.adoc
+++ b/OsmoGSMTester/chapters/config.adoc
@@ -1,5 +1,8 @@
 == Configuration
 
+[[config_paths]]
+=== Config Paths
+
 The osmo-gsm-tester looks for configuration files in various standard
 directories in this order:
 
@@ -17,6 +20,8 @@
 - 'resources.conf'
 - 'default-suites.conf' (optional)
 - 'defaults.conf' (optional)
+
+These are described in detail in the following sections.
 
 === Format: YAML, and its Drawbacks
 
@@ -44,14 +49,14 @@
 Example:
 
 
-state_dir: '/var/run/osmo-gsm-tester'
-suites_dir: './suites'
+state_dir: '/var/tmp/osmo-gsm-tester/state'
+suites_dir: '/usr/local/src/osmo-gsm-tester/suites'
 scenarios_dir: './scenarios'
 
 
-If you would like to set up several separate 'paths.conf' files (not typical),
-note that the 'state_dir' is used to reserve resources, which only works when
-all configurations that share resources also use the same 'state_dir'.
+If you would like to set up several separate configurations (not typical), note
+that the 'state_dir' is used to reserve resources, which only works when all
+configurations that share resources also use the same 'state_dir'.
 
 [[resources_conf]]
 === 'resources.conf'
@@ -173,6 +178,8 @@
 - voice:trx+dyn_ts
 
 
+*TODO*: voice is not actually implemented yet
+
 === 'defaults.conf' (optional)
 
 Each binary run by osmo-gsm-tester, e.g. 'osmo-nitb' or 'osmo-bts-sysmo',
diff --git a/OsmoGSMTester/chapters/install.adoc 
b/OsmoGSMTester/chapters/install.adoc
new file mode 100644
index 000..17905be
--- /dev/null
+++ b/OsmoGSMTester/chapters/install.adoc
@@ -0,0 +1,600 @@
+== Installation on Main Unit
+
+The main unit is a general purpose computer that orchestrates the tests. It
+runs the core network components, controls the modems and so on. This can be
+anything from a dedicated production rack unit to your laptop at home.
+
+This manual will assume that tests are run from a jenkins build slave, by a
+user named 'jenkins'. The user configuration for manual test runs and/or a
+different user name is identical, simply replace the user name.
+
+=== Dependencies
+
+On a Debian/Ubuntu based system, these commands install the packages needed to
+run the osmo-gsm-tester.py code, i.e. install these on your main unit:
+
+
+apt-get install \
+  dbus \
+  tcpdump \
+  python3 \
+  python3-yaml \
+  python3-mako \
+  python3-gi \
+  ofono \
+  python3-pip
+pip3 install pydbus
+
+
+IMPORTANT: ofono may need to be installed from source to contain the most
+recent fixes needed to operate your modem. This depends on the modem hardware
+used and the tests run. Please see <>.
+
+To run osmo-bts-trx with a USRP attached, you may need to install a UHD driver.
+Please refer to http://osmocom.org/projects/osmotrx/wiki/OsmoTRX#UHD for
+details; the following is an example for the B200 family USRP devices:
+
+
+apt-get install libuhd-dev uhd-host
+/usr/lib/uhd/utils/uhd_images_downloader.py
+
+
+[[jenkins_deps]]
+ Jenkins Build Dependencies
+
+Each of the jenkins builds requires individual dependencies. This is generally
+the same as for building the software outside of osmo-gsm-tester and will not
+be detailed here. For the Osmocom projects, refer to
+http://osmocom.org/projects/cellular-infrastructure/wiki/Build_from_Source . Be
+aware of specific requirements for BTS hardware: for example, the
+osmo-bts-sysmo build needs the sysmoBTS SDK installed on the build slave, which
+should match the installed sysmoBTS firmware.
+
+
+[[configure_build_slave]]
+=== Jenkins Build Slave
+
+ Create 'jenkins' User on Main Unit
+
+On the main unit, create a jenkins user:
+
+
+useradd -m jenkins
+
+
+ Allow SSH Access from Jenkins Master
+
+Create an SSH keypair to be used for login on the osmo-gsm-tester. This may be
+entered on the jenkins web UI; alternatively, use the jenkins server's shell:
+
+Login on the main jenkins server shell and create an SSH keypair, for example:
+
+
+# su jenkins
+$ ssh-keygen
+Generating public/private rsa key pair.
+Enter file in which to save the key (/home/jenkins/.ssh/id_rsa): 
/usr/local/jenkins/keys/osmo-gsm-tester-rnd
+Enter passphrase (empty for no passphrase): 
+Enter same passphrase again: 
+Your identification has been saved in 
/usr/local/jenkins/keys/osmo-gsm-tester-rnd
+Your public key has been saved in 
/usr/local/jenkins/keys/osmo-gsm-tester-rnd.pub.

libosmocore[master]: kasumi_test.c: fix incomplete check

2017-05-14 Thread Neels Hofmeyr

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


[PATCH] libosmocore[master]: gsm/tlv.h: fix copy-paste error

2017-05-14 Thread Vadim Yanitskiy

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

gsm/tlv.h: fix copy-paste error

Change-Id: Id52ddd8358fd4af1ecc71142deb09f1e237021f3
---
M include/osmocom/gsm/tlv.h
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/2592/1

diff --git a/include/osmocom/gsm/tlv.h b/include/osmocom/gsm/tlv.h
index 701fe68..8e563de 100644
--- a/include/osmocom/gsm/tlv.h
+++ b/include/osmocom/gsm/tlv.h
@@ -66,9 +66,9 @@
uint16_t ret;
 
if (len <= TVLV_MAX_ONEBYTE)
-   return TLV_GROSS_LEN(len);
+   ret = TLV_GROSS_LEN(len);
else
-   return TL16V_GROSS_LEN(len);
+   ret = TL16V_GROSS_LEN(len);
 
if (tag > TVLV_MAX_ONEBYTE)
ret += 1;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id52ddd8358fd4af1ecc71142deb09f1e237021f3
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 


[PATCH] libosmocore[master]: fsm_test.c: fix unreachable check

2017-05-14 Thread Vadim Yanitskiy

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

fsm_test.c: fix unreachable check

Change-Id: Ic3d5da00f7ece6dbcd4c999187a5748c9331e60f
---
M tests/fsm/fsm_test.c
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/91/2591/1

diff --git a/tests/fsm/fsm_test.c b/tests/fsm/fsm_test.c
index eea8b22..3bcb7d4 100644
--- a/tests/fsm/fsm_test.c
+++ b/tests/fsm/fsm_test.c
@@ -95,8 +95,10 @@
 static struct ctrl_cmd *exec_ctrl_cmd(const char *cmdstr)
 {
struct ctrl_cmd *cmd;
-   return ctrl_cmd_exec_from_string(g_ctrl, cmdstr);
+
+   cmd = ctrl_cmd_exec_from_string(g_ctrl, cmdstr);
OSMO_ASSERT(cmd);
+
return cmd;
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3d5da00f7ece6dbcd4c999187a5748c9331e60f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 


[PATCH] libosmocore[master]: kasumi_test.c: fix incomplete check

2017-05-14 Thread Vadim Yanitskiy

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

kasumi_test.c: fix incomplete check

Previously the 'passed' variable in test_expansion() was being
overwritten on every call of _compare_mem(), so only the result
of last call influenced the test result.

Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
---
M tests/kasumi/kasumi_test.c
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/90/2590/1

diff --git a/tests/kasumi/kasumi_test.c b/tests/kasumi/kasumi_test.c
index a4b1f8d..f0f173b 100644
--- a/tests/kasumi/kasumi_test.c
+++ b/tests/kasumi/kasumi_test.c
@@ -24,14 +24,14 @@
 {
_kasumi_key_expand(test_key, _KLi1, _KLi2, _KOi1, _KOi2, _KOi3, _KIi1, 
_KIi2, _KIi3);
int passed = 1;
-   passed = _compare_mem((uint8_t *)_KLi1, (uint8_t *)_KLi1_r, 16);
-   passed = _compare_mem((uint8_t *)_KLi2, (uint8_t *)_KLi2_r, 16);
-   passed = _compare_mem((uint8_t *)_KOi1, (uint8_t *)_KOi1_r, 16);
-   passed = _compare_mem((uint8_t *)_KOi2, (uint8_t *)_KOi2_r, 16);
-   passed = _compare_mem((uint8_t *)_KOi3, (uint8_t *)_KOi3_r, 16);
-   passed = _compare_mem((uint8_t *)_KIi1, (uint8_t *)_KIi1_r, 16);
-   passed = _compare_mem((uint8_t *)_KIi2, (uint8_t *)_KIi2_r, 16);
-   passed = _compare_mem((uint8_t *)_KIi3, (uint8_t *)_KIi3_r, 16);
+   passed &= _compare_mem((uint8_t *)_KLi1, (uint8_t *)_KLi1_r, 16);
+   passed &= _compare_mem((uint8_t *)_KLi2, (uint8_t *)_KLi2_r, 16);
+   passed &= _compare_mem((uint8_t *)_KOi1, (uint8_t *)_KOi1_r, 16);
+   passed &= _compare_mem((uint8_t *)_KOi2, (uint8_t *)_KOi2_r, 16);
+   passed &= _compare_mem((uint8_t *)_KOi3, (uint8_t *)_KOi3_r, 16);
+   passed &= _compare_mem((uint8_t *)_KIi1, (uint8_t *)_KIi1_r, 16);
+   passed &= _compare_mem((uint8_t *)_KIi2, (uint8_t *)_KIi2_r, 16);
+   passed &= _compare_mem((uint8_t *)_KIi3, (uint8_t *)_KIi3_r, 16);
printf(passed ? " OK. " : "FAILED!");
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 


osmo-bts[master]: Prepare for BTS attribute reporting via OML

2017-05-14 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4649100df8f1b8e095f210fc294567ba014c0b6a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


openbsc[master]: Get basic BTS attributes

2017-05-14 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I589be51daca0cb9e1f3473b93e910e46b06e23ae
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


openbsc[master]: Prepare for BTS attribute reporting via OML

2017-05-14 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7ecb0c4339530d3a8354a2f94b34063dda87e030
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmocore[master]: Make EARFCN size calculation more robust

2017-05-14 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I92e12e91605bdab9916a3f665705287572434f74
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmocore[master]: Make EARFCN size calculation more robust

2017-05-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Make EARFCN size calculation more robust
..


Make EARFCN size calculation more robust

* add osmo_earfcn_bit_size_ext() function which allows to specify how many
  EARFCNs we should skip when estimating required bit size for SI2quater
* make old osmo_earfcn_bit_size() into wrapper over newly added function
  and mark it as deprecated

This is necessary to properly estimate necessary space for EARFCNs when
they are spread over several SI2q messages with different index.

Change-Id: I92e12e91605bdab9916a3f665705287572434f74
Related: RT#8792
---
M include/osmocom/gsm/sysinfo.h
M src/gsm/libosmogsm.map
M src/gsm/sysinfo.c
3 files changed, 26 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/gsm/sysinfo.h b/include/osmocom/gsm/sysinfo.h
index c7972f4..f3e0f22 100644
--- a/include/osmocom/gsm/sysinfo.h
+++ b/include/osmocom/gsm/sysinfo.h
@@ -1,6 +1,8 @@
 #pragma once
 
 #include 
+
+#include 
 #include 
 #include 
 
@@ -66,7 +68,8 @@
 extern const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE];
 int osmo_earfcn_add(struct osmo_earfcn_si2q *e, uint16_t arfcn, uint8_t 
meas_bw);
 int osmo_earfcn_del(struct osmo_earfcn_si2q *e, uint16_t arfcn);
-size_t osmo_earfcn_bit_size(const struct osmo_earfcn_si2q *e);
+size_t osmo_earfcn_bit_size(const struct osmo_earfcn_si2q *e) 
OSMO_DEPRECATED("Use osmo_earfcn_bit_size_ext()instead.");
+size_t osmo_earfcn_bit_size_ext(const struct osmo_earfcn_si2q *e, size_t 
offset);
 void osmo_earfcn_init(struct osmo_earfcn_si2q *e);
 uint8_t osmo_sitype2rsl(enum osmo_sysinfo_type si_type);
 enum osmo_sysinfo_type osmo_rsl2sitype(uint8_t rsl_si);
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 97fd2b4..8fb9878 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -48,6 +48,7 @@
 osmo_earfcn_add;
 osmo_earfcn_del;
 osmo_earfcn_bit_size;
+osmo_earfcn_bit_size_ext;
 osmo_earfcn_init;
 
 gprs_cipher_gen_input_i;
diff --git a/src/gsm/sysinfo.c b/src/gsm/sysinfo.c
index 3ec5444..b5ebd57 100644
--- a/src/gsm/sysinfo.c
+++ b/src/gsm/sysinfo.c
@@ -151,15 +151,30 @@
  */
 size_t osmo_earfcn_bit_size(const struct osmo_earfcn_si2q *e)
 {
+   return osmo_earfcn_bit_size_ext(e, 0);
+}
+
+/*! \brief Return number of bits necessary to represent earfcn struct as
+ *  Repeated E-UTRAN Neighbour Cells IE from 3GPP TS 44.018 Table 10.5.2.33b.1
+ *  \param[in,out] e earfcn struct
+ *  \param[in] offset into earfcn struct: how many EARFCNs to skip while 
estimating size
+ *  \returns number of bits
+ */
+size_t osmo_earfcn_bit_size_ext(const struct osmo_earfcn_si2q *e, size_t 
offset)
+{
/* 1 stop bit + 5 bits for THRESH_E-UTRAN_high */
-   size_t i, bits = 6;
+   size_t i, bits = 6, skip = 0;
for (i = 0; i < e->length; i++) {
if (e->arfcn[i] != OSMO_EARFCN_INVALID) {
-   bits += 17;
-   if (OSMO_EARFCN_MEAS_INVALID == e->meas_bw[i])
-   bits++;
-   else
-   bits += 4;
+   if (skip < offset)
+   skip++;
+   else {
+   bits += 17;
+   if (OSMO_EARFCN_MEAS_INVALID == e->meas_bw[i])
+   bits++;
+   else
+   bits += 4;
+   }
}
}
bits += (e->prio_valid) ? 4 : 1;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I92e12e91605bdab9916a3f665705287572434f74
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


openbsc[master]: Restructure SI2quater generation

2017-05-14 Thread Harald Welte

Patch Set 3: Code-Review-1

(3 comments)

https://gerrit.osmocom.org/#/c/2588/3/openbsc/src/libbsc/rest_octets.c
File openbsc/src/libbsc/rest_octets.c:

PS3, Line 192: )
where does the magic number 25 originate from?


https://gerrit.osmocom.org/#/c/2588/3/openbsc/src/libbsc/system_information.c
File openbsc/src/libbsc/system_information.c:

PS3, Line 674: s
this needs documentation in the code.  The name implies that si2q is not 
needed. but why would it not be needed?


Line 691: size_t earfcn_num(const struct osmo_earfcn_si2q *e)
does it return an EARFCN Number (the EARFCN) or rather the count of EARFCN? In 
latter caes, it might be better to rename it.  Also, as the function is 
non-static, it might make sense to call it si2q_count_earfcn or 
si2q_earfcn_count to give it some significance in the global namespace.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib554cf7ffc949a321571e1ae2ada1160e1b35fa6
Gerrit-PatchSet: 3
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


openbsc[master]: libmsc: Map SMPP command status to GSM 04.11 cause

2017-05-14 Thread Pablo Neira Ayuso

Patch Set 1: Code-Review-1

(6 comments)

https://gerrit.osmocom.org/#/c/2589/1/openbsc/src/libmsc/smpp_openbsc.c
File openbsc/src/libmsc/smpp_openbsc.c:

Line 464: #define SMPP_TO_GSM411_MAX 4
> You're defining this value but not using it the array definition... (s.b.)
Right. Keith, if you use ARRAY_SIZE() then we can skip this macro definition.


Line 466: struct x {
> (no x here please)
Keith, just remove this x. Keep it:

struct {
  ...


Line 477:   .smpp_status_code = ESME_RSYSERR,
> could omit the explicit names, just { ESME_X, GSM411_X }, ...
This is C99 structure initialization... which is actually a good idea since it 
makes code more readable and maintainable. Please keep it there.


PS1, Line 481: .
Add indent here, and everywhere inside the curly braces.


Line 502:   }
> (wrong indent)
That's equivalent... Fair enough.


Line 574:gsm411_cause);
This fits into the line, so no need to break it.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I61fb2d9ef4f2d2eabdc49b53d9966ad328d15e51
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Keith Whyte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pablo Neira Ayuso 
Gerrit-HasComments: Yes