PCU: Add test for SNS Change Weight procedure

Change-Id: Ia63865139f63969ccde010b01ddb8fb073209f3a
diff --git a/library/Osmocom_Gb_Types.ttcn b/library/Osmocom_Gb_Types.ttcn
index a0242c3..780c768 100644
--- a/library/Osmocom_Gb_Types.ttcn
+++ b/library/Osmocom_Gb_Types.ttcn
@@ -613,6 +613,29 @@
 		}
 	}
 
+	template (value) PDU_NS ts_SNS_CHG_WEIGHT(Nsei nsei, uint8_t trans_id,
+						  template (omit) IP4_Elements v4,
+						  template (omit) IP6_Elements v6 := omit) := {
+		pDU_SNS_ChangeWeight := {
+			nsPduType := '0E'O,
+			nSEI_NS := ts_NS_IE_NSEI(nsei),
+			transactionID := trans_id,
+			listofIP4Elements := ts_SNS_IE_ListIP4(v4),
+			listofIP6Elements := ts_SNS_IE_ListIP6(v6)
+		}
+	}
+	template PDU_NS tr_SNS_CHG_WEIGHT(template Nsei nsei, template uint8_t trans_id,
+					  template IP4_Elements v4,
+					  template IP6_Elements v6 := omit) := {
+		pDU_SNS_ChangeWeight := {
+			nsPduType := '0E'O,
+			nSEI_NS := tr_NS_IE_NSEI(nsei),
+			transactionID := trans_id,
+			listofIP4Elements := tr_SNS_IE_ListIP4(v4),
+			listofIP6Elements := tr_SNS_IE_ListIP6(v6)
+		}
+	}
+
 
 	template (value) PDU_NS ts_SNS_ACK(Nsei nsei, uint8_t trans_id,
 					   template (omit) NsCause cause := omit,
diff --git a/pcu/PCU_Tests_RAW_SNS.ttcn b/pcu/PCU_Tests_RAW_SNS.ttcn
index 41a4059..2369b04 100644
--- a/pcu/PCU_Tests_RAW_SNS.ttcn
+++ b/pcu/PCU_Tests_RAW_SNS.ttcn
@@ -89,6 +89,19 @@
 	rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 24, omit, v4));
 }
 
+function f_outgoing_sns_chg_weight(integer idx_chg, uint8_t w_sig, uint8_t w_user, integer idx := 0)
+runs on RAW_NS_CT {
+	log("f_outgoing_sns_chg_weight(idx_chg=", idx_chg, ")");
+	var PDU_NS rx;
+	var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_chg].local_ip,
+							     g_nsconfig[idx_chg].local_udp_port,
+							     w_sig, w_user) };
+	NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CHG_WEIGHT(g_nsconfig[idx].nsei, 25, v4)));
+	rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 25, omit, v4));
+}
+
+
+
 
 
 /* PCU-originated SNS-SIZE: successful case */
@@ -225,6 +238,15 @@
 	setverdict(pass);
 }
 
+/* Test changing weights at runtime */
+testcase TC_sns_chg_weight() runs on RAW_NS_CT {
+	f_sns_bringup_1c1u();
+
+	/* change w_user from 1 to 200 */
+	f_outgoing_sns_chg_weight(idx_chg := 1, w_sig := 0, w_user := 200, idx := 0);
+	setverdict(pass);
+}
+
 
 
 control {
@@ -236,6 +258,7 @@
 	execute( TC_sns_1c1u() );
 	execute( TC_sns_add() );
 	execute( TC_sns_del() );
+	execute( TC_sns_chg_weight() );
 }
 
 }