Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370 )

Change subject: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and 
ConnHdlr
..

BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

Before this patch, sending special TRXC commands to FakeTRX, such as
FAKE_TOA and FAKE_RSSI, from ConnHdlr resulted in a receive timeout
waiting for the response.

As it turned out, both the test_CT and the ConnHdlr have a TRXC port,
as depending on the test one would want to globally control it
from test_CT or from within a ConnHdlr.

However, only one of the two should be active (connected) at any given
point in time. Otherwise we'll have two UDP sockets on the same bind
port, and it's more or less random on which of them it ends up.

Let's add an optional parameter 'trxc_comp', which would indicate
whether we need to control TRXC from ConnHdlr or not.

Let's get rid of both f_trxc_connect() and f_main_trxc_connect(),
which basically do the same, but run on different components.

Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Closes: OS#4039
---
M bts/BTS_Tests.ttcn
1 file changed, 37 insertions(+), 37 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Hoernchen: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index ba67889..50aaee7 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -117,7 +117,7 @@
/* L1CTL port (for classic tests) */
port L1CTL_PT L1CTL;

-   /* TRXC port (for classic tests) */
+   /* Optional TRXC connection to FakeTRX (BTS side) */
port TRXC_CODEC_PT BTS_TRXC;
var integer g_bts_trxc_conn_id;

@@ -160,6 +160,7 @@
 type component ConnHdlr extends RSL_DchanHdlr, lapdm_test_CT {
port L1CTL_PT L1CTL;

+   /* Optional TRXC connection to FakeTRX (BTS side) */
port TRXC_CODEC_PT BTS_TRXC;
var integer g_bts_trxc_conn_id;

@@ -333,6 +334,20 @@
}
 }

+private function f_init_trxc(TRXC_CODEC_PT pt, charstring id,
+out integer trxc_conn_id) {
+   var Result res;
+
+   res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(pt, mp_bts_trxc_ip, 
mp_bts_trxc_port,
+  "", -1, -1, { udp := {} 
}, {});
+   if (not ispresent(res.connId)) {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Could not connect to the control 
(TRXC) interface " &
+   "of FakeTRX, check your configuration");
+   }
+   trxc_conn_id := res.connId;
+}
+
 /* global init function */
 function f_init() runs on test_CT {
var charstring id := testcasename();
@@ -398,8 +413,12 @@

if (mp_bts_trxc_port != -1) {
var TrxcMessage ret;
+
+   /* Init TRXC interface to FakeTRX */
+   map(self:BTS_TRXC, system:BTS_TRXC);
+   f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id);
+
/* start with a default moderate timing offset equalling TA=2 */
-   f_main_trxc_connect();
ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, 
valueof(ts_TRXC_FAKE_TIMING(2*256)));
}

@@ -417,7 +436,9 @@
 type function void_fn(charstring id) runs on ConnHdlr;

 /* create a new test component */
-function f_start_handler(void_fn fn, ConnHdlrPars pars, boolean pcu_comp := 
false)
+function f_start_handler(void_fn fn, ConnHdlrPars pars,
+boolean pcu_comp := false,
+boolean trxc_comp := false)
 runs on test_CT return ConnHdlr {
var charstring id := testcasename();
var ConnHdlr vc_conn;
@@ -426,13 +447,18 @@
/* connect to RSL Emulation main component */
connect(vc_conn:RSL, vc_RSL:CLIENT_PT);
connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC);
+
+   /* The ConnHdlr component may want to talk to some ports directly,
+* so we disconnect it from the test_CT and connect it to the component.
+* This obviously only works for one component, i.e. no concurrency. */
if (pcu_comp) {
-   /* the ConnHdlr component wants to talk directly to the PCU, so 
disconnect
-* it from the test_CT and connect it to the component.  This 
obviously only
-* works for one component, i.e. no concurrency */
unmap(self:PCU, system:PCU);
map(vc_conn:PCU, system:PCU);
}
+   if (trxc_comp) {
+   unmap(self:BTS_TRXC, system:BTS_TRXC);
+   map(vc_conn:BTS_TRXC, system:BTS_TRXC);
+   }

vc_conn.start(f_handler_init(fn, id, pars));
return vc_conn;
@@ -459,19 +485,6 @@
f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, ccch_mode, mp_rxlev_exp);
 }

Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370 )

Change subject: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and 
ConnHdlr
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Gerrit-Change-Number: 14370
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 04 Jun 2019 18:46:00 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

2019-06-04 Thread Hoernchen
Hoernchen has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370 )

Change subject: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and 
ConnHdlr
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Gerrit-Change-Number: 14370
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:47:55 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

2019-06-04 Thread fixeria
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370

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

Change subject: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and 
ConnHdlr
..

BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

Before this patch, sending special TRXC commands to FakeTRX, such as
FAKE_TOA and FAKE_RSSI, from ConnHdlr resulted in a receive timeout
waiting for the response.

As it turned out, both the test_CT and the ConnHdlr have a TRXC port,
as depending on the test one would want to globally control it
from test_CT or from within a ConnHdlr.

