Change in ...osmo-ttcn3-hacks[master]: library: Add S1AP CodecPort/Emulation

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

Change subject: library: Add S1AP CodecPort/Emulation
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15196
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: I9bfba3ab2a3830e590b203c44c03b9c9383fff99
Gerrit-Change-Number: 15196
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Sun, 18 Aug 2019 17:13:53 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: library: Add S1AP CodecPort/Emulation

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

Change subject: library: Add S1AP CodecPort/Emulation
..

library: Add S1AP CodecPort/Emulation

Change-Id: I9bfba3ab2a3830e590b203c44c03b9c9383fff99
---
A library/S1AP_CodecPort.ttcn
A library/S1AP_CodecPort_CtrlFunct.ttcn
A library/S1AP_CodecPort_CtrlFunctDef.cc
A library/S1AP_Emulation.ttcn
M mme/gen_links.sh
M mme/regen_makefile.sh
6 files changed, 871 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/library/S1AP_CodecPort.ttcn b/library/S1AP_CodecPort.ttcn
new file mode 100644
index 000..59cef18
--- /dev/null
+++ b/library/S1AP_CodecPort.ttcn
@@ -0,0 +1,82 @@
+module S1AP_CodecPort {
+
+/* Simple S1AP Codec Port, translating between raw SCTP primitives with
+ * octetstring payload towards the IPL4asp provider, and S1AP primitives
+ * which carry the decoded S1AP data types as payload.
+ *
+ * (C) 2019 by Harald Welte 
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+   import from IPL4asp_PortType all;
+   import from IPL4asp_Types all;
+   import from S1AP_PDU_Descriptions all;
+   import from S1AP_Types all;
+
+   type record S1AP_RecvFrom {
+   ConnectionIdconnId,
+   HostNameremName,
+   PortNumber  remPort,
+   HostNamelocName,
+   PortNumber  locPort,
+   S1AP_PDUmsg
+   };
+
+   template S1AP_RecvFrom t_S1AP_RecvFrom(template S1AP_PDU msg) := {
+   connId := ?,
+   remName := ?,
+   remPort := ?,
+   locName := ?,
+   locPort := ?,
+   msg := msg
+   }
+
+   type record S1AP_Send {
+   ConnectionIdconnId,
+   S1AP_PDUmsg
+   }
+
+   template S1AP_Send t_S1AP_Send(template ConnectionId connId, template 
S1AP_PDU msg) := {
+   connId := connId,
+   msg := msg
+   }
+
+   private function IPL4_to_S1AP_RecvFrom(in ASP_RecvFrom pin, out 
S1AP_RecvFrom pout) {
+   pout.connId := pin.connId;
+   pout.remName := pin.remName;
+   pout.remPort := pin.remPort;
+   pout.locName := pin.locName;
+   pout.locPort := pin.locPort;
+   pout.msg := dec_S1AP_PDU(pin.msg);
+   } with { extension "prototype(fast)" };
+
+   private function S1AP_to_IPL4_Send(in S1AP_Send pin, out ASP_Send pout) 
{
+   pout.connId := pin.connId;
+   pout.proto := {
+   sctp := {
+   sinfo_stream := omit,
+   sinfo_ppid := 18,
+   remSocks := omit,
+   assocId := omit
+   }
+   };
+   pout.msg := enc_S1AP_PDU(pin.msg);
+   } with { extension "prototype(fast)" };
+
+   type port S1AP_CODEC_PT message {
+   out S1AP_Send;
+   in  S1AP_RecvFrom,
+   ASP_ConnId_ReadyToRelease,
+   ASP_Event;
+   } with { extension "user IPL4asp_PT
+   out(S1AP_Send -> ASP_Send:function(S1AP_to_IPL4_Send))
+   in(ASP_RecvFrom -> S1AP_RecvFrom: 
function(IPL4_to_S1AP_RecvFrom);
+  ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: 
simple;
+  ASP_Event -> ASP_Event: simple)"
+   }
+}
diff --git a/library/S1AP_CodecPort_CtrlFunct.ttcn 
b/library/S1AP_CodecPort_CtrlFunct.ttcn
new file mode 100644
index 000..0399199
--- /dev/null
+++ b/library/S1AP_CodecPort_CtrlFunct.ttcn
@@ -0,0 +1,44 @@
+module S1AP_CodecPort_CtrlFunct {
+
+  import from S1AP_CodecPort all;
+  import from IPL4asp_Types all;
+
+  external function f_IPL4_listen(
+inout S1AP_CODEC_PT portRef,
+in HostName locName,
+in PortNumber locPort,
+in ProtoTuple proto,
+in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_connect(
+inout S1AP_CODEC_PT portRef,
+in HostName remName,
+in PortNumber remPort,
+in HostName locName,
+in PortNumber locPort,
+in ConnectionId connId,
+in ProtoTuple proto,
+in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_close(
+inout S1AP_CODEC_PT portRef,
+in ConnectionId id,
+in ProtoTuple proto := { unspecified := {} }
+  ) return Result;
+
+  external function f_IPL4_setUserData(
+inout S1AP_CODEC_PT portRef,
+in ConnectionId id,
+in UserData userData
+  ) return Result;
+
+  

Change in ...osmo-ttcn3-hacks[master]: library: Add S1AP CodecPort/Emulation

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

Change subject: library: Add S1AP CodecPort/Emulation
..


Patch Set 1: Code-Review+1


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


Change in ...osmo-ttcn3-hacks[master]: library: Add S1AP CodecPort/Emulation

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


Change subject: library: Add S1AP CodecPort/Emulation
..

library: Add S1AP CodecPort/Emulation

Change-Id: I9bfba3ab2a3830e590b203c44c03b9c9383fff99
---
A library/S1AP_CodecPort.ttcn
A library/S1AP_CodecPort_CtrlFunct.ttcn
A library/S1AP_CodecPort_CtrlFunctDef.cc
A library/S1AP_Emulation.ttcn
M mme/gen_links.sh
M mme/regen_makefile.sh
6 files changed, 871 insertions(+), 1 deletion(-)



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

diff --git a/library/S1AP_CodecPort.ttcn b/library/S1AP_CodecPort.ttcn
new file mode 100644
index 000..59cef18
--- /dev/null
+++ b/library/S1AP_CodecPort.ttcn
@@ -0,0 +1,82 @@
+module S1AP_CodecPort {
+
+/* Simple S1AP Codec Port, translating between raw SCTP primitives with
+ * octetstring payload towards the IPL4asp provider, and S1AP primitives
+ * which carry the decoded S1AP data types as payload.
+ *
+ * (C) 2019 by Harald Welte 
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+   import from IPL4asp_PortType all;
+   import from IPL4asp_Types all;
+   import from S1AP_PDU_Descriptions all;
+   import from S1AP_Types all;
+
+   type record S1AP_RecvFrom {
+   ConnectionIdconnId,
+   HostNameremName,
+   PortNumber  remPort,
+   HostNamelocName,
+   PortNumber  locPort,
+   S1AP_PDUmsg
+   };
+
+   template S1AP_RecvFrom t_S1AP_RecvFrom(template S1AP_PDU msg) := {
+   connId := ?,
+   remName := ?,
+   remPort := ?,
+   locName := ?,
+   locPort := ?,
+   msg := msg
+   }
+
+   type record S1AP_Send {
+   ConnectionIdconnId,
+   S1AP_PDUmsg
+   }
+
+   template S1AP_Send t_S1AP_Send(template ConnectionId connId, template 
S1AP_PDU msg) := {
+   connId := connId,
+   msg := msg
+   }
+
+   private function IPL4_to_S1AP_RecvFrom(in ASP_RecvFrom pin, out 
S1AP_RecvFrom pout) {
+   pout.connId := pin.connId;
+   pout.remName := pin.remName;
+   pout.remPort := pin.remPort;
+   pout.locName := pin.locName;
+   pout.locPort := pin.locPort;
+   pout.msg := dec_S1AP_PDU(pin.msg);
+   } with { extension "prototype(fast)" };
+
+   private function S1AP_to_IPL4_Send(in S1AP_Send pin, out ASP_Send pout) 
{
+   pout.connId := pin.connId;
+   pout.proto := {
+   sctp := {
+   sinfo_stream := omit,
+   sinfo_ppid := 18,
+   remSocks := omit,
+   assocId := omit
+   }
+   };
+   pout.msg := enc_S1AP_PDU(pin.msg);
+   } with { extension "prototype(fast)" };
+
+   type port S1AP_CODEC_PT message {
+   out S1AP_Send;
+   in  S1AP_RecvFrom,
+   ASP_ConnId_ReadyToRelease,
+   ASP_Event;
+   } with { extension "user IPL4asp_PT
+   out(S1AP_Send -> ASP_Send:function(S1AP_to_IPL4_Send))
+   in(ASP_RecvFrom -> S1AP_RecvFrom: 
function(IPL4_to_S1AP_RecvFrom);
+  ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: 
simple;
+  ASP_Event -> ASP_Event: simple)"
+   }
+}
diff --git a/library/S1AP_CodecPort_CtrlFunct.ttcn 
b/library/S1AP_CodecPort_CtrlFunct.ttcn
new file mode 100644
index 000..0399199
--- /dev/null
+++ b/library/S1AP_CodecPort_CtrlFunct.ttcn
@@ -0,0 +1,44 @@
+module S1AP_CodecPort_CtrlFunct {
+
+  import from S1AP_CodecPort all;
+  import from IPL4asp_Types all;
+
+  external function f_IPL4_listen(
+inout S1AP_CODEC_PT portRef,
+in HostName locName,
+in PortNumber locPort,
+in ProtoTuple proto,
+in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_connect(
+inout S1AP_CODEC_PT portRef,
+in HostName remName,
+in PortNumber remPort,
+in HostName locName,
+in PortNumber locPort,
+in ConnectionId connId,
+in ProtoTuple proto,
+in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_close(
+inout S1AP_CODEC_PT portRef,
+in ConnectionId id,
+in ProtoTuple proto := { unspecified := {} }
+  ) return Result;
+
+  external function f_IPL4_setUserData(
+inout S1AP_CODEC_PT portRef,
+in ConnectionId id,
+in UserData userData
+  ) return Result;
+
+  external function f_IPL4_getUserData(
+inout