[MERGED] osmo-ttcn3-hacks[master]: msc: Disable t310 test for now (seems to never terminate on ...

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: msc: Disable t310 test for now (seems to never terminate on 
TITAN 6.1.0)
..


msc: Disable t310 test for now (seems to never terminate on TITAN 6.1.0)

Change-Id: I1e8d1101cfea6d861f02cca52f3dc2d1453c33f8
---
M msc/MSC_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index f91ff38..0e59dcf 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1623,7 +1623,7 @@
execute( TC_mo_crcx_ran_timeout() );
execute( TC_mo_crcx_ran_reject() );
execute( TC_mt_crcx_ran_reject() );
-   execute( TC_mt_t310() );
+   //execute( TC_mt_t310() );
execute( TC_gsup_cancel() );
execute( TC_lu_imsi_auth_tmsi_encr_1_13() );
execute( TC_lu_imsi_auth_tmsi_encr_3_13() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1e8d1101cfea6d861f02cca52f3dc2d1453c33f8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: msc: Disable t310 test for now (seems to never terminate on ...

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[PATCH] osmo-ttcn3-hacks[master]: msc: Disable t310 test for now (seems to never terminate on ...

2018-01-29 Thread Harald Welte

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

msc: Disable t310 test for now (seems to never terminate on TITAN 6.1.0)

Change-Id: I1e8d1101cfea6d861f02cca52f3dc2d1453c33f8
---
M msc/MSC_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index f91ff38..0e59dcf 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1623,7 +1623,7 @@
execute( TC_mo_crcx_ran_timeout() );
execute( TC_mo_crcx_ran_reject() );
execute( TC_mt_crcx_ran_reject() );
-   execute( TC_mt_t310() );
+   //execute( TC_mt_t310() );
execute( TC_gsup_cancel() );
execute( TC_lu_imsi_auth_tmsi_encr_1_13() );
execute( TC_lu_imsi_auth_tmsi_encr_3_13() );

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

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


osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-29 Thread Harald Welte

Patch Set 1:

> As described in the commit description, I'm still having some
 > issues due to the ICMP packets not being forwarded after arriving
 > to the tun device. The GGSN processing part seems to be working
 > fine but still it'd be better to solve it before merging them.

might be worth creating a redmine issue with attached pcap?

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

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


[MERGED] osmo-ttcn3-hacks[master]: bsc: f_establish_fully(): Wait for release of old channel

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: f_establish_fully(): Wait for release of old channel
..


bsc: f_establish_fully(): Wait for release of old channel

We shouldn't "pass" f_establish_fully() in the assignment case
as long as the old RF channel hasn't been released via RSL.

Change-Id: If7c7c8c4826feba47f8a0395c291157a0e48cd9d
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 11 insertions(+), 5 deletions(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 80bc1fb..6afeca2 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -375,19 +375,21 @@
boolean is_assignment,
/* Assignment related bits */
boolean rr_ass_cmpl_seen,
+   boolean assignment_done,
RslChannelNr old_chan_nr,
/* Modify related bits */
boolean rr_modify_seen,
-   boolean rsl_modify_seen
+   boolean modify_done
 }
 
 template (value) AssignmentState ts_AssignmentStateInit := {
voice_call := false,
is_assignment := false,
rr_ass_cmpl_seen := false,
+   assignment_done := false,
old_chan_nr := -,
rr_modify_seen := false,
-   rsl_modify_seen := false
+   modify_done := false
 }
 
 altstep as_assignment(inout AssignmentState st) runs on MSC_ConnHdlr {
@@ -426,6 +428,7 @@
RSL.send(ts_RSL_RF_CHAN_REL_ACK(st.old_chan_nr));
/* FIXME: unregister for old channel number in RSL emulation */
//f_rslem_unregister(0, st.old_chan_nr);
+   st.assignment_done := true;
repeat;
}
 }
@@ -446,7 +449,7 @@
}
[st.voice_call and st.rr_modify_seen] 
RSL.receive(tr_RSL_MsgTypeD(RSL_MT_MODE_MODIFY_REQ)) -> value rsl {
RSL.send(ts_RSL_MODE_MODIFY_ACK(g_chan_nr));
-   st.rsl_modify_seen := true;
+   st.modify_done := true;
repeat;
}
 }
@@ -524,10 +527,13 @@
[st.voice_call] as_Media();
 
/* if we receive exactly what we expected, always return + pass */
-   [] BSSAP.receive(exp_ass_cpl) -> value bssap {
+   [st.is_assignment and st.assignment_done or
+(not st.is_assignment and st.modify_done)] BSSAP.receive(exp_ass_cpl) 
-> value bssap {
setverdict(pass);
}
-   [exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {
+   [(st.is_assignment and st.assignment_done or
+(not st.is_assignment and st.modify_done)) and
+exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {
setverdict(fail, "Received non-matching ASSIGNMENT COMPLETE");
}
[exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentFail) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If7c7c8c4826feba47f8a0395c291157a0e48cd9d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-ttcn3-hacks[master]: bsc: f_establish_fully(): Wait for release of old channel

2018-01-29 Thread Harald Welte

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

bsc: f_establish_fully(): Wait for release of old channel

We shouldn't "pass" f_establish_fully() in the assignment case
as long as the old RF channel hasn't been released via RSL.

Change-Id: If7c7c8c4826feba47f8a0395c291157a0e48cd9d
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 11 insertions(+), 5 deletions(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 80bc1fb..6afeca2 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -375,19 +375,21 @@
boolean is_assignment,
/* Assignment related bits */
boolean rr_ass_cmpl_seen,
+   boolean assignment_done,
RslChannelNr old_chan_nr,
/* Modify related bits */
boolean rr_modify_seen,
-   boolean rsl_modify_seen
+   boolean modify_done
 }
 
 template (value) AssignmentState ts_AssignmentStateInit := {
voice_call := false,
is_assignment := false,
rr_ass_cmpl_seen := false,
+   assignment_done := false,
old_chan_nr := -,
rr_modify_seen := false,
-   rsl_modify_seen := false
+   modify_done := false
 }
 
 altstep as_assignment(inout AssignmentState st) runs on MSC_ConnHdlr {
@@ -426,6 +428,7 @@
RSL.send(ts_RSL_RF_CHAN_REL_ACK(st.old_chan_nr));
/* FIXME: unregister for old channel number in RSL emulation */
//f_rslem_unregister(0, st.old_chan_nr);
+   st.assignment_done := true;
repeat;
}
 }
@@ -446,7 +449,7 @@
}
[st.voice_call and st.rr_modify_seen] 
RSL.receive(tr_RSL_MsgTypeD(RSL_MT_MODE_MODIFY_REQ)) -> value rsl {
RSL.send(ts_RSL_MODE_MODIFY_ACK(g_chan_nr));
-   st.rsl_modify_seen := true;
+   st.modify_done := true;
repeat;
}
 }
@@ -524,10 +527,13 @@
[st.voice_call] as_Media();
 
/* if we receive exactly what we expected, always return + pass */
-   [] BSSAP.receive(exp_ass_cpl) -> value bssap {
+   [st.is_assignment and st.assignment_done or
+(not st.is_assignment and st.modify_done)] BSSAP.receive(exp_ass_cpl) 
-> value bssap {
setverdict(pass);
}
-   [exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {
+   [(st.is_assignment and st.assignment_done or
+(not st.is_assignment and st.modify_done)) and
+exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {
setverdict(fail, "Received non-matching ASSIGNMENT COMPLETE");
}
[exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentFail) {

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

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


[MERGED] osmo-ttcn3-hacks[master]: bsc: Don't test CTRL commands for old NITB parameters

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Don't test CTRL commands for old NITB parameters
..


bsc: Don't test CTRL commands for old NITB parameters

Change-Id: Ib6c6b24842d7ceb12a93200bd6208a6b392544b5
---
M bsc/BSC_Tests.ttcn
1 file changed, 0 insertions(+), 2 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 8766503..dacb630 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -872,8 +872,6 @@
 
f_ctrl_get_exp(IPA_CTRL, "mcc", "1");
f_ctrl_get_exp(IPA_CTRL, "mnc", "1");
-   f_ctrl_get_exp(IPA_CTRL, "short-name", "OsmoBSC");
-   f_ctrl_get_exp(IPA_CTRL, "long-name", "OsmoBSC");
f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "3");
 
var integer bts_nr := 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6c6b24842d7ceb12a93200bd6208a6b392544b5
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bsc: Register expect criteria for MGCP CRCX

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Register expect criteria for MGCP CRCX
..


bsc: Register expect criteria for MGCP CRCX

Change-Id: I04afa663f4397d5d9b8dec06671aec84f4c4f80e
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 6 insertions(+), 0 deletions(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 3dbb782..e1fd35a 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -158,11 +158,17 @@
var boolean exp_compl := 
ischosen(exp_ass_cpl.pdu.bssmap.assignmentComplete);
var boolean crcx_seen := false;
var boolean rr_modify_seen := false;
+   var ExpectCriteria mgcpcrit := {
+   connid := omit,
+   endpoint := omit,
+   transid := omit
+   };
 
f_create_chan_and_exp(pars);
/* we should now have a COMPL_L3 at the MSC */
 
BSSAP.receive(tr_BSSMAP_ComplL3);
+   f_create_mgcp_expect(mgcpcrit);
BSSAP.send(ass_cmd);
alt {
/* if we receive exactly what we expected, always return + pass */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I04afa663f4397d5d9b8dec06671aec84f4c4f80e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 


osmo-ttcn3-hacks[master]: bsc: Implement Assignment handling

2018-01-29 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5f830b010ea1b466ae74fa810df86638a74a3b8b
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-ttcn3-hacks[master]: BSC_Tests: Add MGCP_Emulation to gen_links

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: BSC_Tests: Add MGCP_Emulation to gen_links
..


BSC_Tests: Add MGCP_Emulation to gen_links

Change-Id: Iac24d8d3baf7e4ca6bdab6b0be7b55096e490d01
---
M bsc/gen_links.sh
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index 01655c0..af747b3 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -76,5 +76,5 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn 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_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 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

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac24d8d3baf7e4ca6bdab6b0be7b55096e490d01
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 


[MERGED] osmo-ttcn3-hacks[master]: bsc: reduce code duplication by introducing f_expect_chan_rel()

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: reduce code duplication by introducing f_expect_chan_rel()
..


bsc: reduce code duplication by introducing f_expect_chan_rel()

The handling of channel release is copy+pasted, let's introduce
a shared function.

Change-Id: If74b0838187f60004b7daf6176db259af511bf87
---
M bsc/BSC_Tests.ttcn
1 file changed, 37 insertions(+), 74 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 87150db..c7b5a8f 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -606,11 +606,44 @@
setverdict(pass);
 }
 
+function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, boolean 
flush := true,
+  boolean handle_rll_rel := true) runs on test_CT {
+
+   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
+   if (flush) {
+   /* Clear the queue, it might still contain stuff like IMMEDIATE 
ASSIGN */
+   IPA_RSL[bts_nr].clear;
+   }
+   alt {
+   /* ignore DEACTIVATE SACCH (if any) */
+   [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
+   tr_RSL_DEACT_SACCH(rsl_chan_nr))) {
+   repeat;
+   }
+   /* acknowledge RLL release (if any)*/
+   [handle_rll_rel] 
IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
+   tr_RSL_REL_REQ(rsl_chan_nr, ?))) {
+   /* FIXME: Why are we getting this for LinkID SACCH? */
+   f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch));
+   repeat;
+   }
+   /* Expect RF channel release from BSC on Abis */
+   [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
+   
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
+   /* respond with CHAN REL ACK */
+   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr));
+   }
+   /* ignore any user data */
+   [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, 
tr_RSL_MsgTypeR(?))) {
+   repeat;
+   }
+   }
+}
+
 /* Test behavior of channel release after hard Clear Command from MSC */
 testcase TC_chan_rel_hard_clear() runs on test_CT {
var BSSAP_N_DATA_ind rx_di;
var DchanTuple dt;
-   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
 
f_init(1);
f_bssap_reset();
@@ -627,36 +660,13 @@
BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
}
 
-   /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN 
*/
-   IPA_RSL[0].clear;
-   alt {
-   /* ignore DEACTIVATE SACCH (if any) */
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) {
-   repeat;
-   }
-   /* acknowledge RLL release (if any)*/
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) {
-   /* FIXME: Why are we getting this for LinkID SACCH? */
-   f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch));
-   repeat;
-   }
-   /* Expect RF channel release from BSC on Abis */
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
-   /* respond with CHAN REL ACK */
-   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-   }
-   }
-
+   f_expect_chan_rel(0, dt.rsl_chan_nr);
setverdict(pass);
 }
 
 /* Test behavior of channel release after hard RLSD from MSC */
 testcase TC_chan_rel_hard_rlsd() runs on test_CT {
var DchanTuple dt;
-   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
 
f_init(1);
f_bssap_reset();
@@ -666,36 +676,13 @@
/* release the SCCP connection */
BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
 
-   /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN 
*/
-   IPA_RSL[0].clear;
-   alt {
-   /* ignore DEACTIVATE SACCH (if any) */
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) {
-   repeat;
-   }
-   /* acknowledge RLL release (if any)*/
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) {
-   /* FIXME: Why are we getting this for LinkID SACCH? */
-   f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch));
-   repeat;
-   }
-   /* Expect RF channel rele

[MERGED] osmo-ttcn3-hacks[master]: MGCP_Emulation: Remove bogus mgcp_conn_id variable from MGCP...

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: MGCP_Emulation: Remove bogus mgcp_conn_id variable from 
MGCP_ConnHdlr
..


MGCP_Emulation: Remove bogus mgcp_conn_id variable from MGCP_ConnHdlr

A given MGCP_ConnHdlr is handling multiple connections on one Endpoint
anyway, and the variable is not set or used anywhere.

Change-Id: If9eea3f665289a52915f114f0a69234aad28f322
---
M library/MGCP_Emulation.ttcn
1 file changed, 0 insertions(+), 1 deletion(-)

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



diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index 074385c..df8e4b4 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -38,7 +38,6 @@
port MGCP_Conn_PT MGCP;
/* procedure based port to register for incoming connections */
port MGCPEM_PROC_PT MGCP_PROC;
-   var MgcpConnectionId mgcp_conn_id;
 }
 
 /* port between individual per-connection components and this dispatcher */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9eea3f665289a52915f114f0a69234aad28f322
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bsc: Unregister old RSL channel number after assignment

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Unregister old RSL channel number after assignment
..


bsc: Unregister old RSL channel number after assignment

