diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-10-24 21:53:40 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2013-04-16 09:17:21 +0200 |
commit | 462b7d7158937b51fbb833ea3066e01fe8322f37 (patch) | |
tree | 9588a91447f6496c36ea815af62fbc48721061b0 /openbsc/tests/mgcp | |
parent | c327187259d74cf260c977f165963778de4bedb1 (diff) |
nat: We want the remote to respond to our DLCX request
We want to send a TRAP with the MGCP statistics from the NAT and
the connected BSC. The BSC endpoint can be either released because
of a DLCX from the MGCP CallAgent or the SCCP Connection release on
the A-link.
This is why we need to queue the statistics when the deleting the
endpoint on the BSC. The processing is continued once the response
arrives. This code assumes that the response of the DLCX will be sent
by the remote side. The current amount of outstanding responses can be
seen on the VTY. This assumption is based on the fact that the BSC has
already responded to the CRCX and maybe to the MDCX.
The MGCP RFC is bended to prefix the transaction identifier with "nat-"
to easily detect the response and hand it to the handler. This will
then parse the response and generate the TRAP. The current version is
v1. We assume that the transaction space is big enough and we will
not re-assign the transaction identifier too early.
Diffstat (limited to 'openbsc/tests/mgcp')
-rw-r--r-- | openbsc/tests/mgcp/mgcp_test.c | 25 | ||||
-rw-r--r-- | openbsc/tests/mgcp/mgcp_test.ok | 3 |
2 files changed, 28 insertions, 0 deletions
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c index 4dfd2abe3..5565e7316 100644 --- a/openbsc/tests/mgcp/mgcp_test.c +++ b/openbsc/tests/mgcp/mgcp_test.c @@ -323,6 +323,30 @@ static void test_packet_loss_calc(void) } } +static void test_mgcp_stats(void) +{ + printf("Testing stat parsing\n"); + + uint32_t bps, bos, pr, _or, jitter; + struct msgb *msg; + int loss; + int rc; + + msg = create_msg(DLCX_RET); + rc = mgcp_parse_stats(msg, &bps, &bos, &pr, &_or, &loss, &jitter); + printf("Parsing result: %d\n", rc); + if (bps != 0 || bos != 0 || pr != 0 || _or != 0 || loss != 0 || jitter != 0) + printf("FAIL: Parsing failed1.\n"); + msgb_free(msg); + + msg = create_msg("250 7 OK\r\nP: PS=10, OS=20, PR=30, OR=40, PL=-3, JI=40\r\n"); + rc = mgcp_parse_stats(msg, &bps, &bos, &pr, &_or, &loss, &jitter); + printf("Parsing result: %d\n", rc); + if (bps != 10 || bos != 20 || pr != 30 || _or != 40 || loss != -3 || jitter != 40) + printf("FAIL: Parsing failed2.\n"); + msgb_free(msg); +} + int main(int argc, char **argv) { osmo_init_logging(&log_info); @@ -331,6 +355,7 @@ int main(int argc, char **argv) test_retransmission(); test_packet_loss_calc(); test_rqnt_cb(); + test_mgcp_stats(); printf("Done\n"); return EXIT_SUCCESS; diff --git a/openbsc/tests/mgcp/mgcp_test.ok b/openbsc/tests/mgcp/mgcp_test.ok index 224bba8d7..8711e38f2 100644 --- a/openbsc/tests/mgcp/mgcp_test.ok +++ b/openbsc/tests/mgcp/mgcp_test.ok @@ -25,4 +25,7 @@ Re-transmitting MDCX3 Testing DLCX Re-transmitting DLCX Testing packet loss calculation. +Testing stat parsing +Parsing result: 0 +Parsing result: 0 Done |