sgsn: First PDP CTX ACT test: TC_attach_pdp_act

Change-Id: Ia1bfaca99a2a70bb097e2ee44f54e4a31b849a1b
diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 9bd74db..73d2818 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -1766,6 +1766,130 @@
 	}
 }
 
+
+function ts_ApnTLV(template (omit) octetstring apn) return template (omit) AccessPointNameTLV {
+	if (istemplatekind(apn, "omit")) {
+		return omit;
+	} else {
+		var template (omit) AccessPointNameTLV ret := {
+			elementIdentifier := '28'O,
+			lengthIndicator := 0, /* overwritten */
+			accessPointNameValue := apn
+		}
+		return ret;
+	}
+}
+
+function ts_PcoTLV(template (omit) ProtocolConfigOptionsV pco)
+					return template (omit) ProtocolConfigOptionsTLV {
+	if (istemplatekind(pco, "omit")) {
+		return omit;
+	} else {
+		var template (omit) ProtocolConfigOptionsTLV ret := {
+			elementIdentifier := '27'O,
+			lengthIndicator := 0, /* overwritten */
+			protocolConfigOptionsV := pco
+		}
+		return ret;
+	}
+}
+
+template (value) PDU_L3_MS_SGSN ts_SM_ACT_PDP_REQ(BIT3 tid, BIT4 nsapi, BIT4 sapi, QoSV qos,
+						  PDPAddressV addr,
+						  template (omit) octetstring apn := omit,
+						  template (omit) ProtocolConfigOptionsV pco := omit
+						) := {
+	discriminator := '0000'B, /* overwritten */
+	tiOrSkip := {
+		transactionId := {
+			tio := tid,
+			tiFlag := '0'B,
+			tIExtension := omit
+		}
+	},
+	msgs := {
+		gprs_sm := {
+			activatePDPContextRequest := {
+				messageType := '00000000'B, /* overwritten */
+				requestedNSAPI := { nsapi, '0000'B },
+				requestedLLCSAPI := { sapi, '0000'B },
+				requestedQoS := {
+					lengthIndicator := 0, /* overwritten */
+					qoSV := qos
+				},
+				requestedPDPaddress := {
+					lengthIndicator := 0, /* overwritten */
+					pdpAddressV := addr
+				},
+				accessPointName := ts_ApnTLV(apn),
+				protocolConfigOpts := ts_PcoTLV(pco),
+				requestType := omit,
+				deviceProperties := omit,
+				nBIFOM_Container := omit
+			}
+		}
+	}
+}
+
+template PDU_L3_SGSN_MS tr_SM_ACT_PDP_REJ(template BIT3 tid := ?, template OCT1 cause := ?) := {
+	discriminator := '1010'B,
+	tiOrSkip := {
+		transactionId := {
+			tio := tid,
+			tiFlag := '1'B,
+			tIExtension := omit
+		}
+	},
+	msgs := {
+		gprs_sm := {
+			activatePDPContextReject := {
+				messageType := '01001111'B,
+				smCause := cause,
+				protocolConfigOpts := *,
+				backOffTimer := *,
+				reAttemptIndicator := *,
+				nBIFOM_Container := *
+			}
+		}
+	}
+}
+
+template PDU_L3_SGSN_MS tr_SM_ACT_PDP_ACCEPT(template BIT3 tid := ?, template BIT4 sapi := ?,
+					     template QoSV qos := ?)
+:= {
+	discriminator := '1010'B,
+	tiOrSkip := {
+		transactionId := {
+			tio := tid,
+			tiFlag := '1'B,
+			tIExtension := omit
+		}
+	},
+	msgs := {
+		gprs_sm := {
+			activatePDPContextAccept := {
+				messageType := '01000010'B,
+				negotiatedLLCSAPI := { sapi, '0000'B },
+				negotiatedQoS := {
+					lengthIndicator := ?,
+					qoSV := qos
+				},
+				radioPriority := ?,
+				spare := '0000'B,
+				pdpAddress := *,
+				protocolConfigOpts := *,
+				packetFlowID := *,
+				sMCause2 := *,
+				connectivityType := *,
+				wLANOffloadIndication := *,
+				nBIFOM_Container := *
+			}
+		}
+	}
+}
+
+
+
 private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
 	var integer suffix_len := tot_len - lengthof(prefix);
 	var charstring suffix_ch := int2str(suffix);