Change-Id: I27d113391094f938ff92c4d6514172ee634f695c
---
M bsc/MSC_ConnectionHandler.ttcn
M library/RSL_Emulation.ttcn
2 files changed, 20 insertions(+), 3 deletions(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 6afeca2..55cdb89 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -426,8 +426,9 @@
}
[st.rr_ass_cmpl_seen] RSL.receive(tr_RSL_RF_CHAN_REL(st.old_chan_nr)) {
RSL.send(ts_RSL_RF_CHAN_REL_ACK(st.old_chan_nr));
-   /* FIXME: unregister for old channel number in RSL emulation */
-   //f_rslem_unregister(0, st.old_chan_nr);
+   /* unregister for old channel number in RSL emulation */
+   /* FIXME: Determine TRX NR by ARFCN, instead of hard-coded 
TRX0! */
+   f_rslem_unregister(0, st.old_chan_nr);
st.assignment_done := true;
repeat;
}
diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index cbcff2c..d20718f 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -50,9 +50,10 @@
 } with { extension "internal" };
 
 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);
 
 type port RSLEM_PROC_PT procedure {
-   inout RSLEM_register;
+   inout RSLEM_register, RSLEM_unregister;
 } with { extension "internal" };
 
 /***
@@ -379,6 +380,13 @@
RSL_PROC.reply(RSLEM_register:{trx_nr, chan_nr, 
vc_conn});
}
 
+   [] RSL_PROC.getcall(RSLEM_unregister:{?,?,?}) -> param(trx_nr, 
chan_nr, vc_conn) {
+   cid := f_cid_by_chan_nr(trx_nr, chan_nr);
+   f_cid_clear(cid);
+   RSL_PROC.reply(RSLEM_unregister:{trx_nr, chan_nr, 
vc_conn});
+   }
+
+
}
}
 }
@@ -400,4 +408,12 @@
}
 }
 
+/* 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:{?,?,?}) {};
+   }
+}
+
+
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I27d113391094f938ff92c4d6514172ee634f695c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: MGCP_Emulation: Remove bogus mgcp_conn_id variable from MGCP...

2018-01-29 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If9eea3f665289a52915f114f0a69234aad28f322
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-ttcn3-hacks[master]: bsc: Implement Assignment handling

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Implement Assignment handling
..


bsc: Implement Assignment handling

This adds code for the rather intricated and nested transactions
happening on RSL, BSSAP, MGCP and RSL-IPA.  We use explicit
invocation of altsteps to simplify the main function f_establish_fully.

Change-Id: I5f830b010ea1b466ae74fa810df86638a74a3b8b
---
M bsc/MSC_ConnectionHandler.ttcn
M bsc/gen_links.sh
M bsc/regen_makefile.sh
3 files changed, 379 insertions(+), 61 deletions(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index d619068..80bc1fb 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -8,6 +8,9 @@
 import from BSSMAP_Emulation all;
 import from BSSMAP_Templates all;
 
+import from IPL4asp_Types all;
+import from Native_Functions all;
+
 import from MGCP_Types all;
 import from MGCP_Templates all;
 import from MGCP_Emulation all;
@@ -18,8 +21,197 @@
 
 import from MobileL3_Types all;
 import from MobileL3_CommonIE_Types all;
-//import from MobileL3_RRM_Types all;
+import from MobileL3_RRM_Types all;
 import from L3_Templates all;
+
+
+/***
+ * Media related handling
+ ***/
+
+/* Tuple containing host/ip and port */
+type record HostPort {
+   HostNamehost,
+   PortNumber  port_nr
+};
+
+/* State encapsulating one MGCP Connection */
+type record MgcpConnState {
+   boolean crcx_seen,
+   MgcpConnectionId conn_id,
+   charstring mime_type,   /* e.g. AMR */
+   integer sample_rate,/* 8000 */
+   integer ptime,  /* 20 */
+   uint7_t rtp_pt, /* RTP Payload Type */
+   HostPort mgw,   /* MGW side */
+   HostPort peer   /* CA side */
+};
+
+/* BTS media state */
+type record BtsMediaState {
+   boolean ipa_crcx_seen,
+   uint16_t conn_id,
+   uint7_t rtp_pt,
+   HostPort bts,
+   HostPort peer
+};
+
+type record MediaState {
+   MgcpEndpointmgcp_ep,
+   MgcpConnState   mgcp_conn[2],
+   BtsMediaState   bts
+};
+
+function f_MediaState_init(inout MediaState g_media, integer nr, HostName bts, 
HostName mgw) {
+   /* BTS Side */
+   g_media.bts := {
+   ipa_crcx_seen := false,
+   conn_id := nr,
+   rtp_pt := 0,
+   bts := {
+   host := bts,
+   port_nr := 9000 + nr*2
+   },
+   peer := -
+   }
+
+   //g_media.mgcp_ep := int2str(i) & "@mgw";
+
+   for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
+   g_media.mgcp_conn[i].mime_type := "AMR";
+   g_media.mgcp_conn[i].sample_rate := 8000;
+   g_media.mgcp_conn[i].ptime := 20;
+   g_media.mgcp_conn[i].rtp_pt := 98;
+   g_media.mgcp_conn[i].crcx_seen := false;
+   g_media.mgcp_conn[i].conn_id := f_mgcp_alloc_conn_id();
+   }
+
+   g_media.mgcp_conn[0].mgw := {
+   host := mgw,
+   port_nr := 1 + nr*2
+   }
+   g_media.mgcp_conn[1].mgw := {
+   host := mgw,
+   port_nr := 11000 + nr*2
+   }
+}
+
+private function f_get_free_mgcp_conn() runs on MSC_ConnHdlr return integer {
+   for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
+   if (not g_media.mgcp_conn[i].crcx_seen) {
+   return i;
+   }
+   }
+   setverdict(fail, "Only 2 Connections per EP!");
+   self.stop;
+   return -1;
+}
+
+private function f_get_mgcp_conn(MgcpConnectionId cid) runs on MSC_ConnHdlr 
return integer {
+   for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
+   if (g_media.mgcp_conn[i].conn_id == cid and 
g_media.mgcp_conn[i].crcx_seen) {
+   return i;
+   }
+   }
+   setverdict(fail, "No Connection for ID ", cid);
+   self.stop;
+   return -1;
+}
+
+
+/* altstep for handling of IPA + MGCP media related commands. Can be activated 
by a given
+ * test case if it expects to see media related handling (i.e. voice calls */
+altstep as_Media() runs on MSC_ConnHdlr {
+   var RSL_Message rsl;
+   var MgcpCommand mgcp_cmd;
+   var RSL_IE_Body ie;
+   [not g_media.bts.ipa_crcx_seen] RSL.receive(tr_RSL_IPA_CRCX(g_chan_nr)) 
-> value rsl {
+   /* Extract parameters from request + use in response */
+   if (f_rsl_find_ie(rsl, RSL_IE_IPAC_RTP_PAYLOAD, ie)) {
+   g_media.bts.rtp_pt := ie.ipa_rtp_pt;
+   }
+   i

[MERGED] osmo-ttcn3-hacks[master]: bsc: Permit MGCP messages from random ports on BSC side

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Permit MGCP messages from random ports on BSC side
..


bsc: Permit MGCP messages from random ports on BSC side

Change-Id: Ie8896edc3f4310a78b584fd4ad017b77bda22afb
---
M bsc/BSC_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 7e5b675..9da5b65 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -191,7 +191,7 @@
};
var MGCP_conn_parameters mgcp_pars := {
callagent_ip := mp_bsc_ip,
-   callagent_udp_port := 2727,
+   callagent_udp_port := -1,
mgw_ip := mp_test_ip,
mgw_udp_port := 2427
};

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8896edc3f4310a78b584fd4ad017b77bda22afb
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: bsc: f_establish_fully(): Wait for release of old channel

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Unregister old RSL channel number after assignment

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-ttcn3-hacks[master]: RSL_Types: More templates, f_rsl_find_ie() for finding an IE...

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: RSL_Types: More templates, f_rsl_find_ie() for finding an IE in 
a message
..


RSL_Types: More templates, f_rsl_find_ie() for finding an IE in a message

Change-Id: Id7fa7d672c1fde97882fa44959501e8bf7b8dc0b
---
M library/RSL_Types.ttcn
1 file changed, 20 insertions(+), 0 deletions(-)

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



diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index b3d758b..765a91e 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -909,6 +909,15 @@
msg_type := RSL_MT_MODE_MODIFY_NACK
}
 
+   /* 8.4.14: BTS <- BSC */
+   template RSL_Message tr_RSL_RF_CHAN_REL(template RslChannelNr chan_nr) 
:= {
+   msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+   msg_type := RSL_MT_RF_CHAN_REL,
+   ies := {
+   tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr})
+   }
+   }
+
/* 8.4.19 BTS -> BSC */
template RSL_Message ts_RSL_RF_CHAN_REL_ACK(RslChannelNr chan_nr) :=
ts_RSL_MsgDiscType(ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
@@ -1160,5 +1169,16 @@
}
 
 
+   function f_rsl_find_ie(RSL_Message msg, RSL_IE_Type iei, out 
RSL_IE_Body ret) return boolean {
+   for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
+   if (msg.ies[i].iei == iei) {
+   ret := msg.ies[i].body;
+   return true;
+   }
+   }
+   return false;
+   }
+
+
 
 } with { encode "RAW" ; variant "FIELDORDER(msb)" }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id7fa7d672c1fde97882fa44959501e8bf7b8dc0b
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: RSL_Emulation: Permit registration of explicit Channel Number

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: RSL_Emulation: Permit registration of explicit Channel Number
..


RSL_Emulation: Permit registration of explicit Channel Number

During assignment or hand-over, a given TTCN-3 component may be
interested in registering more than one channel number.  Add an explicit
procedure port with associated registration procedure, similar to what
we already do in GSUP, MNCC and others.

Change-Id: Iba37bf9541c779b79e179f995cdfa677633fadeb
---
M bsc/BSC_Tests.ttcn
M library/RSL_Emulation.ttcn
2 files changed, 77 insertions(+), 3 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 29150ce..7e5b675 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1222,6 +1222,7 @@
connect(vc_conn:BSSMAPEM, vc_BSSMAP:PROC);
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:BSSAP, vc_BSSMAP:CLIENT);
connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
vc_conn.start(derefers(fn)(id));
diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index a19e627..cbcff2c 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -31,6 +31,7 @@
 type component RSL_DchanHdlr {
/* port facing up towards dedicated channel handler */
port RSL_DCHAN_PT RSL;
+   port RSLEM_PROC_PT RSL_PROC;
var RslChannelNr g_chan_nr;
 };
 
@@ -46,6 +47,12 @@
 
 type port RSL_DCHAN_PT message {
inout RSLDC_ChanRqd, RSL_Message;
+} with { extension "internal" };
+
+signature RSLEM_register(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr 
hdlr);
+
+type port RSLEM_PROC_PT procedure {
+   inout RSLEM_register;
 } with { extension "internal" };
 
 /***
@@ -163,7 +170,8 @@
 runs on RSL_Emulation_CT return integer {
var integer i;
for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
-   if (not ispresent(ConnectionTable[i].ra)) {
+   if (not ispresent(ConnectionTable[i].ra) and
+   not ispresent(ConnectionTable[i].trx_nr)) {
ConnectionTable[i].ra := ra;
ConnectionTable[i].ra_fn := fn;
ConnectionTable[i].comp_ref := comp_ref;
@@ -174,14 +182,52 @@
return -1;
 }
 
+/* create an ew client with given RA and FN */
+private function f_cid_create_cnr(uint8_t trx_nr, RslChannelNr chan_nr,  
RSL_DchanHdlr comp_ref)
+runs on RSL_Emulation_CT return integer {
+   var integer i;
+   for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
+   if (not ispresent(ConnectionTable[i].ra) and
+   not ispresent(ConnectionTable[i].trx_nr)) {
+   ConnectionTable[i].stream_id := 
f_streamId_by_trx(trx_nr);
+   ConnectionTable[i].trx_nr := trx_nr;
+   ConnectionTable[i].chan_nr := chan_nr;
+   ConnectionTable[i].comp_ref := comp_ref;
+   return i;
+   }
+   }
+   log("No free entry in conn table for ", trx_nr, chan_nr, comp_ref);
+   return -1;
+}
+
+
+/* create an ew client with given RA and FN */
+private function f_cid_delete_cnr(IpaStreamId stream_id, RslChannelNr chan_nr, 
 RSL_DchanHdlr comp_ref)
+runs on RSL_Emulation_CT return integer {
+   var integer i;
+   for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
+   if (ConnectionTable[i].comp_ref == null) {
+   continue;
+   }
+   if (ConnectionTable[i].stream_id == stream_id and
+   ConnectionTable[i].chan_nr == chan_nr and
+   ConnectionTable[i].comp_ref == comp_ref) {
+   f_cid_clear(i);
+   }
+   }
+   log("Unable to find entry to delete for ", stream_id, chan_nr, 
comp_ref);
+   return -1;
+}
+
+
 private function f_cid_clear(integer cid)
 runs on RSL_Emulation_CT {
ConnectionTable[cid].ra := omit;
ConnectionTable[cid].ra_fn := omit;
-   ConnectionTable[cid].ra_fn := omit;
ConnectionTable[cid].trx_nr := omit;
ConnectionTable[cid].stream_id := omit;
ConnectionTable[cid].chan_nr := omit;
+   ConnectionTable[cid].comp_ref := null;
 }
 
 type component RSL_Emulation_CT {
@@ -189,6 +235,7 @@
port IPA_RSL_PT IPA_PT;
/* port facing up towards dedicated channel handler */
port RSL_DCHAN_PT CLIENT_PT;
+   port RSLEM_PROC_PT RSL_PROC;
 
/* state of all concurrent connections / dedicated channels */
var ConnectionData ConnectionTable[64];
@@ -205,12 +252,24 @@
retur

[MERGED] osmo-ttcn3-hacks[master]: bsc: Update TC_chan_rel_conn_fail to subscr_conn_fsm

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Update TC_chan_rel_conn_fail to subscr_conn_fsm
..


bsc: Update TC_chan_rel_conn_fail to subscr_conn_fsm

In OsmoBSC Change-IdI68286d26e2014048b054f39ef29c35fef420cc97 we
introduce a proper subscriber connection state machine which fixes
the order of events during channel release after connection failure.

Change-Id: Ibe9c3205ec11dafcc305ea72aeb33e9152a6458c
---
M bsc/BSC_Tests.ttcn
1 file changed, 5 insertions(+), 5 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 84d0c38..87150db 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -582,11 +582,6 @@
f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, 
RSL_ERR_RADIO_LINK_FAIL));
/* TODO: different cause values? */
 
-   /* expect BSC to disable the channel */
-   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
-   /* respond with CHAN REL ACK */
-   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-
/* expect Clear Request from BSC */
BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, 
tr_BSSMAP_ClearRequest)) -> value rx_di;
 
@@ -594,6 +589,11 @@
var BssmapCause cause := 
bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue);
BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, 
ts_BSSMAP_ClearCommand(cause)));
 
+   /* expect BSC to disable the channel */
+   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
+   /* respond with CHAN REL ACK */
+   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
+
/* expect Clear Complete from BSC */
BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, 
tr_BSSMAP_ClearComplete));
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibe9c3205ec11dafcc305ea72aeb33e9152a6458c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler f...

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler for 
MGCP
..


bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler for MGCP

forward-ported by Harald Welte

Change-Id: I1f316a9ed5859670348ea7aa352604020d6b09f5
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
2 files changed, 39 insertions(+), 3 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 6b5ce24..8766503 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -31,6 +31,7 @@
 import from IPA_Types all;
 import from RSL_Types all;
 import from RSL_Emulation all;
+import from MGCP_Emulation all;
 
 import from Osmocom_CTRL_Functions all;
 import from Osmocom_CTRL_Types all;
@@ -59,6 +60,8 @@
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
 
+   var MGCP_Emulation_CT vc_MGCP;
+
/* are we initialized yet */
var boolean g_initialized := false;
 
@@ -74,6 +77,8 @@
integer mp_bsc_rsl_port := 3003;
/* port number to which to establish the IPA CTRL connection */
integer mp_bsc_ctrl_port := 4249;
+   /* IP address at which the test binds */
+   charstring mp_test_ip := "127.0.0.1";
 }
 
 type record IPA_Client {
@@ -176,6 +181,24 @@
}
 }
 
+function f_init_mgcp(charstring id) runs on test_CT {
+   id := id & "-MGCP";
+
+   var MGCPOps ops := {
+   create_cb := refers(MGCP_Emulation.ExpectedCreateCallback),
+   unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback)
+   };
+   var MGCP_conn_parameters mgcp_pars := {
+   callagent_ip := mp_bsc_ip,
+   callagent_udp_port := 2727,
+   mgw_ip := mp_test_ip,
+   mgw_udp_port := 2427
+   };
+
+   vc_MGCP := MGCP_Emulation_CT.create(id);
+   vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id));
+}
+
 /* 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) */
@@ -195,6 +218,8 @@
f_bssap_init("VirtMSC", omit);
}
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
+
+   f_init_mgcp("VirtMSC");
 
for (i := 0; i < nr_bts; i := i+1) {
/* wait until osmo-bts-omldummy has respawned */
@@ -1197,8 +1222,10 @@
 
vc_conn := MSC_ConnHdlr.create(id);
connect(vc_conn:BSSMAPEM, vc_BSSMAP:PROC);
+   connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC);
connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT);
connect(vc_conn:BSSAP, vc_BSSMAP:CLIENT);
+   connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
vc_conn.start(derefers(fn)(id));
return vc_conn;
 }
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index d1be0ef..3dbb782 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -10,6 +10,7 @@
 
 import from MGCP_Types all;
 import from MGCP_Templates all;
+import from MGCP_Emulation all;
 import from SDP_Types all;
 
 import from RSL_Emulation all;
@@ -24,7 +25,7 @@
 /* this component represents a single subscriber connection at the MSC.
  * There is a 1:1 mapping between SCCP connections and BSSAP_ConnHdlr 
components.
  * We inherit all component variables, ports, functions, ... from 
BSSAP_ConnHdlr */
-type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr {
+type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr, 
MGCP_ConnHdlr {
/* SCCP Connecction Identifier for the underlying SCCP connection */
var integer g_sccp_conn_id;
 
@@ -55,6 +56,10 @@
role_ms := false
 }
 
+const MGCPOps MSC_MGCPOps := {
+   create_cb := refers(MGCP_Emulation.ExpectedCreateCallback)
+}
+
 type enumerated MSC_State {
MSC_STATE_NONE,
MSC_STATE_WAIT_ASS_COMPL,
@@ -65,7 +70,7 @@
 }
 
 /* register an expect with the BSSMAP core */
-private function f_create_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
+private function f_create_bssmap_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
BSSMAPEM.call(BSSMAPEM_register:{l3_enc, self}) {
[] BSSMAPEM.getreply(BSSMAPEM_register:{?, ?}) {};
}
@@ -92,7 +97,7 @@
 
/* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */
RSL_Emulation.f_chan_est(pars.ra, l3_enc, pars.link_id, pars.fn);
-   f_create_exp(l3_enc);
+   f_create_bssmap_exp(l3_enc);
 }
 
 function f_rsl_reply(template PDU_ML3_MS_NW l3, RSL_Message orig) runs on 
