bts: Proper tear down

This way we stop vc_IPA_OML before stopping the main component.
If we don't do this, the vc_IPA_OML is potentially receiving tons of OML
messages during BTS bringup which it tries to forward to the main
component. If the main component has stopped at that point, port
IPA_OML_PORT is no longer active and hence vc_IPA_OML fails with a
dynamic test error.

Change-Id: I761ae94aa698a74bb30b8a6b1860358545f222b5
diff --git a/bts/BTS_Tests_OML.ttcn b/bts/BTS_Tests_OML.ttcn
index ac66c02..e3099e2 100644
--- a/bts/BTS_Tests_OML.ttcn
+++ b/bts/BTS_Tests_OML.ttcn
@@ -152,6 +152,11 @@
 	pt.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, testcasename())));
 }
 
+private function f_shutdown_helper() runs on BSC_OML_CT
+{
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass);
+}
+
 /* Perform an "OPSTART" procedure with the speciifed MO" */
 private function f_oml_opstart(template (value) OML_FOM_ObjectClass obj_class,
 				template (value) OML_FOM_ObjectInstance obj_inst,
@@ -431,6 +436,7 @@
 testcase TC_oml_nothing() runs on BSC_OML_CT {
 	f_init_oml(testcasename());
 	f_sleep(100.0);
+	f_shutdown_helper();
 }
 
 /* test behavior for unsupported message discriminator */
@@ -447,6 +453,7 @@
 	};
 
 	f_oml_send_exp_fail_rep(mmi_pdu, "Unexpected response to MMI message");
+	f_shutdown_helper();
 }
 
 /* send a message of unknown/unsupported type */
@@ -455,6 +462,7 @@
 	var OML_PDU tx := valueof(ts_OML_MsgType(NM_MT_ESTABLISH_TEI, NM_OC_BTS,
 						 ts_OML_ObjectInstance(0, 255, 255), omit));
 	f_oml_send_exp_fail_rep(tx, "ESTABLISH_TEI");
+	f_shutdown_helper();
 }
 
 /* send message shorter than OML header length indicates */
@@ -468,6 +476,7 @@
 							  ts_OML_ObjectInstance(0, 255, 255),
 							  ?, ?, ?);
 	f_oml_exp_rx(exp_fail, "Failure Event Report");
+	f_shutdown_helper();
 }
 
 /* send message longer than OML header length indicates */
@@ -480,6 +489,7 @@
 		tr_OML_ChangeAdmStateACK(NM_OC_BTS, ts_OML_ObjectInstance(0, 255, 255),
 					 NM_STATE_LOCKED);
 	f_oml_exp_rx(exp, "Change ADM State ACK");
+	f_shutdown_helper();
 }
 
 /* test behavior for unsupported placement (!= ONLY) */
@@ -499,6 +509,7 @@
 
 	pdu.placement := ABIS_OM_PLACEMENT_LAST;
 	f_oml_send_exp_fail_rep(pdu, "Unexpected response to PLACEMENT_LAST");
+	f_shutdown_helper();
 }
 
 /* test behavior for sequence != 0 (invalid if mdisc == ONLY) */
@@ -513,6 +524,7 @@
 
 	pdu.sequence := 23;
 	f_oml_send_exp_fail_rep(pdu, "Unexpected response to sequence != 0");
+	f_shutdown_helper();
 }
 
 /* test behavior for unsupported obj_class */
@@ -526,6 +538,7 @@
 
 	/* NM_NACK_OBJCLASS_INVAL */
 	f_oml_send_exp_nack(pdu, NM_NACK_OBJCLASS_NOTSUPP);
+	f_shutdown_helper();
 }
 
 /* test behavior for wrong BTS number in object instance */
@@ -537,6 +550,7 @@
 	var OML_PDU pdu := valueof(ts_OML_ChangeAdmState(obj_class, obj_inst, NM_STATE_LOCKED));
 
 	f_oml_send_exp_nack(pdu, NM_NACK_BTSNR_UNKN);
+	f_shutdown_helper();
 }
 
 /* test behavior for wrong TRX number in object instance */
@@ -548,6 +562,7 @@
 	var OML_PDU pdu := valueof(ts_OML_ChangeAdmState(obj_class, obj_inst, NM_STATE_LOCKED));
 
 	f_oml_send_exp_nack(pdu, NM_NACK_TRXNR_UNKN);
+	f_shutdown_helper();
 }
 
 /* test behavior for wrong TS number in object instance */
@@ -559,6 +574,7 @@
 	var OML_PDU pdu := valueof(ts_OML_ChangeAdmState(obj_class, obj_inst, NM_STATE_LOCKED));
 
 	f_oml_send_exp_nack(pdu, NM_NACK_OBJINST_UNKN);
+	f_shutdown_helper();
 }
 
 /* RADIO CARRIER: Test OPSTART with SET BTS ATTRIBUTES; expect ACK */
@@ -570,6 +586,7 @@
 
 	f_oml_radio_attr(0);
 	f_oml_opstart(obj_class, obj_inst);
+	f_shutdown_helper();
 }
 
 /* RADIO CARRIER: Test OPSTART without SET BTS ATTRIBUTES; expect NACK */
@@ -581,6 +598,7 @@
 
 	/* we are *not* setting any attributes here */
 	f_oml_opstart(obj_class, obj_inst, exp_fail := true);
+	f_shutdown_helper();
 }
 
 
@@ -600,6 +618,7 @@
 
 	f_oml_bts_setattr();
 	f_oml_opstart(obj_class, obj_inst, false, NM_OPSTATE_ENABLED);
+	f_shutdown_helper();
 }
 
 
@@ -612,6 +631,7 @@
 
 	/* we are *not* setting any attributes here */
 	f_oml_opstart(obj_class, obj_inst, exp_fail := true);
+	f_shutdown_helper();
 }
 
 /* CHANNEL: Test OPSTART after SET CHANNEL ATTRIBUTES; expect ACK */
@@ -623,6 +643,7 @@
 
 	f_oml_ts_attr(trx_nr := 0, ts_nr := 1);
 	f_oml_opstart(obj_class, obj_inst);
+	f_shutdown_helper();
 }
 
 
@@ -635,6 +656,7 @@
 
 	/* we are *not* setting any attributes here */
 	f_oml_opstart(obj_class, obj_inst, exp_fail := true);
+	f_shutdown_helper();
 }
 
 /* Ensure the initial Event State Change Reports after OML connect match our expectation */
@@ -649,6 +671,7 @@
 	[] OML.receive(tr_OML_StateChgEvtRep(NM_OC_BTS, ts_OML_ObjectInstance(0, 255, 255),
 					     NM_OPSTATE_DISABLED, NM_AVSTATE_DEPENDENCY));
 	}
+	f_shutdown_helper();
 }
 
 /* Make sure that the IUT sends RSL Connect NACK when the remote is not reachable. */
@@ -673,6 +696,7 @@
 		setverdict(fail, "Timeout waiting for RSL Connect NACK");
 		}
 	}
+	f_shutdown_helper();
 }
 
 /* Make sure that the IUT forwards Container PCUIF messages between BSC and PCU */
@@ -766,7 +790,7 @@
 	}
 	[] T.timeout { setverdict(fail, "Timeout waiting for ANR request on BSC inteface"); }
 	}
-	setverdict(pass);
+	f_shutdown_helper();
 }