osmo-sgsn[master]: .gitignore: Add m4 files

2018-02-12 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6389/1/.gitignore
File .gitignore:

Line 24: m4/lt~obsolete.m4
> I think, you can use a wildcard here ;)
Agreed.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


osmo-ttcn3-hacks[master]: General_Types: Add INT18b_BO_LAST type

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9611cad26bf9a447e63462caa608da1f5888a9d8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: gprs: Move NS Types/CodecPort/Emulation to library directory

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I876ce0e981d70ff0e737175983002268fd690989
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: gprs: Move BSSGP related code to library

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9e13c63cc12c88be82124a8e3ce3c315b7b3a1fa
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: Migrate Gb (NS/BSSGP) code over to Ericsson NS/BSSGP modules

2018-02-12 Thread Harald Welte

Patch Set 1:

this needs testing.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icbc4f5d24f3419f99c9a4805f836bddd2849f492
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: MSC_ConnectionHdlr: Add telnet to VTY to each ConnHdlr

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibd726af53219d829286da80b44ea4d9fb2ffdf3d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

2018-02-12 Thread Harald Welte

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

Move f_hex_is_odd_length from BSSMAP_Templates to GSM_Types

It's a quite frequent requirement in encoding IMSI/BCD numbers, so
let's move it to the more generic GSM_Types module.

Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
---
M library/BSSMAP_Templates.ttcn
M library/GSM_Types.ttcn
2 files changed, 8 insertions(+), 8 deletions(-)


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

diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index d4e278b..cd1caf2 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -644,14 +644,6 @@
 }
 
 
-function f_hex_is_odd_length(hexstring digits) return bitstring {
-   if (lengthof(digits) rem 2 == 1) {
-   return '1'B;
-   } else {
-   return '0'B;
-   }
-}
-
 template BSSMAP_IE_IMSI ts_BSSMAP_Imsi(hexstring imsi_digits) := {
elementIdentifier := '08'O,
lengthIndicator := 0, /* overwritten */
diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index e1d6b48..e57575d 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -160,4 +160,12 @@
sapi := sapi
};
 
+   function f_hex_is_odd_length(hexstring digits) return bitstring {
+   if (lengthof(digits) rem 2 == 1) {
+   return '1'B;
+   } else {
+   return '0'B;
+   }
+   }
+
 } with { encode "RAW"; variant "FIELDORDER(msb)" }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6fb8d9a6f37c990f6901fb48b15312a157954fda
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmo-ttcn3-hacks[master]: RSL_Emulation: Add procedure calls to suspend/resume dchan h...

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review-1

we should use a counter in case multiple components want to suspend, we want to 
resume processing only after the last resume has been issued.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: Migrate Gb (NS/BSSGP) code over to Ericsson NS/BSSGP modules

2018-02-12 Thread Harald Welte

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

Migrate Gb (NS/BSSGP) code over to Ericsson NS/BSSGP modules

When we started out, Ericsson hadn't released yet their NS and BSSGP
modules.  Let's port our logic over to their encoder/decoders, as they
are more complete (but less regular / more difficult to use).

Change-Id: Icbc4f5d24f3419f99c9a4805f836bddd2849f492
---
M gprs_gb/Test.ttcn
M gprs_gb/gen_links.sh
M gprs_gb/regen_makefile.sh
M library/BSSGP_Emulation.ttcn
M library/NS_CodecPort.ttcn
M library/NS_Emulation.ttcn
A library/Osmocom_Gb_Types.ttcn
7 files changed, 737 insertions(+), 143 deletions(-)


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

diff --git a/gprs_gb/Test.ttcn b/gprs_gb/Test.ttcn
index 1c3fb50..19cfd26 100644
--- a/gprs_gb/Test.ttcn
+++ b/gprs_gb/Test.ttcn
@@ -4,7 +4,7 @@
import from Osmocom_Types all;
import from GSM_Types all;
import from GSM_RR_Types all;
-   import from BSSGP_Helper_Functions all;
+   import from Osmocom_Gb_Types all;
import from BSSGP_Types all;
import from BSSGP_Emulation all;
import from NS_Types all;
@@ -16,7 +16,7 @@
 
type record MmContext {
octetstring imsi optional,
-   BssgpTlli   tlli,
+   GprsTllitlli,
uint9_t n_u
};
 
@@ -59,24 +59,9 @@
lapdm_component.start(LAPDmStart());
}
 
-   function f_bssgp_assert_prepr(in octetstring a, in octetstring b) {
-   log("BSSGP Input: ", a);
-   log("BSSGP Expected: ", b);
-   var octetstring a_preprocessed := f_BSSGP_expand_len(a);
-   log("BSSGP Preprocessed: ", a_preprocessed);
-
-   if (a_preprocessed != b) {
-   setverdict(fail);
-   } else {
-   setverdict(pass);
-   }
-   }
-
function f_bssgp_dec_and_log(in octetstring inp) {
log("BSSGP Input: ", inp);
-   var octetstring inp_p := f_BSSGP_expand_len(inp);
-   log("BSSGP Preprocessed: ", inp_p);
-   var BssgpPdu dec := dec_BssgpPdu(inp_p);
+   var PDU_BSSGP dec := dec_PDU_BSSGP(inp);
log("BSSGP Decoded: ", dec);
}
 
@@ -97,18 +82,6 @@
const octetstring c_gmm_mt_det_req := 
'00bb146ddd00500016820a8204030e8941c00908050215f0b6'O;
const octetstring c_gmm_mo_att_cpl := 
'01fb146ddd04088832f44000c80051e000800e000801c009080339d7bc'O;
 
-   /* single byte length to two byte length */
-   f_bssgp_assert_prepr('04058101'O, '0405000101'O);
-   f_bssgp_assert_prepr('040589000102030405060708'O, 
'04050009000102030405060708'O);
-   /* two byte length to two byte length */
-   f_bssgp_assert_prepr('0405000101'O, '0405000101'O);
-   /* special case: DL-UD + UL-UD */
-   f_bssgp_assert_prepr('00aabbccddeeffaa29822342'O, 
'00aabbccddeeffaa2900022342'O);
-   f_bssgp_assert_prepr('01aabbccddeeffaa29822342'O, 
'01aabbccddeeffaa2900022342'O);
-   /* multiple TLVs */
-   f_bssgp_assert_prepr('234281aa4382'O, 
'23420001aa430002'O);
-   f_bssgp_assert_prepr('230080'O, '2300'O);
-
f_bssgp_dec_and_log(c_bvc_reset_pcu);
f_bssgp_dec_and_log(c_bvc_reset_q);
f_bssgp_dec_and_log(c_status_pcu);
@@ -125,16 +98,14 @@
f_bssgp_dec_and_log(c_gmm_mt_det_req);
f_bssgp_dec_and_log(c_gmm_mo_att_cpl);
 
-   log(t_BSSGP_PS_PAGING_IMSI(196, '262420123456789'H));
+   log(ts_BSSGP_PS_PAGING_IMSI(196, '262420123456789'H));
}
 