MSC_ConnHdlr {
@@ -184,10 +189,14 @@
crcx_seen := true;
repeat;
}
+   /* mgw CRCX goes here */
+
[crcx_seen] RSL.receive(tr_RSL_IPA_MDCX(g_chan_nr, ?)) -> value rsl{
   

[MERGED] osmo-ttcn3-hacks[master]: bsc: Cosmetic: Update commented-out config file options

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Cosmetic: Update commented-out config file options
..


bsc: Cosmetic: Update commented-out config file options

There's no point in listing non-existing module parameters. Instead,
list those that the BSC testsuite actually has

Change-Id: I3cb756750cafba4ca481a0a98d19e27cb58395df
---
M bsc/BSC_Tests.cfg
1 file changed, 9 insertions(+), 11 deletions(-)

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



diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index fcb1055..497489f 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -14,20 +14,18 @@
 #*.*.udpReuseAddress := "yes";
 
 [MODULE_PARAMETERS]
-#mp_bsc_port := 4;
+#mp_bsc_rsl_port := 3003;
+#mp_bsc_ctrl_port := 4249;
 #mp_bsc_ip   := "127.0.0.1";
-#mp_msc_port := 5100;
-#mp_msc_ip   := "127.0.0.1";
-#mp_nat_port := 5000;
-#mp_nat_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;
 
 #mp_ipa_mgcp_uses_osmo_ext := true;
-
-#mp_mgcp_uses_udp := true;
-#mp_callagent_ip := "127.0.0.1";
-#mp_callagent_udp_port := 2727;
-#mp_mgw_ip := "127.0.0.1";
-#mp_mgw_udp_port := 2427;
 
 [MAIN_CONTROLLER]
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3cb756750cafba4ca481a0a98d19e27cb58395df
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: MGCP_Templates: Some more convenience extraction functions

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: MGCP_Templates: Some more convenience extraction functions
..


MGCP_Templates: Some more convenience extraction functions

Change-Id: I2fc121b1d90327c879a096773ecc5c04faad07d7
---
M library/MGCP_Templates.ttcn
1 file changed, 17 insertions(+), 4 deletions(-)

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



diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 7f10bd2..5a8d9b1 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -273,20 +273,33 @@
return "";
}
 
-   function f_MgcpResp_extract_conn_id(MgcpResponse resp) return 
MgcpConnectionId {
+   function f_MgcpResp_extract_par(MgcpResponse resp, MgcpInfoCode code) 
return charstring {
var MgcpMessage msg := {
response := resp
}
-   return str2hex(f_mgcp_extract_par(msg, "I"));
+   return f_mgcp_extract_par(msg, code);
}
 
-   function f_MgcpCmd_extract_call_id(MgcpCommand cmd) return MgcpCallId {
+   function f_MgcpCmd_extract_par(MgcpCommand cmd, MgcpInfoCode code) 
return charstring {
var MgcpMessage msg := {
command := cmd
}
-   return str2hex(f_mgcp_extract_par(msg, "C"));
+   return f_mgcp_extract_par(msg, code);
}
 
+   function f_MgcpResp_extract_conn_id(MgcpResponse resp) return 
MgcpConnectionId {
+   return str2hex(f_MgcpResp_extract_par(resp, "I"));
+   }
+
+   function f_MgcpCmd_extract_call_id(MgcpCommand cmd) return MgcpCallId {
+   return str2hex(f_MgcpCmd_extract_par(cmd, "C"));
+   }
+
+   function f_MgcpCmd_extract_conn_id(MgcpCommand cmd) return 
MgcpConnectionId {
+   return str2hex(f_MgcpCmd_extract_par(cmd, "I"));
+   }
+
+
function f_mgcp_alloc_tid() return MgcpTransId {
return int2str(float2int(rnd()*2147483647.0));
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2fc121b1d90327c879a096773ecc5c04faad07d7
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bsc: Fix TC_chan_act_ack_est_ind_refused()

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Fix TC_chan_act_ack_est_ind_refused()
..


bsc: Fix TC_chan_act_ack_est_ind_refused()

This test case was incomplete in that it didn't account for a RLL REL
REQ/RESP before RF_CHAN_REL.

Together with OsmoBSC Change-Id
I64a46b5bcd4272e3fa2ff4ee824c2f3fdff6854b, this test now passes.

Change-Id: Ia5af254d4fc572c1d324f70b5ec99d87bdaf9eb9
---
M bsc/BSC_Tests.ttcn
1 file changed, 1 insertion(+), 2 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index b65d899..69f072b 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -356,8 +356,7 @@
BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0));
 
/* expect BSC to disable the channel */
-   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
-
+   f_expect_chan_rel(0, chan_nr);
setverdict(pass);
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5af254d4fc572c1d324f70b5ec99d87bdaf9eb9
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: L3_Templates: Add ts_RRM_AssignmentComplete

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Unregister old RSL channel number after assignment

2018-01-29 Thread Harald Welte

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

bsc: Unregister old RSL channel number after assignment

Change-Id: I27d113391094f938ff92c4d6514172ee634f695c
---
M bsc/MSC_ConnectionHandler.ttcn
M library/RSL_Emulation.ttcn
2 files changed, 20 insertions(+), 3 deletions(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 6afeca2..55cdb89 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -426,8 +426,9 @@
}
[st.rr_ass_cmpl_seen] RSL.receive(tr_RSL_RF_CHAN_REL(st.old_chan_nr)) {
RSL.send(ts_RSL_RF_CHAN_REL_ACK(st.old_chan_nr));
-   /* FIXME: unregister for old channel number in RSL emulation */
-   //f_rslem_unregister(0, st.old_chan_nr);
+   /* unregister for old channel number in RSL emulation */
+   /* FIXME: Determine TRX NR by ARFCN, instead of hard-coded 
TRX0! */
+   f_rslem_unregister(0, st.old_chan_nr);
st.assignment_done := true;
repeat;
}
diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index cbcff2c..d20718f 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -50,9 +50,10 @@
 } with { extension "internal" };
 
 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);
 
 type port RSLEM_PROC_PT procedure {
-   inout RSLEM_register;
+   inout RSLEM_register, RSLEM_unregister;
 } with { extension "internal" };
 
 /***
@@ -379,6 +380,13 @@
RSL_PROC.reply(RSLEM_register:{trx_nr, chan_nr, 
vc_conn});
}
 
+   [] RSL_PROC.getcall(RSLEM_unregister:{?,?,?}) -> param(trx_nr, 
chan_nr, vc_conn) {
+   cid := f_cid_by_chan_nr(trx_nr, chan_nr);
+   f_cid_clear(cid);
+   RSL_PROC.reply(RSLEM_unregister:{trx_nr, chan_nr, 
vc_conn});
+   }
+
+
}
}
 }
@@ -400,4 +408,12 @@
}
 }
 
+/* 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:{?,?,?}) {};
+   }
+}
+
+
 }

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

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


[MERGED] osmo-ttcn3-hacks[master]: bsc: Reply to CRCX with ACK

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Reply to CRCX with ACK
..


bsc: Reply to CRCX with ACK

Change-Id: Ieaea431a99241d8844b915e1b46b77c79fff24df
---
M bsc/MSC_ConnectionHandler.ttcn
M library/MGCP_Emulation.ttcn
2 files changed, 6 insertions(+), 0 deletions(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index e1fd35a..f763994 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -154,6 +154,7 @@
 runs on MSC_ConnHdlr return PDU_BSSAP {
var PDU_BSSAP bssap;
var RSL_Message rsl;
+   var MgcpCommand cmd;
timer T := 10.0;
var boolean exp_compl := 
ischosen(exp_ass_cpl.pdu.bssmap.assignmentComplete);
var boolean crcx_seen := false;
@@ -164,6 +165,7 @@
transid := omit
};
 
+   mgcp_conn_id := f_mgcp_alloc_conn_id();
f_create_chan_and_exp(pars);
/* we should now have a COMPL_L3 at the MSC */
 
@@ -171,6 +173,9 @@
f_create_mgcp_expect(mgcpcrit);
BSSAP.send(ass_cmd);
alt {
+   [] MGCP.receive(tr_CRCX) -> value cmd {
+   MGCP.send(ts_CRCX_ACK(cmd.line.trans_id, mgcp_conn_id, cmd.sdp))
+   }
/* if we receive exactly what we expected, always return + pass */
[] BSSAP.receive(exp_ass_cpl) -> value bssap {
setverdict(pass);
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index df8e4b4..074385c 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -38,6 +38,7 @@
port MGCP_Conn_PT MGCP;
/* procedure based port to register for incoming connections */
port MGCPEM_PROC_PT MGCP_PROC;
+   var MgcpConnectionId mgcp_conn_id;
 }
 
 /* port between individual per-connection components and this dispatcher */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieaea431a99241d8844b915e1b46b77c79fff24df
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 


[MERGED] osmo-ttcn3-hacks[master]: bsc: Expect CRCX and send an ACK back

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Expect CRCX and send an ACK back
..


bsc: Expect CRCX and send an ACK back

Change-Id: Ic4fabc2a2cf034a831e446697b3a22f4d1d0c6d6
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 7 insertions(+), 3 deletions(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index f763994..d619068 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -164,6 +164,7 @@
endpoint := omit,
transid := omit
};
+   var SDP_Message sdp;
 
mgcp_conn_id := f_mgcp_alloc_conn_id();
f_create_chan_and_exp(pars);
@@ -172,10 +173,13 @@
BSSAP.receive(tr_BSSMAP_ComplL3);
f_create_mgcp_expect(mgcpcrit);
BSSAP.send(ass_cmd);
+   MGCP.receive(tr_CRCX) -> value cmd;
+   sdp := valueof(ts_SDP("127.0.0.1", "127.0.0.1", "foo", "21", 1000, { 
"98" },
+   {valueof(ts_SDP_rtpmap(98, "AMR/8000")),
+   valueof(ts_SDP_ptime(20)) } ));
+   MGCP.send(ts_CRCX_ACK(cmd.line.trans_id, mgcp_conn_id, sdp))
+
alt {
-   [] MGCP.receive(tr_CRCX) -> value cmd {
-   MGCP.send(ts_CRCX_ACK(cmd.line.trans_id, mgcp_conn_id, cmd.sdp))
-   }
/* if we receive exactly what we expected, always return + pass */
[] BSSAP.receive(exp_ass_cpl) -> value bssap {
setverdict(pass);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic4fabc2a2cf034a831e446697b3a22f4d1d0c6d6
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 


[MERGED] osmo-ttcn3-hacks[master]: bsc: Fix TC_paging_imsi_nochan

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Fix TC_paging_imsi_nochan
..


bsc: Fix TC_paging_imsi_nochan

The point of this test is to verify that *no* paging messages are sent
if "No cell" is given as cell identifier list by the MSC.  We can thus
not use the existing pageing_helper function, but have to handle this
a bit differently.

This makes TC_paging_imsi_nochan runs pass.

Change-Id: Iec1086bd42f42de1986bb00b91af718977f73b30
---
M bsc/BSC_Tests.ttcn
1 file changed, 26 insertions(+), 1 deletion(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 69f072b..29150ce 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -976,7 +976,32 @@
 testcase TC_paging_imsi_nochan() runs on test_CT {
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
-   f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all);
+   var integer i;
+
+   f_init();
+   f_bssap_reset();
+
+   /* Clear the queue, it might still contain stuff like BCCH FILLING */
+   for (i := 0; i < NUM_BTS; i := i + 1) {
+   IPA_RSL[i].clear;
+   }
+
+   f_bssap_tx_ud(ts_BSSMAP_Paging('001010123456789'H, cid_list, omit, 
omit));
+
+   /* wait for some time until when paging messages would appear */
+   f_sleep(3.0);
+
+   for (i := 0; i < NUM_BTS; i := i + 1) {
+   timer T := 0.01;
+   T.start;
+   alt {
+   [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, 
tr_RSL_PAGING_CMD(?))) {
+   setverdict(fail, "Received unexpected paging");
+   }
+   [] T.timeout {}
+   }
+   }
+   setverdict(pass);
 }
 
 /* PAGING by IMSI + TMSI */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iec1086bd42f42de1986bb00b91af718977f73b30
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bsc: Update TC_exhaustion to recent osmo-bsc

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Update TC_exhaustion to recent osmo-bsc
..


bsc: Update TC_exhaustion to recent osmo-bsc

When Change-Id I10fc9f60c58c6b7ed424a86ce23bf6b9802c9eb1 was merged,
OsmoBSC started to always allocate SDCCH first, no matter what the
establishment cause.  This basically means we don't do very early
assignment anymore.  TC_exhaustion must be adapted to allocate all
SDCCH and all TCH before failing.

Change-Id: I9d8bbfca0deebc738385f2a1a20d4a17c3853082
---
M bsc/BSC_Tests.ttcn
1 file changed, 5 insertions(+), 3 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index dacb630..84d0c38 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -46,6 +46,7 @@
 
 /* make sure to sync this with the osmo-bts.cfg you're using */
 const integer NUM_TCHF_PER_BTS := 5;
+const integer NUM_SDCCH_PER_BTS := 4;
 
 
 /* per-BTS state which we keep */
@@ -386,13 +387,14 @@
chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:no_channel");
 
/* expect 5xTCH/F to succeed */
-   for (i := 0; i < NUM_TCHF_PER_BTS; i := i+1) {
+   for (i := 0; i < NUM_TCHF_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) {
f_chreq_act_ack('23'O, i);
}
 
IPA_RSL[0].clear;
 
-   f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", 
chreq_total+NUM_TCHF_PER_BTS);
+   f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total",
+  
chreq_total+NUM_TCHF_PER_BTS+NUM_SDCCH_PER_BTS);
 
/* now expect additional channel activations to fail */
f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42));
@@ -408,7 +410,7 @@
rr := 
dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload);
if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) {
f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:total",
-  
chreq_total+NUM_TCHF_PER_BTS+1);
+  
chreq_total+NUM_TCHF_PER_BTS+NUM_SDCCH_PER_BTS+1);
f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:no_channel",
   chreq_nochan+1);
setverdict(pass);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9d8bbfca0deebc738385f2a1a20d4a17c3853082
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: GSM_Types: Enable sub-slot templating in t_RslChanNr_Lm

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: GSM_Types: Enable sub-slot templating in t_RslChanNr_Lm
..


GSM_Types: Enable sub-slot templating in t_RslChanNr_Lm

Change-Id: I22dca2338ad66c81add5d161bd2a3b3e8e15bdcf
---
M library/GSM_Types.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index 1efeac8..e1d6b48 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -93,7 +93,7 @@
template RslChannelNr t_RslChanNr_PCH_AGCH(template uint3_t tn) := 
t_RslChanNr0(tn, RSL_CHAN_NR_PCH_AGCH);
template RslChannelNr t_RslChanNr_Bm(template uint3_t tn) := 
t_RslChanNr0(tn, RSL_CHAN_NR_Bm_ACCH);
template RslChannelNr t_RslChanNr_PDCH(template uint3_t tn) := 
t_RslChanNr0(tn, RSL_CHAN_NR_OSMO_PDCH);
-   template RslChannelNr t_RslChanNr_Lm(template uint3_t tn, uint1_t 
sub_slot) := {
+   template RslChannelNr t_RslChanNr_Lm(template uint3_t tn, template 
uint1_t sub_slot) := {
u := { lm := { tag := '0001'B, sub_chan := sub_slot } },
tn := tn
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I22dca2338ad66c81add5d161bd2a3b3e8e15bdcf
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: L3_Templates: Add ts_RRM_AssignmentComplete

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: L3_Templates: Add ts_RRM_AssignmentComplete
..


L3_Templates: Add ts_RRM_AssignmentComplete

Change-Id: I3ae33ea00496eaef5885a58cd5fbc491abe68c87
---
M library/L3_Templates.ttcn
1 file changed, 16 insertions(+), 0 deletions(-)

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



diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 7736ff5..ed477d5 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -251,6 +251,22 @@
}
 }
 
+template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
+   discriminator := ''B, /* overwritten */
+   tiOrSkip := {
+   skipIndicator := ''B
+   },
+   msgs := {
+   rrm := {
+   assignmentComplete := {
+   messageType := '00101001'B,
+   rR_Cause := {
+   valuePart := cause
+   }
+   }
+   }
+   }
+}
 
 template PDU_ML3_MS_NW ts_ML3_MO := {
discriminator := ''B,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ae33ea00496eaef5885a58cd5fbc491abe68c87
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: bsc: Fix TC_chan_act_ack_est_ind_noreply()

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: bsc: Fix TC_chan_act_ack_est_ind_noreply()
..


bsc: Fix TC_chan_act_ack_est_ind_noreply()

This test case was incomplete in that it
* applied the wrong timeout T3101 instead of T3210
* didn't account for a RLL REL REQ/RESP before RF_CHAN_REL

Let's fix it. Together with OsmoBSC Change-Id
Ie11d7d06353ba1b1e2fab6763dd7b032ce8a5d2c this check now actually
passes for the first time.

Change-Id: I9ed41d246cf153735fd4e71cc6cc174ede32a76b
---
M bsc/BSC_Tests.ttcn
1 file changed, 12 insertions(+), 1 deletion(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index c7b5a8f..b65d899 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -308,7 +308,10 @@
 
 /* Test behavior if MSC never answers to CR */
 testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT {
+   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
+   var IpaStreamId sid := IPAC_PROTO_RSL_TRX0;
var RSL_Message rx_rsl;
+   var ASP_RSL_Unitdata rx_rsl_ud;
 
f_init(1);
f_bssap_reset();
@@ -322,7 +325,15 @@
BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3)));
 
/* expect BSC to disable the channel again if there's no response from 
MSC */
-   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
+   /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s 
(T3220) AT detach */
+   IPA_RSL[0].clear;
+   alt {
+   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, 
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) -> value rx_rsl_ud { }
+   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_REL_REQ(chan_nr, ?))) 
-> value rx_rsl_ud {
+   f_ipa_tx(0, ts_RSL_REL_CONF(chan_nr, main_dcch));
+   repeat;
+   }
+   }
 
setverdict(pass);
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9ed41d246cf153735fd4e71cc6cc174ede32a76b
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: RSL_Types: Make tr_RSL_MsgTypeDR match non-transparent RLL

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: RSL_Types: Make tr_RSL_MsgTypeDR match non-transparent RLL
..


RSL_Types: Make tr_RSL_MsgTypeDR match non-transparent RLL

There are quite a number of non-transparent RLL messages, such as
RLL_RELEASE_REQ.  Make sure we match those as intended.

Change-Id: I30260a57fc01613450e6ac66e0af97c29041b4fa
---
M library/RSL_Types.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index f42b7fd..b3d758b 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -711,7 +711,7 @@
 
 /* dedicated channel or RLL */
 template RSL_Message tr_RSL_MsgTypeDR(template RSL_MessageType msg_type) 
modifies tr_RSL_MsgType := {
-   msg_disc := ({RSL_MDISC_DCHAN,?}, {RSL_MDISC_RLL,true}, 
{RSL_MDISC_IPACCESS,false})
+   msg_disc := ({RSL_MDISC_DCHAN,?}, {RSL_MDISC_RLL,?}, 
{RSL_MDISC_IPACCESS,false})
 }
 
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I30260a57fc01613450e6ac66e0af97c29041b4fa
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: bsc: Permit MGCP messages from random ports on BSC side

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: RSL_Emulation: Permit registration of explicit Channel Number

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: RSL_Types: More templates, f_rsl_find_ie() for finding an IE...

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: GSM_Types: Enable sub-slot templating in t_RslChanNr_Lm

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: RSL_Types: Make tr_RSL_MsgTypeDR match non-transparent RLL

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: MGCP_Templates: Some more convenience extraction functions

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Fix TC_paging_imsi_nochan

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Fix TC_chan_act_ack_est_ind_refused()

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Fix TC_chan_act_ack_est_ind_noreply()

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Cosmetic: Update commented-out config file options

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: reduce code duplication by introducing f_expect_chan_rel()

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Update TC_chan_rel_conn_fail to subscr_conn_fsm

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Don't test CTRL commands for old NITB parameters

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Update TC_exhaustion to recent osmo-bsc

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler f...

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Expect CRCX and send an ACK back

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: BSC_Tests: Add MGCP_Emulation to gen_links

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Reply to CRCX with ACK

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: bsc: Register expect criteria for MGCP CRCX

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-ttcn3-hacks[master]: start-testsuite.sh: Add archlinux tccn3 path to LD_LIBRARY_PATH

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: start-testsuite.sh: Add archlinux tccn3 path to LD_LIBRARY_PATH
..


start-testsuite.sh: Add archlinux tccn3 path to LD_LIBRARY_PATH

Archlinux installs ttcn33 libaries in /usr/ttcn3/lib (titan-git package from 
AUR).

Change-Id: I99219f4ab36c82e562ef3fed047d3c52d64497f1
---
M start-testsuite.sh
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/start-testsuite.sh b/start-testsuite.sh
index 87cf08b..a291a4f 100755
--- a/start-testsuite.sh
+++ b/start-testsuite.sh
@@ -15,4 +15,4 @@
CFG=$2
 fi
 
-LD_LIBRARY_PATH=`dirname $SUITE`:/usr/lib/titan ttcn3_start $SUITE $CFG
+LD_LIBRARY_PATH=`dirname $SUITE`:/usr/lib/titan:/usr/ttcn3/lib ttcn3_start 
$SUITE $CFG

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I99219f4ab36c82e562ef3fed047d3c52d64497f1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: ggsn_tests: Validate DNS PCO values

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: ggsn_tests: Validate DNS PCO values
..


ggsn_tests: Validate DNS PCO values

Change-Id: I54124cb5269c0992e6c72af1a1ecaa8e3202bf05
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
2 files changed, 34 insertions(+), 2 deletions(-)

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



diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index 90368b9..d8994df 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -18,6 +18,8 @@
 GGSN_Tests.m_ggsn_ip_gtpu := "127.0.0.2"
 GGSN_Tests.m_ggsn_ip4_dns1 := "192.168.100.1"
 GGSN_Tests.m_ggsn_ip4_dns2 := "8.8.8.8"
+GGSN_Tests.m_ggsn_ip6_dns1 := "2001:4860:4860::"
+GGSN_Tests.m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
 
 [EXECUTE]
 #GGSN_Tests.TC_dummy
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 06d9dcf..f7814db 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -26,6 +26,8 @@
 
charstring m_ggsn_ip4_dns1 := "192.168.100.1"
charstring m_ggsn_ip4_dns2 := "8.8.8.8"
+   charstring m_ggsn_ip6_dns1 := "2001:4860:4860::"
+   charstring m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
}
 
type set PdpContext {
@@ -426,11 +428,15 @@
}
 
/* extract a given protocol payload from PCO */
-   function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol) 
return octetstring {
+   function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, 
integer nth_match := 1) return octetstring {
var integer i;
+   var integer num_matches := 0;
for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
if (pco.protocols[i].protocolID == protocol) {
-   return pco.protocols[i].protoIDContents;
+   num_matches := num_matches + 1;
+   if (num_matches == nth_match) {
+   return pco.protocols[i].protoIDContents;
+   }
}
}
setverdict(fail);
@@ -925,6 +931,18 @@
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), 
'1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
f_pdp_ctx_act(ctx);
+
+   /* verify PCO contains both primary and secondary DNS */
+   var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), 
ggsn_ip6_dns1)) {
+   setverdict(fail, "Primary DNS IPv6 PCO option 
not found");
+   }
+
+   var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), 
ggsn_ip6_dns2)) {
+   setverdict(fail, "Secondary DNS IPv6 PCO option 
not found");
+   }
+
f_pdp_ctx_del(ctx, '1'B);
}
 
@@ -984,6 +1002,18 @@
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), 
'1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
f_pdp_ctx_act(ctx);
+
+   /* verify PCO contains both primary and secondary DNS */
+   var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), 
ggsn_ip4_dns1)) {
+   setverdict(fail, "Primary DNS IPv4 PCO option 
not found");
+   }
+
+   var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), 
ggsn_ip4_dns2)) {
+   setverdict(fail, "Secondary DNS IPv4 PCO option 
not found");
+   }
+
f_pdp_ctx_del(ctx, '1'B);
}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I54124cb5269c0992e6c72af1a1ecaa8e3202bf05
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: ggsn_tests: Configure expected GGSN DNS values and improve e...

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: ggsn_tests: Configure expected GGSN DNS values and improve 
error message
..


ggsn_tests: Configure expected GGSN DNS values and improve error message

Change-Id: Ie64ca0b4cda22fd358c8c304d5b3909fd9685948
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
2 files changed, 15 insertions(+), 4 deletions(-)

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



diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index e97578c..90368b9 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -14,8 +14,10 @@
 [MODULE_PARAMETERS]
 GGSN_Tests.m_bind_ip_gtpc := "127.0.42.1"
 GGSN_Tests.m_bind_ip_gtpu := "127.0.42.1"
-GGSN_Tests.m_ggsn_ip_gtpc := "127.0.23.1"
-GGSN_Tests.m_ggsn_ip_gtpu := "127.0.23.1"
+GGSN_Tests.m_ggsn_ip_gtpc := "127.0.0.2"
+GGSN_Tests.m_ggsn_ip_gtpu := "127.0.0.2"
+GGSN_Tests.m_ggsn_ip4_dns1 := "192.168.100.1"
+GGSN_Tests.m_ggsn_ip4_dns2 := "8.8.8.8"
 
 [EXECUTE]
 #GGSN_Tests.TC_dummy
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 23e7054..06d9dcf 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -23,6 +23,9 @@
 
charstring m_ggsn_ip_gtpc := "127.0.0.6";
charstring m_ggsn_ip_gtpu := "127.0.0.6";
+
+   charstring m_ggsn_ip4_dns1 := "192.168.100.1"
+   charstring m_ggsn_ip4_dns2 := "8.8.8.8"
}
 
