ms: Make ms_{attach,detach}_tbf expectancies more robust

* Make sure that the tbf being attached has already the MS assigned.
* Check no re-attaching of alredy attached TBF ever happens.
* Document and early skip case where a non-attached TBF detach is
  attempted.
* Avoid recursive call mess to tbf_set_ms(tbf, NULL); during detach.
* MsTest needs to be modified since it uses fake TBF objects which use
  different set of calls than the regular TBFs in osmo-pcu. Since the
ul_tbf object is reused, it needs to be assigned ul_tbf->ms again before
re-assigning it, as per what happens usually in tbf_set_ms() in
osmo-pcu.

Change-Id: Ia18fe2de1fb3bf72f530157e5f30de64f2b11e12
diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp
index a8febd0..40e8381 100644
--- a/tests/ms/MsTest.cpp
+++ b/tests/ms/MsTest.cpp
@@ -443,7 +443,7 @@
 	OSMO_ASSERT(ms != NULL);
 	ul_tbf = alloc_ul_tbf(bts, ms);
 	ms_attach_tbf(ms, ul_tbf);
-	ms_detach_tbf(ms, ul_tbf);
+	tbf_set_ms(ul_tbf, NULL);
 	ms = bts_get_ms_by_tlli(bts, tlli + 0, GSM_RESERVED_TMSI);
 	OSMO_ASSERT(ms == NULL);
 	ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
@@ -452,8 +452,8 @@
 	/* delete ms */
 	ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
 	OSMO_ASSERT(ms != NULL);
-	ms_attach_tbf(ms, ul_tbf);
-	ms_detach_tbf(ms, ul_tbf);
+	tbf_set_ms(ul_tbf, ms);
+	tbf_set_ms(ul_tbf, NULL);
 	ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
 	OSMO_ASSERT(ms == NULL);