implement nanoBTS frequency error test

This helps us to detect the frequency error of BS-11 if it is located
next to the nanoBTS 900.

If 'ipaccess-config -l' is called, it will produce a report like
<0020> ipaccess-config.c:85 TEST REPORT: test_no=0x42 test_res=0
<0020> ipaccess-config.c:108 ==> ARFCN  220, Frequency Error     22
<0020> ipaccess-config.c:108 ==> ARFCN    1, Frequency Error    -37
<0020> ipaccess-config.c:108 ==> ARFCN   10, Frequency Error      0
<0020> ipaccess-config.c:108 ==> ARFCN   20, Frequency Error     11
<0020> ipaccess-config.c:108 ==> ARFCN   53, Frequency Error      5
<0020> ipaccess-config.c:108 ==> ARFCN   63, Frequency Error     -4
<0020> ipaccess-config.c:108 ==> ARFCN   84, Frequency Error     11
<0020> ipaccess-config.c:108 ==> ARFCN  101, Frequency Error      0
<0020> ipaccess-config.c:108 ==> ARFCN  123, Frequency Error    -52

where in this case the ARFCN 123 is the BS-11 with a frequency error
larger than all the other (regular) BTS in the vicinity.
diff --git a/openbsc/src/abis_nm.c b/openbsc/src/abis_nm.c
index 0eb8657..31f1df0 100644
--- a/openbsc/src/abis_nm.c
+++ b/openbsc/src/abis_nm.c
@@ -801,6 +801,10 @@
 		rx_fail_evt_rep(mb);
 		dispatch_signal(SS_NM, S_NM_FAIL_REP, mb);
 		break;
+	case NM_MT_TEST_REP:
+		DEBUGPC(DNM, "Test Report\n");
+		dispatch_signal(SS_NM, S_NM_TEST_REP, mb);
+		break;
 	default:
 		DEBUGPC(DNM, "reporting NM MT 0x%02x\n", mt);
 		break;
@@ -1790,6 +1794,33 @@
 	return abis_nm_sendmsg(bts, msg);
 }
 
+/* Chapter 8.7.1 */
+int abis_nm_perform_test(struct gsm_bts *bts, u_int8_t obj_class,
+			 u_int8_t bts_nr, u_int8_t trx_nr, u_int8_t ts_nr,
+			 u_int8_t test_nr, u_int8_t auton_report,
+			 u_int8_t *phys_config, u_int16_t phys_config_len)
+{
+	struct abis_om_hdr *oh;
+	struct msgb *msg = nm_msgb_alloc();
+	int len = 4; /* 2 TV attributes */
+
+	DEBUGP(DNM, "PEFORM TEST\n");
+	
+	if (phys_config_len)
+		len += 3 + phys_config_len;
+	
+	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+	fill_om_fom_hdr(oh, len, NM_MT_PERF_TEST,
+			obj_class, bts_nr, trx_nr, ts_nr);
+	msgb_tv_put(msg, NM_ATT_TEST_NO, test_nr);
+	msgb_tv_put(msg, NM_ATT_AUTON_REPORT, auton_report);
+	if (phys_config_len)
+		msgb_tl16v_put(msg, NM_ATT_PHYS_CONF, phys_config_len,
+				phys_config);
+
+	return abis_nm_sendmsg(bts, msg);
+}
+
 int abis_nm_event_reports(struct gsm_bts *bts, int on)
 {
 	if (on == 0)