type set PdpContext {
@@ -954,6 +957,8 @@
/* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in 
IPCP */
testcase TC_pdp4_act_deact_ipcp() runs on GT_CT {
f_init();
+   var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
+   var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), 
'1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP);
f_pdp_ctx_act(ctx);
@@ -963,8 +968,12 @@
}
/* verify IPCP contains both primary and secondary DNS */
var IpcpPacket ipcp := 
dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O));
-   if (not match(ipcp, tr_IPCP_Ack_DNS(0, 'C0A86401'O, 
'08080808'O))) {
-   setverdict(fail, "Primary/Secondary DNS not found in 
IPCP");
+   if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, 
ggsn_ip4_dns2))) {
+   if (not match(ipcp, tr_IPCP_Ack_DNS(0))) {
+   setverdict(fail, "Primary/Secondary DNS PCO 
IPCP option not found");
+   } else {
+   setverdict(fail, "Primary/Secondary DNS PCO 
IPCP option found but not matching expected values");
+   }
}
f_pdp_ctx_del(ctx, '1'B);
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie64ca0b4cda22fd358c8c304d5b3909fd9685948
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: gitignore: Ignore dependency subdirs

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: gitignore: Ignore dependency subdirs
..


gitignore: Ignore dependency subdirs

Change-Id: I843da5c51d68102b992ce178404d8601c520229f
---
M .gitignore
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/.gitignore b/.gitignore
index d525ada..d8c3ab3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 bin/*.cc
 bin/*.hh
+deps/*/
 *.o
 *.log
 *.so

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I843da5c51d68102b992ce178404d8601c520229f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: library: Implement f_inet6_addr function

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: library: Implement f_inet6_addr function
..


library: Implement f_inet6_addr function

It can be used to parse IPv6 functions, since inet_addr supports IPv4
only.

Change-Id: Icb6dd38462501895d1b4409a3c530793917bd803
---
M library/Native_FunctionDefs.cc
M library/Native_Functions.ttcn
2 files changed, 18 insertions(+), 0 deletions(-)

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



diff --git a/library/Native_FunctionDefs.cc b/library/Native_FunctionDefs.cc
index 5dda08c..8aa31b4 100644
--- a/library/Native_FunctionDefs.cc
+++ b/library/Native_FunctionDefs.cc
@@ -7,12 +7,28 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
 
 namespace Native__Functions {
 
+OCTETSTRING f__inet6__addr(const CHARSTRING& in)
+{
+   char buf[INET6_ADDRSTRLEN];
+   TTCN_Buffer ttcn_buffer(in);
+   int ret;
+
+   ret = inet_pton(AF_INET6, (const char *)ttcn_buffer.get_data(), buf);
+   if(ret < 1)
+   fprintf(stderr, "inet_pton failed: %d %s\n", ret, 
strerror(errno));
+
+   return OCTETSTRING(16, (const unsigned char *)&buf[0]);
+}
+
 OCTETSTRING f__inet__addr(const CHARSTRING& in)
 {
TTCN_Buffer ttcn_buffer(in);
diff --git a/library/Native_Functions.ttcn b/library/Native_Functions.ttcn
index 31bc767..d59670a 100644
--- a/library/Native_Functions.ttcn
+++ b/library/Native_Functions.ttcn
@@ -1,5 +1,7 @@
 module Native_Functions {
 
+   /* direct import of inet_pton(AF_INET6) C function, returns net byte 
order */
+   external function f_inet6_addr(in charstring ch) return octetstring;
/* direct import of inet_addr() C function, returns net byte order */
external function f_inet_addr(in charstring ch) return octetstring;
/* like inet_addr() but return is host byte order */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icb6dd38462501895d1b4409a3c530793917bd803
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: regen-makefile.sh: Support Archlinux install paths

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: regen-makefile.sh: Support Archlinux install paths
..


regen-makefile.sh: Support Archlinux install paths

Archlinux (titan-git AUR package) installs everything (includes, libs
and bin) into /usr/ttcn/ prefix.

Change-Id: I545f2f04890310e98233b04b44c4614df34f2f17
---
M regen-makefile.sh
1 file changed, 5 insertions(+), 1 deletion(-)

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



diff --git a/regen-makefile.sh b/regen-makefile.sh
index f757fa3..e89b3ee 100755
--- a/regen-makefile.sh
+++ b/regen-makefile.sh
@@ -20,5 +20,9 @@
 sed -i -e 's/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = 
-D$(PLATFORM) -DMAKEDEPEND_RUN -I$(TTCN3_DIR)\/include 
-I\/usr\/include\/titan/' Makefile
 
 # for TITAN 6.3.0
-sed -i -e 's/TTCN3_DIR = $/TTCN3_DIR = \/usr/' Makefile
+if cat /etc/issue | grep "Arch Linux" >/dev/null 2>&1; then
+sed -i -e 's/TTCN3_DIR = $/TTCN3_DIR = \/usr\/ttcn3/' Makefile
+else
+sed -i -e 's/TTCN3_DIR = $/TTCN3_DIR = \/usr/' Makefile
+fi
 sed -i -e 's/\/bin\/compiler/\/bin\/ttcn3_compiler/' Makefile

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I545f2f04890310e98233b04b44c4614df34f2f17
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: regen-makefile.sh: Exit with clear error if ttcn3 bin not found

2018-01-29 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: regen-makefile.sh: Exit with clear error if ttcn3 bin not found
..


regen-makefile.sh: Exit with clear error if ttcn3 bin not found

Change-Id: I866a758ec472968f368866e3b3b24dc6f14ac7cb
---
M regen-makefile.sh
1 file changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/regen-makefile.sh b/regen-makefile.sh
index e89b3ee..7edd783 100755
--- a/regen-makefile.sh
+++ b/regen-makefile.sh
@@ -10,6 +10,8 @@
 # unstable, so far tested with TITAN 6.1.0, 6.2.0 and 6.3.0
 #
 
+test -x "$(which ttcn3_makefilegen 2>/dev/null)" || { echo "ERROR: 
ttcn3_makefilegen not in PATH"; exit 1; }
+
 ttcn3_makefilegen -l -f $*
 sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
 sed -i -e 's/LDFLAGS = /LDFLAGS = -L \/usr\/lib\/titan /' Makefile

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I866a758ec472968f368866e3b3b24dc6f14ac7cb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: library: Implement f_inet6_addr function

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: ggsn_tests: Configure expected GGSN DNS values and improve e...

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: regen-makefile.sh: Exit with clear error if ttcn3 bin not found

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: gitignore: Ignore dependency subdirs

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: regen-makefile.sh: Support Archlinux install paths

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: start-testsuite.sh: Add archlinux tccn3 path to LD_LIBRARY_PATH

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: ggsn_tests: Validate DNS PCO values

2018-01-29 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[PATCH] osmo-ttcn3-hacks[master]: MGCP_Emulation: Remove bogus mgcp_conn_id variable from MGCP...

2018-01-29 Thread Harald Welte

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

MGCP_Emulation: Remove bogus mgcp_conn_id variable from MGCP_ConnHdlr

A given MGCP_ConnHdlr is handling multiple connections on one Endpoint
anyway, and the variable is not set or used anywhere.

Change-Id: If9eea3f665289a52915f114f0a69234aad28f322
---
M library/MGCP_Emulation.ttcn
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index 074385c..df8e4b4 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -38,7 +38,6 @@
port MGCP_Conn_PT MGCP;
/* procedure based port to register for incoming connections */
port MGCPEM_PROC_PT MGCP_PROC;
-   var MgcpConnectionId mgcp_conn_id;
 }
 
 /* port between individual per-connection components and this dispatcher */

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

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


[PATCH] osmo-ttcn3-hacks[master]: BSC_Tests: Add MGCP_Emulation to gen_links

2018-01-29 Thread Harald Welte

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

BSC_Tests: Add MGCP_Emulation to gen_links

Change-Id: Iac24d8d3baf7e4ca6bdab6b0be7b55096e490d01
---
M bsc/gen_links.sh
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index 01655c0..af747b3 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -76,5 +76,5 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn 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_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 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

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Expect CRCX and send an ACK back

2018-01-29 Thread Harald Welte

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

bsc: Expect CRCX and send an ACK back

Change-Id: Ic4fabc2a2cf034a831e446697b3a22f4d1d0c6d6
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 7 insertions(+), 3 deletions(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index f763994..d619068 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -164,6 +164,7 @@
endpoint := omit,
transid := omit
};
+   var SDP_Message sdp;
 
mgcp_conn_id := f_mgcp_alloc_conn_id();
f_create_chan_and_exp(pars);
@@ -172,10 +173,13 @@
BSSAP.receive(tr_BSSMAP_ComplL3);
f_create_mgcp_expect(mgcpcrit);
BSSAP.send(ass_cmd);
+   MGCP.receive(tr_CRCX) -> value cmd;
+   sdp := valueof(ts_SDP("127.0.0.1", "127.0.0.1", "foo", "21", 1000, { 
"98" },
+   {valueof(ts_SDP_rtpmap(98, "AMR/8000")),
+   valueof(ts_SDP_ptime(20)) } ));
+   MGCP.send(ts_CRCX_ACK(cmd.line.trans_id, mgcp_conn_id, sdp))
+
alt {
-   [] MGCP.receive(tr_CRCX) -> value cmd {
-   MGCP.send(ts_CRCX_ACK(cmd.line.trans_id, mgcp_conn_id, cmd.sdp))
-   }
/* if we receive exactly what we expected, always return + pass */
[] BSSAP.receive(exp_ass_cpl) -> value bssap {
setverdict(pass);

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

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


[PATCH] osmo-ttcn3-hacks[master]: RSL_Emulation: Permit registration of explicit Channel Number

2018-01-29 Thread Harald Welte

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

RSL_Emulation: Permit registration of explicit Channel Number

During assignment or hand-over, a given TTCN-3 component may be
interested in registering more than one channel number.  Add an explicit
procedure port with associated registration procedure, similar to what
we already do in GSUP, MNCC and others.

Change-Id: Iba37bf9541c779b79e179f995cdfa677633fadeb
---
M bsc/BSC_Tests.ttcn
M library/RSL_Emulation.ttcn
2 files changed, 77 insertions(+), 3 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 29150ce..7e5b675 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1222,6 +1222,7 @@
connect(vc_conn:BSSMAPEM, vc_BSSMAP:PROC);
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:BSSAP, vc_BSSMAP:CLIENT);
connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
vc_conn.start(derefers(fn)(id));
diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index a19e627..cbcff2c 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -31,6 +31,7 @@
 type component RSL_DchanHdlr {
/* port facing up towards dedicated channel handler */
port RSL_DCHAN_PT RSL;
+   port RSLEM_PROC_PT RSL_PROC;
var RslChannelNr g_chan_nr;
 };
 
@@ -46,6 +47,12 @@
 
 type port RSL_DCHAN_PT message {
inout RSLDC_ChanRqd, RSL_Message;
+} with { extension "internal" };
+
+signature RSLEM_register(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr 
hdlr);
+
+type port RSLEM_PROC_PT procedure {
+   inout RSLEM_register;
 } with { extension "internal" };
 
 /***
@@ -163,7 +170,8 @@
 runs on RSL_Emulation_CT return integer {
var integer i;
for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
-   if (not ispresent(ConnectionTable[i].ra)) {
+   if (not ispresent(ConnectionTable[i].ra) and
+   not ispresent(ConnectionTable[i].trx_nr)) {
ConnectionTable[i].ra := ra;
ConnectionTable[i].ra_fn := fn;
ConnectionTable[i].comp_ref := comp_ref;
@@ -174,14 +182,52 @@
return -1;
 }
 
+/* create an ew client with given RA and FN */
+private function f_cid_create_cnr(uint8_t trx_nr, RslChannelNr chan_nr,  
RSL_DchanHdlr comp_ref)
+runs on RSL_Emulation_CT return integer {
+   var integer i;
+   for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
+   if (not ispresent(ConnectionTable[i].ra) and
+   not ispresent(ConnectionTable[i].trx_nr)) {
+   ConnectionTable[i].stream_id := 
f_streamId_by_trx(trx_nr);
+   ConnectionTable[i].trx_nr := trx_nr;
+   ConnectionTable[i].chan_nr := chan_nr;
+   ConnectionTable[i].comp_ref := comp_ref;
+   return i;
+   }
+   }
+   log("No free entry in conn table for ", trx_nr, chan_nr, comp_ref);
+   return -1;
+}
+
+
+/* create an ew client with given RA and FN */
+private function f_cid_delete_cnr(IpaStreamId stream_id, RslChannelNr chan_nr, 
 RSL_DchanHdlr comp_ref)
+runs on RSL_Emulation_CT return integer {
+   var integer i;
+   for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
+   if (ConnectionTable[i].comp_ref == null) {
+   continue;
+   }
+   if (ConnectionTable[i].stream_id == stream_id and
+   ConnectionTable[i].chan_nr == chan_nr and
+   ConnectionTable[i].comp_ref == comp_ref) {
+   f_cid_clear(i);
+   }
+   }
+   log("Unable to find entry to delete for ", stream_id, chan_nr, 
comp_ref);
+   return -1;
+}
+
+
 private function f_cid_clear(integer cid)
 runs on RSL_Emulation_CT {
ConnectionTable[cid].ra := omit;
ConnectionTable[cid].ra_fn := omit;
-   ConnectionTable[cid].ra_fn := omit;
ConnectionTable[cid].trx_nr := omit;
ConnectionTable[cid].stream_id := omit;
ConnectionTable[cid].chan_nr := omit;
+   ConnectionTable[cid].comp_ref := null;
 }
 
 type component RSL_Emulation_CT {
@@ -189,6 +235,7 @@
port IPA_RSL_PT IPA_PT;
/* port facing up towards dedicated channel handler */
port RSL_DCHAN_PT CLIENT_PT;
+   port RSLEM_PROC_PT RSL_PROC;
 
/* state of all concurrent connections / dedicated channels */
var ConnectionData ConnectionTable[64];
@@ -205,12 +252,24 @@
return enum2int(id);
 }
 
+private function f_streamId_by_trx(uint8_t trx_nr) return IpaStreamId {
+   select (trx_nr) {
+   case (0) { return IPAC_PROTO_RSL_TRX0

[PATCH] osmo-ttcn3-hacks[master]: bsc: Don't test CTRL commands for old NITB parameters

2018-01-29 Thread Harald Welte

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

bsc: Don't test CTRL commands for old NITB parameters

Change-Id: Ib6c6b24842d7ceb12a93200bd6208a6b392544b5
---
M bsc/BSC_Tests.ttcn
1 file changed, 0 insertions(+), 2 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 8766503..dacb630 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -872,8 +872,6 @@
 
f_ctrl_get_exp(IPA_CTRL, "mcc", "1");
f_ctrl_get_exp(IPA_CTRL, "mnc", "1");
-   f_ctrl_get_exp(IPA_CTRL, "short-name", "OsmoBSC");
-   f_ctrl_get_exp(IPA_CTRL, "long-name", "OsmoBSC");
f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "3");
 
var integer bts_nr := 0;

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Fix TC_chan_act_ack_est_ind_noreply()

2018-01-29 Thread Harald Welte

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

bsc: Fix TC_chan_act_ack_est_ind_noreply()

This test case was incomplete in that it
* applied the wrong timeout T3101 instead of T3210
* didn't account for a RLL REL REQ/RESP before RF_CHAN_REL

Let's fix it. Together with OsmoBSC Change-Id
Ie11d7d06353ba1b1e2fab6763dd7b032ce8a5d2c this check now actually
passes for the first time.

Change-Id: I9ed41d246cf153735fd4e71cc6cc174ede32a76b
---
M bsc/BSC_Tests.ttcn
1 file changed, 12 insertions(+), 1 deletion(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index c7b5a8f..b65d899 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -308,7 +308,10 @@
 
 /* Test behavior if MSC never answers to CR */
 testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT {
+   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
+   var IpaStreamId sid := IPAC_PROTO_RSL_TRX0;
var RSL_Message rx_rsl;
+   var ASP_RSL_Unitdata rx_rsl_ud;
 
f_init(1);
f_bssap_reset();
@@ -322,7 +325,15 @@
BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3)));
 
/* expect BSC to disable the channel again if there's no response from 
MSC */
-   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
+   /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s 
(T3220) AT detach */
+   IPA_RSL[0].clear;
+   alt {
+   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, 
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) -> value rx_rsl_ud { }
+   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_REL_REQ(chan_nr, ?))) 
-> value rx_rsl_ud {
+   f_ipa_tx(0, ts_RSL_REL_CONF(chan_nr, main_dcch));
+   repeat;
+   }
+   }
 
setverdict(pass);
 }

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Implement Assignment handling

2018-01-29 Thread Harald Welte

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

bsc: Implement Assignment handling

This adds code for the rather intricated and nested transactions
happening on RSL, BSSAP, MGCP and RSL-IPA.  We use explicit
invocation of altsteps to simplify the main function f_establish_fully.

Change-Id: I5f830b010ea1b466ae74fa810df86638a74a3b8b
---
M bsc/MSC_ConnectionHandler.ttcn
M bsc/gen_links.sh
M bsc/regen_makefile.sh
3 files changed, 379 insertions(+), 61 deletions(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index d619068..80bc1fb 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -8,6 +8,9 @@
 import from BSSMAP_Emulation all;
 import from BSSMAP_Templates all;
 
+import from IPL4asp_Types all;
+import from Native_Functions all;
+
 import from MGCP_Types all;
 import from MGCP_Templates all;
 import from MGCP_Emulation all;
@@ -18,8 +21,197 @@
 
 import from MobileL3_Types all;
 import from MobileL3_CommonIE_Types all;
-//import from MobileL3_RRM_Types all;
+import from MobileL3_RRM_Types all;
 import from L3_Templates all;
+
+
+/***
+ * Media related handling
+ ***/
+
+/* Tuple containing host/ip and port */
+type record HostPort {
+   HostNamehost,
+   PortNumber  port_nr
+};
+
+/* State encapsulating one MGCP Connection */
+type record MgcpConnState {
+   boolean crcx_seen,
+   MgcpConnectionId conn_id,
+   charstring mime_type,   /* e.g. AMR */
+   integer sample_rate,/* 8000 */
+   integer ptime,  /* 20 */
+   uint7_t rtp_pt, /* RTP Payload Type */
+   HostPort mgw,   /* MGW side */
+   HostPort peer   /* CA side */
+};
+
+/* BTS media state */
+type record BtsMediaState {
+   boolean ipa_crcx_seen,
+   uint16_t conn_id,
+   uint7_t rtp_pt,
+   HostPort bts,
+   HostPort peer
+};
+
+type record MediaState {
+   MgcpEndpointmgcp_ep,
+   MgcpConnState   mgcp_conn[2],
+   BtsMediaState   bts
+};
+
+function f_MediaState_init(inout MediaState g_media, integer nr, HostName bts, 
HostName mgw) {
+   /* BTS Side */
+   g_media.bts := {
+   ipa_crcx_seen := false,
+   conn_id := nr,
+   rtp_pt := 0,
+   bts := {
+   host := bts,
+   port_nr := 9000 + nr*2
+   },
+   peer := -
+   }
+
+   //g_media.mgcp_ep := int2str(i) & "@mgw";
+
+   for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
+   g_media.mgcp_conn[i].mime_type := "AMR";
+   g_media.mgcp_conn[i].sample_rate := 8000;
+   g_media.mgcp_conn[i].ptime := 20;
+   g_media.mgcp_conn[i].rtp_pt := 98;
+   g_media.mgcp_conn[i].crcx_seen := false;
+   g_media.mgcp_conn[i].conn_id := f_mgcp_alloc_conn_id();
+   }
+
+   g_media.mgcp_conn[0].mgw := {
+   host := mgw,
+   port_nr := 1 + nr*2
+   }
+   g_media.mgcp_conn[1].mgw := {
+   host := mgw,
+   port_nr := 11000 + nr*2
+   }
+}
+
+private function f_get_free_mgcp_conn() runs on MSC_ConnHdlr return integer {
+   for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
+   if (not g_media.mgcp_conn[i].crcx_seen) {
+   return i;
+   }
+   }
+   setverdict(fail, "Only 2 Connections per EP!");
+   self.stop;
+   return -1;
+}
+
+private function f_get_mgcp_conn(MgcpConnectionId cid) runs on MSC_ConnHdlr 
return integer {
+   for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
+   if (g_media.mgcp_conn[i].conn_id == cid and 
g_media.mgcp_conn[i].crcx_seen) {
+   return i;
+   }
+   }
+   setverdict(fail, "No Connection for ID ", cid);
+   self.stop;
+   return -1;
+}
+
+
+/* altstep for handling of IPA + MGCP media related commands. Can be activated 
by a given
+ * test case if it expects to see media related handling (i.e. voice calls */
+altstep as_Media() runs on MSC_ConnHdlr {
+   var RSL_Message rsl;
+   var MgcpCommand mgcp_cmd;
+   var RSL_IE_Body ie;
+   [not g_media.bts.ipa_crcx_seen] RSL.receive(tr_RSL_IPA_CRCX(g_chan_nr)) 
-> value rsl {
+   /* Extract parameters from request + use in response */
+   if (f_rsl_find_ie(rsl, RSL_IE_IPAC_RTP_PAYLOAD, ie)) {
+   g_media.bts.rtp_pt := ie.ipa_rtp_pt;
+   }
+   if (f_rsl_find_ie(rsl, RSL_IE_IPAC_RTP_PAYLOAD2, ie)) {
+   g_media.bts.rtp_pt := ie.ipa_rtp_pt2;
+   }
+  

[PATCH] osmo-ttcn3-hacks[master]: GSM_Types: Enable sub-slot templating in t_RslChanNr_Lm

2018-01-29 Thread Harald Welte

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

GSM_Types: Enable sub-slot templating in t_RslChanNr_Lm

Change-Id: I22dca2338ad66c81add5d161bd2a3b3e8e15bdcf
---
M library/GSM_Types.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index 1efeac8..e1d6b48 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -93,7 +93,7 @@
template RslChannelNr t_RslChanNr_PCH_AGCH(template uint3_t tn) := 
t_RslChanNr0(tn, RSL_CHAN_NR_PCH_AGCH);
template RslChannelNr t_RslChanNr_Bm(template uint3_t tn) := 
t_RslChanNr0(tn, RSL_CHAN_NR_Bm_ACCH);
template RslChannelNr t_RslChanNr_PDCH(template uint3_t tn) := 
t_RslChanNr0(tn, RSL_CHAN_NR_OSMO_PDCH);
-   template RslChannelNr t_RslChanNr_Lm(template uint3_t tn, uint1_t 
sub_slot) := {
+   template RslChannelNr t_RslChanNr_Lm(template uint3_t tn, template 
uint1_t sub_slot) := {
u := { lm := { tag := '0001'B, sub_chan := sub_slot } },
tn := tn
}

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Cosmetic: Update commented-out config file options

2018-01-29 Thread Harald Welte

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

bsc: Cosmetic: Update commented-out config file options

There's no point in listing non-existing module parameters. Instead,
list those that the BSC testsuite actually has

Change-Id: I3cb756750cafba4ca481a0a98d19e27cb58395df
---
M bsc/BSC_Tests.cfg
1 file changed, 9 insertions(+), 11 deletions(-)


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

diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index fcb1055..497489f 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -14,20 +14,18 @@
 #*.*.udpReuseAddress := "yes";
 
 [MODULE_PARAMETERS]
-#mp_bsc_port := 4;
+#mp_bsc_rsl_port := 3003;
+#mp_bsc_ctrl_port := 4249;
 #mp_bsc_ip   := "127.0.0.1";
-#mp_msc_port := 5100;
-#mp_msc_ip   := "127.0.0.1";
-#mp_nat_port := 5000;
-#mp_nat_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;
 
 #mp_ipa_mgcp_uses_osmo_ext := true;
-
-#mp_mgcp_uses_udp := true;
-#mp_callagent_ip := "127.0.0.1";
-#mp_callagent_udp_port := 2727;
-#mp_mgw_ip := "127.0.0.1";
-#mp_mgw_udp_port := 2427;
 
 [MAIN_CONTROLLER]
 

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

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


[PATCH] osmo-ttcn3-hacks[master]: MGCP_Templates: Some more convenience extraction functions

2018-01-29 Thread Harald Welte

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

MGCP_Templates: Some more convenience extraction functions

Change-Id: I2fc121b1d90327c879a096773ecc5c04faad07d7
---
M library/MGCP_Templates.ttcn
1 file changed, 17 insertions(+), 4 deletions(-)


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

diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 7f10bd2..5a8d9b1 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -273,20 +273,33 @@
return "";
}
 
-   function f_MgcpResp_extract_conn_id(MgcpResponse resp) return 
MgcpConnectionId {
+   function f_MgcpResp_extract_par(MgcpResponse resp, MgcpInfoCode code) 
return charstring {
var MgcpMessage msg := {
response := resp
}
-   return str2hex(f_mgcp_extract_par(msg, "I"));
+   return f_mgcp_extract_par(msg, code);
}
 
-   function f_MgcpCmd_extract_call_id(MgcpCommand cmd) return MgcpCallId {
+   function f_MgcpCmd_extract_par(MgcpCommand cmd, MgcpInfoCode code) 
return charstring {
var MgcpMessage msg := {
command := cmd
}
-   return str2hex(f_mgcp_extract_par(msg, "C"));
+   return f_mgcp_extract_par(msg, code);
}
 
+   function f_MgcpResp_extract_conn_id(MgcpResponse resp) return 
MgcpConnectionId {
+   return str2hex(f_MgcpResp_extract_par(resp, "I"));
+   }
+
+   function f_MgcpCmd_extract_call_id(MgcpCommand cmd) return MgcpCallId {
+   return str2hex(f_MgcpCmd_extract_par(cmd, "C"));
+   }
+
+   function f_MgcpCmd_extract_conn_id(MgcpCommand cmd) return 
MgcpConnectionId {
+   return str2hex(f_MgcpCmd_extract_par(cmd, "I"));
+   }
+
+
function f_mgcp_alloc_tid() return MgcpTransId {
return int2str(float2int(rnd()*2147483647.0));
}

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

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


[PATCH] osmo-ttcn3-hacks[master]: RSL_Types: Make tr_RSL_MsgTypeDR match non-transparent RLL

2018-01-29 Thread Harald Welte

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

RSL_Types: Make tr_RSL_MsgTypeDR match non-transparent RLL

There are quite a number of non-transparent RLL messages, such as
RLL_RELEASE_REQ.  Make sure we match those as intended.

Change-Id: I30260a57fc01613450e6ac66e0af97c29041b4fa
---
M library/RSL_Types.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index f42b7fd..b3d758b 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -711,7 +711,7 @@
 
 /* dedicated channel or RLL */
 template RSL_Message tr_RSL_MsgTypeDR(template RSL_MessageType msg_type) 
modifies tr_RSL_MsgType := {
-   msg_disc := ({RSL_MDISC_DCHAN,?}, {RSL_MDISC_RLL,true}, 
{RSL_MDISC_IPACCESS,false})
+   msg_disc := ({RSL_MDISC_DCHAN,?}, {RSL_MDISC_RLL,?}, 
{RSL_MDISC_IPACCESS,false})
 }
 
 

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

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


[PATCH] osmo-ttcn3-hacks[master]: L3_Templates: Add ts_RRM_AssignmentComplete

2018-01-29 Thread Harald Welte

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

L3_Templates: Add ts_RRM_AssignmentComplete

Change-Id: I3ae33ea00496eaef5885a58cd5fbc491abe68c87
---
M library/L3_Templates.ttcn
1 file changed, 16 insertions(+), 0 deletions(-)


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

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 7736ff5..ed477d5 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -251,6 +251,22 @@
}
 }
 
+template (value) PDU_ML3_MS_NW ts_RRM_AssignmentComplete(OCT1 cause) := {
+   discriminator := ''B, /* overwritten */
+   tiOrSkip := {
+   skipIndicator := ''B
+   },
+   msgs := {
+   rrm := {
+   assignmentComplete := {
+   messageType := '00101001'B,
+   rR_Cause := {
+   valuePart := cause
+   }
+   }
+   }
+   }
+}
 
 template PDU_ML3_MS_NW ts_ML3_MO := {
discriminator := ''B,

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Permit MGCP messages from random ports on BSC side

2018-01-29 Thread Harald Welte

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

bsc: Permit MGCP messages from random ports on BSC side

Change-Id: Ie8896edc3f4310a78b584fd4ad017b77bda22afb
---
M bsc/BSC_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 7e5b675..9da5b65 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -191,7 +191,7 @@
};
var MGCP_conn_parameters mgcp_pars := {
callagent_ip := mp_bsc_ip,
-   callagent_udp_port := 2727,
+   callagent_udp_port := -1,
mgw_ip := mp_test_ip,
mgw_udp_port := 2427
};

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

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


[PATCH] osmo-ttcn3-hacks[master]: RSL_Types: More templates, f_rsl_find_ie() for finding an IE...

2018-01-29 Thread Harald Welte

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

RSL_Types: More templates, f_rsl_find_ie() for finding an IE in a message

Change-Id: Id7fa7d672c1fde97882fa44959501e8bf7b8dc0b
---
M library/RSL_Types.ttcn
1 file changed, 20 insertions(+), 0 deletions(-)


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

diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index b3d758b..765a91e 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -909,6 +909,15 @@
msg_type := RSL_MT_MODE_MODIFY_NACK
}
 
+   /* 8.4.14: BTS <- BSC */
+   template RSL_Message tr_RSL_RF_CHAN_REL(template RslChannelNr chan_nr) 
:= {
+   msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+   msg_type := RSL_MT_RF_CHAN_REL,
+   ies := {
+   tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr})
+   }
+   }
+
/* 8.4.19 BTS -> BSC */
template RSL_Message ts_RSL_RF_CHAN_REL_ACK(RslChannelNr chan_nr) :=
ts_RSL_MsgDiscType(ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
@@ -1160,5 +1169,16 @@
}
 
 
+   function f_rsl_find_ie(RSL_Message msg, RSL_IE_Type iei, out 
RSL_IE_Body ret) return boolean {
+   for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
+   if (msg.ies[i].iei == iei) {
+   ret := msg.ies[i].body;
+   return true;
+   }
+   }
+   return false;
+   }
+
+
 
 } with { encode "RAW" ; variant "FIELDORDER(msb)" }

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Fix TC_paging_imsi_nochan

