mgw: Test IPv6 addresses in MGCP messages

These tests verify that osmo-mgw handles requests no matter of IP
version used in the remote address.

Change-Id: Ib134dda5a8f7c8f50968b6ce330f9986ae72575d
This commit is contained in:
Pau Espin 2020-09-07 16:30:29 +02:00 committed by pespin
parent b604af09ea
commit db2dc0494e
2 changed files with 69 additions and 0 deletions

View File

@ -2230,6 +2230,72 @@ module MGCP_Test {
setverdict(pass);
}
/* test valid CRCX then MDCX with IPv4 address, MGW provides a local IPv4 too */
testcase TC_crcx_mdcx_ip4() runs on dummy_CT {
var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
var template MgcpCommand cmd;
var MgcpResponse resp;
var MgcpCallId call_id := '1234'H;
var MgcpConnectionId conn_id;
f_init(ep);
/* create the connection on the MGW */
cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id);
resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
conn_id := extract_conn_id(resp);
cmd := ts_MDCX(get_next_trans_id(), ep, "sendrecv", call_id, conn_id);
cmd.sdp := ts_SDP("127.0.0.2", "127.0.0.1", "23", "42", 2344, { "98" },
{ valueof(ts_SDP_rtpmap(98, "AMR/8000")),
valueof(ts_SDP_ptime(20)) });
resp := mgcp_transceive_mgw(cmd, tr_MDCX_ACK);
if (not ispresent(resp.sdp) or not ispresent(resp.sdp.connection)) {
setverdict(fail, "No RemoteConnection info found in MDCX ACK!");
}
if (not match(resp.sdp.connection, ts_SDP_connection_IP("127.0.0.1", "IP4"))) {
setverdict(fail, "Wrong RemoteConnection in MDCX ACK!", resp.sdp.connection);
}
/* clean-up */
f_dlcx_ok(ep, call_id);
setverdict(pass);
}
/* test valid CRCX then MDCX with IPv6 address, MGW provides a local IPv6 too */
testcase TC_crcx_mdcx_ip6() runs on dummy_CT {
var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
var template MgcpCommand cmd;
var MgcpResponse resp;
var MgcpCallId call_id := '1234'H;
var MgcpConnectionId conn_id;
f_init(ep);
/* create the connection on the MGW */
cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id);
resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
conn_id := extract_conn_id(resp);
cmd := ts_MDCX(get_next_trans_id(), ep, "sendrecv", call_id, conn_id);
cmd.sdp := ts_SDP("::2", "::1", "23", "42", 2344, { "98" },
{ valueof(ts_SDP_rtpmap(98, "AMR/8000")),
valueof(ts_SDP_ptime(20)) });
resp := mgcp_transceive_mgw(cmd, tr_MDCX_ACK);
if (not ispresent(resp.sdp) or not ispresent(resp.sdp.connection)) {
setverdict(fail, "No RemoteConnection info found in MDCX ACK!");
}
if (not match(resp.sdp.connection, ts_SDP_connection_IP("::1", "IP6"))) {
setverdict(fail, "Wrong RemoteConnection in MDCX ACK!", resp.sdp.connection);
}
/* clean-up */
f_dlcx_ok(ep, call_id);
setverdict(pass);
}
control {
execute(TC_selftest());
execute(TC_crcx());
@ -2290,5 +2356,7 @@ module MGCP_Test {
execute(TC_e1_crcx_with_overlap());
execute(TC_e1_crcx_loopback());
execute(TC_crcx_mdcx_ip4());
execute(TC_crcx_mdcx_ip6());
}
}

View File

@ -22,6 +22,7 @@ mgcp
bind port 2427
rtp port-range 4002 16000
rtp bind-ip 127.0.0.1
rtp bind-ip-v6 ::1
rtp ip-probing
rtp ip-dscp 184
no rtp keep-alive