function f_ns_assert_prepr(in octetstring a, in octetstring b) {
log("NS Input: ", a);
log("NS Expected: ", b);
-   var octetstring a_preprocessed := f_NS_expand_len(a);
-   log("NS Preprocessed: ", a_preprocessed);
 
-   if (a_preprocessed != b) {
+   if (a != b) {
setverdict(fail);
} else {
setverdict(pass);
@@ -143,9 +114,7 @@
 
function f_ns_dec_and_log(in octetstring inp) {
log("NS Input: ", inp);
-   var octetstring inp_p := f_NS_expand_len(inp);
-   log("NS Preprocessed: ", inp_p);
-   var NsPdu dec := dec_NsPdu(inp_p);
+   var PDU_NS dec := dec_PDU_NS(inp);
log("NS Decoded: ", dec);
}
 
@@ -167,57 +136,6 @@
f_ns_dec_and_log(c_ns_reset_pcu);
}
 
-   const BssgpQosProfile c_DefaultQos := { r := 80, spare := '00'B, c_r := 
false, t := false, a := false, precedence := 0 };
-   template BssgpTLV c_DefaultLifetimeTLV := t_BSSGP_IE_Lifetime(65535);
-
-   template BssgpTLV 

osmo-ttcn3-hacks[master]: RSL_Emulation: Add second RSL/RSL_PROC port for hand-over cases

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic22778f17dc4b93ef54837cf400ddd7d1732ae7e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: gprs: Move NS Types/CodecPort/Emulation to library directory

2018-02-12 Thread Harald Welte

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

gprs: Move NS Types/CodecPort/Emulation to library directory

Change-Id: I876ce0e981d70ff0e737175983002268fd690989
---
M gprs_gb/gen_links.sh
R library/NS_CodecPort.ttcn
R library/NS_CodecPort_CtrlFunct.ttcn
R library/NS_CodecPort_CtrlFunctDef.cc
R library/NS_Emulation.ttcn
R library/NS_Types.ttcn
6 files changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/gprs_gb/gen_links.sh b/gprs_gb/gen_links.sh
index 9f4cea4..2c01fa3 100755
--- a/gprs_gb/gen_links.sh
+++ b/gprs_gb/gen_links.sh
@@ -32,5 +32,6 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn"
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
+FILES+="NS_Types.ttcn NS_Emulation.ttcn NS_CodecPort.ttcn 
NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
 gen_links $DIR $FILES
diff --git a/gprs_gb/NS_CodecPort.ttcn b/library/NS_CodecPort.ttcn
similarity index 100%
rename from gprs_gb/NS_CodecPort.ttcn
rename to library/NS_CodecPort.ttcn
diff --git a/gprs_gb/NS_CodecPort_CtrlFunct.ttcn 
b/library/NS_CodecPort_CtrlFunct.ttcn
similarity index 100%
rename from gprs_gb/NS_CodecPort_CtrlFunct.ttcn
rename to library/NS_CodecPort_CtrlFunct.ttcn
diff --git a/gprs_gb/NS_CodecPort_CtrlFunctDef.cc 
b/library/NS_CodecPort_CtrlFunctDef.cc
similarity index 100%
rename from gprs_gb/NS_CodecPort_CtrlFunctDef.cc
rename to library/NS_CodecPort_CtrlFunctDef.cc
diff --git a/gprs_gb/NS_Emulation.ttcn b/library/NS_Emulation.ttcn
similarity index 100%
rename from gprs_gb/NS_Emulation.ttcn
rename to library/NS_Emulation.ttcn
diff --git a/gprs_gb/NS_Types.ttcn b/library/NS_Types.ttcn
similarity index 100%
rename from gprs_gb/NS_Types.ttcn
rename to library/NS_Types.ttcn

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I876ce0e981d70ff0e737175983002268fd690989
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-ttcn3-hacks[master]: sgsn: Skeleton of a SGSN test fremwork

2018-02-12 Thread Harald Welte

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

sgsn: Skeleton of a SGSN test fremwork

Based on the exsting NS/BSSGP emulation as well as the VTY, GSUP and
CTRL implementations, we are now building a test framework skeleton
for osmo-sgsn.

Change-Id: Icce90f9d8a680c7a523163e2c0bc03d12ff857e2
---
M library/BSSGP_Emulation.ttcn
A sgsn/SGSN_Tests.ttcn
A sgsn/gen_links.sh
A sgsn/regen_makefile.sh
4 files changed, 145 insertions(+), 2 deletions(-)


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

diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn
index 70c9c80..52649ef 100644
--- a/library/BSSGP_Emulation.ttcn
+++ b/library/BSSGP_Emulation.ttcn
@@ -40,7 +40,8 @@
out PDU_BSSGP;
} with { extension "internal" };
 
-   function BssgpStart() runs on BSSGP_CT {
+   function BssgpStart(boolean sgsn_role := false) runs on BSSGP_CT {
+   g_sgsn_role := sgsn_role
f_init();
f_ScanEvents();
}
@@ -189,10 +190,13 @@
[] g_T1.timeout {
f_sendUnblock();
}
-   [] 
BSCP.receive(f_BnsUdInd(t_BVC_UNBLOCK_ACK(mp_bvci))) {
+   [] 
BSCP.receive(f_BnsUdInd(t_BVC_UNBLOCK_ACK(mp_bvci), 0)) {
g_T1.stop;
f_change_state(BVC_S_UNBLOCKED);
}
+   [not g_sgsn_role] 
BSCP.receive(f_BnsUdInd(tr_BVC_RESET_ACK(mp_bvci, omit), 0)) {
+   f_sendUnblock();
+   }
}
} else if (g_ptp_bvc_state == BVC_S_UNBLOCKED) {
alt {
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
new file mode 100644
index 000..d535432
--- /dev/null
+++ b/sgsn/SGSN_Tests.ttcn
@@ -0,0 +1,67 @@
+module SGSN_Tests {
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from NS_Types all;
+import from NS_Emulation all;
+import from BSSGP_Types all;
+import from BSSGP_Emulation all;
+
+type component test_CT {
+   var NS_CT vc_NS;
+
+   var BSSGP_CT vc_BSSGP;
+   port BSSGP_PT BSSGP;
+
+   var boolean g_initialized := false;
+};
+
+function f_init() runs on test_CT {
+   if (g_initialized == true) {
+   return;
+   }
+   g_initialized := true;
+
+   vc_NS := NS_CT.create;
+   vc_BSSGP := BSSGP_CT.create;
+   /* connect our BSSGP port to upper end of BSSGP emulation */
+   connect(self:BSSGP, vc_BSSGP:BSSGP_SP);
+   /* connect lower end of BSSGP emulation with NS upper port */
+   connect(vc_BSSGP:BSCP, vc_NS:NS_SP);
+   /* connect lower end of NS emulation to NS codec port (on top of IPL4) 
*/
+   map(vc_NS:NSCP, system:NS_CODEC_PORT);
+
+   vc_NS.start(NSStart());
+   vc_BSSGP.start(BssgpStart(false));
+}
+
+/* TODO:
+   * RAU without Attach
+   * Detach without Attach
+   * SM procedures without attach / RAU
+   * ATTACH / RAU
+   ** with / without authentication
+   ** with / without P-TMSI allocation
+   ** timeout from HLR on SAI
+   ** timeout from HLR on UL
+   ** reject from HLR on SAI
+   ** reject from HLR on UL
+   * re-transmissions of LLC frames
+   * PDP Context activation
+   ** with different GGSN config in SGSN VTY
+   ** with different PDP context type (v4/v6/v46)
+   ** timeout from GGSN
+   ** reject from GGSN
+ */
+
+testcase TC_wait_ns_up() runs on test_CT {
+   f_init();
+   f_sleep(20.0);
+}
+
+
+//control { }
+
+
+
+}
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
new file mode 100755
index 000..160f1f0
--- /dev/null
+++ b/sgsn/gen_links.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+BASEDIR=../deps
+
+gen_links() {
+   DIR=$1
+   FILES=$*
+   for f in $FILES; do
+   echo "Linking $f"
+   ln -sf $DIR/$f $f
+   done
+}
+
+#DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
+#FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
+#gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
+FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn 
TCCConversion.cc TCCConversion.hh TCCInterface.cc TCCInterface_ip.h"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
+FILES="Socket_API_Definitions.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.IPL4asp/src
+FILES="IPL4asp_Functions.ttcn  IPL4asp_PT.cc  IPL4asp_PT.hh 
IPL4asp_PortType.ttcn  IPL4asp_Types.ttcn  IPL4asp_discovery.cc 
IPL4asp_protocol_L234.hh"
+gen_links $DIR $FILES
+
+#DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
+#FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
+#gen_links $DIR $FILES
+
+# for Osmocom_VTY
+DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
+FILES="TELNETasp_PT.cc  

[PATCH] osmo-ttcn3-hacks[master]: General_Types: Add INT18b_BO_LAST type

2018-02-12 Thread Harald Welte

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

General_Types: Add INT18b_BO_LAST type

Change-Id: I9611cad26bf9a447e63462caa608da1f5888a9d8
---
M library/General_Types.ttcn
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/library/General_Types.ttcn b/library/General_Types.ttcn
index 37b9c70..aab0609 100644
--- a/library/General_Types.ttcn
+++ b/library/General_Types.ttcn
@@ -282,6 +282,7 @@
   type integer INT12b_BO_LAST ( 0 .. 4095 ) with { variant "FIELDLENGTH(12), 
COMP(nosign), BYTEORDER(last)" };
   type integer INT13b_BO_LAST ( 0 .. 8191 ) with { variant "FIELDLENGTH(13), 
COMP(nosign), BYTEORDER(last)" };
   type integer INT14b_BO_LAST ( 0 .. 16383 ) with { variant "FIELDLENGTH(14), 
COMP(nosign), BYTEORDER(last)" };
+  type integer INT18b_BO_LAST ( 0 .. 262143 ) with { variant "FIELDLENGTH(18), 
COMP(nosign), BYTEORDER(last)" };
   type integer INT20b_BO_LAST ( 0 .. 1048575 ) with { variant 
"FIELDLENGTH(20), COMP(nosign), BYTEORDER(last)" };
   type integer INT31b_BO_LAST ( 0 .. 2147483647 ) with { variant 
"FIELDLENGTH(31), COMP(nosign), BYTEORDER(last)" };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9611cad26bf9a447e63462caa608da1f5888a9d8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-ttcn3-hacks[master]: gprs: Move BSSGP related code to library

2018-02-12 Thread Harald Welte

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

gprs: Move BSSGP related code to library

Change-Id: I9e13c63cc12c88be82124a8e3ce3c315b7b3a1fa
---
M gprs_gb/gen_links.sh
R library/BSSGP_Emulation.ttcn
R library/BSSGP_Helper.cc
R library/BSSGP_Helper_Functions.ttcn
R library/BSSGP_Types.ttcn
5 files changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/gprs_gb/gen_links.sh b/gprs_gb/gen_links.sh
index 2c01fa3..29bada3 100755
--- a/gprs_gb/gen_links.sh
+++ b/gprs_gb/gen_links.sh
@@ -34,4 +34,5 @@
 DIR=../library
 FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn 
RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc L1CTL_Types.ttcn 
L1CTL_PortType.ttcn LAPDm_RAW_PT.ttcn LAPDm_Types.ttcn "
 FILES+="NS_Types.ttcn NS_Emulation.ttcn NS_CodecPort.ttcn 
NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
+FILES+="BSSGP_Emulation.ttcn BSSGP_Helper.cc BSSGP_Helper_Functions.ttcn 
BSSGP_Types.ttcn "
 gen_links $DIR $FILES
diff --git a/gprs_gb/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn
similarity index 100%
rename from gprs_gb/BSSGP_Emulation.ttcn
rename to library/BSSGP_Emulation.ttcn
diff --git a/gprs_gb/BSSGP_Helper.cc b/library/BSSGP_Helper.cc
similarity index 100%
rename from gprs_gb/BSSGP_Helper.cc
rename to library/BSSGP_Helper.cc
diff --git a/gprs_gb/BSSGP_Helper_Functions.ttcn 
b/library/BSSGP_Helper_Functions.ttcn
similarity index 100%
rename from gprs_gb/BSSGP_Helper_Functions.ttcn
rename to library/BSSGP_Helper_Functions.ttcn
diff --git a/gprs_gb/BSSGP_Types.ttcn b/library/BSSGP_Types.ttcn
similarity index 100%
rename from gprs_gb/BSSGP_Types.ttcn
rename to library/BSSGP_Types.ttcn

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e13c63cc12c88be82124a8e3ce3c315b7b3a1fa
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmo-ttcn3-hacks[master]: bsc: Add VTY module to BSC_Tests

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia78f1231f56fc5f3b003bccc850ea109ed4ed2d8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: bsc: Add VTY module to BSC_Tests

2018-02-12 Thread Harald Welte

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

bsc: Add VTY module to BSC_Tests

Change-Id: Ia78f1231f56fc5f3b003bccc850ea109ed4ed2d8
---
M bsc/BSC_Tests.cfg
M bsc/BSC_Tests.ttcn
M bsc/gen_links.sh
M bsc/regen_makefile.sh
4 files changed, 26 insertions(+), 2 deletions(-)


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

diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index c31c9eb..44bbf61 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -12,6 +12,14 @@
 
 [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;
@@ -30,6 +38,7 @@
 #};
 
 #mp_ipa_mgcp_uses_osmo_ext := true;
+Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBSC";
 
 [MAIN_CONTROLLER]
 
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index cb2b41e..9ab3b2c 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -37,6 +37,9 @@
 import from Osmocom_CTRL_Types all;
 import from Osmocom_CTRL_Adapter all;
 
+import from Osmocom_VTY_Functions all;
+import from TELNETasp_PortType all;
+
 import from MobileL3_CommonIE_Types all;
 import from MobileL3_Types all;
 import from L3_Templates all;
@@ -63,6 +66,7 @@
port IPA_RSL_PT IPA_RSL[NUM_BTS];
 
var MGCP_Emulation_CT vc_MGCP;
+   port TELNETasp_PT BSCVTY;
 
var BSSAP_Adapter g_bssap;
/* for old legacy-tests only */
@@ -235,6 +239,12 @@
vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id));
 }
 
+private function f_init_vty(charstring id) runs on test_CT {
+   map(self:BSCVTY, system:BSCVTY);
+   f_vty_set_prompts(BSCVTY);
+   f_vty_transceive(BSCVTY, "enable");
+}
+
 /* global initialization function
  * \param nr_bts Number of BTSs we should start/bring up
  * \param handler_mode Start an RSL_Emulation_CT component (true) or not 
(false) */
@@ -258,6 +268,7 @@
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
 
f_init_mgcp("VirtMSC");
+   f_init_vty("VirtMSC");
 
for (i := 0; i < nr_bts; i := i+1) {
/* wait until osmo-bts-omldummy has respawned */
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index e807ca5..c80ae64 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -75,6 +75,10 @@
 FILES="RTP_EncDec.cc RTP_Types.ttcn"
 gen_links $DIR $FILES
 
+DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
+FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
+gen_links $DIR $FILES
+
 DIR=../library
-FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn 
Native_Functions.ttcn Native_FunctionDefs.cc IPA_Types.ttcn IPA_CodecPort.ttcn 
IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn 
L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn 
RLCMAC_CSN1_Types.ttcn GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn 
MGCP_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn 
MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc 
BSSAP_CodecPort.ttcn BSSAP_Adapter.ttcn Osmocom_CTRL_Types.ttcn 
Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn RTP_CodecPort.ttcn 
RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn 
IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn GSUP_Types.ttcn"
+FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn 
Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc 
IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn 
BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn RLCMAC_CSN1_Types.ttcn 
GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn MGCP_Emulation.ttcn 
MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn 
MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc 
BSSAP_CodecPort.ttcn BSSAP_Adapter.ttcn Osmocom_CTRL_Types.ttcn 
Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn RTP_CodecPort.ttcn 
RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn 
IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn GSUP_Types.ttcn"
 gen_links $DIR $FILES
diff --git a/bsc/regen_makefile.sh b/bsc/regen_makefile.sh
index 08eaae4..0b8e1fa 100755
--- a/bsc/regen_makefile.sh
+++ b/bsc/regen_makefile.sh
@@ -2,6 +2,6 @@
 
 MAIN=BSC_Tests.ttcn
 
-FILES="*.ttcn IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc SCTPasp_PT.cc RTP_EncDec.cc SDP_EncDec.cc 
RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc IuUP_EncDec.cc 
Native_FunctionDefs.cc *.c"
+FILES="*.ttcn IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc SCTPasp_PT.cc RTP_EncDec.cc SDP_EncDec.cc 

[PATCH] osmo-ttcn3-hacks[master]: WIP: Prepare MSC_Tests for ability to emulate two BSCs

2018-02-12 Thread Harald Welte

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

WIP: Prepare MSC_Tests for ability to emulate two BSCs

Change-Id: Ibe3ae6ed4181c6ba7501f5443b4f22e3c8abeb3e
---
M bsc/BSC_Tests.cfg
M bsc/BSC_Tests.ttcn
M library/BSSAP_Adapter.ttcn
M library/BSSMAP_Emulation.ttcn
M library/RTP_Emulation.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.cfg
M msc/MSC_Tests.ttcn
8 files changed, 231 insertions(+), 159 deletions(-)


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

diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index 497489f..c31c9eb 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -19,11 +19,15 @@
 #mp_bsc_ip   := "127.0.0.1";
 #mp_test_ip   := "127.0.0.1";
 
-#mp_sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" };
-#mp_own_pc := 185;
-#mp_own_ssn := 254;
-#mp_peer_pc := 187;
-#mp_peer_ssn := 254;
+#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;
 
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 086830a..cb2b41e 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -56,13 +56,17 @@
IPA_Client rsl
 }
 
-type component test_CT extends BSSAP_Adapter_CT, CTRL_Adapter_CT {
+type component test_CT extends CTRL_Adapter_CT {
/* Array of per-BTS state */
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
 
var MGCP_Emulation_CT vc_MGCP;
+
+   var BSSAP_Adapter g_bssap;
+   /* for old legacy-tests only */
+   port BSSAP_CODEC_PT BSSAP;
 
/* are we initialized yet */
var boolean g_initialized := false;
@@ -81,6 +85,36 @@
integer mp_bsc_ctrl_port := 4249;
/* IP address at which the test binds */
charstring mp_test_ip := "127.0.0.1";
+
+   BSSAP_Configuration 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
+   };
+}
+
+private function f_legacy_bssap_reset() runs on test_CT {
+   var BSSAP_N_UNITDATA_ind ud_ind;
+   timer T := 5.0;
+   BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
+   T.start;
+   alt {
+   [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, 
g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) {
+   log("Received RESET-ACK in response to RESET, we're ready to 
go!");
+   }
+   [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value 
ud_ind {
+   log("Respoding to inbound RESET with RESET-ACK");
+   BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, 
ud_ind.calledAddress,
+  ts_BSSMAP_ResetAck));
+   repeat;
+   }
+   [] BSSAP.receive { repeat; }
+   [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending 
RESET"); }
+   }
 }
 
 type record IPA_Client {
@@ -215,9 +249,11 @@
/* Call a function of our 'parent component' BSSAP_Adapter_CT to start 
the
 * MSC-side BSSAP emulation */
if (handler_mode) {
-   f_bssap_init("VirtMSC", MSC_BssmapOps);
+   f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", MSC_BssmapOps);
} else {
-   f_bssap_init("VirtMSC", omit);
+   f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit);
+   connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT);
+   f_legacy_bssap_reset();
}
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
 
@@ -268,7 +304,6 @@
var BSSAP_N_UNITDATA_ind ud_ind;
 
f_init(1);
-   f_bssap_reset();
 

IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
@@ -281,7 +316,6 @@
var integer chreq_total;
 
f_init(1);
-   f_bssap_reset();
 
chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:total");

IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
@@ -296,7 +330,6 @@
var RSL_Message rx_rsl;
 
f_init(1);
-   f_bssap_reset();
 
/* Send CHAN RQD and wait for allocation; acknowledge it */
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -315,7 +348,6 @@
var ASP_RSL_Unitdata rx_rsl_ud;
 
f_init(1);
-   f_bssap_reset();
 
/* Send CHAN RQD and wait for allocation; acknowledge it */
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -345,7 +377,6 @@
var RSL_Message 

[PATCH] osmo-ttcn3-hacks[master]: RSL_Emulation: Add second RSL/RSL_PROC port for hand-over cases

2018-02-12 Thread Harald Welte

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

RSL_Emulation: Add second RSL/RSL_PROC port for hand-over cases

Also, extend RSLEM_{register,unregister}() with an optional third
argiment, so the RSL_DchanHdlr can register 'expect' also for
that secondary BTS/port during hand-over

Change-Id: Ic22778f17dc4b93ef54837cf400ddd7d1732ae7e
---
M library/RSL_Emulation.ttcn
1 file changed, 11 insertions(+), 6 deletions(-)


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

diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index d20718f..f45b425 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -33,6 +33,9 @@
port RSL_DCHAN_PT RSL;
port RSLEM_PROC_PT RSL_PROC;
var RslChannelNr g_chan_nr;
+   /* second BTS / DChan during hand-over */
+   port RSL_DCHAN_PT RSL1;
+   port RSLEM_PROC_PT RSL1_PROC;
 };
 
 type record RSLDC_ChanRqd {
@@ -402,16 +405,18 @@
 }
 
 /* client/conn_hdlr side function to use procedure port to register 
stream_id/chan_nr */
-function f_rslem_register(uint8_t trx_nr, RslChannelNr chan_nr) runs on 
RSL_DchanHdlr {
-   RSL_PROC.call(RSLEM_register:{trx_nr, chan_nr, self}) {
-   [] RSL_PROC.getreply(RSLEM_register:{?,?,?}) {};
+function f_rslem_register(uint8_t trx_nr, RslChannelNr chan_nr, RSLEM_PROC_PT 
PT := RSL_PROC)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_register:{trx_nr, chan_nr, self}) {
+   [] PT.getreply(RSLEM_register:{?,?,?}) {};
}
 }
 
 /* client/conn_hdlr side function to use procedure port to unregister 
stream_id/chan_nr */
-function f_rslem_unregister(uint8_t trx_nr, RslChannelNr chan_nr) runs on 
RSL_DchanHdlr {
-   RSL_PROC.call(RSLEM_unregister:{trx_nr, chan_nr, self}) {
-   [] RSL_PROC.getreply(RSLEM_unregister:{?,?,?}) {};
+function f_rslem_unregister(uint8_t trx_nr, RslChannelNr chan_nr, 
RSLEM_PROC_PT PT := RSL_PROC)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_unregister:{trx_nr, chan_nr, self}) {
+   [] PT.getreply(RSLEM_unregister:{?,?,?}) {};
}
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic22778f17dc4b93ef54837cf400ddd7d1732ae7e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmo-sgsn[master]: sgsn_libgtp.c: Fix typos and whitespace

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic223cf378a83051603f58dacf087cc59d9f03890
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: WIP: Intra-BSC handover testing

2018-02-12 Thread Harald Welte

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

WIP: Intra-BSC handover testing

Change-Id: Ic47e639a7c8640c736c84a44780fc8e111a64b52
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
M library/L3_Templates.ttcn
3 files changed, 203 insertions(+), 3 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 9ab3b2c..cccec49 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1277,6 +1277,8 @@
connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC);
connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT);
connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC);
+   connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT);
+   connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC);
connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT);
connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
vc_conn.start(derefers(fn)(id));
@@ -1553,6 +1555,71 @@
vc_conn.done;
 }
 