2018-01-29 Thread Harald Welte

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

bsc: Fix TC_paging_imsi_nochan

The point of this test is to verify that *no* paging messages are sent
if "No cell" is given as cell identifier list by the MSC.  We can thus
not use the existing pageing_helper function, but have to handle this
a bit differently.

This makes TC_paging_imsi_nochan runs pass.

Change-Id: Iec1086bd42f42de1986bb00b91af718977f73b30
---
M bsc/BSC_Tests.ttcn
1 file changed, 26 insertions(+), 1 deletion(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 69f072b..29150ce 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -976,7 +976,32 @@
 testcase TC_paging_imsi_nochan() runs on test_CT {
var BSSMAP_FIELD_CellIdentificationList cid_list;
cid_list := valueof(ts_BSSMAP_CIL_noCell);
-   f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all);
+   var integer i;
+
+   f_init();
+   f_bssap_reset();
+
+   /* Clear the queue, it might still contain stuff like BCCH FILLING */
+   for (i := 0; i < NUM_BTS; i := i + 1) {
+   IPA_RSL[i].clear;
+   }
+
+   f_bssap_tx_ud(ts_BSSMAP_Paging('001010123456789'H, cid_list, omit, 
omit));
+
+   /* wait for some time until when paging messages would appear */
+   f_sleep(3.0);
+
+   for (i := 0; i < NUM_BTS; i := i + 1) {
+   timer T := 0.01;
+   T.start;
+   alt {
+   [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, 
tr_RSL_PAGING_CMD(?))) {
+   setverdict(fail, "Received unexpected paging");
+   }
+   [] T.timeout {}
+   }
+   }
+   setverdict(pass);
 }
 
 /* PAGING by IMSI + TMSI */

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Reply to CRCX with ACK

2018-01-29 Thread Harald Welte

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

bsc: Reply to CRCX with ACK

Change-Id: Ieaea431a99241d8844b915e1b46b77c79fff24df
---
M bsc/MSC_ConnectionHandler.ttcn
M library/MGCP_Emulation.ttcn
2 files changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index e1fd35a..f763994 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -154,6 +154,7 @@
 runs on MSC_ConnHdlr return PDU_BSSAP {
var PDU_BSSAP bssap;
var RSL_Message rsl;
+   var MgcpCommand cmd;
timer T := 10.0;
var boolean exp_compl := 
ischosen(exp_ass_cpl.pdu.bssmap.assignmentComplete);
var boolean crcx_seen := false;
@@ -164,6 +165,7 @@
transid := omit
};
 
+   mgcp_conn_id := f_mgcp_alloc_conn_id();
f_create_chan_and_exp(pars);
/* we should now have a COMPL_L3 at the MSC */
 
@@ -171,6 +173,9 @@
f_create_mgcp_expect(mgcpcrit);
BSSAP.send(ass_cmd);
alt {
+   [] MGCP.receive(tr_CRCX) -> value cmd {
+   MGCP.send(ts_CRCX_ACK(cmd.line.trans_id, mgcp_conn_id, cmd.sdp))
+   }
/* if we receive exactly what we expected, always return + pass */
[] BSSAP.receive(exp_ass_cpl) -> value bssap {
setverdict(pass);
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index df8e4b4..074385c 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -38,6 +38,7 @@
port MGCP_Conn_PT MGCP;
/* procedure based port to register for incoming connections */
port MGCPEM_PROC_PT MGCP_PROC;
+   var MgcpConnectionId mgcp_conn_id;
 }
 
 /* port between individual per-connection components and this dispatcher */

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: reduce code duplication by introducing f_expect_chan_rel()

2018-01-29 Thread Harald Welte

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

bsc: reduce code duplication by introducing f_expect_chan_rel()

The handling of channel release is copy+pasted, let's introduce
a shared function.

Change-Id: If74b0838187f60004b7daf6176db259af511bf87
---
M bsc/BSC_Tests.ttcn
1 file changed, 37 insertions(+), 74 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 87150db..c7b5a8f 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -606,11 +606,44 @@
setverdict(pass);
 }
 
+function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, boolean 
flush := true,
+  boolean handle_rll_rel := true) runs on test_CT {
+
+   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
+   if (flush) {
+   /* Clear the queue, it might still contain stuff like IMMEDIATE 
ASSIGN */
+   IPA_RSL[bts_nr].clear;
+   }
+   alt {
+   /* ignore DEACTIVATE SACCH (if any) */
+   [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
+   tr_RSL_DEACT_SACCH(rsl_chan_nr))) {
+   repeat;
+   }
+   /* acknowledge RLL release (if any)*/
+   [handle_rll_rel] 
IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
+   tr_RSL_REL_REQ(rsl_chan_nr, ?))) {
+   /* FIXME: Why are we getting this for LinkID SACCH? */
+   f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch));
+   repeat;
+   }
+   /* Expect RF channel release from BSC on Abis */
+   [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
+   
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
+   /* respond with CHAN REL ACK */
+   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr));
+   }
+   /* ignore any user data */
+   [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, 
tr_RSL_MsgTypeR(?))) {
+   repeat;
+   }
+   }
+}
+
 /* Test behavior of channel release after hard Clear Command from MSC */
 testcase TC_chan_rel_hard_clear() runs on test_CT {
var BSSAP_N_DATA_ind rx_di;
var DchanTuple dt;
-   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
 
f_init(1);
f_bssap_reset();
@@ -627,36 +660,13 @@
BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
}
 
-   /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN 
*/
-   IPA_RSL[0].clear;
-   alt {
-   /* ignore DEACTIVATE SACCH (if any) */
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) {
-   repeat;
-   }
-   /* acknowledge RLL release (if any)*/
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) {
-   /* FIXME: Why are we getting this for LinkID SACCH? */
-   f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch));
-   repeat;
-   }
-   /* Expect RF channel release from BSC on Abis */
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   
tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
-   /* respond with CHAN REL ACK */
-   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-   }
-   }
-
+   f_expect_chan_rel(0, dt.rsl_chan_nr);
setverdict(pass);
 }
 
 /* Test behavior of channel release after hard RLSD from MSC */
 testcase TC_chan_rel_hard_rlsd() runs on test_CT {
var DchanTuple dt;
-   var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
 
f_init(1);
f_bssap_reset();
@@ -666,36 +676,13 @@
/* release the SCCP connection */
BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
 
-   /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN 
*/
-   IPA_RSL[0].clear;
-   alt {
-   /* ignore DEACTIVATE SACCH (if any) */
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) {
-   repeat;
-   }
-   /* acknowledge RLL release (if any)*/
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) {
-   /* FIXME: Why are we getting this for LinkID SACCH? */
-   f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch));
-   repeat;
-   }
-   /* Expect RF channel release from BSC on Abis */
-   [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
-   
tr_RSL_MsgTypeD(RSL_MT_RF_CHA

[PATCH] osmo-ttcn3-hacks[master]: bsc: Fix TC_chan_act_ack_est_ind_refused()

2018-01-29 Thread Harald Welte

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

bsc: Fix TC_chan_act_ack_est_ind_refused()

This test case was incomplete in that it didn't account for a RLL REL
REQ/RESP before RF_CHAN_REL.

Together with OsmoBSC Change-Id
I64a46b5bcd4272e3fa2ff4ee824c2f3fdff6854b, this test now passes.

Change-Id: Ia5af254d4fc572c1d324f70b5ec99d87bdaf9eb9
---
M bsc/BSC_Tests.ttcn
1 file changed, 1 insertion(+), 2 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index b65d899..69f072b 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -356,8 +356,7 @@
BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0));
 
/* expect BSC to disable the channel */
-   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
-
+   f_expect_chan_rel(0, chan_nr);
setverdict(pass);
 }
 

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Update TC_exhaustion to recent osmo-bsc

2018-01-29 Thread Harald Welte

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

bsc: Update TC_exhaustion to recent osmo-bsc

When Change-Id I10fc9f60c58c6b7ed424a86ce23bf6b9802c9eb1 was merged,
OsmoBSC started to always allocate SDCCH first, no matter what the
establishment cause.  This basically means we don't do very early
assignment anymore.  TC_exhaustion must be adapted to allocate all
SDCCH and all TCH before failing.

Change-Id: I9d8bbfca0deebc738385f2a1a20d4a17c3853082
---
M bsc/BSC_Tests.ttcn
1 file changed, 5 insertions(+), 3 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index dacb630..84d0c38 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -46,6 +46,7 @@
 
 /* make sure to sync this with the osmo-bts.cfg you're using */
 const integer NUM_TCHF_PER_BTS := 5;
+const integer NUM_SDCCH_PER_BTS := 4;
 
 
 /* per-BTS state which we keep */
@@ -386,13 +387,14 @@
chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:no_channel");
 
/* expect 5xTCH/F to succeed */
-   for (i := 0; i < NUM_TCHF_PER_BTS; i := i+1) {
+   for (i := 0; i < NUM_TCHF_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) {
f_chreq_act_ack('23'O, i);
}
 
IPA_RSL[0].clear;
 
-   f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", 
chreq_total+NUM_TCHF_PER_BTS);
+   f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total",
+  
chreq_total+NUM_TCHF_PER_BTS+NUM_SDCCH_PER_BTS);
 
/* now expect additional channel activations to fail */
f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42));
@@ -408,7 +410,7 @@
rr := 
dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload);
if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) {
f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:total",
-  
chreq_total+NUM_TCHF_PER_BTS+1);
+  
chreq_total+NUM_TCHF_PER_BTS+NUM_SDCCH_PER_BTS+1);
f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:no_channel",
   chreq_nochan+1);
setverdict(pass);

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Update TC_chan_rel_conn_fail to subscr_conn_fsm

2018-01-29 Thread Harald Welte

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

bsc: Update TC_chan_rel_conn_fail to subscr_conn_fsm

In OsmoBSC Change-IdI68286d26e2014048b054f39ef29c35fef420cc97 we
introduce a proper subscriber connection state machine which fixes
the order of events during channel release after connection failure.

Change-Id: Ibe9c3205ec11dafcc305ea72aeb33e9152a6458c
---
M bsc/BSC_Tests.ttcn
1 file changed, 5 insertions(+), 5 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 84d0c38..87150db 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -582,11 +582,6 @@
f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, 
RSL_ERR_RADIO_LINK_FAIL));
/* TODO: different cause values? */
 
-   /* expect BSC to disable the channel */
-   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
-   /* respond with CHAN REL ACK */
-   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
-
/* expect Clear Request from BSC */
BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, 
tr_BSSMAP_ClearRequest)) -> value rx_di;
 
@@ -594,6 +589,11 @@
var BssmapCause cause := 
bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue);
BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, 
ts_BSSMAP_ClearCommand(cause)));
 
+   /* expect BSC to disable the channel */
+   rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 
T3101_MAX);
+   /* respond with CHAN REL ACK */
+   f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
+
/* expect Clear Complete from BSC */
BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, 
tr_BSSMAP_ClearComplete));
 

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Register expect criteria for MGCP CRCX

2018-01-29 Thread Harald Welte

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

bsc: Register expect criteria for MGCP CRCX

Change-Id: I04afa663f4397d5d9b8dec06671aec84f4c4f80e
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 3dbb782..e1fd35a 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -158,11 +158,17 @@
var boolean exp_compl := 
ischosen(exp_ass_cpl.pdu.bssmap.assignmentComplete);
var boolean crcx_seen := false;
var boolean rr_modify_seen := false;
+   var ExpectCriteria mgcpcrit := {
+   connid := omit,
+   endpoint := omit,
+   transid := omit
+   };
 
f_create_chan_and_exp(pars);
/* we should now have a COMPL_L3 at the MSC */
 
BSSAP.receive(tr_BSSMAP_ComplL3);
+   f_create_mgcp_expect(mgcpcrit);
BSSAP.send(ass_cmd);
alt {
/* if we receive exactly what we expected, always return + pass */

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

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


[PATCH] osmo-ttcn3-hacks[master]: bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler f...

2018-01-29 Thread Harald Welte

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

bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler for MGCP

forward-ported by Harald Welte

Change-Id: I1f316a9ed5859670348ea7aa352604020d6b09f5
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
2 files changed, 39 insertions(+), 3 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 6b5ce24..8766503 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -31,6 +31,7 @@
 import from IPA_Types all;
 import from RSL_Types all;
 import from RSL_Emulation all;
+import from MGCP_Emulation all;
 
 import from Osmocom_CTRL_Functions all;
 import from Osmocom_CTRL_Types all;
@@ -59,6 +60,8 @@
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
 
+   var MGCP_Emulation_CT vc_MGCP;
+
/* are we initialized yet */
var boolean g_initialized := false;
 
@@ -74,6 +77,8 @@
integer mp_bsc_rsl_port := 3003;
/* port number to which to establish the IPA CTRL connection */
integer mp_bsc_ctrl_port := 4249;
+   /* IP address at which the test binds */
+   charstring mp_test_ip := "127.0.0.1";
 }
 
 type record IPA_Client {
@@ -176,6 +181,24 @@
}
 }
 
+function f_init_mgcp(charstring id) runs on test_CT {
+   id := id & "-MGCP";
+
+   var MGCPOps ops := {
+   create_cb := refers(MGCP_Emulation.ExpectedCreateCallback),
+   unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback)
+   };
+   var MGCP_conn_parameters mgcp_pars := {
+   callagent_ip := mp_bsc_ip,
+   callagent_udp_port := 2727,
+   mgw_ip := mp_test_ip,
+   mgw_udp_port := 2427
+   };
+
+   vc_MGCP := MGCP_Emulation_CT.create(id);
+   vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id));
+}
+
 /* 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) */
@@ -195,6 +218,8 @@
f_bssap_init("VirtMSC", omit);
}
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
+
+   f_init_mgcp("VirtMSC");
 
for (i := 0; i < nr_bts; i := i+1) {
/* wait until osmo-bts-omldummy has respawned */
@@ -1197,8 +1222,10 @@
 
vc_conn := MSC_ConnHdlr.create(id);
connect(vc_conn:BSSMAPEM, vc_BSSMAP:PROC);
+   connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC);
connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT);
connect(vc_conn:BSSAP, vc_BSSMAP:CLIENT);
+   connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
vc_conn.start(derefers(fn)(id));
return vc_conn;
 }
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index d1be0ef..3dbb782 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -10,6 +10,7 @@
 
 import from MGCP_Types all;
 import from MGCP_Templates all;
+import from MGCP_Emulation all;
 import from SDP_Types all;
 
 import from RSL_Emulation all;
@@ -24,7 +25,7 @@
 /* this component represents a single subscriber connection at the MSC.
  * There is a 1:1 mapping between SCCP connections and BSSAP_ConnHdlr 
components.
  * We inherit all component variables, ports, functions, ... from 
BSSAP_ConnHdlr */
-type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr {
+type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr, 
MGCP_ConnHdlr {
/* SCCP Connecction Identifier for the underlying SCCP connection */
var integer g_sccp_conn_id;
 
@@ -55,6 +56,10 @@
role_ms := false
 }
 
+const MGCPOps MSC_MGCPOps := {
+   create_cb := refers(MGCP_Emulation.ExpectedCreateCallback)
+}
+
 type enumerated MSC_State {
MSC_STATE_NONE,
MSC_STATE_WAIT_ASS_COMPL,
@@ -65,7 +70,7 @@
 }
 
 /* register an expect with the BSSMAP core */
-private function f_create_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
+private function f_create_bssmap_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
BSSMAPEM.call(BSSMAPEM_register:{l3_enc, self}) {
[] BSSMAPEM.getreply(BSSMAPEM_register:{?, ?}) {};
}
@@ -92,7 +97,7 @@
 
/* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */
RSL_Emulation.f_chan_est(pars.ra, l3_enc, pars.link_id, pars.fn);
-   f_create_exp(l3_enc);
+   f_create_bssmap_exp(l3_enc);
 }
 
 function f_rsl_reply(template PDU_ML3_MS_NW l3, RSL_Message orig) runs on 
MSC_ConnHdlr {
@@ -184,10 +189,14 @@
crcx_seen := true;
repeat;
}
+   /* mgw CRCX goes here */
+
[crcx_seen] RSL.receive(tr_RSL_IPA_MDCX(g_chan_nr, ?)) -> value rsl{
RSL.send(ts_RSL_IPA_MDCX_ACK(g_chan_nr, 1, 1, 1, 1));
repeat;
}
+   /* mgw MGCX goes here */
+
[exp_compl] BSSAP.re

osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-29 Thread Pau Espin Pedrol

Patch Set 1: Code-Review-1

As described in the commit description, I'm still having some issues due to the 
ICMP packets not being forwarded after arriving to the tun device. The GGSN 
processing part seems to be working fine but still it'd be better to solve it 
before merging them.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9c6043a6cd3b6622782ec7e7fcd2815101755ba
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-29 Thread Pau Espin Pedrol

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

ggsn_tests: Add test case to validate packets forwarded vs dropped

New dependency is required: titan.ProtocolModules.ICMP
It tests that ICMP echo packets can be sent successfully (reply is
received or otherwise dest unreachable if routing is not set up
correctly during the test). It also tests some cases in which osmo-ggsn
is required to drop the packets (eg. unknown src ip unrelated to pdp
ctx). It also checks that IPv6 packets are dropped in IPv4 pdp ctx and
viceversa It also checks that IPv6 packets are dropped in IPv4 pdp ctx
and vice versa.

I am having some issues having my setup forwarding the crafted ICMPv4 echo
messages. They are seen in the tun4 interface but it seems kernel
routing is dropping them before sending them to my eth device.

Change-Id: Ib9c6043a6cd3b6622782ec7e7fcd2815101755ba
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/gen_links.sh
M ggsn_tests/regen_makefile.sh
4 files changed, 262 insertions(+), 1 deletion(-)


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

diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index d8994df..bf82057 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -26,9 +26,11 @@
 GGSN_Tests.TC_pdp4_act_deact
 GGSN_Tests.TC_pdp4_act_deact_ipcp
 GGSN_Tests.TC_pdp4_act_deact_pcodns
+GGSN_Tests.TC_pdp4_act_deact_gtpu_access
 
 GGSN_Tests.TC_pdp6_act_deact
 GGSN_Tests.TC_pdp6_act_deact_pcodns
 GGSN_Tests.TC_pdp6_act_deact_icmp6
+GGSN_Tests.TC_pdp6_act_deact_gtpu_access
 
 GGSN_Tests.TC_echo_req_resp
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index f7814db..8bd5f52 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -10,6 +10,7 @@
import from GTPU_Types all;
import from IPCP_Types all;
import from IP_Types all;
+   import from ICMP_Types all;
import from ICMPv6_Types all;
import from Native_Functions all;
 
@@ -734,6 +735,63 @@
/* IPv6 neighbor solicitation fe80::2 -> ff02::1:ff00:2 from 
02:88:b5:1f:25:59 */
const octetstring c_neigh_solicit:= 
'60203afffe82ff020001ff0287009f96fe8201010288b51f2559'O;
 
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMP ts_ICMPv4_ERQ := {
+   echo := {
+   type_field := 8,
+   code := 0,
+   checksum := ''O,
+   identifier := '0345'O,
+   sequence_number := '0001'O,
+   data := ''O
+   }
+   }
+
+   /* template for an ICMPv4 echo reply */
+   template PDU_ICMP tr_ICMPv4_ERP(octetstring data := ''O) := {
+   echo_reply := {
+   type_field := 0,
+   code := 0,
+   checksum := ?,
+   identifier := ?,
+   sequence_number := ?,
+   data := data
+   }
+   }
+
+   /* template for receiving/matching an ICMPv6 Destination Unreachable  */
+   template PDU_ICMP tr_ICMPv4_DU := {
+   destination_unreachable := {
+   type_field := 1,
+   code := ?,
+   checksum := ?,
+   unused := ?,
+   original_ip_msg  := ?
+   }
+   }
+
+   /* template to construct IPv4_packet from input arguments, ready for 
use in f_IPv4_enc() */
+   template IPv4_packet ts_IP4(OCT4 srcaddr, OCT4 dstaddr, LIN1 proto, 
LIN2_BO_LAST tlen, octetstring payload) := {
+   header := {
+   ver := 4,
+   hlen := 5,
+   tos := 0,
+   tlen := tlen,
+   id := 35902,
+   res := '0'B,
+   dfrag := '1'B,
+   mfrag := '0'B,
+   foffset := 0,
+   ttl := 64,
+   proto := proto,
+   cksum := 0,
+   srcaddr := srcaddr,
+   dstaddr := dstaddr
+   },
+   ext_headers := omit,
+   payload := payload
+   }
+
/* template to generate a 'Prefix Information' ICMPv6 option */
template OptionField ts_ICMP6_OptPrefix(OCT16 prefix, INT1 prefix_len) 
:= {
prefixInformation := {
@@ -747,6 +805,18 @@
preferredLifetime := oct2int(''O),
reserved2 := ''O,
prefix := prefix
+   }
+   }
+
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMPv6 ts_ICMPv6_ERQ := {
+   echoRequest := {
+   typeF

[PATCH] osmo-ttcn3-hacks[master]: ggsn_tests: Validate DNS PCO values

2018-01-29 Thread Pau Espin Pedrol

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

ggsn_tests: Validate DNS PCO values

Change-Id: I54124cb5269c0992e6c72af1a1ecaa8e3202bf05
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
2 files changed, 34 insertions(+), 2 deletions(-)


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

diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index 90368b9..d8994df 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -18,6 +18,8 @@
 GGSN_Tests.m_ggsn_ip_gtpu := "127.0.0.2"
 GGSN_Tests.m_ggsn_ip4_dns1 := "192.168.100.1"
 GGSN_Tests.m_ggsn_ip4_dns2 := "8.8.8.8"
+GGSN_Tests.m_ggsn_ip6_dns1 := "2001:4860:4860::"
+GGSN_Tests.m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
 
 [EXECUTE]
 #GGSN_Tests.TC_dummy
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 06d9dcf..f7814db 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -26,6 +26,8 @@
 
charstring m_ggsn_ip4_dns1 := "192.168.100.1"
charstring m_ggsn_ip4_dns2 := "8.8.8.8"
+   charstring m_ggsn_ip6_dns1 := "2001:4860:4860::"
+   charstring m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
}
 
type set PdpContext {
@@ -426,11 +428,15 @@
}
 
/* extract a given protocol payload from PCO */
-   function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol) 
return octetstring {
+   function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, 
integer nth_match := 1) return octetstring {
var integer i;
+   var integer num_matches := 0;
for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
if (pco.protocols[i].protocolID == protocol) {
-   return pco.protocols[i].protoIDContents;
+   num_matches := num_matches + 1;
+   if (num_matches == nth_match) {
+   return pco.protocols[i].protoIDContents;
+   }
}
}
setverdict(fail);
@@ -925,6 +931,18 @@
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), 
'1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
f_pdp_ctx_act(ctx);
+
+   /* verify PCO contains both primary and secondary DNS */
+   var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), 
ggsn_ip6_dns1)) {
+   setverdict(fail, "Primary DNS IPv6 PCO option 
not found");
+   }
+
+   var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), 
ggsn_ip6_dns2)) {
+   setverdict(fail, "Secondary DNS IPv6 PCO option 
not found");
+   }
+
f_pdp_ctx_del(ctx, '1'B);
}
 
@@ -984,6 +1002,18 @@
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), 
'1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
f_pdp_ctx_act(ctx);
+
+   /* verify PCO contains both primary and secondary DNS */
+   var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), 
ggsn_ip4_dns1)) {
+   setverdict(fail, "Primary DNS IPv4 PCO option 
not found");
+   }
+
+   var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
+   if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), 
ggsn_ip4_dns2)) {
+   setverdict(fail, "Secondary DNS IPv4 PCO option 
not found");
+   }
+
f_pdp_ctx_del(ctx, '1'B);
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54124cb5269c0992e6c72af1a1ecaa8e3202bf05
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-pcu[master]: Use built-in bit counter

2018-01-29 Thread Max

Patch Set 2: Code-Review-1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaf470e9a7ee0d003177c4328f93849606ca31521
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-pcu[master]: Use built-in bit counter

2018-01-29 Thread Max

Patch Set 1:

You're right - it's actually used for uint8_t only but it's not obvious from 
function type signatures and is not covered by tests so I've got to fix it 
first. Let#s keep this here until then.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaf470e9a7ee0d003177c4328f93849606ca31521
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] osmo-pcu[master]: Simplify TS alloc: move slot check into functions

2018-01-29 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/3935

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

Simplify TS alloc: move slot check into functions

Move timeslot applicability check outside of nested for loop into
separate functions and document them. Add corresponding tests.

This allows us to clarify types used in TS-related computations.

Change-Id: Ic39e848da47dc11357782362fdf6206d2c1457c2
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
M src/mslot_class.c
M src/mslot_class.h
M tests/alloc/MslotTest.cpp
M tests/alloc/MslotTest.ok
5 files changed, 627 insertions(+), 122 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/35/3935/6

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index e394a6e..af4d011 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -50,14 +50,6 @@
return buf;
 }
 
-static bool test_and_set_bit(uint32_t *bits, size_t elem)
-{
-   bool was_set = bits[elem/32] & (1 << (elem % 32));
-   bits[elem/32] |= (1 << (elem % 32));
-
-   return was_set;
-}
-
 static inline int8_t find_free_usf(const struct gprs_rlcmac_pdch *pdch)
 {
uint8_t usf_map = 0;
@@ -93,11 +85,11 @@
return -1;
 }
 
-static int find_possible_pdchs(const struct gprs_rlcmac_trx *trx, size_t 
max_slots, uint8_t mask,
-  const char *mask_reason = NULL)
+static uint8_t find_possible_pdchs(const struct gprs_rlcmac_trx *trx, uint8_t 
max_slots, uint8_t mask,
+  const char *mask_reason = NULL)
 {
unsigned ts;
-   int valid_ts_set = 0;
+   uint8_t valid_ts_set = 0;
int8_t last_tsc = -1; /* must be signed */
 
for (ts = 0; ts < ARRAY_SIZE(trx->pdch); ts++) {
@@ -375,7 +367,7 @@
int trx_no;
int tfi = -1;
int usf = -1;
-   int mask = 0xff;
+   uint8_t mask = 0xff;
const char *mask_reason = NULL;
const GprsMs *ms = ms_;
const gprs_rlcmac_tbf *tbf = tbf_;
@@ -452,6 +444,58 @@
return 0;
 }
 
+/*! Decide if a given slot should be skipped by multislot allocator
+ *
+ *  \param[in] ms_class Pointer to MS Class object
+ *  \param[in] check_tr Flag indicating whether we should check for Tra or Tta 
parameters for a given MS class
+ *  \param[in] rx_window Receive window
+ *  \param[in] tx_window Transmit window
+ *  \param[in,out] checked_rx array with already checked RX timeslots
+ *  \returns true if the slot should be skipped, false otherwise
+ */
+static bool skip_slot(uint8_t mslot_class, bool check_tr,
+ int16_t rx_window, int16_t tx_window,
+ uint32_t *checked_rx)
+{
+   uint8_t common_slot_count, req_common_slots,
+   rx_slot_count = pcu_bitcount(rx_window),
+   tx_slot_count = pcu_bitcount(tx_window);
+
+   /* Check compliance with TS 45.002, table 6.4.2.2.1 */
+   /* Whether to skip this round doesn not only depend on the bit
+* sets but also on check_tr. Therefore this check must be done
+* before doing the mslot_test_and_set_bit shortcut. */
+   if (mslot_class_get_type(mslot_class) == 1) {
+   uint16_t slot_sum = rx_slot_count + tx_slot_count;
+   /* Assume down + up / dynamic.
+* TODO: For ext-dynamic, down only, up only add more cases.
+*/
+   if (slot_sum <= 6 && tx_slot_count < 3) {
+   if (!check_tr)
+   return true; /* Skip Tta */
+   } else if (slot_sum > 6 && tx_slot_count < 3) {
+   if (check_tr)
+   return true; /* Skip Tra */
+   } else
+   return true; /* No supported row in TS 45.002, table 
6.4.2.2.1. */
+   }
+
+   /* Avoid repeated RX combination check */
+   if (mslot_test_and_set_bit(checked_rx, rx_window))
+   return true;
+
+   /* Check number of common slots according to TS 45.002, §6.4.2.2 */
+   common_slot_count = pcu_bitcount(tx_window & rx_window);
+   req_common_slots = OSMO_MIN(tx_slot_count, rx_slot_count);
+   if (mslot_class_get_type(mslot_class) == 1)
+   req_common_slots = OSMO_MIN(req_common_slots, 2);
+
+   if (req_common_slots != common_slot_count)
+   return true;
+
+   return false;
+}
+
 /*! Find set of slots available for allocation while taking MS class into 
account
  *
  *  \param[in] trx Pointer to TRX object
@@ -465,18 +509,14 @@
uint8_t Tx, Sum;/* Maximum Number of Slots: RX, Tx, Sum Rx+Tx */
uint8_t Tta, Ttb, Tra, Trb; /* Minimum Number of Slots */
uint8_t Type; /* Type of Mobile */
-   int rx_window, tx_window, pdch_slots;
+   uint8_t max_slots, num_tx, mask_sel, pdch_slots, ul_ts, dl_ts;
+   int16_t rx_window, tx_window;
static const cha

[PATCH] osmo-pcu[master]: Simplify TS alloc: separate capacity computation

2018-01-29 Thread Max
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/3934

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

Simplify TS alloc: separate capacity computation

Move TRX capacity computation into separate function and document it.

Change-Id: Ifd88fc7ff818ea2a041eae61c5d457926a0df0f2
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
1 file changed, 32 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/34/3934/6

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index af4d011..438ec93 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -496,6 +496,33 @@
return false;
 }
 
