aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-12-19 12:20:49 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-01-16 12:17:24 +0100
commit1b653af283c2d7430923a816364d732431b831d9 (patch)
tree19f311b4e58e7c08c09142be07be41c7b07414fa
parent0970bab2a39244dfdd6caa226383da4d4e569b65 (diff)
mgcp/test: Test the connection mode parser
This modifies the test MGCP messages to include M:recvonly (CRCX), M:sendrecv (MDCX) and M:sendonly (MDCX) outputs the resulting output_enabled flags and the conn_mode after processing the message. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/tests/mgcp/mgcp_test.c38
-rw-r--r--openbsc/tests/mgcp/mgcp_test.ok15
2 files changed, 50 insertions, 3 deletions
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index 3cfc183e7..7653a0d45 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -84,6 +84,7 @@ static void test_strline(void)
"a=rtpmap:126 AMR/8000\r\n" \
"a=ptime:20\r\n"
#define MDCX4 "MDCX 18983216 1@mgw MGCP 1.0\r\n" \
+ "M: sendrecv\r" \
"C: 2\r\n" \
"I: 1\r\n" \
"L: p:20, a:AMR, nt:IN\r\n" \
@@ -107,6 +108,7 @@ static void test_strline(void)
"a=ptime:20\r\n"
#define MDCX4_PT1 "MDCX 18983217 1@mgw MGCP 1.0\r\n" \
+ "M: sendrecv\r" \
"C: 2\r\n" \
"I: 1\r\n" \
"L: p:20-40, a:AMR, nt:IN\r\n" \
@@ -120,6 +122,7 @@ static void test_strline(void)
"a=ptime:40\r\n"
#define MDCX4_PT2 "MDCX 18983218 1@mgw MGCP 1.0\r\n" \
+ "M: sendrecv\r" \
"C: 2\r\n" \
"I: 1\r\n" \
"L: p:20-20, a:AMR, nt:IN\r\n" \
@@ -133,6 +136,7 @@ static void test_strline(void)
"a=ptime:40\r\n"
#define MDCX4_PT3 "MDCX 18983219 1@mgw MGCP 1.0\r\n" \
+ "M: sendrecv\r" \
"C: 2\r\n" \
"I: 1\r\n" \
"L: a:AMR, nt:IN\r\n" \
@@ -145,6 +149,20 @@ static void test_strline(void)
"a=rtpmap:99 AMR/8000\r\n" \
"a=ptime:40\r\n"
+#define MDCX4_SO "MDCX 18983220 1@mgw MGCP 1.0\r\n" \
+ "M: sendonly\r" \
+ "C: 2\r\n" \
+ "I: 1\r\n" \
+ "L: p:20, a:AMR, nt:IN\r\n" \
+ "\n" \
+ "v=0\r\n" \
+ "o=- 1 23 IN IP4 0.0.0.0\r\n" \
+ "c=IN IP4 0.0.0.0\r\n" \
+ "t=0 0\r\n" \
+ "m=audio 4441 RTP/AVP 99\r\n" \
+ "a=rtpmap:99 AMR/8000\r\n" \
+ "a=ptime:40\r\n"
+
#define SHORT2 "CRCX 1"
#define SHORT2_RET "510 000000 FAIL\r\n"
#define SHORT3 "CRCX 1 1@mgw"
@@ -152,7 +170,7 @@ static void test_strline(void)
#define SHORT5 "CRCX 1 1@mgw MGCP 1.0"
#define CRCX "CRCX 2 1@mgw MGCP 1.0\r\n" \
- "M: sendrecv\r\n" \
+ "M: recvonly\r\n" \
"C: 2\r\n" \
"L: p:20\r\n" \
"\r\n" \
@@ -174,7 +192,7 @@ static void test_strline(void)
"a=ptime:20\r\n"
#define CRCX_ZYN "CRCX 2 1@mgw MGCP 1.0\r" \
- "M: sendrecv\r" \
+ "M: recvonly\r" \
"C: 2\r\r" \
"v=0\r" \
"c=IN IP4 123.12.12.123\r" \
@@ -233,6 +251,7 @@ static const struct mgcp_test tests[] = {
{ "MDCX4_PT1", MDCX4_PT1, MDCX4_RET("18983217"), 99, 126 },
{ "MDCX4_PT2", MDCX4_PT2, MDCX4_RET("18983218"), 99, 126 },
{ "MDCX4_PT3", MDCX4_PT3, MDCX4_RET("18983219"), 99, 126 },
+ { "MDCX4_SO", MDCX4_SO, MDCX4_RET("18983220"), 99, 126 },
{ "DLCX", DLCX, DLCX_RET, -1, -1 },
{ "CRCX_ZYN", CRCX_ZYN, CRCX_ZYN_RET, 97, 126 },
{ "EMPTY", EMPTY, EMPTY_RET },
@@ -294,6 +313,9 @@ static void test_messages(void)
endp = &cfg->trunk.endpoints[i];
endp->net_end.payload_type = PTYPE_NONE;
endp->net_end.packet_duration_ms = -1;
+ endp->bts_end.output_enabled = 0;
+ endp->net_end.output_enabled = 0;
+ endp->conn_mode = -1;
}
for (i = 0; i < ARRAY_SIZE(tests); i++) {
@@ -332,7 +354,19 @@ static void test_messages(void)
else
printf("Requested packetization period not set\n");
+ if (endp->conn_mode != -1)
+ printf("Connection mode: %d, "
+ "BTS output %sabled, NET output %sabled\n",
+ endp->conn_mode,
+ endp->bts_end.output_enabled ? "en" : "dis",
+ endp->net_end.output_enabled ? "en" : "dis");
+ else
+ printf("Connection mode not set\n");
+
endp->net_end.packet_duration_ms = -1;
+ endp->bts_end.output_enabled = 0;
+ endp->net_end.output_enabled = 0;
+ endp->conn_mode = -1;
}
diff --git a/openbsc/tests/mgcp/mgcp_test.ok b/openbsc/tests/mgcp/mgcp_test.ok
index 638ac9215..d5fb56f6a 100644
--- a/openbsc/tests/mgcp/mgcp_test.ok
+++ b/openbsc/tests/mgcp/mgcp_test.ok
@@ -18,27 +18,39 @@ Testing MDCX2
Testing CRCX
Detected packet duration: 40
Requested packetetization period: 20-20
+Connection mode: 1, BTS output disabled, NET output disabled
Testing MDCX3
Packet duration not set
Requested packetization period not set
+Connection mode not set
Testing MDCX4
Detected packet duration: 40
Requested packetetization period: 20-20
+Connection mode: 3, BTS output disabled, NET output disabled
Testing MDCX4_PT1
Detected packet duration: 40
Requested packetetization period: 20-40
+Connection mode: 3, BTS output disabled, NET output disabled
Testing MDCX4_PT2
Detected packet duration: 40
Requested packetetization period: 20-20
+Connection mode: 3, BTS output disabled, NET output disabled
Testing MDCX4_PT3
Detected packet duration: 40
Requested packetization period not set
+Connection mode: 3, BTS output disabled, NET output disabled
+Testing MDCX4_SO
+Detected packet duration: 40
+Requested packetetization period: 20-20
+Connection mode: 2, BTS output disabled, NET output disabled
Testing DLCX
Detected packet duration: 20
-Requested packetization period not set
+Requested packetetization period: 20-20
+Connection mode: 0, BTS output enabled, NET output enabled
Testing CRCX_ZYN
Packet duration not set
Requested packetization period not set
+Connection mode: 1, BTS output disabled, NET output disabled
Testing EMPTY
Testing SHORT1
Testing SHORT2
@@ -49,6 +61,7 @@ Testing RQNT2
Testing DLCX
Detected packet duration: 20
Requested packetization period not set
+Connection mode: 0, BTS output enabled, NET output enabled
Testing CRCX
Re-transmitting CRCX
Testing RQNT1