aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gb/gprs_bssgp_test.c35
-rw-r--r--tests/gb/gprs_bssgp_test.ok4
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/gb/gprs_bssgp_test.c b/tests/gb/gprs_bssgp_test.c
index a2473268..3d1384b7 100644
--- a/tests/gb/gprs_bssgp_test.c
+++ b/tests/gb/gprs_bssgp_test.c
@@ -125,6 +125,40 @@ static void test_bssgp_suspend_resume(void)
printf("----- %s END\n", __func__);
}
+static void send_bssgp_status(enum gprs_bssgp_cause cause, uint16_t *bvci)
+{
+ struct msgb *msg = bssgp_msgb_alloc();
+ uint8_t cause_ = cause;
+
+ msgb_v_put(msg, BSSGP_PDUT_STATUS);
+ msgb_tvlv_put(msg, BSSGP_IE_CAUSE, 1, &cause_);
+ if (bvci) {
+ uint16_t bvci_ = htons(*bvci);
+ msgb_tvlv_put(msg, BSSGP_IE_BVCI, 2, (uint8_t *) &bvci_);
+ }
+
+ msgb_bssgp_send_and_free(msg);
+}
+
+static void test_bssgp_status(void)
+{
+ uint16_t bvci;
+
+ printf("----- %s START\n", __func__);
+
+ send_bssgp_status(BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL);
+ OSMO_ASSERT(last_oph.primitive == PRIM_NM_STATUS);
+
+ /* Enforce prim != PRIM_NM_STATUS */
+ last_oph.primitive = PRIM_NM_LLC_DISCARDED;
+
+ bvci = 1234;
+ send_bssgp_status(BSSGP_CAUSE_UNKNOWN_BVCI, &bvci);
+ OSMO_ASSERT(last_oph.primitive == PRIM_NM_STATUS);
+
+ printf("----- %s END\n", __func__);
+}
+
static struct log_info info = {};
int main(int argc, char **argv)
@@ -146,6 +180,7 @@ int main(int argc, char **argv)
printf("===== BSSGP test START\n");
test_bssgp_suspend_resume();
+ test_bssgp_status();
printf("===== BSSGP test END\n\n");
exit(EXIT_SUCCESS);
diff --git a/tests/gb/gprs_bssgp_test.ok b/tests/gb/gprs_bssgp_test.ok
index c9ec83d7..0392e6a5 100644
--- a/tests/gb/gprs_bssgp_test.ok
+++ b/tests/gb/gprs_bssgp_test.ok
@@ -3,5 +3,9 @@
BSSGP primitive, SAP 16777219, prim = 3, op = 0, msg = 0b 1f 84 f0 12 34 56 1b 86 0f f1 80 20 37 00
BSSGP primitive, SAP 16777219, prim = 4, op = 0, msg = 0e 1f 84 f0 12 34 56 1b 86 0f f1 80 20 37 00 1d 81 01
----- test_bssgp_suspend_resume END
+----- test_bssgp_status START
+BSSGP primitive, SAP 16777221, prim = 11, op = 2, msg = 41 07 81 27
+BSSGP primitive, SAP 16777221, prim = 11, op = 2, msg = 41 07 81 05 04 82 04 d2
+----- test_bssgp_status END
===== BSSGP test END