+/* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command 
on given Dchan */
+private function f_vty_ss_action(charstring suffix, integer bts_nr, integer 
trx_nr, RslChannelNr chan_nr)
+runs on MSC_ConnHdlr {
+   /* FIXME: resolve those from component-global state */
+   var integer ts_nr := chan_nr.tn;
+   var integer ss_nr;
+   if (ischosen(chan_nr.u.ch0)) {
+   ss_nr := 0;
+   } else if (ischosen(chan_nr.u.lm)) {
+   ss_nr := chan_nr.u.lm.sub_chan;
+   } else if (ischosen(chan_nr.u.sdcch4)) {
+   ss_nr := chan_nr.u.sdcch4.sub_chan;
+   } else if (ischosen(chan_nr.u.sdcch8)) {
+   ss_nr := chan_nr.u.sdcch8.sub_chan;
+   } else {
+   setverdict(fail, "Invalid ChanNr ", chan_nr);
+   self.stop;
+   }
+
+   var charstring cmd := "bts "(bts_nr)&" trx "(trx_nr)&
+   " timeslot "(ts_nr)&" sub-slot 
"(ss_nr)&" ";
+   f_vty_transceive(BSCVTY, cmd & suffix);
+}
+
+private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr 
chan_nr,
+   integer new_bts_nr)
+runs on MSC_ConnHdlr {
+   f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, 
chan_nr);
+}
+
+/* intra-BSC hand-over between BTS0 and BTS1 */
+private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr {
+   var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
+   var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, 
?);
+   var BSSMAP_IE_AoIP_TransportLayerAddress tla := 
valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342));
+   var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla));
+   const OCT8 kc := '0001020304050607'O;
+
+   ass_cmd.pdu.bssmap.assignmentRequest.channelType := 
valueof(ts_BSSMAP_IE_ChannelType);
+   ass_cmd.pdu.bssmap.assignmentRequest.codecList := 
valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+
+   f_establish_fully(pars, ass_cmd, exp_compl);
+
+   var HandoverState hs := {
+   rr_ho_cmpl_seen := false,
+   handover_done := false,
+   old_chan_nr := -
+   };
+   /* issue hand-over command on VTY */
+   f_vty_handover(0, 0, g_chan_nr, 1);
+   /* temporarily suspend DChan processing on BTS1 to avoid race with 
RSLEM_register */
+   f_rslem_suspend(RSL1_PROC);
+   alt {
+   [] as_handover(hs);
+   /* FIXME: somehow determine that the hand-over has completed, by MGCP 
MDCX? */
+   }
+}
+
+testcase TC_ho_int() runs on test_CT {
+   var MSC_ConnHdlr vc_conn;
+   f_init(2, true);
+   f_sleep(1.0);
+   vc_conn := f_start_handler(refers(f_tc_ho_int), testcasename());
+   vc_conn.done;
+}
 
 
 control {
@@ -1623,6 +1690,7 @@
execute( TC_unsol_ho_fail() );
execute( TC_err_82_short_msg() );
execute( TC_err_84_unknown_msg() );
+   execute( TC_ho_int() );
 }
 
 }
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 5f1095a..b68b4f8 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -62,7 +62,8 @@
 type record MediaState {
MgcpEndpointmgcp_ep,
MgcpConnState   mgcp_conn[2],
-   BtsMediaState   bts
+   BtsMediaState   bts,
+   BtsMediaState   bts1 /* only during hand-over */
 };
 
 function f_MediaState_init(inout MediaState g_media, integer nr, HostName bts, 
HostName mgw) {
@@ -73,6 +74,17 @@
rtp_pt := 0,
bts := {
host := bts,
+   port_nr := 9000 + nr*2
+   },
+   peer := -
+   }
+
+   g_media.bts1 := {
+   ipa_crcx_seen := false,
+   conn_id := nr,
+   rtp_pt := 0,
+   bts := {
+   host := bts, /* FIXME */
port_nr := 9000 + nr*2
},
   

[PATCH] osmo-ttcn3-hacks[master]: MSC_ConnectionHdlr: Add telnet to VTY to each ConnHdlr

2018-02-12 Thread Harald Welte

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

MSC_ConnectionHdlr: Add telnet to VTY to each ConnHdlr

This allows each ConnHandler to issue telnet commands to the VTY

As a side-effect, it puts some more stress on the VTY interface,
as each [parallel] DchanHdlr now has its own telnet connection.

Change-Id: Ibd726af53219d829286da80b44ea4d9fb2ffdf3d
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 8 insertions(+), 1 deletion(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 8193a8d..5f1095a 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -24,6 +24,9 @@
 import from MobileL3_RRM_Types all;
 import from L3_Templates all;
 
+import from TELNETasp_PortType all;
+import from Osmocom_VTY_Functions all;
+
 
 /***
  * Media related handling
@@ -233,6 +236,7 @@
 
/* procedure port back to our parent (BSSMAP_Emulation_CT) for control 
*/
port BSSMAPEM_PROC_PT BSSMAPEM;
+   port TELNETasp_PT BSCVTY;
 
var MediaState g_media;
 }
@@ -240,6 +244,9 @@
 /* initialize all parameters */
 function f_MscConnHdlr_init(integer i, HostName bts, HostName mgw) runs on 
MSC_ConnHdlr {
f_MediaState_init(g_media, i, bts, mgw);
+   map(self:BSCVTY, system:BSCVTY);
+   f_vty_set_prompts(BSCVTY);
+   f_vty_transceive(BSCVTY, "enable");
 }
 
 /* Callback function from general BSSMAP_Emulation whenever a connectionless
@@ -576,7 +583,7 @@
st.is_assignment := true;
}
 
-   f_MediaState_init(g_media, 1, "127.0.0.2", "127.0.0.3");
+   f_MscConnHdlr_init(1, "127.0.0.2", "127.0.0.3");
 
f_create_chan_and_exp(pars);
/* we should now have a COMPL_L3 at the MSC */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd726af53219d829286da80b44ea4d9fb2ffdf3d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-ttcn3-hacks[master]: RSL_Emulation: Add procedure calls to suspend/resume dchan h...

2018-02-12 Thread Harald Welte

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

RSL_Emulation: Add procedure calls to suspend/resume dchan handling

We introduce a procedure by which any DchanHandler can globally
disable all receiving/processing of DChan related messages.  This is
required in upcoming handover code, as we need to block handling
of messages such as RSL IPAC CRCX on the new Dchan before we have
processed the RR HANDOVER CMD and raised an associated expect here in
the RSL emulation code.

Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
---
M library/RSL_Emulation.ttcn
1 file changed, 34 insertions(+), 3 deletions(-)


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

diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index f45b425..dab1785 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -54,9 +54,10 @@
 
 signature RSLEM_register(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr 
hdlr);
 signature RSLEM_unregister(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr 
hdlr);
+signature RSLEM_suspend(boolean suspend);
 
 type port RSLEM_PROC_PT procedure {
-   inout RSLEM_register, RSLEM_unregister;
+   inout RSLEM_register, RSLEM_unregister, RSLEM_suspend;
 } with { extension "internal" };
 
 /***
@@ -276,6 +277,8 @@
var uint8_t trx_nr;
var integer cid;
var integer i;
+   /* special synchronization handling during hand-over */
+   var boolean dchan_suspended := false;
 
f_conn_table_init();
 
@@ -348,7 +351,7 @@
IPA_PT.send(ts_ASP_RSL_UD(rx_rsl.streamId, 
ts_RSL_CHAN_ACT_ACK(chan_nr, 23)));
}
 
-   [] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeDR(?))) -> value rx_rsl {
+   [not dchan_suspended] 
IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeDR(?))) -> value rx_rsl {
/* dispatch to channel based on ChanId */
cid := 
f_cid_by_chan_nr(f_trx_by_streamId(rx_rsl.streamId),
rx_rsl.rsl.ies[0].body.chan_nr);
@@ -359,7 +362,7 @@
}
}
 
