Change in ...osmo-ttcn3-hacks[master]: mme: Extend MME tests to also include S1AP interface testing

2019-08-18 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15203 )

Change subject: mme: Extend MME tests to also include S1AP interface testing
..

mme: Extend MME tests to also include S1AP interface testing

The tests so far only tested SGsAP alone, which doesn't get us very
far.  Let's add interfacing with the S1, too.

Change-Id: Id54071b901db720a0f88b91cdc5a8e09bea0fb58
---
A mme/MME_Tests.cfg
A mme/MME_Tests.default
M mme/MME_Tests.ttcn
M mme/MME_Tests_SGsAP.ttcn
M mme/gen_links.sh
M mme/regen_makefile.sh
6 files changed, 399 insertions(+), 25 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/mme/MME_Tests.cfg b/mme/MME_Tests.cfg
new file mode 100644
index 000..3e478c3
--- /dev/null
+++ b/mme/MME_Tests.cfg
@@ -0,0 +1,18 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./MME_Tests.default"
+
+# Local configuration below
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+MME_Tests.control
diff --git a/mme/MME_Tests.default b/mme/MME_Tests.default
new file mode 100644
index 000..1c220d8
--- /dev/null
+++ b/mme/MME_Tests.default
@@ -0,0 +1,12 @@
+[LOGGING]
+FileMask := LOG_ALL | TTCN_MATCHING;
+mtc.FileMask := ERROR | WARNING | PARALLEL | VERDICTOP;
+
+[TESTPORT_PARAMETERS]
+
+
+[MODULE_PARAMETERS]
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn
index 3ba0677..ae71173 100644
--- a/mme/MME_Tests.ttcn
+++ b/mme/MME_Tests.ttcn
@@ -10,31 +10,84 @@

 module MME_Tests {

+import from General_Types all;
+
+import from S1AP_Types all;
+import from S1AP_Templates all;
+import from S1AP_Emulation all;
+import from S1AP_PDU_Descriptions all;
+import from S1AP_IEs all;
+
+import from NAS_EPS_Types all;
+import from NAS_Templates all;
+
 import from SGsAP_Types all;
 import from SGsAP_Templates all;
 import from SGsAP_Emulation all;

+import from LTE_CryptoFunctions all;
+
 import from L3_Templates all;
 import from DNS_Helpers all;
+import from Osmocom_Types all;

 friend module MME_Tests_SGsAP;

+/* (maximum) number of emulated eNBs */
+const integer NUM_ENB := 3;
+
+/* (maximum) number of emulated UEs */
+const integer NUM_UE := 3;
+
+/* parameters of emulated ENB */
+type record EnbParams {
+   Global_ENB_ID global_enb_id,
+   integer cell_identity,
+   SupportedTAs supported_tas
+}
+
+/* parameters of emulated UE */
+type record UeParams {
+   hexstring imsi
+}
+
 type component MTC_CT {
+   /* S1 intreface of emulated ENBs */
+   var EnbParams g_enb_pars[NUM_ENB];
+   var S1AP_Emulation_CT vc_S1AP[NUM_ENB];
+   port S1AP_PT S1AP_UNIT[NUM_ENB];
+   port S1APEM_PROC_PT S1AP_PROC[NUM_ENB];
+
+   /* SGs interface of emulated MSC/VLR */
var SGsAP_Emulation_CT vc_SGsAP;
port SGsAP_PT SGsAP_UNIT;
port SGsAPEM_PROC_PT SGsAP_PROC;
+
+   var UeParams g_ue_pars[NUM_UE];
 }

-type component ConnHdlr extends SGsAP_ConnHdlr {
+type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr {
var ConnHdlrPars g_pars;
timer g_Tguard := 30.0;
 }

 type record ConnHdlrPars {
-   hexstring imsi
+   /* copied over from MTC_CT on start of component */
+   EnbParams enb_pars[NUM_ENB],
+   /* copied over from MTC_CT on start of component */
+   UeParams ue_pars,
+   /* currently used MME (index into enb_pars, S1AP, ...) */
+   integer mme_idx
 }

 modulepar {
+   /* S1 interface */
+   charstring mp_mme_ip := "127.0.0.1";
+   integer mp_mme_s1ap_port := 36412;
+   charstring mp_s1_local_ip := "127.0.0.1";
+   integer mp_s1_local_port := 5;
+
+   /* SGs interface */
charstring mp_sgs_local_ip := "127.0.0.1";
integer mp_sgs_local_port := 29118;
charstring mp_vlr_name := "vlr.example.net";
@@ -68,11 +121,96 @@
vc_SGsAP.start(SGsAP_Emulation.main(ops, pars, id));
 }

+/* send incoming unit data messages (like reset) to global S1AP_UNIT port */
+friend function S1apForwardUnitdataCallback(S1AP_PDU msg)
+runs on S1AP_Emulation_CT return template S1AP_PDU {
+   S1AP_UNIT.send(msg);
+   return omit;
+}
+
+friend function S1apCreateCallback(S1AP_PDU msg, template (omit) 
MME_UE_S1AP_ID mme_id,
+  template (omit) ENB_UE_S1AP_ID enb_id, 
charstring id)
+runs on S1AP_Emulation_CT return S1AP_ConnHdlr
+{
+   setverdict(fail, "implement this");
+   mtc.stop;
+}
+
+friend function f_init_one_enb(charstring id, integer num := 0) runs on MTC_CT 
{
+   id := id & "-S1AP" & int2str(num);
+   var S1APOps ops := {
+   create_cb := refers(S1apCreateCallback),
+   unitdata_cb := refers(S1apForwardUnitdataCallback)
+   }
+   var 

Change in ...osmo-ttcn3-hacks[master]: mme: Extend MME tests to also include S1AP interface testing

2019-08-14 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15203 )

Change subject: mme: Extend MME tests to also include S1AP interface testing
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15203
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: Id54071b901db720a0f88b91cdc5a8e09bea0fb58
Gerrit-Change-Number: 15203
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 14 Aug 2019 11:33:12 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: mme: Extend MME tests to also include S1AP interface testing

2019-08-14 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15203


Change subject: mme: Extend MME tests to also include S1AP interface testing
..

mme: Extend MME tests to also include S1AP interface testing

The tests so far only tested SGsAP alone, which doesn't get us very
far.  Let's add interfacing with the S1, too.

Change-Id: Id54071b901db720a0f88b91cdc5a8e09bea0fb58
---
A mme/MME_Tests.cfg
A mme/MME_Tests.default
M mme/MME_Tests.ttcn
M mme/MME_Tests_SGsAP.ttcn
M mme/gen_links.sh
M mme/regen_makefile.sh
6 files changed, 399 insertions(+), 25 deletions(-)



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

diff --git a/mme/MME_Tests.cfg b/mme/MME_Tests.cfg
new file mode 100644
index 000..3e478c3
--- /dev/null
+++ b/mme/MME_Tests.cfg
@@ -0,0 +1,18 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./MME_Tests.default"
+
+# Local configuration below
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+MME_Tests.control
diff --git a/mme/MME_Tests.default b/mme/MME_Tests.default
new file mode 100644
index 000..1c220d8
--- /dev/null
+++ b/mme/MME_Tests.default
@@ -0,0 +1,12 @@
+[LOGGING]
+FileMask := LOG_ALL | TTCN_MATCHING;
+mtc.FileMask := ERROR | WARNING | PARALLEL | VERDICTOP;
+
+[TESTPORT_PARAMETERS]
+
+
+[MODULE_PARAMETERS]
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn
index 3ba0677..ae71173 100644
--- a/mme/MME_Tests.ttcn
+++ b/mme/MME_Tests.ttcn
@@ -10,31 +10,84 @@

 module MME_Tests {

+import from General_Types all;
+
+import from S1AP_Types all;
+import from S1AP_Templates all;
+import from S1AP_Emulation all;
+import from S1AP_PDU_Descriptions all;
+import from S1AP_IEs all;
+
+import from NAS_EPS_Types all;
+import from NAS_Templates all;
+
 import from SGsAP_Types all;
 import from SGsAP_Templates all;
 import from SGsAP_Emulation all;

+import from LTE_CryptoFunctions all;
+
 import from L3_Templates all;
 import from DNS_Helpers all;
+import from Osmocom_Types all;

 friend module MME_Tests_SGsAP;

+/* (maximum) number of emulated eNBs */
+const integer NUM_ENB := 3;
+
+/* (maximum) number of emulated UEs */
+const integer NUM_UE := 3;
+
+/* parameters of emulated ENB */
+type record EnbParams {
+   Global_ENB_ID global_enb_id,
+   integer cell_identity,
+   SupportedTAs supported_tas
+}
+
+/* parameters of emulated UE */
+type record UeParams {
+   hexstring imsi
+}
+
 type component MTC_CT {
+   /* S1 intreface of emulated ENBs */
+   var EnbParams g_enb_pars[NUM_ENB];
+   var S1AP_Emulation_CT vc_S1AP[NUM_ENB];
+   port S1AP_PT S1AP_UNIT[NUM_ENB];
+   port S1APEM_PROC_PT S1AP_PROC[NUM_ENB];
+
+   /* SGs interface of emulated MSC/VLR */
var SGsAP_Emulation_CT vc_SGsAP;
port SGsAP_PT SGsAP_UNIT;
port SGsAPEM_PROC_PT SGsAP_PROC;
+
+   var UeParams g_ue_pars[NUM_UE];
 }

-type component ConnHdlr extends SGsAP_ConnHdlr {
+type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr {
var ConnHdlrPars g_pars;
timer g_Tguard := 30.0;
 }

 type record ConnHdlrPars {
-   hexstring imsi
+   /* copied over from MTC_CT on start of component */
+   EnbParams enb_pars[NUM_ENB],
+   /* copied over from MTC_CT on start of component */
+   UeParams ue_pars,
+   /* currently used MME (index into enb_pars, S1AP, ...) */
+   integer mme_idx
 }

 modulepar {
+   /* S1 interface */
+   charstring mp_mme_ip := "127.0.0.1";
+   integer mp_mme_s1ap_port := 36412;
+   charstring mp_s1_local_ip := "127.0.0.1";
+   integer mp_s1_local_port := 5;
+
+   /* SGs interface */
charstring mp_sgs_local_ip := "127.0.0.1";
integer mp_sgs_local_port := 29118;
charstring mp_vlr_name := "vlr.example.net";
@@ -68,11 +121,96 @@
vc_SGsAP.start(SGsAP_Emulation.main(ops, pars, id));
 }

+/* send incoming unit data messages (like reset) to global S1AP_UNIT port */
+friend function S1apForwardUnitdataCallback(S1AP_PDU msg)
+runs on S1AP_Emulation_CT return template S1AP_PDU {
+   S1AP_UNIT.send(msg);
+   return omit;
+}
+
+friend function S1apCreateCallback(S1AP_PDU msg, template (omit) 
MME_UE_S1AP_ID mme_id,
+  template (omit) ENB_UE_S1AP_ID enb_id, 
charstring id)
+runs on S1AP_Emulation_CT return S1AP_ConnHdlr
+{
+   setverdict(fail, "implement this");
+   mtc.stop;
+}
+
+friend function f_init_one_enb(charstring id, integer num := 0) runs on MTC_CT 
{
+   id := id & "-S1AP" & int2str(num);
+   var S1APOps ops := {
+   create_cb := refers(S1apCreateCallback),
+   unitdata_cb := refers(S1apForwardUnitdataCallback)
+   }
+   var