I submitted some patches to support multiple MGWs when in SCCPlite mode:
https://gerrit.osmocom.org/c/osmo-mgw/+/34510 mgcp-client: Introduce API osmo_mgcpc_ep_local_name()
https://gerrit.osmocom.org/c/osmo-bsc/+/34511 sccplite: Support multiple MGW in MGW pool
However, I still need to fix some problems in TTCN3 BSC_Tests.TC_mgwpool_all_used when running through ttcn3-bsc-test-sccplite.
First of all, it seems the 1st conn is not torn down properly at the BSC by the emulated MSC, and then the emulated MSC attempts to re-use the same MGCP-endpoint=1, and as a result osmo-bsc ends up picking the first conn (which was somehow not freed) and hence forwarding the message to the first MGW.
Here's the output proving what I'm saying, by removing the "break" line in the loop in osmo-bsc patch iterating over conns:
20230922182836616 DMSC NOTICE SUBSCR_CONN(msc0-conn1_subscr-IMSI-001011113915361)[0x612000021e20]{ACTIVE}: ep_local_name='1' vs rcv_ep_local_name='1' (osmo_bsc_mgcp.c:132)
20230922182836616 DMSC NOTICE SUBSCR_CONN(msc0-conn2_subscr-IMSI-001011048855582)[0x6120000228a0]{ACTIVE}: ep_local_name='1' vs rcv_ep_local_name='1' (osmo_bsc_mgcp.c:132
After removing the "break" line, the proper conn is picked and the MGCP message is forwarded to the correct MGW.
However, even then, BSC_Tests seem to be problems finding out the MGCP response message sent back to it through IPA:
18:28:36.636878 5 RAN_Emulation.ttcnpp:1143 Matching on port MGCP succeeded: matched
18:28:36.636915 5 RAN_Emulation.ttcnpp:1143 Receive operation on port MGCP succeeded, message from VirtMSC-IPA(6): @MGCP_Types.MgcpResponse : { line := { code := "200", trans_id := "0", string := "OK" }, params := { { code := "I", val := "07E8EC18" }, { code := "Z", val := "1@mgw" } }, sdp := { protocol_version := 0, origin := { user_name := "-", session_id := "foo", session_version := "21", net_type := "IN", addr_type := "IP4", addr := "127.0.0.3" }, session_name := "-", information := omit, uri := omit, emails := omit, phone_numbers := omit, connection := { net_type := "IN", addr_type := "IP4", conn_addr := { addr := "127.0.0.5", ttl := omit, num_of_addr := omit } }, bandwidth := omit, times := { { time_field := { start_time := "0", stop_time := "0" }, time_repeat := omit } }, timezone_adjustments := omit, key := omit, attributes := omit, media_list := { { media_field := { media := "audio", ports := { port_number := 11002, num_of_ports := omit }, transport := "RTP/AVP", fmts := { "3" } }, information := omit, connections := omit, bandwidth := omit, key := omit, attributes := { { rtpmap := { attr_value := "3 GSM/8000" } }, { ptime := { attr_value := "20" } } } } } } } id 2
18:28:36.636942 5 RAN_Emulation.ttcnpp:1143 Message with id 2 was extracted from the queue of MGCP.
18:28:36.636977 5 RAN_Emulation.ttcnpp:1147 Sent on CLIENT to TC_mgwpool_all_used(13) @MGCP_Types.MgcpResponse : { line := { code := "200", trans_id := "0", string := "OK" }, params := { { code := "I", val := "07E8EC18" }, { code := "Z", val := "1@mgw" } }, sdp := { protocol_version := 0, origin := { user_name := "-", session_id := "foo", session_version := "21", net_type := "IN", addr_type := "IP4", addr := "127.0.0.3" }, session_name := "-", information := omit, uri := omit, emails := omit, phone_numbers := omit, connection := { net_type := "IN", addr_type := "IP4", conn_addr := { addr := "127.0.0.5", ttl := omit, num_of_addr := omit } }, bandwidth := omit, times := { { time_field := { start_time := "0", stop_time := "0" }, time_repeat := omit } }, timezone_adjustments := omit, key := omit, attributes := omit, media_list := { { media_field := { media := "audio", ports := { port_number := 11002, num_of_ports := omit }, transport := "RTP/AVP", fmts := { "3" } }, information := omit, connections := omit, bandwidth := omit, key := omit, attributes := { { rtpmap := { attr_value := "3 GSM/8000" } }, { ptime := { attr_value := "20" } } } } } } }
18:28:36.637131 13 BSC_Tests.ttcn:12154 Message enqueued on BSSAP from VirtMSC-RAN(5) @MGCP_Types.MgcpResponse : { line := { code := "200", trans_id := "0", string := "OK" }, params := { { code := "I", val := "07E8EC18" }, { code := "Z", val := "1@mgw" } }, sdp := { protocol_version := 0, origin := { user_name := "-", session_id := "foo", session_version := "21", net_type := "IN", addr_type := "IP4", addr := "127.0.0.3" }, session_name := "-", information := omit, uri := omit, emails := omit, phone_numbers := omit, connection := { net_type := "IN", addr_type := "IP4", conn_addr := { addr := "127.0.0.5", ttl := omit, num_of_addr := omit } }, bandwidth := omit, times := { { time_field := { start_time := "0", stop_time := "0" }, time_repeat := omit } }, timezone_adjustments := omit, key := omit, attributes := omit, media_list := { { media_field := { media := "audio", ports := { port_number := 11002, num_of_ports := omit }, transport := "RTP/AVP", fmts := { "3" } }, information := omit, connections := omit, bandwidth := omit, key := omit, attributes := { { rtpmap := { attr_value := "3 GSM/8000" } }, { ptime := { attr_value := "20" } } } } } } } id 4
18:28:41.615771 14 MSC_ConnectionHandler.ttcn:1415 Timeout T: 5 s
18:28:41.617575 14 MSC_ConnectionHandler.ttcn:1416 setverdict(fail): pass -> fail reason: "Timeout waiting for response to { line := { verb := "CRCX", trans_id := "0", ep := "1@mgw", ver := "1.0" }, params := { { code := "M", val := "sendrecv" }, { code := "C", val := "51234" }, { code := "L", val := "p:20, a:AMR" } }, sdp := { protocol_version := 0, origin := { user_name := "-", session_id := "23", session_version := "42", net_type := "IN", addr_type := "IP4", addr := "127.0.0.4" }, session_name := "-", information := omit, uri := omit, emails := omit, phone_numbers := omit, connection := { net_type := "IN", addr_type := "IP4", conn_addr := { addr := "127.0.0.5", ttl := omit, num_of_addr := omit } }, bandwidth := omit, times := { { time_field := { start_time := "0", stop_time := "0" }, time_repeat := omit } }, timezone_adjustments := omit, key := omit, attributes := omit, media_list := { { media_field := { media := "audio", ports := { port_number := 14000, num_of_ports := omit }, transport := "RTP/AVP", fmts := { "3" } }, information := omit, connections := omit, bandwidth := omit, key := omit, attributes := { { ptime := { attr_value := "20" } } } } } } }", new component reason: "Timeout waiting for response to { line := { verb := "CRCX", trans_id := "0", ep := "1@mgw", ver := "1.0" }, params := { { code := "M", val := "sendrecv" }, { code := "C", val := "51234" }, { code := "L", val := "p:20, a:AMR" } }, sdp := { protocol_version := 0, origin := { user_name := "-", session_id := "23", session_version := "42", net_type := "IN", addr_type := "IP4", addr := "127.0.0.4" }, session_name := "-", information := omit, uri := omit, emails := omit, phone_numbers := omit, connection := { net_type := "IN", addr_type := "IP4", conn_addr := { addr := "127.0.0.5", ttl := omit, num_of_addr := omit } }, bandwidth := omit, times := { { time_field := { start_time := "0", stop_time := "0" }, time_repeat := omit } }, timezone_adjustments := omit, key := omit, attributes := omit, media_list := { { media_field := { media := "audio", ports := { port_number := 14000, num_of_ports := omit }, transport := "RTP/AVP", fmts := { "3" } }, information := omit, connections := omit, bandwidth := omit, key := omit, attributes := { { ptime := { attr_value := "20" } } } } } } }"