However, only one of the two should be active (connected) at any given
point in time. Otherwise we'll have two UDP sockets on the same bind
port, and it's more or less random on which of them it ends up.

Let's add an optional parameter 'trxc_comp', which would indicate
whether we need to control TRXC from ConnHdlr or not.

Let's get rid of both f_trxc_connect() and f_main_trxc_connect(),
which basically do the same, but run on different components.

Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Closes: OS#4039
---
M bts/BTS_Tests.ttcn
1 file changed, 37 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/70/14370/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Gerrit-Change-Number: 14370
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

2019-06-04 Thread fixeria
fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370


Change subject: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and 
ConnHdlr
..

BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

Before this patch, sending special TRXC commands to FakeTRX, such as
FAKE_TOA and FAKE_RSSI, from ConnHdlr resulted in a receive timeout
waiting for the response.

As it turned out, both the test_CT and the ConnHdlr have a TRXC port,
as depending on the test one would want to globally control it
from test_CT or from within a ConnHdlr.

However, only one of the two should be active (connected) at any given
point in time. Otherwise we'll have two UDP sockets on the same bind
port, and it's more or less random on which of them it ends up.

Let's add an optional parameter 'trxc_comp', which would indicate
whether we need to control TRXC from ConnHdlr or not.

Let's get rid of both f_trxc_connect() and f_main_trxc_connect(),
which basically do the same, but run on different components.

Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Closes: OS#4039
---
M bts/BTS_Tests.ttcn
1 file changed, 35 insertions(+), 37 deletions(-)



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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index ba67889..b9091cc 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -117,7 +117,7 @@
/* L1CTL port (for classic tests) */
port L1CTL_PT L1CTL;

-   /* TRXC port (for classic tests) */
+   /* Optional TRXC connection to FakeTRX (BTS side) */
port TRXC_CODEC_PT BTS_TRXC;
var integer g_bts_trxc_conn_id;

@@ -160,6 +160,7 @@
 type component ConnHdlr extends RSL_DchanHdlr, lapdm_test_CT {
port L1CTL_PT L1CTL;

+   /* Optional TRXC connection to FakeTRX (BTS side) */
port TRXC_CODEC_PT BTS_TRXC;
var integer g_bts_trxc_conn_id;

@@ -333,6 +334,22 @@
}
 }

+private function f_init_trxc(TRXC_CODEC_PT pt, charstring id,
+out integer trxc_conn_id) {
+   var Result res;
+
+   map(self:BTS_TRXC, system:BTS_TRXC);
+
+   res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(pt, mp_bts_trxc_ip, 
mp_bts_trxc_port,
+  "", -1, -1, { udp := {} 
}, {});
+   if (not ispresent(res.connId)) {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Could not connect to the control 
(TRXC) interface " &
+   "of FakeTRX, check your configuration");
+   }
+   trxc_conn_id := res.connId;
+}
+
 /* global init function */
 function f_init() runs on test_CT {
var charstring id := testcasename();
@@ -399,7 +416,7 @@
if (mp_bts_trxc_port != -1) {
var TrxcMessage ret;
/* start with a default moderate timing offset equalling TA=2 */
-   f_main_trxc_connect();
+   f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id);
ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, 
valueof(ts_TRXC_FAKE_TIMING(2*256)));
}

@@ -417,7 +434,9 @@
 type function void_fn(charstring id) runs on ConnHdlr;

 /* create a new test component */
-function f_start_handler(void_fn fn, ConnHdlrPars pars, boolean pcu_comp := 
false)
+function f_start_handler(void_fn fn, ConnHdlrPars pars,
+boolean pcu_comp := false,
+boolean trxc_comp := false)
 runs on test_CT return ConnHdlr {
var charstring id := testcasename();
var ConnHdlr vc_conn;
@@ -426,13 +445,18 @@
/* connect to RSL Emulation main component */
connect(vc_conn:RSL, vc_RSL:CLIENT_PT);
connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC);
+
+   /* The ConnHdlr component may want to talk to some ports directly,
+* so we disconnect it from the test_CT and connect it to the component.
+* This obviously only works for one component, i.e. no concurrency. */
if (pcu_comp) {
-   /* the ConnHdlr component wants to talk directly to the PCU, so 
disconnect
-* it from the test_CT and connect it to the component.  This 
obviously only
-* works for one component, i.e. no concurrency */
unmap(self:PCU, system:PCU);
map(vc_conn:PCU, system:PCU);
}
+   if (trxc_comp) {
+   unmap(self:BTS_TRXC, system:BTS_TRXC);
+   map(vc_conn:BTS_TRXC, system:BTS_TRXC);
+   }

vc_conn.start(f_handler_init(fn, id, pars));
return vc_conn;
@@ -459,19 +483,6 @@
f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, ccch_mode, mp_rxlev_exp);
 }

-private function f_trxc_connect() runs on ConnHdlr {
-   map(self:BTS_TRXC, system:BTS_TRXC);
-   var Result res;
-   res