[MERGED] osmo-ttcn3-hacks[master]: RSL_Emulation: Introduce notion of 'bts_role'

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

Change subject: RSL_Emulation: Introduce notion of 'bts_role'
..


RSL_Emulation: Introduce notion of 'bts_role'

So far we assumed we emulate the BTS side and talk to a BSC.

Let's make this configurable and disable the BTS-side spcific code
paths by means of a 'bts_role' boolean type.

Change-Id: I0d0460cbb633b470f6117d07643f68aefb1530eb
---
M library/RSL_Emulation.ttcn
1 file changed, 20 insertions(+), 8 deletions(-)

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



diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index dab1785..5c7dc9c 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -52,6 +52,11 @@
inout RSLDC_ChanRqd, RSL_Message;
 } with { extension "internal" };
 
+type port RSL_CCHAN_PT message {
+   inout ASP_RSL_Unitdata;
+} 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);
 signature RSLEM_suspend(boolean suspend);
@@ -242,6 +247,9 @@
port RSL_DCHAN_PT CLIENT_PT;
port RSLEM_PROC_PT RSL_PROC;
 
+   /* port for Common Channel / TRX Management */
+   port RSL_CCHAN_PT CCHAN_PT;
+
/* state of all concurrent connections / dedicated channels */
var ConnectionData ConnectionTable[64];
 }
@@ -268,7 +276,7 @@
 }
 
 
-function main() runs on RSL_Emulation_CT {
+function main(boolean bts_role := true) runs on RSL_Emulation_CT {
var ASP_RSL_Unitdata rx_rsl;
var RSL_Message rx_rsl_msg;
var RSLDC_ChanRqd chan_rqd;
@@ -286,10 +294,10 @@
alt {
[] IPA_PT.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) {
}
-   [] IPA_PT.receive(ASP_IPA_Event:{up_down := 
ASP_IPA_EVENT_ID_ACK}) {
+   [bts_role] IPA_PT.receive(ASP_IPA_Event:{up_down := 
ASP_IPA_EVENT_ID_ACK}) {

IPA_PT.send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23)));
}
-   [] IPA_PT.receive(tr_RSL(tr_RSL_IMM_ASSIGN)) -> value rx_rsl {
+   [bts_role] IPA_PT.receive(tr_RSL(tr_RSL_IMM_ASSIGN)) -> value 
rx_rsl {
var GsmRrMessage rr;
var OCT1 ra;
var GsmFrameNumber fn;
@@ -327,7 +335,7 @@
}
}
 
-   [] IPA_PT.receive(tr_RSL(tr_RSL_PAGING_CMD(?, ?))) -> value 
rx_rsl {
+   [bts_role] IPA_PT.receive(tr_RSL(tr_RSL_PAGING_CMD(?, ?))) -> 
value rx_rsl {
log("PAGING IDENTITY ", rx_rsl.rsl.ies[2].body.other);
/* broadcast to all clients? */
for (i := 0; i < sizeof(ConnectionTable); i := i + 1) {
@@ -337,16 +345,20 @@
}
}
 
+   /* Forward common channel management to the special port for it 
*/
[] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeT(?))) -> value rx_rsl {
-   log("Ingnoring TRX Mgmt ", rx_rsl.rsl);
+   log("Forwarding TRX Mgmt ", rx_rsl.rsl);
+   CCHAN_PT.send(rx_rsl);
}
 
+   /* Forward common channel management to the special port for it 
*/
[] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeC(?))) -> value rx_rsl {
-   log("Ignoring Common Channel Mgmt ", rx_rsl.rsl);
+   log("Forwarding Common Channel Mgmt ", rx_rsl.rsl);
+   CCHAN_PT.send(rx_rsl);
}
 
/* blindly acknowledge all channel activations */
-   [] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) 
-> value rx_rsl {
+   [bts_role] 
IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) -> value rx_rsl {
chan_nr := rx_rsl.rsl.ies[0].body.chan_nr;
IPA_PT.send(ts_ASP_RSL_UD(rx_rsl.streamId, 
ts_RSL_CHAN_ACT_ACK(chan_nr, 23)));
}
@@ -367,7 +379,7 @@
self.stop;
}
 
-   [] CLIENT_PT.receive(RSLDC_ChanRqd:?) -> value chan_rqd sender 
vc_conn {
+   [bts_role] CLIENT_PT.receive(RSLDC_ChanRqd:?) -> value chan_rqd 
sender vc_conn {
/* Store the knowledge that this sender has requested a 
certain RQ+time */
f_cid_create(chan_rqd.ra, chan_rqd.fn, vc_conn);
IPA_PT.send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d0460cbb633b470f6117d07643f68aefb1530eb
Gerrit-PatchSet: 1

osmo-ttcn3-hacks[master]: RSL_Emulation: Introduce notion of 'bts_role'

2018-02-21 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0d0460cbb633b470f6117d07643f68aefb1530eb
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]: RSL_Emulation: Introduce notion of 'bts_role'

2018-02-21 Thread Harald Welte

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

RSL_Emulation: Introduce notion of 'bts_role'

So far we assumed we emulate the BTS side and talk to a BSC.

Let's make this configurable and disable the BTS-side spcific code
paths by means of a 'bts_role' boolean type.

Change-Id: I0d0460cbb633b470f6117d07643f68aefb1530eb
---
M library/RSL_Emulation.ttcn
1 file changed, 20 insertions(+), 8 deletions(-)


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

diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index dab1785..5c7dc9c 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -52,6 +52,11 @@
inout RSLDC_ChanRqd, RSL_Message;
 } with { extension "internal" };
 
+type port RSL_CCHAN_PT message {
+   inout ASP_RSL_Unitdata;
+} 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);
 signature RSLEM_suspend(boolean suspend);
@@ -242,6 +247,9 @@
port RSL_DCHAN_PT CLIENT_PT;
port RSLEM_PROC_PT RSL_PROC;
 
+   /* port for Common Channel / TRX Management */
+   port RSL_CCHAN_PT CCHAN_PT;
+
/* state of all concurrent connections / dedicated channels */
var ConnectionData ConnectionTable[64];
 }
@@ -268,7 +276,7 @@
 }
 
 
-function main() runs on RSL_Emulation_CT {
+function main(boolean bts_role := true) runs on RSL_Emulation_CT {
var ASP_RSL_Unitdata rx_rsl;
var RSL_Message rx_rsl_msg;
var RSLDC_ChanRqd chan_rqd;
@@ -286,10 +294,10 @@
alt {
[] IPA_PT.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) {
}
-   [] IPA_PT.receive(ASP_IPA_Event:{up_down := 
ASP_IPA_EVENT_ID_ACK}) {
+   [bts_role] IPA_PT.receive(ASP_IPA_Event:{up_down := 
ASP_IPA_EVENT_ID_ACK}) {

IPA_PT.send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23)));
}
-   [] IPA_PT.receive(tr_RSL(tr_RSL_IMM_ASSIGN)) -> value rx_rsl {
+   [bts_role] IPA_PT.receive(tr_RSL(tr_RSL_IMM_ASSIGN)) -> value 
rx_rsl {
var GsmRrMessage rr;
var OCT1 ra;
var GsmFrameNumber fn;
@@ -327,7 +335,7 @@
}
}
 
-   [] IPA_PT.receive(tr_RSL(tr_RSL_PAGING_CMD(?, ?))) -> value 
rx_rsl {
+   [bts_role] IPA_PT.receive(tr_RSL(tr_RSL_PAGING_CMD(?, ?))) -> 
value rx_rsl {
log("PAGING IDENTITY ", rx_rsl.rsl.ies[2].body.other);
/* broadcast to all clients? */
for (i := 0; i < sizeof(ConnectionTable); i := i + 1) {
@@ -337,16 +345,20 @@
}
}
 
+   /* Forward common channel management to the special port for it 
*/
[] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeT(?))) -> value rx_rsl {
-   log("Ingnoring TRX Mgmt ", rx_rsl.rsl);
+   log("Forwarding TRX Mgmt ", rx_rsl.rsl);
+   CCHAN_PT.send(rx_rsl);
}
 
+   /* Forward common channel management to the special port for it 
*/
[] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeC(?))) -> value rx_rsl {
-   log("Ignoring Common Channel Mgmt ", rx_rsl.rsl);
+   log("Forwarding Common Channel Mgmt ", rx_rsl.rsl);
+   CCHAN_PT.send(rx_rsl);
}
 
/* blindly acknowledge all channel activations */
-   [] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) 
-> value rx_rsl {
+   [bts_role] 
IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) -> value rx_rsl {
chan_nr := rx_rsl.rsl.ies[0].body.chan_nr;
IPA_PT.send(ts_ASP_RSL_UD(rx_rsl.streamId, 
ts_RSL_CHAN_ACT_ACK(chan_nr, 23)));
}
@@ -367,7 +379,7 @@
self.stop;
}
 
-   [] CLIENT_PT.receive(RSLDC_ChanRqd:?) -> value chan_rqd sender 
vc_conn {
+   [bts_role] CLIENT_PT.receive(RSLDC_ChanRqd:?) -> value chan_rqd 
sender vc_conn {
/* Store the knowledge that this sender has requested a 
certain RQ+time */
f_cid_create(chan_rqd.ra, chan_rqd.fn, vc_conn);
IPA_PT.send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,

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

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