+/*! Compute capacity of a given TRX
+ *
+ *  \param[in] trx Pointer to TRX object
+ *  \param[in] rx_window Receive window
+ *  \param[in] tx_window Transmit window
+ *  \returns non-negative capacity
+ */
+static inline unsigned compute_capacity(const struct gprs_rlcmac_trx *trx, int 
rx_window, int tx_window)
+{
+   const struct gprs_rlcmac_pdch *pdch;
+   unsigned ts, capacity = 0;
+
+   for (ts = 0; ts < ARRAY_SIZE(trx->pdch); ts++) {
+   pdch = &trx->pdch[ts];
+   if (rx_window & (1 << ts))
+   capacity += OSMO_MAX(32 - 
pdch->num_reserved(GPRS_RLCMAC_DL_TBF), 1);
+
+   /* Only consider common slots for UL */
+   if (tx_window & rx_window & (1 << ts)) {
+   if (find_free_usf(pdch) >= 0)
+   capacity += OSMO_MAX(32 - 
pdch->num_reserved(GPRS_RLCMAC_UL_TBF), 1);
+   }
+   }
+
+   return capacity;
+}
+
 /*! Find set of slots available for allocation while taking MS class into 
account
  *
  *  \param[in] trx Pointer to TRX object
@@ -620,7 +647,6 @@
 
/* Validate with both Tta/Ttb/Trb and Ttb/Tra/Trb */
for (mask_sel = MASK_TT; mask_sel <= MASK_TR; mask_sel += 1) {
-   unsigned ts;
int capacity;
 
rx_window = mslot_filter_bad(rx_mask[mask_sel], ul_ts, 
*dl_slots, rx_valid_win);
@@ -631,25 +657,7 @@
continue;
 
/* Compute capacity */
-   capacity = 0;
-
-   for (ts = 0; ts < ARRAY_SIZE(trx->pdch); ts++) {
-   int c;
-   const struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts];
-   if (rx_window & (1 << ts)) {
-   c = 32 - pdch->num_reserved(GPRS_RLCMAC_DL_TBF);
-   c = OSMO_MAX(c, 1);
-   capacity += c;
-   }
-   /* Only consider common slots for UL */
-   if (tx_window & rx_window & (1 << ts)) {
-   if (find_free_usf(pdch) >= 0) {
-   c = 32 - 
pdch->num_reserved(GPRS_RLCMAC_UL_TBF);
-   c = OSMO_MAX(c, 1);
-   capacity += c;
-   }
-   }
-   }
+   capacity = compute_capacity(trx, rx_window, tx_window);
 
 #ifdef ENABLE_TS_ALLOC_DEBUG
LOGP(DRLCMAC, LOGL_DEBUG,
@@ -670,7 +678,10 @@
max_capacity = capacity;
max_ul_slots = tx_window;
max_dl_slots = rx_window;
-   
+   }
+   }
+   }
+   }
 
if (!max_ul_slots || !max_dl_slots) {
LOGP(DRLCMAC, LOGL_NOTICE,

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifd88fc7ff818ea2a041eae61c5d457926a0df0f2
Gerrit-PatchSet: 6
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-pcu[master]: Simplify TS alloc: replace debug printer

2018-01-29 Thread Max
Hello Harald Welte, Jenkins Builder, Holger Freyther,

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

https://gerrit.osmocom.org/3929

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

Simplify TS alloc: replace debug printer

Replace unreadable recursive debug printer with simpler functions.

Note: the new printer also correctly handle reserved TS so Control slot
overrides TS for the bits set for both Uplink and Downlink slots. This
does not change the allocation semantics of course but requires cosmetic
adjustement to TBF tests output.

Change-Id: Ia13855877b2145cb57b1646f5562b2af3b87bcfb
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
1 file changed, 3 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/29/3929/8

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 707aca5..5cebed4 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -36,20 +36,6 @@
 /* Consider a PDCH as idle if has at most this number of TBFs assigned to it */
 #define PDCH_IDLE_TBF_THRESH   1
 
-static char *set_flag_chars(char *buf, uint8_t val, char set_char, char 
unset_char = 0)
-{
-   int i;
-
-   for (i = 0; i < 8; i += 1, val = val >> 1) {
-   if (val & 1)
-   buf[i] = set_char;
-   else if (unset_char)
-   buf[i] = unset_char;
-   }
-
-   return buf;
-}
-
 static inline void masked_override_with(char *buf, uint8_t mask, char set_char)
 {
int i;
@@ -588,11 +574,9 @@
*dl_slots &= pdch_slots;
*ul_slots &= pdch_slots;
 
-   LOGP(DRLCMAC, LOGL_DEBUG, "- Possible DL/UL slots: 
(TS=0)\"%s\"(TS=7)\n",
-   set_flag_chars(set_flag_chars(set_flag_chars(slot_info,
-   *dl_slots, 'D', '.'),
-   *ul_slots, 'U'),
-   *ul_slots & *dl_slots, 'C'));
+   ts_format(slot_info, *dl_slots, *ul_slots);
+   LOGP(DRLCMAC, LOGL_DEBUG,
+"- Possible DL/UL slots: (TS=0)\"%s\"(TS=7)\n", slot_info);
 
/* Check for each UL (TX) slot */
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia13855877b2145cb57b1646f5562b2af3b87bcfb
Gerrit-PatchSet: 8
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[PATCH] osmo-pcu[master]: Simplify TS alloc: split off RX mask computation

2018-01-29 Thread Max
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/3913

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

Simplify TS alloc: split off RX mask computation

Move computation of RX mask into separate function and document it. This
allows to significantly shrink find_multi_slot() function and overall
improve code readability.

Since the test output requires cosmetic adjustment anyway due to change
in the sequence of log messages, use this opportunity to better group
and format log message.

Change-Id: I731726a096bba7ee97499e5cbe3e7401869d7392
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
M src/mslot_class.c
M src/mslot_class.h
M tests/tbf/TbfTest.err
4 files changed, 55 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/13/3913/8

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 438ec93..fa3f788 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -533,44 +533,24 @@
  */
 int find_multi_slots(struct gprs_rlcmac_trx *trx, uint8_t mslot_class, uint8_t 
*ul_slots, uint8_t *dl_slots)
 {
-   uint8_t Tx, Sum;/* Maximum Number of Slots: RX, Tx, Sum Rx+Tx */
-   uint8_t Tta, Ttb, Tra, Trb; /* Minimum Number of Slots */
-   uint8_t Type; /* Type of Mobile */
+   uint8_t Tx = mslot_class_get_tx(mslot_class),   /* Max number of Tx 
slots */
+   Sum = mslot_class_get_sum(mslot_class); /* Max number of Tx + 
Rx slots */
uint8_t max_slots, num_tx, mask_sel, pdch_slots, ul_ts, dl_ts;
int16_t rx_window, tx_window;
-   static const char *digit[10] = { 
"0","1","2","3","4","5","6","7","8","9" };
char slot_info[9] = {0};
-   int max_capacity;
-   uint8_t max_ul_slots;
-   uint8_t max_dl_slots;
-   enum {MASK_TT, MASK_TR};
+   int max_capacity = -1;
+   uint8_t max_ul_slots = 0;
+   uint8_t max_dl_slots = 0;
 
if (mslot_class)
LOGP(DRLCMAC, LOGL_DEBUG, "Slot Allocation (Algorithm B) for 
class %d\n",
 mslot_class);
-
-   Tx = mslot_class_get_tx(mslot_class);
-   Sum = mslot_class_get_sum(mslot_class);
-   Tta = mslot_class_get_ta(mslot_class);
-   Ttb = mslot_class_get_tb(mslot_class);
-
-   /* FIXME: use actual TA offset for computation - make sure to adjust "1 
+ MS_TO" accordingly
-  see also "Offset required" bit in 3GPP TS 24.008 §10.5.1.7 */
-   Tra = mslot_class_get_ra(mslot_class, 0);
-   Trb = mslot_class_get_rb(mslot_class, 0);
-
-   Type = mslot_class_get_type(mslot_class);
 
if (Tx == MS_NA) {
LOGP(DRLCMAC, LOGL_NOTICE, "Multislot class %d not 
applicable.\n",
 mslot_class);
return -EINVAL;
}
-
-   LOGP(DRLCMAC, LOGL_DEBUG, "- Rx=%d Tx=%d Sum Rx+Tx=%s  Tta=%s Ttb=%d "
-   " Tra=%d Trb=%d Type=%d\n", mslot_class_get_rx(mslot_class), Tx,
-   (Sum == MS_NA) ? "N/A" : digit[Sum],
-   (Tta == MS_NA) ? "N/A" : digit[Tta], Ttb, Tra, Trb, Type);
 
max_slots = OSMO_MAX(mslot_class_get_rx(mslot_class), Tx);
 
@@ -593,29 +573,12 @@
 
/* Check for each UL (TX) slot */
 
-   max_capacity = -1;
-   max_ul_slots = 0;
-   max_dl_slots = 0;
-
/* Iterate through possible numbers of TX slots */
for (num_tx = 1; num_tx <= mslot_class_get_tx(mslot_class); num_tx += 
1) {
uint16_t tx_valid_win = (1 << num_tx) - 1;
+   uint8_t rx_mask[MASK_TR + 1];
 
-   uint8_t rx_mask[MASK_TR+1];
-   if (Type == 1) {
-   rx_mask[MASK_TT] = (0x100 >> OSMO_MAX(Ttb, Tta)) - 1;
-   rx_mask[MASK_TT] &= ~((1 << (Trb + num_tx)) - 1);
-   rx_mask[MASK_TR] = (0x100 >> Ttb) - 1;
-   rx_mask[MASK_TR] &=
-   ~((1 << (OSMO_MAX(Trb, Tra) + num_tx)) - 1);
-   } else {
-   /* Class type 2 MS have independant RX and TX */
-   rx_mask[MASK_TT] = 0xff;
-   rx_mask[MASK_TR] = 0xff;
-   }
-
-   rx_mask[MASK_TT] = (rx_mask[MASK_TT] << 3) | (rx_mask[MASK_TT] 
>> 5);
-   rx_mask[MASK_TR] = (rx_mask[MASK_TR] << 3) | (rx_mask[MASK_TR] 
>> 5);
+   mslot_fill_rx_mask(mslot_class, num_tx, rx_mask);
 
/* Rotate group of TX slots: UUU-, -UUU, ..., UU-U */
for (ul_ts = 0; ul_ts < 8; ul_ts += 1, tx_valid_win <<= 1) {
diff --git a/src/mslot_class.c b/src/mslot_class.c
index f8441e4..24f6de6 100644
--- a/src/mslot_class.c
+++ b/src/mslot_class.c
@@ -21,6 +21,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
@@ -205,3 +206,44 @@
 
return rx_good & rx_valid_win;
 }
+
+/*! Fill in RX mask table for a given MS Class
+ *
+ *  \param[in] ms_cl MS Class pointer
+ *  \param[in] num_tx Number

[PATCH] osmo-pcu[master]: Simplify TS alloc: move slot assignment

2018-01-29 Thread Max
Hello Harald Welte, Jenkins Builder, Holger Freyther,

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

https://gerrit.osmocom.org/3905

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

Simplify TS alloc: move slot assignment

Move into separate functions:
* move timeslot reservation
* move UL timeslot assignment
* move DL timeslot assignment

Change-Id: I64cf78c5cfc78664766f9769dd5cde632dab92b0
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
M tests/tbf/TbfTest.err
2 files changed, 90 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/05/3905/10

diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index fa3f788..7aecf09 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -50,6 +50,21 @@
return buf;
 }
 
+static inline void masked_override_with(char *buf, uint8_t mask, char set_char)
+{
+   int i;
+   for (i = 0; mask; i++, mask >>= 1)
+   if (mask & 1)
+   buf[i] = set_char;
+}
+
+static void ts_format(char *buf, uint8_t dl_mask, uint8_t ul_mask)
+{
+   snprintf(buf, 9, OSMO_BIT_SPEC, OSMO_BIT_PRINT_EX(dl_mask, 'D'));
+   masked_override_with(buf, ul_mask, 'U');
+   masked_override_with(buf, ul_mask & dl_mask, 'C');
+}
+
 static inline int8_t find_free_usf(const struct gprs_rlcmac_pdch *pdch)
 {
uint8_t usf_map = 0;
@@ -658,6 +673,75 @@
return 0;
 }
 
+/*! Update MS' reserved timeslots
+ *
+ *  \param[in,out] trx Pointer to TRX struct
+ *  \param[in,out] ms_ Pointer to MS object
+ *  \param[in] tbf_ Pointer to TBF struct
+ *  \param[in] res_ul_slots Newly reserved UL slots
+ *  \param[in] res_dl_slots Newly reserved DL slots
+ *  \param[in] ul_slots available UL slots (for logging only)
+ *  \param[in] dl_slots available DL slots (for logging only)
+ */
+static void update_ms_reserved_slots(gprs_rlcmac_trx *trx, GprsMs *ms, uint8_t 
res_ul_slots, uint8_t res_dl_slots,
+uint8_t ul_slots, uint8_t dl_slots)
+{
+   char slot_info[9] = { 0 };
+
+   if (res_ul_slots == ms->reserved_ul_slots() && res_dl_slots == 
ms->reserved_dl_slots())
+   return;
+
+   /* The reserved slots have changed, update the MS */
+   ms->set_reserved_slots(trx, res_ul_slots, res_dl_slots);
+
+   ts_format(slot_info, dl_slots, ul_slots);
+   LOGP(DRLCMAC, LOGL_DEBUG, "- Reserved DL/UL slots: 
(TS=0)\"%s\"(TS=7)\n", slot_info);
+}
+
+/*! Assign given UL timeslots to UL TBF
+ *
+ *  \param[in,out] ul_tbf Pointer to UL TBF struct
+ *  \param[in,out] trx Pointer to TRX object
+ *  \param[in] ul_slots Set of slots to be assigned
+ *  \param[in] tfi selected TFI
+ *  \param[in] usf selected USF
+ */
+static void assign_ul_tbf_slots(struct gprs_rlcmac_ul_tbf *ul_tbf, 
gprs_rlcmac_trx *trx, uint8_t ul_slots, int tfi,
+   int *usf)
+{
+   uint8_t ts;
+
+   for (ts = 0; ts < 8; ts++) {
+   if (!(ul_slots & (1 << ts)))
+   continue;
+
+   OSMO_ASSERT(usf[ts] >= 0);
+
+   LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning UL TS %u\n", ts);
+   assign_uplink_tbf_usf(&trx->pdch[ts], ul_tbf, tfi, usf[ts]);
+   }
+}
+
+/*! Assign given DL timeslots to DL TBF
+ *
+ *  \param[in,out] dl_tbf Pointer to DL TBF struct
+ *  \param[in,out] trx Pointer to TRX object
+ *  \param[in] ul_slots Set of slots to be assigned
+ *  \param[in] tfi selected TFI
+ */
+static void assign_dl_tbf_slots(struct gprs_rlcmac_dl_tbf *dl_tbf, 
gprs_rlcmac_trx *trx, uint8_t dl_slots, int tfi)
+{
+   uint8_t ts;
+
+   for (ts = 0; ts < 8; ts++) {
+   if (!(dl_slots & (1 << ts)))
+   continue;
+
+   LOGP(DRLCMAC, LOGL_DEBUG, "- Assigning DL TS %u\n", ts);
+   assign_dlink_tbf(&trx->pdch[ts], dl_tbf, tfi);
+   }
+}
+
 /*! Slot Allocation: Algorithm B
  *
  * Assign as many downlink slots as possible.
@@ -841,50 +925,16 @@
 
/* Step 4: Update MS and TBF and really allocate the resources */
 
-   /* The reserved slots have changed, update the MS */
-   if (reserved_ul_slots != ms->reserved_ul_slots() ||
-   reserved_dl_slots != ms->reserved_dl_slots())
-   {
-   ms_->set_reserved_slots(trx,
-   reserved_ul_slots, reserved_dl_slots);
-
-   LOGP(DRLCMAC, LOGL_DEBUG,
-   "- Reserved DL/UL slots: (TS=0)\"%s\"(TS=7)\n",
-   set_flag_chars(set_flag_chars(set_flag_chars(slot_info,
-   dl_slots, 'D', '.'),
-   ul_slots, 'U'),
-   ul_slots & dl_slots, 'C'));
-   }
+   update_ms_reserved_slots(trx, ms_, reserved_ul_slots, 
reserved_dl_slots, ul_slots, dl_slots);
 
tbf_->trx = trx;
tbf_->first_common_ts = first_common_ts;
tbf_->first_ts = first_ts;
 
-   if (tbf->dire

  1   2   >