-   [] IPA_PT.receive {
+   [not dchan_suspended] IPA_PT.receive {
setverdict(fail, "Received unknown primitive from IPA");
self.stop;
}
@@ -389,6 +392,17 @@
RSL_PROC.reply(RSLEM_unregister:{trx_nr, chan_nr, 
vc_conn});
}
 
+   [] RSL_PROC.getcall(RSLEM_suspend:{true}) {
+   log("Suspending DChan");
+   dchan_suspended := true;
+   RSL_PROC.reply(RSLEM_suspend:{true});
+   }
+
+   [] RSL_PROC.getcall(RSLEM_suspend:{false}) {
+   log("Resuming DChan");
+   dchan_suspended := false;
+   RSL_PROC.reply(RSLEM_suspend:{false});
+   }
 
}
}
@@ -420,5 +434,22 @@
}
 }
 
+/* resume handling of RSL DChan messages from IPA until f_rslem_resume() is 
called */
+function f_rslem_suspend(RSLEM_PROC_PT PT)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_suspend:{true}) {
+   [] PT.getreply(RSLEM_suspend:{true}) {};
+   }
+}
+
+/* resume handling of RSL DChan messages after f_rslem_suspend() is called */
+function f_rslem_resume(RSLEM_PROC_PT PT)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_suspend:{false}) {
+   [] PT.getreply(RSLEM_suspend:{false}) {};
+   }
+}
+
+
 
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmo-sgsn[master]: sgsn_libgtp.c: Fix typos and whitespace

2018-02-12 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic223cf378a83051603f58dacf087cc59d9f03890
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-sgsn[master]: .gitignore: Add m4 files

2018-02-12 Thread Vadim Yanitskiy

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6389/1/.gitignore
File .gitignore:

Line 24: m4/lt~obsolete.m4
I think, you can use a wildcard here ;)

m4/*.m4


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


libosmocore[master]: gsmtap.h: define TETRA DMO mode channels

2018-02-12 Thread Vadim Yanitskiy

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: allesklar2 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: allesklar2 
Gerrit-HasComments: No


libosmocore[master]: gsmtap.h: define TETRA DMO mode channels

2018-02-12 Thread allesklar2

Patch Set 3:

> Usually we use the imperative style for commit messages,
 > for example:
 > 
 > "gsmtap.h: define TETRA DMO mode channels"

Thanks for this suggestion. I changed the commit message.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: allesklar2 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: allesklar2 
Gerrit-HasComments: No


osmo-ggsn[master]: sgsnemu: fix: no outgoing GTP-U in "createif" mode

2018-02-12 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Viktor Tsymbalyuk 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Viktor Tsymbalyuk 
Gerrit-HasComments: No


[PATCH] libosmocore[master]: gsmtap.h: define TETRA DMO mode channels

2018-02-12 Thread allesklar2

gsmtap.h: define TETRA DMO mode channels

Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
---
M include/osmocom/core/gsmtap.h
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/6376/3

diff --git a/include/osmocom/core/gsmtap.h b/include/osmocom/core/gsmtap.h
index 7a14ba9..b4239f8 100644
--- a/include/osmocom/core/gsmtap.h
+++ b/include/osmocom/core/gsmtap.h
@@ -112,6 +112,11 @@
 #define GSMTAP_TETRA_BNCH  0x06
 #define GSMTAP_TETRA_STCH  0x07
 #define GSMTAP_TETRA_TCH_F 0x08
+#define GSMTAP_TETRA_DMO_SCH_S 0x09
+#define GSMTAP_TETRA_DMO_SCH_H 0x0a
+#define GSMTAP_TETRA_DMO_SCH_F 0x0b
+#define GSMTAP_TETRA_DMO_STCH  0x0c
+#define GSMTAP_TETRA_DMO_TCH   0x0d
 
 /* == DO NOT MAKE UNAPPROVED MODIFICATIONS HERE = */
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: allesklar2 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 


osmo-ggsn[master]: sgsnemu: fix: no outgoing GTP-U in "createif" mode

2018-02-12 Thread Pau Espin Pedrol

Patch Set 1:

I reviewed it and indeed it fixes (yet) an(other) error I introduced myself 
during development of IPv4v6. I doesn't fix the full issue though. I submitted 
another patch on top of yours to also correctly deallocate the contexts.

Thanks for your contributions!

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Viktor Tsymbalyuk 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Viktor Tsymbalyuk 
Gerrit-HasComments: No


[PATCH] osmo-ggsn[master]: sgsnemu: Fix bad ptr during context deallocation

2018-02-12 Thread Pau Espin Pedrol

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

sgsnemu: Fix bad ptr during context deallocation

Older commit switched pdp_t to have an array of 2 peers instead of
only one in order to accomodate for ipv4v6 contexts, which can have 2
addresses assigned. The usage of peer field was not updated in sgsnemu
accordingly, which means the wrong memory portion was being accessed.

