SABP (Service Area Broadcast Protocol) definitions

Using ASN.1 syntax copy+pasted from 3GPP TS 25.419 version 15.0.0 Release 15

Change-Id: Iab44cca10a664bbe2823a4183bca055ac8851137
diff --git a/library/sabp/SABP_Templates.ttcn b/library/sabp/SABP_Templates.ttcn
new file mode 100644
index 0000000..a5ed81d
--- /dev/null
+++ b/library/sabp/SABP_Templates.ttcn
@@ -0,0 +1,682 @@
+/* SABP Templates in TTCN-3
+ * (C) 2019 Harald Welte <laforge@gnumonks.org>
+ * 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
+ */
+
+module SABP_Templates {
+
+import from General_Types all;
+
+import from SABP_IEs all;
+import from SABP_CommonDataTypes all;
+import from SABP_Constants all;
+import from SABP_Containers all;
+import from SABP_PDU_Contents all;
+import from SABP_PDU_Descriptions all;
+
+template (value) Service_Area_Identifier ts_SabpSai(template (value) OCT3 plmn_id,
+						    template (value) OCT2 lac,
+						    template (value) OCT2 sac) := {
+	pLMNidentity := plmn_id,
+	lac := lac,
+	sac := sac
+}
+
+/* 9.1.3 WRITE REPLACE */
+template (value) SABP_PDU
+ts_SABP_Write(template (value) BIT16 msg_id, template (value) BIT16 ser_nr,
+	      template (value) Service_Areas_List sa_list, template (value) integer rep_per,
+	      template (value) integer num_bcast, template (value) BIT8 dcs,
+	      template (value) bitstring content) := {
+	initiatingMessage := {
+		procedureCode := id_Write_Replace,
+		criticality := reject,
+		value_ := {
+			Write_Replace := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_New_Serial_Number,
+						criticality := reject,
+						value_ := { New_Serial_Number := ser_nr }
+					}, {
+						/* Optional: Old Serial Number */
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}, {
+						/* Optional: Category */
+						id := SABP_Constants.id_Repetition_Period,
+						criticality := reject,
+						value_ := { Repetition_Period := rep_per }
+					}, {
+						id := SABP_Constants.id_Number_of_Broadcasts_Requested,
+						criticality := reject,
+						value_ := { Number_of_Broadcasts_Requested := num_bcast }
+					}, {
+						id := SABP_Constants.id_Data_Coding_Scheme,
+						criticality := reject,
+						value_ := { Data_Coding_Scheme := dcs }
+					}, {
+						id := SABP_Constants.id_Broadcast_Message_Content,
+						criticality := reject,
+						value_ := { Broadcast_Message_Content := content }
+					}
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_Write(template (present) BIT16 msg_id, template (present) BIT16 ser_nr,
+	      template (present) Service_Areas_List sa_list := ?, template (present) integer rep_per := ?,
+	      template (present) integer num_bcast := ?, template (present) BIT8 dcs := ?,
+	      template (present) bitstring content := ?) := {
+	initiatingMessage := {
+		procedureCode := id_Write_Replace,
+		criticality := reject,
+		value_ := {
+			Write_Replace := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_New_Serial_Number,
+						criticality := reject,
+						value_ := { New_Serial_Number := ser_nr }
+					}, *, /* Optional: Old Serial Number */
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}, * /* Optional: Category */,
+					{
+						id := SABP_Constants.id_Repetition_Period,
+						criticality := reject,
+						value_ := { Repetition_Period := rep_per }
+					}, {
+						id := SABP_Constants.id_Number_of_Broadcasts_Requested,
+						criticality := reject,
+						value_ := { Number_of_Broadcasts_Requested := num_bcast }
+					}, {
+						id := SABP_Constants.id_Data_Coding_Scheme,
+						criticality := reject,
+						value_ := { Data_Coding_Scheme := dcs }
+					}, {
+						id := SABP_Constants.id_Broadcast_Message_Content,
+						criticality := reject,
+						value_ := { Broadcast_Message_Content := content }
+					}
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.4 WRITE REPLACE COMPLETE */
+template (value) SABP_PDU
+ts_SABPWriteCompl(template (value) BIT16 msg_id, template (value) BIT16 ser_nr) := {
+	successfulOutcome := {
+		procedureCode := id_Write_Replace,
+		criticality := reject,
+		value_ := {
+			Write_Replace_Complete := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_New_Serial_Number,
+						criticality := reject,
+						value_ := { New_Serial_Number := ser_nr }
+					}
+					/* Optional: Number of Broadcasts Completed List */
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_WriteCompl(template (present) BIT16 msg_id, template (present) BIT16 ser_nr) := {
+	successfulOutcome := {
+		procedureCode := id_Write_Replace,
+		criticality := reject,
+		value_ := {
+			Write_Replace_Complete := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_New_Serial_Number,
+						criticality := reject,
+						value_ := { New_Serial_Number := ser_nr }
+					}, *
+					/* Optional: Number of Broadcasts Completed List */
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.5 WRITE REPLACE FAILURE */
+template (value) SABP_PDU
+ts_SABP_WriteFail(template (value) BIT16 msg_id, template (value) BIT16 ser_nr,
+		  template (value) Failure_List fail_list) := {
+	unsuccessfulOutcome := {
+		procedureCode := id_Write_Replace,
+		criticality := reject,
+		value_ := {
+			Write_Replace_Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_New_Serial_Number,
+						criticality := reject,
+						value_ := { New_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Failure_List,
+						criticality := reject,
+						value_ := { Failure_List := fail_list }
+					}
+					/* Optional: Number of Broadcasts Completed List */
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_WriteFail(template (present) BIT16 msg_id, template (present) BIT16 ser_nr,
+		  template (present) Failure_List fail_list := ?) := {
+	unsuccessfulOutcome := {
+		procedureCode := id_Write_Replace,
+		criticality := reject,
+		value_ := {
+			Write_Replace_Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_New_Serial_Number,
+						criticality := reject,
+						value_ := { New_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Failure_List,
+						criticality := reject,
+						value_ := { Failure_List := fail_list }
+					}, *
+					/* Optional: Number of Broadcasts Completed List */
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.6 KILL */
+template (value) SABP_PDU
+ts_SABP_Kill(template (value) BIT16 msg_id, template (value) BIT16 ser_nr,
+	     template (value) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Kill,
+		criticality := reject,
+		value_ := {
+			kill_ := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_Old_Serial_Number,
+						criticality := reject,
+						value_ := { Old_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_Kill(template (present) BIT16 msg_id, template (present) BIT16 ser_nr,
+	     template (present) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Kill,
+		criticality := reject,
+		value_ := {
+			kill_ := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_Old_Serial_Number,
+						criticality := reject,
+						value_ := { Old_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.7 KILL COMPLETE */
+template (value) SABP_PDU
+ts_SABP_KillCompl(template (value) BIT16 msg_id, template (value) BIT16 ser_nr,
+		  template (value) Number_of_Broadcasts_Completed_List num_bcast_compl) := {
+	successfulOutcome := {
+		procedureCode := id_Kill,
+		criticality := reject,
+		value_ := {
+			Kill_Complete := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_Old_Serial_Number,
+						criticality := reject,
+						value_ := { Old_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Number_of_Broadcasts_Completed_List,
+						criticality := reject,
+						value_ := { Number_of_Broadcasts_Completed_List := num_bcast_compl }
+					}
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_KillCompl(template (present) BIT16 msg_id, template (present) BIT16 ser_nr,
+		  template (present) Number_of_Broadcasts_Completed_List num_bcast_compl := ?) := {
+	successfulOutcome := {
+		procedureCode := id_Kill,
+		criticality := reject,
+		value_ := {
+			Kill_Complete := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_Old_Serial_Number,
+						criticality := reject,
+						value_ := { Old_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Number_of_Broadcasts_Completed_List,
+						criticality := reject,
+						value_ := { Number_of_Broadcasts_Completed_List := num_bcast_compl }
+					}, *
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+
+/* 9.1.7 KILL FAILURE */
+template (value) SABP_PDU
+ts_SABP_KillFail(template (value) BIT16 msg_id, template (value) BIT16 ser_nr,
+		 template (value) Failure_List fail_list) := {
+	unsuccessfulOutcome := {
+		procedureCode := id_Kill,
+		criticality := reject,
+		value_ := {
+			Kill_Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_Old_Serial_Number,
+						criticality := reject,
+						value_ := { Old_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Failure_List,
+						criticality := reject,
+						value_ := { Failure_List := fail_list }
+					}
+					/* Optional: Number-of-Broadcasts-Completed-List */
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_KillFail(template (present) BIT16 msg_id, template (present) BIT16 ser_nr,
+		 template (present) Failure_List fail_list := ?) := {
+	unsuccessfulOutcome := {
+		procedureCode := id_Kill,
+		criticality := reject,
+		value_ := {
+			Kill_Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := reject,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_Old_Serial_Number,
+						criticality := reject,
+						value_ := { Old_Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Failure_List,
+						criticality := reject,
+						value_ := { Failure_List := fail_list }
+					}, *
+					/* Optional: Number-of-Broadcasts-Completed-List */
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* TODO: Load Query + Complete + Failure */
+/* TODO: Message Status Query + Complete + Failure */
+
+/* 9.1.15 RESET */
+template (value) SABP_PDU
+ts_SABP_Reset(template (value) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Reset,
+		criticality := reject,
+		value_ := {
+			Reset := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_Reset(template (present) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Reset,
+		criticality := reject,
+		value_ := {
+			Reset := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+
+/* 9.1.16 RESET COMPLETE */
+template (value) SABP_PDU
+ts_SABP_ResetCompl(template (value) Service_Areas_List sa_list) := {
+	successfulOutcome := {
+		procedureCode := id_Reset,
+		criticality := reject,
+		value_ := {
+			Reset_Complete := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_ResetCompl(template (present) Service_Areas_List sa_list) := {
+	successfulOutcome := {
+		procedureCode := id_Reset,
+		criticality := reject,
+		value_ := {
+			Reset_Complete := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}, *
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.17 RESET FAILURE */
+template (value) SABP_PDU
+ts_SABP_ResetFail(template (value) Failure_List f_list) := {
+	unsuccessfulOutcome := {
+		procedureCode := id_Reset,
+		criticality := reject,
+		value_ := {
+			Reset_Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Failure_List,
+						criticality := reject,
+						value_ := { Failure_List := f_list }
+					}
+					/* Optional: Service Area List */
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_ResetFail(template (present) Failure_List f_list := ?) := {
+	unsuccessfulOutcome := {
+		procedureCode := id_Reset,
+		criticality := reject,
+		value_ := {
+			Reset_Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Failure_List,
+						criticality := reject,
+						value_ := { Failure_List := f_list }
+					}, *
+					/* Optional: Service Area List */
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.18 RESTART (RNC->CN) */
+template (value) SABP_PDU
+ts_SABP_Restart(template (value) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Restart_Indication,
+		criticality := ignore,
+		value_ := {
+			Restart := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}
+					/* Optional: Recovery_Indication */
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_Restart(template (present) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Restart_Indication,
+		criticality := ignore,
+		value_ := {
+			Restart := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := reject,
+						value_ := { Service_Areas_List := sa_list }
+					}, *
+					/* Optional: Recovery_Indication */
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.19 FAILURE (RNC->CN) */
+template (value) SABP_PDU
+ts_SABP_Failure(template (value) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Failure_Indication,
+		criticality := ignore,
+		value_ := {
+			Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := ignore,
+						value_ := { Service_Areas_List := sa_list }
+					}
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_Failure(template (present) Service_Areas_List sa_list) := {
+	initiatingMessage := {
+		procedureCode := id_Failure_Indication,
+		criticality := ignore,
+		value_ := {
+			Failure := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Service_Areas_List,
+						criticality := ignore,
+						value_ := { Service_Areas_List := sa_list }
+					}
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+/* 9.1.20 ERROR INDICATION (RNC->CN) */
+template (value) SABP_PDU
+ts_SABP_ErrorInd(template (value) BIT16 msg_id, template (value) BIT16 ser_nr,
+		 template (value) Cause cause) := {
+	initiatingMessage := {
+		procedureCode := id_Error_Indication,
+		criticality := ignore,
+		value_ := {
+			Error_Indication := {
+				protocolIEs := {
+					{
+						id := SABP_Constants.id_Message_Identifier,
+						criticality := ignore,
+						value_ := { Message_Identifier := msg_id }
+					}, {
+						id := SABP_Constants.id_Serial_Number,
+						criticality := ignore,
+						value_ := { Serial_Number := ser_nr }
+					}, {
+						id := SABP_Constants.id_Cause,
+						criticality := ignore,
+						value_ :={ Cause := cause }
+					}
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := omit
+			}
+		}
+	}
+}
+template (present) SABP_PDU
+tr_SABP_ErrorInd := {
+	initiatingMessage := {
+		procedureCode := id_Error_Indication,
+		criticality := ignore,
+		value_ := {
+			Error_Indication := {
+				protocolIEs := {
+					*
+					/* Optional: Message-Identifier */
+					/* Optional: Serial-Number */
+					/* Optional: Cause */
+					/* Optional: Criticality-Diagnostics */
+				},
+				protocolExtensions := *
+			}
+		}
+	}
+}
+
+
+
+}
+