WIP: ns: Add test for SNS Size NSEI IE
Related: OS#5208
Change-Id: I3584b7b048031c798cee9566c4cc8694bf6002ac
diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 722f8ec..d5af707 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -67,6 +67,9 @@
}
}
};
+ NsIEI mp_ns_iei_num_ipv4_ep := NS_IEI_NUM_IPv4_EP;
+ NsIEI mp_ns_iei_num_ipv6_ep := NS_IEI_NUM_IPv6_EP;
+ NsIEI mp_ns_iei_nsei := NS_IEI_NSEI;
}
type component RAW_Test_CT extends RAW_NS_CT {
@@ -559,6 +562,53 @@
/* 48.016 SNS test cases */
/* do a succesful SNS configuration */
+function f_send_expect(in integer NSCP_IDX, in template (omit) PDU_NS pdu,
+ in NsCause c) runs on RAW_Test_CT {
+ log("Expected cause: ", c);
+ NSCP[NSCP_IDX].send(pdu);
+ f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig.nsei, c), NSCP_IDX);
+}
+
+function f_set_num_of_ip_endpoints(inout template (omit) PDU_NS base, AddressFamily af) runs on RAW_Test_CT {
+ const integer NUM_IP := 1;
+ if (af == AF_INET) {
+ base.pDU_SNS_Size.numberOfIP4_Endpoints :=
+ {iEI := int2oct(enum2int(mp_ns_iei_num_ipv4_ep), 1),
+ numberOfIP_Endpoints := int2oct(NUM_IP, 2)};
+ } else {
+ base.pDU_SNS_Size.numberOfIP4_Endpoints :=
+ {iEI := int2oct(enum2int(mp_ns_iei_num_ipv6_ep), 1),
+ numberOfIP_Endpoints := int2oct(NUM_IP, 2)};
+ }
+}
+
+/* Send SNS Size PDUs with invalid IEs */
+testcase TC_sns_sgsn_sns_size_syntactically_wrong_NSEI() runs on RAW_Test_CT {
+ f_init_vty();
+ f_init_ns_codec(mp_nsconfig);
+ const integer IDX := 0;
+ /* Assumption: No connections to other NSEs for SUT and testcomponent */
+ const integer sgsn_ip4_endpoints := lengthof(mp_nsconfig.nsvc);
+ const integer ip4_endpoints := lengthof(mp_nsconfig.nsvc);
+ const integer num_of_nsvcs := sgsn_ip4_endpoints * ip4_endpoints;
+ /* Template that would be accepted, only missing the number of IP endpoints
+ * (since there are no ternary operators in TTCN-3...) */
+ var template (omit) PDU_NS ts_base_SNS_SIZE_configured :=
+ ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := num_of_nsvcs,
+ num_v4 := omit, num_v6 := omit);
+ var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[IDX];
+
+ f_set_num_of_ip_endpoints(ts_base_SNS_SIZE_configured, g_nsconfig.nsvc[0].provider.ip.address_family);
+ /* Syntactical error here: length of 1 (has to be >=2) */
+ ts_base_SNS_SIZE_configured.pDU_SNS_Size.nSEI_NS :=
+ {iEI := int2oct(enum2int(mp_ns_iei_nsei), 1), ext := '0'B, lengthIndicator := {length1 := 1},
+ nSEI := int2oct(g_nsconfig.nsei, 2)};
+ const NsCause cause := NS_CAUSE_INVALID_ESSENTIAL_IE;
+ f_send_expect(IDX, ts_base_SNS_SIZE_configured, cause);
+ setverdict(pass);
+ f_clean_ns_codec();
+}
+
testcase TC_sns_bss_config_success() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig);
@@ -1098,6 +1148,7 @@
execute( TC_sns_sgsn_add_change_del() );
execute( TC_sns_sgsn_size_correct_port() );
execute( TC_sns_sgsn_size_after_success() );
+ execute( TC_sns_sgsn_sns_size_syntactically_wrong_NSEI() );
}
}
}