Fixes: 2d6a69e69a4b4cb2b8cc63c4810dae44e5a4d8f6 ("Add support for IPv4v6 End 
User Addresses")

Change-Id: I9e563522173a82b265e93b1ef9dc93ced40fefa2
---
M sgsnemu/sgsnemu.c
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/92/6392/1

diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index cf4aa44..804b542 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1312,8 +1312,8 @@
if (tun && options.ipdown)
tun_runscript(tun, options.ipdown);
 
-   ipdel((struct iphash_t *)pdp->peer);
-   memset(pdp->peer, 0, sizeof(struct iphash_t));  /* To be sure */
+   ipdel((struct iphash_t *)pdp->peer[0]);
+   memset(pdp->peer[0], 0, sizeof(struct iphash_t));   /* To be sure */
 
if (1 == options.contexts)
state = 5;  /* Disconnected */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e563522173a82b265e93b1ef9dc93ced40fefa2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


[PATCH] osmo-ggsn[master]: sgsnemu: listen param is a host, not an interface

2018-02-12 Thread Pau Espin Pedrol

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

sgsnemu: listen param is a host, not an interface

This param is parsed by gethostbyname() and it's confusing to document
it as an interface, because users will then attempt to pass "lo" to it,
which fails.

Change-Id: Id8ef0e12ddcaf8bfd199a44de0ba4280f05d4431
---
M sgsnemu/cmdline.c
M sgsnemu/cmdline.ggo
M sgsnemu/cmdline.h
3 files changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/91/6391/1

diff --git a/sgsnemu/cmdline.c b/sgsnemu/cmdline.c
index 412e484..b062533 100644
--- a/sgsnemu/cmdline.c
+++ b/sgsnemu/cmdline.c
@@ -41,7 +41,7 @@
"  --pidfile=STRING  Filename of process id file\n  
(default=`./sgsnemu.pid')",
"  --statedir=STRING Directory of nonvolatile data  
(default=`./')",
"  --dns=STRING  DNS Server to use",
-   "  -l, --listen=STRING   Local interface",
+   "  -l, --listen=STRING   Local host",
"  -r, --remote=STRING   Remote host",
"  --contexts=INTNumber of contexts  (default=`1')",
"  --timelimit=INT   Exit after timelimit seconds  
(default=`0')",
@@ -1003,7 +1003,7 @@
goto failure;
 
break;
-   case 'l':   /* Local interface.  */
+   case 'l':   /* Local host.  */
 
if (update_arg((void *)&(args_info->listen_arg),
   &(args_info->listen_orig),
diff --git a/sgsnemu/cmdline.ggo b/sgsnemu/cmdline.ggo
index dec19cd..0f415f5 100644
--- a/sgsnemu/cmdline.ggo
+++ b/sgsnemu/cmdline.ggo
@@ -26,7 +26,7 @@
 option  "statedir" - "Directory of nonvolatile data"  string default="./" 
no
 
 option  "dns"  - "DNS Server to use"  string no
-option  "listen"   l "Local interface"string no
+option  "listen"   l "Local host" string no
 option  "remote"   r "Remote host"string no
 
 option  "contexts" - "Number of contexts" intdefault="1" no
diff --git a/sgsnemu/cmdline.h b/sgsnemu/cmdline.h
index 31a2085..24f772b 100644
--- a/sgsnemu/cmdline.h
+++ b/sgsnemu/cmdline.h
@@ -69,11 +69,11 @@
const char *dns_help;
/**< @brief DNS Server to use help description.  */
char *listen_arg;
-   /**< @brief Local interface.  */
+   /**< @brief Local host.  */
char *listen_orig;
-   /**< @brief Local interface original value given at 
command line.  */
+   /**< @brief Local host original value given at command 
line.  */
const char *listen_help;
-  /**< @brief Local interface help description.  */
+  /**< @brief Local host help description.  */
char *remote_arg;
/**< @brief Remote host.  */
char *remote_orig;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8ef0e12ddcaf8bfd199a44de0ba4280f05d4431
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


[PATCH] osmo-sgsn[master]: sgsn_libgtp.c: Fix typos and whitespace

2018-02-12 Thread Pau Espin Pedrol

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

sgsn_libgtp.c: Fix typos and whitespace

Change-Id: Ic223cf378a83051603f58dacf087cc59d9f03890
---
M src/gprs/sgsn_libgtp.c
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/90/6390/1

diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index ae293f1..4061e7a 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -587,7 +587,7 @@
 static int cb_recovery(struct sockaddr_in *peer, uint8_t recovery)
 {
struct sgsn_ggsn_ctx *ggsn;
-   
+
ggsn = sgsn_ggsn_ctx_by_addr(>sin_addr);
if (!ggsn) {
LOGP(DGPRS, LOGL_NOTICE, "Received Recovery IE for unknown 
GGSN\n");
@@ -635,7 +635,7 @@
 /* Called whenever a PDP context is deleted for any reason */
 static int cb_delete_context(struct pdp_t *pdp)
 {
-   LOGPDPX(DGPRS, LOGL_INFO, pdp, "Context was deleted\n")   ;
+   LOGPDPX(DGPRS, LOGL_INFO, pdp, "Context was deleted\n");
 
return 0;
 }
@@ -652,13 +652,13 @@
 /* Called when we receive a Supported Ext Headers Notification */
 static int cb_extheader_ind(struct sockaddr_in *peer)
 {
-   LOGP(DGPRS, LOGL_INFO, "GTP Supported Ext Headers Noficiation "
+   LOGP(DGPRS, LOGL_INFO, "GTP Supported Ext Headers Notification "
"from %s:%u\n", inet_ntoa(peer->sin_addr),
ntohs(peer->sin_port));
return 0;
 }
 
-/* Called whenever we recive a DATA packet */
+/* Called whenever we receive a DATA packet */
 static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
 {
struct bssgp_paging_info pinfo;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic223cf378a83051603f58dacf087cc59d9f03890
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


[PATCH] osmo-sgsn[master]: .gitignore: Add m4 files

2018-02-12 Thread Pau Espin Pedrol

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

.gitignore: Add m4 files

Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
---
M .gitignore
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/89/6389/1

diff --git a/.gitignore b/.gitignore
index 5f6aee2..3a254f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,11 @@
 #configure
 aclocal.m4
 autom4te.cache/
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
 config.log
 config.status
 config.guess

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-pcu[master]: Move include guard to the top

2018-02-12 Thread Stefan Sperling

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5114a63ce00b03c8eed23565d52969250bd505cc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: VLR: fix potential NULL dereference

2018-02-12 Thread Max

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

VLR: fix potential NULL dereference

The vlr_subscr_get() can return NULL if its argument is NULL
(which isn't checked for) so before dereferencing it's result
we should check for it.

Change-Id: I13632908d0b67323202effa9dd6f29732a12cc91
---
M src/libmsc/gsm_04_08.c
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/88/6388/1

diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 7b6e94a..ac15d18 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -3716,7 +3716,8 @@
struct gsm_subscriber_connection *conn = msc_conn_ref;
OSMO_ASSERT(!conn->vsub);
conn->vsub = vlr_subscr_get(vsub);
-   conn->vsub->cs.attached_via_ran = conn->via_ran;
+   if (conn->vsub)
+   conn->vsub->cs.attached_via_ran = conn->via_ran;
 }
 
 /* operations that we need to implement for libvlr */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I13632908d0b67323202effa9dd6f29732a12cc91
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max 


gapk[master]: Add --enable-sanitize configure option

2018-02-12 Thread tnt

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb26e5fc73843f3951dbc534653ee7d88e4c80e7
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


[PATCH] osmo-bsc[master]: Generate the S_L_INP_TEI_UP signal earlier.

2018-02-12 Thread Stefan Sperling

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

Generate the S_L_INP_TEI_UP signal earlier.

The S_L_INP_TEI_UP signal was generated when the first message from a BTS
arrives on the OML/RSL link, rather than when the OML/RSL link comes up.
Instead, generate this signal when the link is brought up, so we
intitialize state regardless of how a particular BTS behaves.

Tested with osmo-bts-virtual and virtphy/mobile programs.

Change-Id: I3b76ae6b00043e706dddc78209311e00ace85bb7
Related: OS#2719
---
M src/libbsc/bts_ipaccess_nanobts.c
1 file changed, 12 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/87/6387/1

diff --git a/src/libbsc/bts_ipaccess_nanobts.c 
b/src/libbsc/bts_ipaccess_nanobts.c
index 03bb708..e72e6a5 100644
--- a/src/libbsc/bts_ipaccess_nanobts.c
+++ b/src/libbsc/bts_ipaccess_nanobts.c
@@ -438,6 +438,11 @@
bts->oml_tei, 0);
rc = clock_gettime(CLOCK_MONOTONIC, );
bts->uptime = (rc < 0) ? 0 : tp.tv_sec; /* we don't need 
sub-second precision for uptime */
+   if (!(sign_link->trx->bts->ip_access.flags & OML_UP)) {
+   e1inp_event(sign_link->ts, S_L_INP_TEI_UP,
+   sign_link->tei, sign_link->sapi);
+   sign_link->trx->bts->ip_access.flags |= OML_UP;
+   }
break;
case E1INP_SIGN_RSL: {
struct e1inp_ts *ts;
@@ -458,6 +463,13 @@
e1inp_sign_link_create(ts, E1INP_SIGN_RSL,
   trx, trx->rsl_tei, 0);
trx->rsl_link->ts->sign.delay = 0;
+   if (!(sign_link->trx->bts->ip_access.flags &
+   (RSL_UP << sign_link->trx->nr))) {
+   e1inp_event(sign_link->ts, S_L_INP_TEI_UP,
+   sign_link->tei, sign_link->sapi);
+   sign_link->trx->bts->ip_access.flags |=
+   (RSL_UP << sign_link->trx->nr);
+   }
break;
}
default:
@@ -486,25 +498,12 @@
 {
int ret = 0;
struct e1inp_sign_link *link = msg->dst;
-   struct e1inp_ts *e1i_ts = link->ts;
 
switch (link->type) {
case E1INP_SIGN_RSL:
-   if (!(link->trx->bts->ip_access.flags &
-   (RSL_UP << link->trx->nr))) {
-   e1inp_event(e1i_ts, S_L_INP_TEI_UP,
-   link->tei, link->sapi);
-   link->trx->bts->ip_access.flags |=
-   (RSL_UP << link->trx->nr);
-   }
ret = abis_rsl_rcvmsg(msg);
break;
case E1INP_SIGN_OML:
-   if (!(link->trx->bts->ip_access.flags & OML_UP)) {
-   e1inp_event(e1i_ts, S_L_INP_TEI_UP,
-   link->tei, link->sapi);
-   link->trx->bts->ip_access.flags |= OML_UP;
-   }
ret = abis_nm_rcvmsg(msg);
break;
default:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b76ae6b00043e706dddc78209311e00ace85bb7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 


[PATCH] osmo-bsc[master]: Add support for Access Control Class ramping.

2018-02-12 Thread Stefan Sperling
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6324

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

Add support for Access Control Class ramping.

Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.

Ramping behaviour can be configured with new VTY commands:

  [no] access-control-class-ramping
  access-control-class-ramping-step-interval (<30,600>|dynamic)
  access-control-class-ramping-step-size (<1,10>

(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)

The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.

By default, ACC ramping is disabled.

When enabled, the default behaviour is to enable one ACC per
ramping stepm with a 'dyanmic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.

Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:

(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average

Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
---
M include/osmocom/bsc/Makefile.am
A include/osmocom/bsc/acc_ramp.h
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/Makefile.am
A src/libbsc/acc_ramp.c
M src/libbsc/bsc_init.c
M src/libbsc/bsc_vty.c
M src/libbsc/chan_alloc.c
M src/libbsc/system_information.c
M src/libcommon/gsm_data_shared.c
10 files changed, 488 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/24/6324/5

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 699aeb3..7919e8d 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -3,6 +3,7 @@
abis_nm.h \
abis_om2000.h \
abis_rsl.h \
+   acc_ramp.h \
arfcn_range_encode.h \
bsc_msc.h \
bsc_msg_filter.h \
diff --git a/include/osmocom/bsc/acc_ramp.h b/include/osmocom/bsc/acc_ramp.h
new file mode 100644
index 000..003f6cd
--- /dev/null
+++ b/include/osmocom/bsc/acc_ramp.h
@@ -0,0 +1,138 @@
+/* (C) 2018 by sysmocom s.f.m.c. GmbH 
+ *
+ * Author: Stefan Sperling 
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see .
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+
+#include 
+#include 
+
+/*
+ * Access control class (ACC) ramping is used to slowly make the cell 
available to
+ * an increasing number of MS. This avoids overload at startup time in cases 
where
+ * a lot of MS would discover the new cell and try to connect to it all at 
once.
+ */
+
+#define ACC_RAMP_STEP_SIZE_MIN 1 /* allow at most 1 new ACC per ramp step */

osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint

2018-02-12 Thread dexter

Patch Set 1:

> do we have a TTCN-3 test case for this in OsmoMSC yet, so we can
 > make sure the feature works as expected?  If not, please provide
 > one (or indicate what is missing in terms of infrastructure to
 > write one).

There is no test for this yet. If we apply the patch we possibly need to change 
the existing MSC tests because the behavior on the MGCP side changes. From what 
I can see so far only the CRCX is actually different. The TTCN3 part must 
expect a wildcarded CRCX and then return a specific endpoint. The rest of the 
code should then use this endpoint, so from the CRCX on everything should stay 
the same. 

The new code uses rtpbridge/*@mgw as endpoint scheme, thats also a difference 
between the old and the new way.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


osmo-bts[master]: Cosmetic fixes for power ramping code.

2018-02-12 Thread Stefan Sperling

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6287/1/src/common/tx_power.c
File src/common/tx_power.c:

Line 153:   return (tpp->p_total_tgt_mdBm > tpp->p_total_cur_mdBm);
> sorry, I really prefer the more verbose version, I think it is what we do i
Sure, if you prefer that, I don't mind.

Next patch set will leave this bit of code as it is and just fix the comments.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I214bcc8b78446bfea450fe445fa9391898638905
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


[PATCH] osmo-bts[master]: Cosmetic fixes for power ramping code.

2018-02-12 Thread Stefan Sperling
Hello Vadim Yanitskiy, Jenkins Builder,

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

https://gerrit.osmocom.org/6287

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

Cosmetic fixes for power ramping code.

Fix typos in 2 comments.

Change-Id: I214bcc8b78446bfea450fe445fa9391898638905
---
M src/common/tx_power.c
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/87/6287/2

diff --git a/src/common/tx_power.c b/src/common/tx_power.c
index 3dfe1f7..e418cec 100644
--- a/src/common/tx_power.c
+++ b/src/common/tx_power.c
@@ -275,7 +275,7 @@
/* Set attenuation to cause no power change right now */
tpp->ramp.attenuation_mdB = tpp->p_total_tgt_mdBm - 
tpp->p_total_cur_mdBm;
 
-   /* start with the firsrt step */
+   /* start with the first step */
power_ramp_do_step(trx, 1);
}
} else {
@@ -283,7 +283,7 @@
 * steps until it reaches 0 */
tpp->ramp.attenuation_mdB = tpp->p_total_tgt_mdBm - 
tpp->p_total_cur_mdBm;
 
-   /* start with the firsrt step */
+   /* start with the first step */
power_ramp_do_step(trx, 1);
}
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I214bcc8b78446bfea450fe445fa9391898638905
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


[PATCH] osmo-bsc[master]: Make RSL connection attempts time out.

2018-02-12 Thread Stefan Sperling

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

Make RSL connection attempts time out.

If a BTS/TRX does not respond to the "IPA RSL Connect" command,
pretend that the BTS has sent a NACk for the connection.

This is a proof-of-concept which still has (at least) two problems:

1) It assumes that osmo_timer_del() can be called even if osmo_timer_setup()
   has not yet been called. This can happen in case we receive an RSL Connect
   ACK/NACK from a BTS even though we have not yet sent an RSL Connect.
   While this seems to work, it relies on private implementation details
   of the osmo_timer code.
   Fixing this would require moving osmo_timer_setup() somewhere else.
   A good candidate might be gsm_bts_trx_alloc(), however that function
   is in libcommon, which means the RSL connection timeout function
   would also have to move there (it is currently a symbol in libbsc).
   Can anyone suggest a nicer solution?

2) We cancel the timeout if we receive an RSL Connect ACK or NACK from
   the BTS, but surely there are other situations where we'd want to
   cancel it, such as if underlying state related to this BTS/TRX gets
   reset. Can anyone suggest a good opportunity in the code for
   cancelling the timeout in such cases?

Change-Id: Ia72b65a0f15f47dcb8a6f944f6c3695a4a64b923
Related: OS#2716
---
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/abis_nm.c
2 files changed, 28 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/86/6386/1

diff --git a/include/osmocom/bsc/gsm_data_shared.h 
b/include/osmocom/bsc/gsm_data_shared.h
index e3e1389..b753e54 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -351,6 +351,9 @@
uint8_t rsl_tei;
struct e1inp_sign_link *rsl_link;
 
+   /* Timeout for initiating the RSL connection. */
+   struct osmo_timer_list rsl_connect_timeout;
+
/* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
struct e1inp_sign_link *oml_link;
 
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 33af213..a67add6 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -2660,6 +2660,7 @@
DEBUGPC(DNM, "STREAM=0x%02x ",
*TLVP_VAL(, NM_ATT_IPACC_STREAM_ID));
DEBUGPC(DNM, "\n");
+   osmo_timer_del(_link->trx->rsl_connect_timeout);
break;
case NM_MT_IPACC_RSL_CONNECT_NACK:
LOGP(DNM, LOGL_ERROR, "RSL CONNECT NACK ");
@@ -2668,6 +2669,7 @@
abis_nm_nack_cause_name(*TLVP_VAL(, 
NM_ATT_NACK_CAUSES)));
else
LOGPC(DNM, LOGL_ERROR, "\n");
+   osmo_timer_del(_link->trx->rsl_connect_timeout);
break;
case NM_MT_IPACC_SET_NVATTR_ACK:
DEBUGPC(DNM, "SET NVATTR ACK\n");
@@ -2776,6 +2778,19 @@
attr_len);
 }
 
+static void rsl_connect_timeout(void *data)
+{
+   struct gsm_bts_trx *trx = data;
+   struct ipacc_ack_signal_data signal;
+
+   LOGP(DRSL, LOGL_NOTICE, "(bts=%d,trx=%d) RSL connection request timed 
out\n", trx->bts->nr, trx->nr);
+
+   /* Fake an RSL CONECT NACK message from the BTS. */
+   signal.trx = trx;
+   signal.msg_type = NM_MT_IPACC_RSL_CONNECT_NACK;
+   osmo_signal_dispatch(SS_NM, S_NM_IPACC_NACK, );
+}
+
 int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
 uint32_t ip, uint16_t port, uint8_t stream)
 {
@@ -2785,6 +2800,7 @@
NM_ATT_IPACC_DST_IP, 0, 0, 0, 0 };
 
int attr_len = sizeof(attr);
+   int error;
 
ia.s_addr = htonl(ip);
attr[1] = stream;
@@ -2799,9 +2815,15 @@
DEBUGP(DNM, "ip.access RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
inet_ntoa(ia), port, stream);
 
-   return abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
-   NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
-   trx->nr, 0xff, attr, attr_len);
+   error = abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
+NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
+trx->nr, 0xff, attr, attr_len);
+   if (error == 0) {
+   osmo_timer_setup(>rsl_connect_timeout, 
rsl_connect_timeout, trx);
+   osmo_timer_schedule(>rsl_connect_timeout, 60, 0);
+   }
+
+   return error;
 }
 
 /* restart / reboot an ip.access nanoBTS */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia72b65a0f15f47dcb8a6f944f6c3695a4a64b923
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 


gapk[master]: Add basic CI integration

2018-02-12 Thread Max

Patch Set 1:

> Should we also install both libgsm and libopencore-amrnb dependencies here?

No, this is for Osmocom dependencies. External packages should be added as 
build slave dependencies to ansible.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4b36df8f010cd7e035fe5a8b846632541b655f5
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


osmo-ggsn[master]: sgsnemu: fix: no outgoing GTP-U in "createif" mode

2018-02-12 Thread Viktor Tsymbalyuk

Patch Set 1:

some debug below - just for time saving.

## stop on Breakpoint after sending packet into tun0
- ipm->pdp null as result gtp_data_req not executed
```
Breakpoint 1, cb_tun_ind (tun=, pack=0x7fffbe40, len=1028) 
at sgsnemu.c:1367
1367if (ipm->pdp)   /* Check if a peer protocol is defined 
*/
(gdb)
(gdb) print ipm->pdp
$1 = (struct pdp_t *) 0x0
(gdb) list
1362printf("Dropping packet from invalid source address: 
%s\n",
1363   in46a_ntoa());
1364return 0;
1365}
1366
1367if (ipm->pdp)   /* Check if a peer protocol is defined 
*/
1368gtp_data_req(gsn, ipm->pdp, pack, len);
1369return 0;
1370}
1371
```

## new run Breakpoint in create_pdp_conf
```
Breakpoint 5, create_pdp_conf (cause=, cbp=0x6145a0 , 
pdp=0x779be2e0 ) at sgsnemu.c:1465
1465ipset((struct iphash_t *)pdp->peer, );
(gdb)
(gdb)
(gdb)
(gdb)
(gdb) list
1460}
1461free(accept_ra);
1462free(forwarding);
1463}
1464
1465ipset((struct iphash_t *)pdp->peer, );
1466
1467state = 2;  /* Connected */
1468
1469return 0;
(gdb) s
ipset (addr=0x7fffb500, ipaddr=0x779be300 ) at sgsnemu.c:172
172 int hash = ippool_hash(addr) % MAXCONTEXTS;
(gdb) n
176 ipaddr->addr = *addr;
(gdb) print hash
$5 = 165
(gdb) n
177 for (h = iphash[hash]; h; h = h->ipnext)
(gdb) n
175 ipaddr->ipnext = NULL;
(gdb) n
176 ipaddr->addr = *addr;
(gdb) n
177 for (h = iphash[hash]; h; h = h->ipnext)
(gdb) n
create_pdp_conf (cause=, cbp=0x6145a0 , 
pdp=0x779be2e0 ) at sgsnemu.c:1465
1465ipset((struct iphash_t *)pdp->peer, );
(gdb) print iphash[165]
$7 = (struct iphash_t *) 0x0
(gdb) n
1467state = 2;  /* Connected */
```
 - as result of `struct iphash_t *)pdp->peer` casting in *iphash[165] we has 
pdp = 0x0

```
(gdb) print *iphash[165]
$9 = {inuse = 160 '\240', ipnext = 0x0, pdp = 0x0, addr = {len = 4 '\004', {v4 
= {s_addr = 67112970}, v6 = {__in6_u = {
  __u6_addr8 = "\n\020\000\004mQ{\367\377\177\000\000\377\000\000", 
__u6_addr16 = {4106, 1024, 20845, 63355, 32767, 0, 255,
0}, __u6_addr32 = {67112970, 4152054125, 32767, 255}}
(gdb)
```

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Viktor Tsymbalyuk 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Viktor Tsymbalyuk 
Gerrit-HasComments: No


gapk[master]: Add basic CI integration

2018-02-12 Thread Vadim Yanitskiy

Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/#/c/6384/1/contrib/jenkins.sh
File contrib/jenkins.sh:

Line 20: osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
Should we also install both libgsm and libopencore-amrnb
dependencies here?


Line 37: ./configure
At the moment TCH-HR related tests don't pass for
some unknown reason, so let's use '--disable-gsmhr'.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4b36df8f010cd7e035fe5a8b846632541b655f5
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: Yes


[PATCH] osmo-ggsn[master]: sgsnemu: fix: no outgoing GTP-U in "createif" mode

2018-02-12 Thread Viktor Tsymbalyuk

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

sgsnemu: fix: no outgoing GTP-U in "createif" mode

in "createif" mode uplink traffic not forwarding
from tun interface into Gn, inside GTP-U.
create_pdp_conf get iphash (ipm) with pdp ==  0x0
Fix - in create_pdp_conf - instead of casting using already
definned iphash in ipset function.

Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
---
M sgsnemu/sgsnemu.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/85/6385/1

diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 630733b..cf4aa44 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1462,7 +1462,7 @@
free(forwarding);
}
 
-   ipset((struct iphash_t *)pdp->peer, );
+   ipset(iph, );
 
state = 2;  /* Connected */
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Viktor Tsymbalyuk 


gapk[master]: Ignore build products

2018-02-12 Thread Max

Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/#/c/6383/1/.gitignore
File .gitignore:

Line 54: /compile
> Why it's starting from '/'?
To match the beginning of the pathname - see https://git-scm.com/docs/gitignore


Line 55: /src/gapk
> I am not sure if we have this build product...
Must be leftover from earlier compilation.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24be6fdbd17c7877d7a9a87081107dc5a3cd2fe8
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: Yes


[PATCH] gapk[master]: Add basic CI integration

2018-02-12 Thread Max

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

Add basic CI integration

Change-Id: Ib4b36df8f010cd7e035fe5a8b846632541b655f5
---
A contrib/jenkins.sh
1 file changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/84/6384/1

diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
new file mode 100755
index 000..ba4e7af
--- /dev/null
+++ b/contrib/jenkins.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# jenkins build helper script for jenkins.osmocom.org
+
+if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then
+   echo "Error: We need to have scripts/osmo-deps.sh from 
http://git.osmocom.org/osmo-ci/ in PATH !"
+   exit 2
+fi
+
+set -ex
+
+base="$PWD"
+deps="$base/deps"
+inst="$deps/install"
+export deps inst
+
+osmo-clean-workspace.sh
+
+mkdir "$deps" || true
+
+osmo-build-dep.sh libosmocore "" ac_cv_path_DOXYGEN=false
+
+verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
+
+export PKG_CONFIG_PATH="$inst/lib/pkgconfig:$PKG_CONFIG_PATH"
+export LD_LIBRARY_PATH="$inst/lib"
+
+set +x
+echo
+echo
+echo
+echo " === gapk ==="
+echo
+set -x
+
+cd "$base"
+autoreconf --install --force
+./configure
+$MAKE $PARALLEL_MAKE
+LD_LIBRARY_PATH="$inst/lib" $MAKE check || cat-testlogs.sh
+LD_LIBRARY_PATH="$inst/lib" DISTCHECK_CONFIGURE_FLAGS="" $MAKE distcheck || 
cat-testlogs.sh
+
+osmo-clean-workspace.sh

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4b36df8f010cd7e035fe5a8b846632541b655f5
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 


gapk[master]: Ignore build products

2018-02-12 Thread Vadim Yanitskiy

Patch Set 1: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/#/c/6383/1/.gitignore
File .gitignore:

Line 54: /compile
Why it's starting from '/'?


Line 55: /src/gapk
I am not sure if we have this build product...
Correct me if I am wrong.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I24be6fdbd17c7877d7a9a87081107dc5a3cd2fe8
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: Yes


gapk[master]: Add --enable-sanitize configure option

2018-02-12 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb26e5fc73843f3951dbc534653ee7d88e4c80e7
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


[PATCH] gapk[master]: Ignore build products

2018-02-12 Thread Max

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

Ignore build products

Change-Id: I24be6fdbd17c7877d7a9a87081107dc5a3cd2fe8
---
M .gitignore
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/83/6383/1

diff --git a/.gitignore b/.gitignore
index 298604e..69c7ebc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,3 +51,5 @@
 # temporary/backup files
 *.*~
 .*.swp
+/compile
+/src/gapk

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24be6fdbd17c7877d7a9a87081107dc5a3cd2fe8
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 


[PATCH] gapk[master]: Add --enable-sanitize configure option

2018-02-12 Thread Max

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

Add --enable-sanitize configure option

Change-Id: Ibb26e5fc73843f3951dbc534653ee7d88e4c80e7
---
M configure.ac
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/82/6382/1

diff --git a/configure.ac b/configure.ac
index 180e380..018c479 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,15 @@
 # Checks for programs.
 AC_PROG_CC
 
+AC_ARG_ENABLE(sanitize,
+   [AS_HELP_STRING([--enable-sanitize], [Compile with address 
sanitizer enabled], )],
+   [sanitize=$enableval], [sanitize="no"])
+if test x"$sanitize" = x"yes"
+then
+   CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
+   CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
+fi
+
 # Checks for libraries.
  # libosmocore (codec module)
 PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb26e5fc73843f3951dbc534653ee7d88e4c80e7
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 


osmo-ttcn3-hacks[master]: Ignore symlinks and build byproducts

2018-02-12 Thread Max

Patch Set 3:

I've tried to use global gitignore but it quickly turned out into unreadable 
mess full of exceptions interspersed with patters. Proposed variant is much 
more concise yet it covers most of currently visible output of 'git status'.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia200e7e8e891256f0ffe43910061697769841f91
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: Ignore symlinks and build byproducts

2018-02-12 Thread Max
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6285

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

Ignore symlinks and build byproducts

Using per-directory gitignore allows to use simpler
exclude patters with fewer exceptions.

Change-Id: Ia200e7e8e891256f0ffe43910061697769841f91
---
M .gitignore
A bin/.gitignore
A bsc-nat/.gitignore
A bsc/.gitignore
A ggsn_tests/.gitignore
A gprs_gb/.gitignore
A lapdm/.gitignore
A mgw/.gitignore
A msc/.gitignore
A selftest/.gitignore
A sysinfo/.gitignore
11 files changed, 87 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/85/6285/3

diff --git a/.gitignore b/.gitignore
index d8c3ab3..5e9d90b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,11 @@
-bin/*.cc
-bin/*.hh
 deps/*/
 *.o
 *.log
 *.so
+*.y
+*.l
 compile
+Test
+*_Definitions.ttcn
+IPL4asp_*
+*_ConnectionHandler
\ No newline at end of file
diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 000..9ff9411
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,4 @@
+*.cc
+!SCTPasp_PT.cc
+*.hh
+!SCTPasp_PT.hh
diff --git a/bsc-nat/.gitignore b/bsc-nat/.gitignore
new file mode 100644
index 000..485982e
--- /dev/null
+++ b/bsc-nat/.gitignore
@@ -0,0 +1,11 @@
+*.cc
+*.hh
+*.c
+*.h
+*_Types.ttcn
+*_Functions.ttcn
+*Port*.ttcn
+*_Emulation.ttcn
+*_Templates.ttcn
+*_Mapping.ttcn*
+Makefile
diff --git a/bsc/.gitignore b/bsc/.gitignore
new file mode 100644
index 000..eff3b4e
--- /dev/null
+++ b/bsc/.gitignore
@@ -0,0 +1,11 @@
+*.cc
+*.hh
+*.c
+*.h
+*_Types.ttcn
+*Port*.ttcn
+*_Functions.ttcn
+*_Emulation.ttcn
+*_Templates.ttcn
+*_Mapping.ttcn*
+Makefile
diff --git a/ggsn_tests/.gitignore b/ggsn_tests/.gitignore
new file mode 100644
index 000..5c5565e
--- /dev/null
+++ b/ggsn_tests/.gitignore
@@ -0,0 +1,7 @@
+*.cc
+!GTP_CodecPort_CtrlFunctDef.cc
+*.hh
+*.h
+*_Types.ttcn
+*_Functions.ttcn
+Makefile
diff --git a/gprs_gb/.gitignore b/gprs_gb/.gitignore
new file mode 100644
index 000..b7f4470
--- /dev/null
+++ b/gprs_gb/.gitignore
@@ -0,0 +1,6 @@
+*.cc
+!BSSGP_Helper.cc
+!NS_CodecPort_CtrlFunctDef.cc
+*.hh
+*.h
+*_PortType.ttcn
diff --git a/lapdm/.gitignore b/lapdm/.gitignore
new file mode 100644
index 000..fbfd979
--- /dev/null
+++ b/lapdm/.gitignore
@@ -0,0 +1,4 @@
+*.cc
+*.hh
+*_Types.ttcn
+*Port*.ttcn
diff --git a/mgw/.gitignore b/mgw/.gitignore
new file mode 100644
index 000..50cad03
--- /dev/null
+++ b/mgw/.gitignore
@@ -0,0 +1,8 @@
+*.cc
+!RTP_CodecPort_CtrlFunctDef.cc
+*.hh
+*.c
+*.h
+*_Types.ttcn
+*_Functions.ttcn
+Makefile
diff --git a/msc/.gitignore b/msc/.gitignore
new file mode 100644
index 000..eff3b4e
--- /dev/null
+++ b/msc/.gitignore
@@ -0,0 +1,11 @@
+*.cc
+*.hh
+*.c
+*.h
+*_Types.ttcn
+*Port*.ttcn
+*_Functions.ttcn
+*_Emulation.ttcn
+*_Templates.ttcn
+*_Mapping.ttcn*
+Makefile
diff --git a/selftest/.gitignore b/selftest/.gitignore
new file mode 100644
index 000..eff3b4e
--- /dev/null
+++ b/selftest/.gitignore
@@ -0,0 +1,11 @@
+*.cc
+*.hh
+*.c
+*.h
+*_Types.ttcn
+*Port*.ttcn
+*_Functions.ttcn
+*_Emulation.ttcn
+*_Templates.ttcn
+*_Mapping.ttcn*
+Makefile
diff --git a/sysinfo/.gitignore b/sysinfo/.gitignore
new file mode 100644
index 000..2f24836
--- /dev/null
+++ b/sysinfo/.gitignore
@@ -0,0 +1,8 @@
+*.cc
+*.hh
+*.c
+*.h
+*_Types.ttcn
+*Port*.ttcn
+*_Functions.ttcn
+Makefile

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia200e7e8e891256f0ffe43910061697769841f91
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: dexter 


osmo-msc[master]: MNCC: Copy bearer_cap from MNCC to gsm_trans

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6838dc0c8c4c2c6bba385da548c92f3fc91060c1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: MNCC: Copy bearer_cap from MNCC to gsm_trans

2018-02-12 Thread Harald Welte

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

MNCC: Copy bearer_cap from MNCC to gsm_trans

When we receive bearer capabilities from MNCC and encode thme into
a CC message, we have to also update our "cache" inside 'struct
gsm_trans'.  Only that way, the BSSMAP ASSIGNMENT code is aware of
the actual current/present bearer capabilities such as permitted speech
codecs.

This will in practise only work if the related CC/MNCC message with
berer_cap IE will happen before the MSC performs the BSSMAP ASSIGNMENT
procedure.  Our logic still needs to change in a way that the CC/MNCC
code in gsm_04_08.c detects if trans->bearer_cap != new bearer_cap, and
in that case triggers a new follow-up BSSMAP ASSIGNMENT.

Change-Id: I6838dc0c8c4c2c6bba385da548c92f3fc91060c1
Closes: OS#2854
---
M src/libmsc/gsm_04_08.c
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/81/6381/1

diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 6c95488..a5b967e 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1883,8 +1883,10 @@
new_cc_state(trans, GSM_CSTATE_MO_CALL_PROC);
 
/* bearer capability */
-   if (proceeding->fields & MNCC_F_BEARER_CAP)
+   if (proceeding->fields & MNCC_F_BEARER_CAP) {
gsm48_encode_bearer_cap(msg, 0, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
+   }
/* facility */
if (proceeding->fields & MNCC_F_FACILITY)
gsm48_encode_facility(msg, 0, >facility);
@@ -2575,6 +2577,7 @@
 
/* bearer capability */
gsm48_encode_bearer_cap(msg, 1, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
 
new_cc_state(trans, GSM_CSTATE_MO_TERM_MODIFY);
 
@@ -2621,6 +2624,7 @@
 
/* bearer capability */
gsm48_encode_bearer_cap(msg, 1, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
 
new_cc_state(trans, GSM_CSTATE_ACTIVE);
 
@@ -2673,6 +2677,7 @@
 
/* bearer capability */
gsm48_encode_bearer_cap(msg, 1, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
/* cause */
gsm48_encode_cause(msg, 1, >cause);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6838dc0c8c4c2c6bba385da548c92f3fc91060c1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmo-msc[master]: MT Calls: Copy bearer capabilities from NNCC primitive to trans

2018-02-12 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


osmo-msc[master]: a_iface: s/Abis/L3/ for speech version/preference fields

2018-02-12 Thread Vadim Yanitskiy

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6378/1//COMMIT_MSG
Commit Message:

PS1, Line 10: referrin
cosmetic: referring ;)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id226cd1414ca2a92356801bc71f43102d03ba37e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


[MERGED] osmo-msc[master]: a_iface: Consistent and understandable function names

2018-02-12 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: a_iface: Consistent and understandable function names
..


a_iface: Consistent and understandable function names

Change-Id: I36894e68e4b1f25f266e941c39a44e0171d24689
---
M src/libmsc/a_iface.c
1 file changed, 4 insertions(+), 4 deletions(-)

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



diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index ed6dcdb..86c2e04 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -234,7 +234,7 @@
 }
 
 /* Convert speech version field */
-static uint8_t convert_l3_sv_to_A_sv(int speech_ver)
+static uint8_t convert_speech_version_l3_to_A(int speech_ver)
 {
/* The speech versions that are transmitted in the Bearer capability
 * information element, that is transmitted on the Layer 3 (CC)
@@ -270,7 +270,7 @@
 }
 
 /* Convert speech preference field */
-static uint8_t convert_l3_prev_to_A_pref(int radio)
+static uint8_t convert_speech_pref_l3_to_A(int radio)
 {
/* The Radio channel requirement field that is transmitted in the
 * Bearer capability information element, that is transmitted on the
@@ -309,7 +309,7 @@
for (i = 0; i < ARRAY_SIZE(bc->speech_ver); i++) {
if (bc->speech_ver[i] == -1)
break;
-   sv = convert_l3_sv_to_A_sv(bc->speech_ver[i]);
+   sv = convert_speech_version_l3_to_A(bc->speech_ver[i]);
if (sv != 0xFF) {
/* Detect if something else than
 * GSM HR V1 is supported */
@@ -331,7 +331,7 @@
 * preference and assume a preference for full rate. */
ct->ch_rate_type = GSM0808_SPEECH_FULL_BM;
else
-   ct->ch_rate_type = convert_l3_prev_to_A_pref(bc->radio);
+   ct->ch_rate_type = convert_speech_pref_l3_to_A(bc->radio);
 
if (count)
return 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I36894e68e4b1f25f266e941c39a44e0171d24689
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-msc[master]: a_iface: s/Abis/L3/ for speech version/preference fields

2018-02-12 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: a_iface: s/Abis/L3/ for speech version/preference fields
..


a_iface: s/Abis/L3/ for speech version/preference fields

There is no encoding of speech version / preference on Abis, only
on L3.  L3 is carried on Um, Abis and A.  Hence, referrin to Abis
in function names and comments is irritating.

Change-Id: Id226cd1414ca2a92356801bc71f43102d03ba37e
---
M src/libmsc/a_iface.c
1 file changed, 6 insertions(+), 6 deletions(-)

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



diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 3983ede..ed6dcdb 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -234,10 +234,10 @@
 }
 
 /* Convert speech version field */
-static uint8_t convert_Abis_sv_to_A_sv(int speech_ver)
+static uint8_t convert_l3_sv_to_A_sv(int speech_ver)
 {
/* The speech versions that are transmitted in the Bearer capability
-* information element, that is transmitted on the Abis interfece
+* information element, that is transmitted on the Layer 3 (CC)
 * use a different encoding than the permitted speech version
 * identifier, that is signalled in the channel type element on the A
 * interface. (See also 3GPP TS 48.008, 3.2.2.1 and 3GPP TS 24.008,
@@ -270,11 +270,11 @@
 }
 
 /* Convert speech preference field */
-static uint8_t convert_Abis_prev_to_A_pref(int radio)
+static uint8_t convert_l3_prev_to_A_pref(int radio)
 {
/* The Radio channel requirement field that is transmitted in the
 * Bearer capability information element, that is transmitted on the
-* Abis interfece uses a different encoding than the Channel rate and
+* Layer 3 (CC) uses a different encoding than the Channel rate and
 * type field that is signalled in the channel type element on the A
 * interface. (See also 3GPP TS 48.008, 3.2.2.1 and 3GPP TS 24.008,
 * 10.5.102 */
@@ -309,7 +309,7 @@
for (i = 0; i < ARRAY_SIZE(bc->speech_ver); i++) {
if (bc->speech_ver[i] == -1)
break;
-   sv = convert_Abis_sv_to_A_sv(bc->speech_ver[i]);
+   sv = convert_l3_sv_to_A_sv(bc->speech_ver[i]);
if (sv != 0xFF) {
/* Detect if something else than
 * GSM HR V1 is supported */
@@ -331,7 +331,7 @@
 * preference and assume a preference for full rate. */
ct->ch_rate_type = GSM0808_SPEECH_FULL_BM;
else
-   ct->ch_rate_type = convert_Abis_prev_to_A_pref(bc->radio);
+   ct->ch_rate_type = convert_l3_prev_to_A_pref(bc->radio);
 
if (count)
return 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id226cd1414ca2a92356801bc71f43102d03ba37e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-msc[master]: a_iface: s/Abis/L3/ for speech version/preference fields

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-msc[master]: MT Calls: Copy bearer capabilities from NNCC primitive to trans

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


osmo-msc[master]: a_iface: Consistent and understandable function names

2018-02-12 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[PATCH] osmo-bsc[master]: Add support for Access Control Class ramping.

2018-02-12 Thread Stefan Sperling
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6324

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

Add support for Access Control Class ramping.

Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.

Ramping behaviour can be configured with new VTY commands:

  access-control-class-ramping enabled (0|1)
  access-control-class-ramping step-interval (<30,600>|dynamic)
  access-control-class-ramping step-size (<1,10>

(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)

The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.

By default, ACC ramping is disabled.

When enabled, the default behaviour is to enable one ACC per
ramping stepm with a 'dyanmic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.

Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:

(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average

Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
---
M include/osmocom/bsc/Makefile.am
A include/osmocom/bsc/acc_ramp.h
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/Makefile.am
A src/libbsc/acc_ramp.c
M src/libbsc/bsc_init.c
M src/libbsc/bsc_vty.c
M src/libbsc/chan_alloc.c
M src/libbsc/system_information.c
M src/libcommon/gsm_data_shared.c
10 files changed, 488 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/24/6324/4

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 699aeb3..7919e8d 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -3,6 +3,7 @@
abis_nm.h \
abis_om2000.h \
abis_rsl.h \
+   acc_ramp.h \
arfcn_range_encode.h \
bsc_msc.h \
bsc_msg_filter.h \
diff --git a/include/osmocom/bsc/acc_ramp.h b/include/osmocom/bsc/acc_ramp.h
new file mode 100644
index 000..003f6cd
--- /dev/null
+++ b/include/osmocom/bsc/acc_ramp.h
@@ -0,0 +1,138 @@
+/* (C) 2018 by sysmocom s.f.m.c. GmbH 
+ *
+ * Author: Stefan Sperling 
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see .
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+
+#include 
+#include 
+
+/*
+ * Access control class (ACC) ramping is used to slowly make the cell 
available to
+ * an increasing number of MS. This avoids overload at startup time in cases 
where
+ * a lot of MS would discover the new cell and try to connect to it all at 
once.
+ */
+
+#define ACC_RAMP_STEP_SIZE_MIN 1 /* allow at most 1 new ACC per ramp 

[PATCH] osmo-msc[master]: a_iface: s/Abis/L3/ for speech version/preference fields

2018-02-12 Thread Harald Welte

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

a_iface: s/Abis/L3/ for speech version/preference fields

There is no encoding of speech version / preference on Abis, only
on L3.  L3 is carried on Um, Abis and A.  Hence, referrin to Abis
in function names and comments is irritating.

Change-Id: Id226cd1414ca2a92356801bc71f43102d03ba37e
---
M src/libmsc/a_iface.c
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/78/6378/1

diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 3983ede..ed6dcdb 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -234,10 +234,10 @@
 }
 
 /* Convert speech version field */
-static uint8_t convert_Abis_sv_to_A_sv(int speech_ver)
+static uint8_t convert_l3_sv_to_A_sv(int speech_ver)
 {
/* The speech versions that are transmitted in the Bearer capability
-* information element, that is transmitted on the Abis interfece
+* information element, that is transmitted on the Layer 3 (CC)
 * use a different encoding than the permitted speech version
 * identifier, that is signalled in the channel type element on the A
 * interface. (See also 3GPP TS 48.008, 3.2.2.1 and 3GPP TS 24.008,
@@ -270,11 +270,11 @@
 }
 
 /* Convert speech preference field */
-static uint8_t convert_Abis_prev_to_A_pref(int radio)
+static uint8_t convert_l3_prev_to_A_pref(int radio)
 {
/* The Radio channel requirement field that is transmitted in the
 * Bearer capability information element, that is transmitted on the
-* Abis interfece uses a different encoding than the Channel rate and
+* Layer 3 (CC) uses a different encoding than the Channel rate and
 * type field that is signalled in the channel type element on the A
 * interface. (See also 3GPP TS 48.008, 3.2.2.1 and 3GPP TS 24.008,
 * 10.5.102 */
@@ -309,7 +309,7 @@
for (i = 0; i < ARRAY_SIZE(bc->speech_ver); i++) {
if (bc->speech_ver[i] == -1)
break;
-   sv = convert_Abis_sv_to_A_sv(bc->speech_ver[i]);
+   sv = convert_l3_sv_to_A_sv(bc->speech_ver[i]);
if (sv != 0xFF) {
/* Detect if something else than
 * GSM HR V1 is supported */
@@ -331,7 +331,7 @@
 * preference and assume a preference for full rate. */
ct->ch_rate_type = GSM0808_SPEECH_FULL_BM;
else
-   ct->ch_rate_type = convert_Abis_prev_to_A_pref(bc->radio);
+   ct->ch_rate_type = convert_l3_prev_to_A_pref(bc->radio);
 
if (count)
return 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id226cd1414ca2a92356801bc71f43102d03ba37e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-msc[master]: a_iface: Consistent and understandable function names

2018-02-12 Thread Harald Welte

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

a_iface: Consistent and understandable function names

Change-Id: I36894e68e4b1f25f266e941c39a44e0171d24689
---
M src/libmsc/a_iface.c
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/79/6379/1

diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index ed6dcdb..86c2e04 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -234,7 +234,7 @@
 }
 
 /* Convert speech version field */
-static uint8_t convert_l3_sv_to_A_sv(int speech_ver)
+static uint8_t convert_speech_version_l3_to_A(int speech_ver)
 {
/* The speech versions that are transmitted in the Bearer capability
 * information element, that is transmitted on the Layer 3 (CC)
@@ -270,7 +270,7 @@
 }
 
 /* Convert speech preference field */
-static uint8_t convert_l3_prev_to_A_pref(int radio)
+static uint8_t convert_speech_pref_l3_to_A(int radio)
 {
/* The Radio channel requirement field that is transmitted in the
 * Bearer capability information element, that is transmitted on the
@@ -309,7 +309,7 @@
for (i = 0; i < ARRAY_SIZE(bc->speech_ver); i++) {
if (bc->speech_ver[i] == -1)
break;
-   sv = convert_l3_sv_to_A_sv(bc->speech_ver[i]);
+   sv = convert_speech_version_l3_to_A(bc->speech_ver[i]);
if (sv != 0xFF) {
/* Detect if something else than
 * GSM HR V1 is supported */
@@ -331,7 +331,7 @@
 * preference and assume a preference for full rate. */
ct->ch_rate_type = GSM0808_SPEECH_FULL_BM;
else
-   ct->ch_rate_type = convert_l3_prev_to_A_pref(bc->radio);
+   ct->ch_rate_type = convert_speech_pref_l3_to_A(bc->radio);
 
if (count)
return 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36894e68e4b1f25f266e941c39a44e0171d24689
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-msc[master]: MT Calls: Copy bearer capabilities from NNCC primitive to trans

2018-02-12 Thread Harald Welte

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

MT Calls: Copy bearer capabilities from NNCC primitive to trans

When we receive a MNCC_SETUP_REQ primitive from the external MNCC
handler, we must not only encode it into the TS 04.08 CC SETUP, but
also keep it around in the "trans" structure representing this voice
call, as it is needed e.g. at BSSMAP ASSIGNMENT time.

Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76
Related: OS#2322
Closes: OS#2929
---
M src/libmsc/gsm_04_08.c
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/80/6380/1

diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 7b6e94a..6c95488 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1767,8 +1767,12 @@
gsm48_start_cc_timer(trans, 0x303, GSM48_T303);
 
/* bearer capability */
-   if (setup->fields & MNCC_F_BEARER_CAP)
+   if (setup->fields & MNCC_F_BEARER_CAP) {
+   /* Create a copy of the bearer capability in the transaction 
struct, so we
+* can use this information later */
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
gsm48_encode_bearer_cap(msg, 0, >bearer_cap);
+   }
/* facility */
if (setup->fields & MNCC_F_FACILITY)
gsm48_encode_facility(msg, 0, >facility);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-bsc[master]: Add support for Access Control Class ramping.

2018-02-12 Thread Stefan Sperling
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6324

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

Add support for Access Control Class ramping.

Access Control Class (ACC) ramping is used to slowly make the cell
available to an increasing number of MS. This avoids overload at
startup time in cases where a lot of MS would discover the new
cell and try to connect to it all at once.

Ramping behaviour can be configured with new VTY commands:

  access-control-class-ramping enabled (0|1)
  access-control-class-ramping step-interval (<30,600>|dynamic)
  access-control-class-ramping step-size (<1,10>

(The minimum and maximum values for these parameters are hard-coded,
but could be changed if they are found to be inadequate.)

The VTY command 'show bts' has been extended to display the
current ACC ramping configuration.

By default, ACC ramping is disabled.

When enabled, the default behaviour is to enable one ACC per
ramping stepm with a 'dyanmic' step interval. This means the
ramping interval (time between steps) is scaled to the channel
load average of the BTS, i.e. the number of used vs. available
channels measured over a certain amount of time.

Below is an example of debug log output with ACC ramping enabled,
while many 'mobile' programs are concurrently trying to connect
to the network via an osmo-bts-virtual BTS. Initially, all ACCs
are barred, and then only one class is allowed. Then the current
BTS channel load average is consulted for scheduling the next
ramping step. While the channel load average is low, ramping
proceeds faster, and while it is is high, ramping proceeds slower:

(bts=0) ACC RAMP: barring Access Control Class 0
(bts=0) ACC RAMP: barring Access Control Class 1
(bts=0) ACC RAMP: barring Access Control Class 2
(bts=0) ACC RAMP: barring Access Control Class 3
(bts=0) ACC RAMP: barring Access Control Class 4
(bts=0) ACC RAMP: barring Access Control Class 5
(bts=0) ACC RAMP: barring Access Control Class 6
(bts=0) ACC RAMP: barring Access Control Class 7
(bts=0) ACC RAMP: barring Access Control Class 8
(bts=0) ACC RAMP: barring Access Control Class 9
(bts=0) ACC RAMP: allowing Access Control Class 0
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 1
(bts=0) ACC RAMP: step interval set to 354 seconds based on 59% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 2
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average
(bts=0) ACC RAMP: allowing Access Control Class 3
(bts=0) ACC RAMP: step interval set to 30 seconds based on 0% channel load 
average

Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Related: OS#2591
---
M include/osmocom/bsc/Makefile.am
A include/osmocom/bsc/acc_ramp.h
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/Makefile.am
A src/libbsc/acc_ramp.c
M src/libbsc/bsc_init.c
M src/libbsc/bsc_vty.c
M src/libbsc/chan_alloc.c
M src/libbsc/system_information.c
M src/libcommon/gsm_data_shared.c
10 files changed, 488 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/24/6324/3

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 699aeb3..7919e8d 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -3,6 +3,7 @@
abis_nm.h \
abis_om2000.h \
abis_rsl.h \
+   acc_ramp.h \
arfcn_range_encode.h \
bsc_msc.h \
bsc_msg_filter.h \
diff --git a/include/osmocom/bsc/acc_ramp.h b/include/osmocom/bsc/acc_ramp.h
new file mode 100644
index 000..003f6cd
--- /dev/null
+++ b/include/osmocom/bsc/acc_ramp.h
@@ -0,0 +1,138 @@
+/* (C) 2018 by sysmocom s.f.m.c. GmbH 
+ *
+ * Author: Stefan Sperling 
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see .
+ *
+ */
+
+#pragma once
+
+#include 
+#include 
+
+#include 
+#include 
+
+/*
+ * Access control class (ACC) ramping is used to slowly make the cell 
available to
+ * an increasing number of MS. This avoids overload at startup time in cases 
where
+ * a lot of MS would discover the new cell and try to connect to it all at 
once.
+ */
+
+#define ACC_RAMP_STEP_SIZE_MIN 1 /* allow at most 1 new ACC per ramp 

osmo-bsc[master]: Add support for Access Control Class ramping.

2018-02-12 Thread Stefan Sperling

Patch Set 2:

(9 comments)

https://gerrit.osmocom.org/#/c/6324/2/include/osmocom/bsc/acc_ramp.h
File include/osmocom/bsc/acc_ramp.h:

Line 1: /* (C) 2018 Stefan Sperling 
> (C) sysmocom / Author: Stefan Sperling, please look at other examples, than
Fine, fixed in next patch set.


Line 41:struct gsm_bts *bts; /* backpointer to BTS using this ACC ramp 
*/
> one could avoid the back-pointer if we used offsetof() to go back from acc_
I agree. I will investigate this idea later and provide a follow-up patch if I 
find a nicer way of doing this.


https://gerrit.osmocom.org/#/c/6324/2/src/libbsc/acc_ramp.c
File src/libbsc/acc_ramp.c:

Line 68: static void allow_all_allowed_accs(struct acc_ramp *acc_ramp)
> the naming is a bit ... odd.
:)

I will change the naming in the next patch set to make a distinction between 
"allowed ACC" (this ACC is not currently barred) and "enabled ACC" (the user 
has not permanently barred this ACC via VTY). I hope that will be clearer.


PS2, Line 93: DRLL
> this is not related to the Radio Link Layer (which is a sub-layer of RSL). 
I will switch these to DRSL in the next patch set. I could also introduce a 
separate log category in a follow-up patch if desired.


Line 98: static void send_bts_system_info(struct gsm_bts *bts)
> this should become a public function that's part of the general bts/trx/sys
There already is one in bsc_init.c, gsm_bts_set_system_infos(). I will use that 
instead in the next patch set.


Line 107: static void do_ramping_step(void *data)
> 'acc' in the name might be useful in backtraces/debugging/... to indicate w
Agreed. Will rename in next patch set.


https://gerrit.osmocom.org/#/c/6324/2/src/libbsc/bsc_init.c
File src/libbsc/bsc_init.c:

Line 335:   acc_ramp_start(>bts->acc_ramp);
> your first ramp step is executed before the call to gsm_bts_trx_set_system_
Indeed, thanks for catching this!

I think we can solve this by again calling acc_ramp_init() when we enter this 
function, to ensure ACC barring overrides take effect in the initial system 
infos bootstrap_rsl() sends via gsm_bts_trx_set_system_infos().

And then start the actual ramping process at the end of bootstrap_rsl(). This 
call might update system infos again if needed, but that's what we do as part 
of each ramping step anyway.

Calling acc_ramp_init() in bootstrap_rsl() will also help in case ACC ramp VTY 
configuration has changed when a BTS reconnects, which happens without going 
through bootstrap_bts() again as far as can I tell.


https://gerrit.osmocom.org/#/c/6324/2/src/libbsc/bsc_vty.c
File src/libbsc/bsc_vty.c:

PS2, Line 3135: enabled (0|1)
> while we have some commands like this dating back to the early days, it is 
Changed to work as suggested (Switch/Router style) in the next patch set. The 
commands which modify step size and interval were also changed slightly as a 
side effect.


https://gerrit.osmocom.org/#/c/6324/2/src/libbsc/system_information.c
File src/libbsc/system_information.c:

Line 662: static void apply_acc_ramp(struct gsm48_rach_control *rach_control, 
struct acc_ramp *acc_ramp)
> I think that should be part of the acc related code, not here?  At that poi
In the next patch set I am moving this to acc_ramp.h as an inline function, 
named as suggested.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0a5ac3a08f992f326435944f17e0a9171911afb0
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-12 Thread Pau Espin Pedrol

Patch Set 1: Code-Review-1

(1 comment)

Regarding the test failure: We recently updated the unit running 
osmo-gsm-tester to debian9 using new ansible recipes and we are experiencing 
some ofono modems stability issues and I need to restart ofono every few hours. 
I restarted ofono and re-triggered the jenkins job.

https://gerrit.osmocom.org/#/c/6377/1/src/osmo_gsm_tester/log.py
File src/osmo_gsm_tester/log.py:

Line 278: # Poke into internal to avoid hitting the linecache which will 
make one or
According to [1], _getframe() can have a depth parameter, which if I understand 
correctly, makes useless the for loop below as you can pass levels_up - 1 
directly. Then better except for ValueError and return "" if 
raised.

In the doc it is also specified that this function is cython specific, which 
means it may be better to leave old implementation as fallback. Check for 
except AttributeError when calling sys._getframe() and then call older 
implementation.

[1] https://docs.python.org/3/library/sys.html


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: Yes


osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-12 Thread Holger Freyther

Patch Set 1:

And the test failure seems unrelated to my change? Is the setup currently 
running/working?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-12 Thread Holger Freyther

Patch Set 1:

Motivated by https://osmocom.org/issues/2927.

I have not fully tested it and didn't check how inspect behaves when we want to 
skip more levels than frames we have.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


[PATCH] osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-12 Thread Holger Freyther

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

log: Use sys._getframe() to avoid stat(2) calls

The Osmo MS driver is launching many many processes and I would
like to use the logging framework for the code as well.
Unfortunately the inspect/traceback code will use a linecache which
will execute stat(2) on one or more python files.

Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
---
M src/osmo_gsm_tester/log.py
1 file changed, 8 insertions(+), 2 deletions(-)


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

diff --git a/src/osmo_gsm_tester/log.py b/src/osmo_gsm_tester/log.py
index a9f16c2..698d819 100644
--- a/src/osmo_gsm_tester/log.py
+++ b/src/osmo_gsm_tester/log.py
@@ -275,8 +275,14 @@
 target.large_separator(*msgs, sublevel=sublevel, 
space_above=space_above)
 
 def get_src_from_caller(levels_up=1):
-caller = getframeinfo(stack()[levels_up][0])
-return '%s:%d' % (os.path.basename(caller.filename), caller.lineno)
+# Poke into internal to avoid hitting the linecache which will make one or
+# more calls to stat(2).
+frame = sys._getframe()
+for i in range(0, levels_up):
+frame = frame.f_back
+if not frame:
+return ""
+return '%s:%d' % (os.path.basename(frame.f_code.co_filename), 
frame.f_lineno)
 
 def get_src_from_exc_info(exc_info=None, levels_up=1):
 if exc_info is None:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther