[PATCH] osmo-ttcn3-hacks[master]: sgsn: Add TC_attach_pdp_act_user_deact_mo

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Feb 18 21:28:45 UTC 2018


Review at  https://gerrit.osmocom.org/6586

sgsn: Add TC_attach_pdp_act_user_deact_mo

Change-Id: I43cb7728658cae6590eb1bd31c7c285b942a265e
---
M library/GTP_Templates.ttcn
M library/L3_Templates.ttcn
M sgsn/SGSN_Tests.ttcn
3 files changed, 118 insertions(+), 3 deletions(-)


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

diff --git a/library/GTP_Templates.ttcn b/library/GTP_Templates.ttcn
index f071d04..ef7e97b 100644
--- a/library/GTP_Templates.ttcn
+++ b/library/GTP_Templates.ttcn
@@ -495,6 +495,27 @@
 					valueof(ts_DeletePdpPDU(nsapi, teardown_ind)), seq)
 	}
 
+	template GTPC_PDUs ts_DeletePdpRespPDU(OCT1 cause,
+						template ProtConfigOptions pco := omit) := {
+		deletePDPContextResponse := {
+			cause := { '00'O, cause },
+			protConfigOptions := pco,
+			userLocationInformation := omit,
+			mS_TimeZone := omit,
+			uLI_Timestamp := omit,
+			private_extension_gtpc := omit
+		}
+	}
+
+	template Gtp1cUnitdata ts_GTPC_DeletePdpResp(GtpPeer peer, uint16_t seq, OCT4 teid,
+						OCT1 cause,
+						template ProtConfigOptions pco := omit) := {
+		peer := peer,
+		gtpc := ts_GTP1C_PDU(deletePDPContextResponse, teid,
+					valueof(ts_DeletePdpRespPDU(cause, pco)), seq)
+	}
+
+
 
 	/* GTP-U */
 
diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index ffabff4..e1947b2 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -1904,6 +1904,61 @@
 	}
 }
 
+template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_REQ_MO(BIT3 tid, OCT1 cause, boolean tdown := false,
+						  template (omit) ProtocolConfigOptionsV pco := omit
+						) := {
+	discriminator := '0000'B, /* overwritten */
+	tiOrSkip := {
+		transactionId := {
+			tio := tid,
+			tiFlag := '0'B,
+			tIExtension := omit
+		}
+	},
+	msgs := {
+		gprs_sm := {
+			deactivatePDPContextRequest := {
+				messageType := '00000000'B, /* overwritten */
+				smCause := cause,
+				tearDownIndicator := {
+					tearDownIndicatorV := {
+						tdi_flag := bool2bit(tdown),
+						spare := '000'B
+					},
+					elementIdentifier := '1001'B
+				},
+				protocolConfigOpts := ts_PcoTLV(pco),
+				mBMSprotocolConfigOptions := omit,
+				t3396 := omit,
+				wLANOffloadIndication := omit,
+				nBIFOM_Container := omit
+			}
+		}
+	}
+}
+
+template PDU_L3_SGSN_MS tr_SM_DEACT_PDP_ACCEPT_MT(template BIT3 tid := ?)
+:= {
+	discriminator := '1010'B,
+	tiOrSkip := {
+		transactionId := {
+			tio := tid,
+			tiFlag := '1'B,
+			tIExtension := omit
+		}
+	},
+	msgs := {
+		gprs_sm := {
+			deactivatePDPContextAccept := {
+				messageType := '01000111'B,
+				protocolConfigOpts := *,
+				mBMSprotocolConfigOptions := *,
+				nBIFOM_Container := *
+			}
+		}
+	}
+}
+
 
 
 private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 4369078..06ed56b 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -257,14 +257,12 @@
    * ATTACH / RAU
    ** with / without authentication
    ** with / without P-TMSI allocation
-   ** reject from HLR on SAI
-   ** reject from HLR on UL
    * re-transmissions of LLC frames
    * PDP Context activation
    ** with different GGSN config in SGSN VTY
    ** with different PDP context type (v4/v6/v46)
    ** timeout from GGSN
-   ** reject from GGSN
+   ** multiple / secondary PDP context
  */
 
 testcase TC_wait_ns_up() runs on test_CT {
@@ -826,6 +824,25 @@
 	}
 }
 
+function f_pdp_ctx_deact_mo(inout PdpActPars apars, OCT1 cause) runs on BSSGP_ConnHdlr {
+	var boolean exp_rej := ispresent(apars.exp_rej_cause);
+	var Gtp1cUnitdata g_ud;
+
+	BSSGP.send(ts_SM_DEACT_PDP_REQ_MO(apars.tid, cause, false, omit));
+	GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud {
+		var integer seq_nr := oct2int(g_ud.gtpc.opt_part.sequenceNumber);
+		BSSGP.clear;
+		GTP.send(ts_GTPC_DeletePdpResp(g_ud.peer, seq_nr, apars.sgsn_tei_c, '7F'O));
+	}
+	alt {
+	[] BSSGP.receive(tr_BD_L3_MT(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid))) {
+		setverdict(pass);
+		}
+	[] as_xid(apars);
+	}
+}
+
+
 /* Table 10.5.156/3GPP TS 24.008 */
 template (value) QoSV t_QosDefault := {
 	reliabilityClass := '011'B, /* unacknowledged GTP+LLC, acknowledged RLC */
@@ -1057,6 +1074,27 @@
 	vc_conn.done;
 }
 
+/* ATTACH + PDP CTX ACT + user plane traffic + PDP CTX DEACT in MO direction */
+private function f_TC_attach_pdp_act_user_deact_mo(charstring id) runs on BSSGP_ConnHdlr {
+	var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+
+	/* first perform regular attach */
+	f_TC_attach(id);
+	/* then activate PDP context */
+	f_pdp_ctx_act(apars);
+	/* then transceive a downlink PDU */
+	f_gtpu_xceive_mt(apars, f_rnd_octstring(100));
+	f_gtpu_xceive_mo(apars, f_rnd_octstring(200));
+
+	f_pdp_ctx_deact_mo(apars, '00'O);
+}
+testcase TC_attach_pdp_act_user_deact_mo() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_user_deact_mo), testcasename(), g_gb[0], 21);
+	vc_conn.done;
+}
+
 
 control {
 	execute( TC_attach() );
@@ -1078,6 +1116,7 @@
 	execute( TC_pdp_act_unattached() );
 	execute( TC_attach_pdp_act_user() );
 	execute( TC_attach_pdp_act_ggsn_reject() );
+	execute( TC_attach_pdp_act_user_deact_mo() );
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/6586
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I43cb7728658cae6590eb1bd31c7c285b942a265e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list