mgw: Handle MgcpParameterList more elegantly, less repetition

This commit is contained in:
Harald Welte 2017-11-18 18:40:01 +01:00
parent ba62c8c95b
commit a01e38d371
1 changed files with 11 additions and 18 deletions

View File

@ -446,6 +446,11 @@ module MGCP_Test {
f_dlcx_ignore(ep, call_id);
}
function f_mgcp_par_append(inout template MgcpParameterList list, template MgcpParameter par) {
var integer len := lengthof(list);
list[len] := par;
}
/* test CRCX with unsupported Parameters */
testcase TC_crcx_unsupp_param() runs on dummy_CT {
var template MgcpCommand cmd;
@ -457,13 +462,9 @@ module MGCP_Test {
f_init();
cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id);
cmd.params := {
t_MgcpParConnMode("recvonly"),
ts_MgcpParCallId(call_id),
t_MgcpParLocConnOpt("p:20"),
/* osmo-bsc_mgcp/mgw doesn't implement notifications */
{ "N", "foobar" }
}
/* osmo-bsc_mgcp/mgw doesn't implement notifications */
f_mgcp_par_append(cmd.params, MgcpParameter:{ "N", "foobar" });
resp := mgcp_transceive_mgw(cmd, rtmpl);
setverdict(pass);
@ -521,11 +522,7 @@ module MGCP_Test {
f_init();
cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id);
cmd.params := {
t_MgcpParConnMode("recvonly"),
ts_MgcpParCallId(call_id),
t_MgcpParLocConnOpt("p:111")
}
cmd.params[2] := t_MgcpParLocConnOpt("p:111");
resp := mgcp_transceive_mgw(cmd, rtmpl);
setverdict(pass);
@ -543,12 +540,8 @@ module MGCP_Test {
f_init();
cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id);
cmd.params := {
t_MgcpParConnMode("recvonly"),
ts_MgcpParCallId(call_id),
/* p:20 is permitted only once and not twice! */
t_MgcpParLocConnOpt("p:20, a:AMR, p:20")
}
/* p:20 is permitted only once and not twice! */
cmd.params[2] := t_MgcpParLocConnOpt("p:20, a:AMR, p:20");
resp := mgcp_transceive_mgw(cmd, rtmpl);
setverdict(pass);