remsim: Move PIPEasp generic helper code to library/PIPEasp_Templates.ttcn

This way code can be used and extended for other testsuites.

Change-Id: I4a5ededbd958c87537f84155092b6a6cd715865a
diff --git a/remsim/RemsimClient_Tests.ttcn b/remsim/RemsimClient_Tests.ttcn
index 219573c..d747eef 100644
--- a/remsim/RemsimClient_Tests.ttcn
+++ b/remsim/RemsimClient_Tests.ttcn
@@ -20,6 +20,7 @@
 /* the PIPEasp port allows us to interact with osmo-remsim-client-shell via stdin/stdout */
 import from PIPEasp_PortType all;
 import from PIPEasp_Types all;
+import from PIPEasp_Templates all;
 
 import from RSPRO all;
 import from RSPRO_Types all;
@@ -196,34 +197,13 @@
  * Tests interacting with local remsim-bankd-client via PIPE port
  ***********************************************************************/
 
-template (value) ASP_PExecuteBackground ts_ExecBg(charstring cmd) := {
-	command := cmd
-}
-
-template (present) ASP_PStdout tr_Stdout(template (present) charstring line) := {
-	stdout := line
-}
-
-template (present) ASP_PStderr tr_Stderr(template (present) charstring line) := {
-	stderr := line
-}
-
-template (value) ASP_PStdin ts_Stdin(template (value) charstring line) := {
-	stdin :=line
-}
-
-/* osmo-remsim-client logs to stderr, so we need to ignore that log output */
-private altstep as_ignore_stderr() runs on client_test_CT {
-[] PIPE.receive(tr_Stderr(?)) { repeat; }
-}
-
 /* start a local osmo-remsim-client as sub-process and attach it to PIPE port */
 private function f_init_client_pipe(ClientSlot cs) runs on client_test_CT {
 	var charstring cmdline := mp_client_shell_cmd & " -i 127.0.0.1";
 	map(self:PIPE, system:PIPE);
 	PIPE.send(ts_ExecBg(cmdline & " -c " & int2str(cs.clientId)
 				    & " -n " & int2str(cs.slotNr)));
-	activate(as_ignore_stderr());
+	activate(as_ignore_stderr(PIPE));
 }
 
 /* pretty-print an octet string as series of ASCII encoded hex bytes with spaces */
diff --git a/remsim/gen_links.sh b/remsim/gen_links.sh
index b25375b..615c550 100755
--- a/remsim/gen_links.sh
+++ b/remsim/gen_links.sh
@@ -39,6 +39,7 @@
 
 DIR=../library
 FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_VTY_Functions.ttcn Osmocom_Types.ttcn "
+FILES+="PIPEasp_Templates.ttcn "
 FILES+="IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp IPA_CodecPort.ttcn " #RSL_Types.ttcn RSL_Emulation.ttcn "
 FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn  "
 FILES+="Native_Functions.ttcn Native_FunctionDefs.cc "