lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

April 2024

  • 1 participants
  • 1128 discussions
[L] Change in osmo-ttcn3-hacks[master]: Introduce Asterisk_Tests testsuite
by pespin 02 Apr '24

02 Apr '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36490?usp=email ) Change subject: Introduce Asterisk_Tests testsuite ...................................................................... Introduce Asterisk_Tests testsuite Add initial infrastructure to run tests against an Asterisk process. An not-yet-finished draft test doing registration is submitted to validate communication towards Asterisk works. The testsuite will be improved in follow-up commits, but this way other people can already start using it and we can set up the dockerized setup + jenkins jobs to run it nightly. Related: SYS#6782 Change-Id: I66f776d5df6fb5dc488d9e589b84a6b2385406e8 --- M Makefile A asterisk/Asterisk_Tests.cfg A asterisk/Asterisk_Tests.default A asterisk/Asterisk_Tests.ttcn A asterisk/README.md A asterisk/expected-results.xml A asterisk/gen_links.sh A asterisk/regen_makefile.sh M library/SIP_Emulation.ttcn M library/SIP_Templates.ttcn 10 files changed, 414 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/Makefile b/Makefile index 51e51ed..bd88ca5 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ # limitations under the License. SUBDIRS= \ + asterisk \ bsc \ bsc-nat \ bts \ diff --git a/asterisk/Asterisk_Tests.cfg b/asterisk/Asterisk_Tests.cfg new file mode 100644 index 0000000..a3669f9 --- /dev/null +++ b/asterisk/Asterisk_Tests.cfg @@ -0,0 +1,18 @@ +[ORDERED_INCLUDE] +# Common configuration, shared between test suites +"../Common.cfg" +# testsuite specific configuration, not expected to change +"./Asterisk_Tests.default" + +# Local configuration below + +[LOGGING] + +[TESTPORT_PARAMETERS] + +[MODULE_PARAMETERS] + +[MAIN_CONTROLLER] + +[EXECUTE] +Asterisk_Tests.control diff --git a/asterisk/Asterisk_Tests.default b/asterisk/Asterisk_Tests.default new file mode 100644 index 0000000..a2fda0f --- /dev/null +++ b/asterisk/Asterisk_Tests.default @@ -0,0 +1,18 @@ +[LOGGING] +FileMask := LOG_ALL | TTCN_MATCHING; + +mtc.FileMask := ERROR | WARNING | PARALLEL | VERDICTOP; + +[TESTPORT_PARAMETERS] +*.SIP.local_sip_port := "5060" +*.SIP.default_local_address := "127.0.0.2" +*.SIP.default_sip_protocol := "UDP" +*.SIP.default_dest_port := "5060" +*.SIP.default_dest_address := "127.0.0.1" + + +[MODULE_PARAMETERS] + +[MAIN_CONTROLLER] + +[EXECUTE] diff --git a/asterisk/Asterisk_Tests.ttcn b/asterisk/Asterisk_Tests.ttcn new file mode 100644 index 0000000..5d9754e --- /dev/null +++ b/asterisk/Asterisk_Tests.ttcn @@ -0,0 +1,240 @@ +module Asterisk_Tests { + +/* Asterisk test suite in TTCN-3 + * (C) 2024 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * All rights reserved. + * Author: Pau Espin Pedrol <pespin(a)sysmocom.de> + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +import from General_Types all; +import from Osmocom_Types all; +import from Native_Functions all; +import from Misc_Helpers all; + +import from SDP_Types all; +import from SDP_Templates all; + +import from SIP_Emulation all; +import from SIPmsg_Types all; +import from SIP_Templates all; + +modulepar { + charstring mp_local_sip_host := "127.0.0.2"; + integer mp_local_sip_port := 5060; + charstring mp_remote_sip_host := "127.0.0.1"; + integer mp_remote_sip_port := 5060; +} + +type component test_CT { + var SIP_Emulation_CT vc_SIP; +} + +type component ConnHdlr extends SIP_ConnHdlr { + var ConnHdlrPars g_pars; + timer g_Tguard; + var PDU_SIP_Request g_rx_sip_req; + var PDU_SIP_Response g_rx_sip_resp; +} + +type record ConnHdlrPars { + float t_guard, + charstring user, + SipUrl registrar_sip_url, + SipAddr registrar_sip_record, + CallidString registrar_sip_call_id, + Via registrar_via, + integer registrar_sip_seq_nr, + SipAddr sip_url_ext, + Contact local_contact, + CallPars cp optional +} + +template (value) ConnHdlrPars t_Pars(charstring user, + charstring displayname := "\"Anonymous\"") := { + t_guard := 30.0, + user := user, + registrar_sip_url := valueof(ts_SipUrlHost(mp_remote_sip_host)), + registrar_sip_record := ts_SipAddr(ts_HostPort(mp_remote_sip_host), + ts_UserInfo(user), + displayName := displayname), + registrar_sip_call_id := hex2str(f_rnd_hexstring(15)) & "@" & mp_local_sip_host, + registrar_via := ts_Via_from(ts_HostPort(mp_local_sip_host, mp_local_sip_port)), + registrar_sip_seq_nr := f_sip_rand_seq_nr(), + sip_url_ext := ts_SipAddr(ts_HostPort(mp_local_sip_host, mp_local_sip_port), + ts_UserInfo(user)), + local_contact := valueof(ts_Contact({ + ts_ContactAddress( + ts_Addr_Union_SipUrl(ts_SipUrl(ts_HostPort( + mp_local_sip_host, + mp_local_sip_port), + ts_UserInfo(user))), + omit) + })), + cp := omit +} + +function f_init_ConnHdlrPars(integer idx := 1) runs on test_CT return ConnHdlrPars { + var ConnHdlrPars pars := valueof(t_Pars(int2str(500 + idx))); + return pars; +} + +type record CallPars { + boolean is_mo, + charstring calling, + charstring called, + + CallParsComputed comp optional, + + charstring sip_rtp_addr, + uint16_t sip_rtp_port, + charstring cn_rtp_addr, + uint16_t cn_rtp_port +} + +type record CallParsComputed { + CallidString sip_call_id, + charstring sip_body, + integer sip_seq_nr +} + +private template (value) CallPars t_CallPars(boolean is_mo) := { + is_mo := is_mo, + calling := "12345", + called := "98766", + comp := { + sip_call_id := hex2str(f_rnd_hexstring(15)), + sip_body := "", + sip_seq_nr := f_sip_rand_seq_nr() + }, + sip_rtp_addr := "1.2.3.4", + sip_rtp_port := 1234, + cn_rtp_addr := "5.6.7.8", + cn_rtp_port := 5678 +} + +function f_init() runs on test_CT { + f_init_sip(vc_SIP, "Asterisk_Test"); + log("end of f_init"); +} + +type function void_fn(charstring id) runs on ConnHdlr; + +function f_start_handler(void_fn fn, ConnHdlrPars pars) +runs on test_CT return ConnHdlr { + var ConnHdlr vc_conn; + var charstring id := testcasename(); + + vc_conn := ConnHdlr.create(id); + + connect(vc_conn:SIP, vc_SIP:CLIENT); + connect(vc_conn:SIP_PROC, vc_SIP:CLIENT_PROC); + + vc_conn.start(f_handler_init(fn, id, pars)); + return vc_conn; +} + +private altstep as_Tguard() runs on ConnHdlr { + [] g_Tguard.timeout { + setverdict(fail, "Tguard timeout"); + mtc.stop; + } +} + +private function f_handler_init(void_fn fn, charstring id, ConnHdlrPars pars) +runs on ConnHdlr { + g_pars := pars; + g_Tguard.start(pars.t_guard); + activate(as_Tguard()); + + // Make sure the UA is deregistered before starting the test: + // sends REGISTER with Contact = "*" and Expires = 0 + //f_SIP_deregister(); + + /* call the user-supied test case function */ + fn.apply(id); +} + +altstep as_SIP_expect_req(template PDU_SIP_Request sip_expect) runs on ConnHdlr +{ + [] SIP.receive(sip_expect) -> value g_rx_sip_req; + [] SIP.receive { + log("FAIL: expected SIP message ", sip_expect); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received unexpected SIP message"); + } +} + +altstep as_SIP_expect_resp(template PDU_SIP_Response sip_expect) runs on ConnHdlr +{ + [] SIP.receive(sip_expect) -> value g_rx_sip_resp; + [] SIP.receive { + log("FAIL: expected SIP message ", sip_expect); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received unexpected SIP message"); + } +} + +private function f_tr_Via_response(Via via_req) return template (present) Via { + template (present) SemicolonParam_List via_resp_params := ?; + + /*via_resp_params := { + { id := "rport", paramValue := int2str(mp_remote_sip_port) }, + { id := "received", paramValue := mp_remote_sip_host } + }; */ + return tr_Via_from(via_req.viaBody[0].sentBy, + via_resp_params); +} + +function f_SIP_register() runs on ConnHdlr return PDU_SIP_Response +{ + var template (present) PDU_SIP_Response exp; + + SIP.send(ts_SIP_REGISTER(g_pars.registrar_sip_url, + g_pars.registrar_sip_call_id, + g_pars.registrar_sip_record, + g_pars.registrar_sip_record, + g_pars.registrar_via, + g_pars.registrar_sip_seq_nr, + g_pars.local_contact, + ts_Expires("7200"))); + + exp := tr_SIP_Response_REGISTER_Unauthorized( + g_pars.registrar_sip_call_id, + g_pars.registrar_sip_record, + g_pars.registrar_sip_record, + f_tr_Via_response(g_pars.registrar_via), + *, + g_pars.registrar_sip_seq_nr); + as_SIP_expect_resp(exp); + + /* Do the registering after calculating the md5 hash, etc. */ + return g_rx_sip_resp; +} + +/* Successful MO Call, which is subsequently released by SIP side */ +private function f_TC_internal_registration(charstring id) runs on ConnHdlr { + + f_SIP_register(); + /* now call is fully established */ + f_sleep(2.0); + // f_SIP_deregister(); + setverdict(pass); +} + +testcase TC_internal_registration() runs on test_CT { + var ConnHdlrPars pars; + var ConnHdlr vc_conn; + f_init(); + pars := f_init_ConnHdlrPars(); + vc_conn := f_start_handler(refers(f_TC_internal_registration), pars); + vc_conn.done; +} + +control { + execute( TC_internal_registration() ); +} + +} diff --git a/asterisk/README.md b/asterisk/README.md new file mode 100644 index 0000000..c034bbb --- /dev/null +++ b/asterisk/README.md @@ -0,0 +1,16 @@ +* Asterisk_Tests.ttcn + +* external interfaces + * SIP (emulates SIP UAs) + * VoLTE (emulates IMS server) + +{% dot sip_tests.svg +digraph G { + rankdir=LR; + Asterisk [label="IUT\nAsterisk",shape="box"]; + ATS [label="ATS\nAsterisk_Tests.ttcn"]; + + ATS -> Asterisk [label="SIP"]; + ATS -> Asterisk [label="VoLTE (IMS)"]; +} +%} diff --git a/asterisk/expected-results.xml b/asterisk/expected-results.xml new file mode 100644 index 0000000..c1d9e2e --- /dev/null +++ b/asterisk/expected-results.xml @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<testsuite name='Titan' tests='9' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'> + <testcase classname='Asterisk_Tests' name='TC_internal_registration' time='MASKED'/> +</testsuite> diff --git a/asterisk/gen_links.sh b/asterisk/gen_links.sh new file mode 100755 index 0000000..1fd6ecc --- /dev/null +++ b/asterisk/gen_links.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +BASEDIR=../deps + +. ../gen_links.sh.inc + +DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src +FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src +FILES="Socket_API_Definitions.ttcn" +gen_links $DIR $FILES + +# Required by MGCP and IPA +DIR=$BASEDIR/titan.TestPorts.IPL4asp/src +FILES="IPL4asp_Functions.ttcn IPL4asp_PT.cc IPL4asp_PT.hh IPL4asp_PortType.ttcn IPL4asp_Types.ttcn IPL4asp_discovery.cc IPL4asp_protocol_L234.hh" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.ProtocolModules.SDP/src +FILES="SDP_EncDec.cc SDP_Types.ttcn SDP_parse_.tab.c SDP_parse_.tab.h SDP_parse_parser.h SDP_parser.l +SDP_parser.y lex.SDP_parse_.c" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.ProtocolModules.RTP/src +FILES="RTP_EncDec.cc RTP_Types.ttcn" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.SIPmsg/src +FILES="SIP_parse.h SIP_parse.y SIP_parse_.tab.h SIPmsg_PT.hh SIPmsg_Types.ttcn SIP_parse.l SIP_parse_.tab.c SIPmsg_PT.cc SIPmsg_PortType.ttcn lex.SIP_parse_.c" +gen_links $DIR $FILES + +DIR=../library +FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc " +FILES+="RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunctDef.cc " +FILES+="SDP_Templates.ttcn " +FILES+="SIP_Emulation.ttcn SIP_Templates.ttcn " +gen_links $DIR $FILES + +ignore_pp_results diff --git a/asterisk/regen_makefile.sh b/asterisk/regen_makefile.sh new file mode 100755 index 0000000..3995b3d --- /dev/null +++ b/asterisk/regen_makefile.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +NAME=Asterisk_Tests + +FILES=" + *.c + *.ttcn + IPL4asp_PT.cc + IPL4asp_discovery.cc + Native_FunctionDefs.cc + RTP_CodecPort_CtrlFunctDef.cc + RTP_EncDec.cc + SDP_EncDec.cc + SIPmsg_PT.cc + TCCConversion.cc + TCCInterface.cc +" + +../regen-makefile.sh -e $NAME $FILES diff --git a/library/SIP_Emulation.ttcn b/library/SIP_Emulation.ttcn index e71c611..41e6975 100644 --- a/library/SIP_Emulation.ttcn +++ b/library/SIP_Emulation.ttcn @@ -72,6 +72,13 @@ sipVersion := ? } +private template PDU_SIP_Request tr_SIP_REGISTER := { + requestLine := tr_ReqLine(REGISTER_E), + msgHeader := t_SIP_msgHeader_any, + messageBody := *, + payload := * +} + private template PDU_SIP_Request tr_SIP_INVITE := { requestLine := tr_ReqLine(INVITE_E), msgHeader := t_SIP_msgHeader_any, @@ -79,7 +86,6 @@ payload := * } - template SipUrl tr_SIP_Url(template charstring user_or_num, template charstring host := *, template integer portField := *) := { @@ -286,6 +292,19 @@ } } + /* a ConnHdlr is sending us a SIP REGISTER: Forward to SIP port */ + [] CLIENT.receive(tr_SIP_REGISTER) -> value sip_req sender vc_conn { + var CallidString call_id := sip_req.msgHeader.callId.callid; + if (f_call_id_known(call_id)) { + /* re-register */ + vc_conn := f_comp_by_call_id(call_id); + } else { + /* new REGISTER: add to table */ + f_call_table_add(vc_conn, call_id); + } + SIP.send(sip_req); + } + /* a ConnHdlr is sending us a SIP INVITE: Forward to SIP port */ [] CLIENT.receive(tr_SIP_INVITE) -> value sip_req sender vc_conn { var CallidString call_id := sip_req.msgHeader.callId.callid; diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn index f48d137..fc8e23f 100644 --- a/library/SIP_Templates.ttcn +++ b/library/SIP_Templates.ttcn @@ -525,6 +525,26 @@ payload := omit } +/* Expect during first REGISTER when authorization is required: */ +template (present) PDU_SIP_Response +tr_SIP_Response_REGISTER_Unauthorized( + template CallidString call_id, + template SipAddr from_addr, + template SipAddr to_addr, + template (present) Via via := tr_Via_from(?), + template Contact contact := *, + template integer seq_nr := ?, + template charstring method := "REGISTER", + template integer status_code := 401, + template charstring reason := "Unauthorized", + template charstring body := *) := { + statusLine := tr_SIP_StatusLine(status_code, reason), + msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, contact, + via, + method, *, seq_nr), + messageBody := body, + payload := omit +} /* RFC 3261 8.1.1.5: * "The sequence number value MUST be expressible as a 32-bit unsigned integer -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36490?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I66f776d5df6fb5dc488d9e589b84a6b2385406e8 Gerrit-Change-Number: 36490 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: SIP_Templates: Rework templates to make them more extensible
by pespin 02 Apr '24

02 Apr '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36489?usp=email ) Change subject: SIP_Templates: Rework templates to make them more extensible ...................................................................... SIP_Templates: Rework templates to make them more extensible The existing template system in SIP_Templates made it difficult to craft specific templates, since it was usually skipping several layers of fields when passing parameters. This commit reworks some of those templates, adds news templates, and cleans formatting for others, as a preparation for further work which will be done when adding Asterisk_Tests testsuite. Change-Id: Ifd14213e9c2b8f5061f828a63ef47844828d94ea --- M library/SIP_Templates.ttcn M sip/SIP_Tests.ttcn 2 files changed, 329 insertions(+), 192 deletions(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn index f57b524..f48d137 100644 --- a/library/SIP_Templates.ttcn +++ b/library/SIP_Templates.ttcn @@ -11,59 +11,142 @@ const charstring c_SIP_VERSION := "SIP/2.0"; -template (value) SipUrl ts_SipUrl(charstring user_or_tel, charstring host, integer portnr) := { +template (value) SipUrl ts_SipUrl(template (value) HostPort host_port, + template (omit) UserInfo user_info := omit) := { scheme := "sip", - userInfo := { - userOrTelephoneSubscriber := user_or_tel, - password := omit - }, - hostPort := { - host := host, - portField := portnr - }, + userInfo := user_info, + hostPort := host_port, urlParameters := omit, headers := omit } -template SipUrl tr_SipUrl(template charstring user_or_tel, - template charstring host, - template integer portnr) := { +template (present) SipUrl tr_SipUrl(template (present) HostPort host_port := ?, + template UserInfo user_info := *) := { scheme := "sip", - userInfo := { - userOrTelephoneSubscriber := user_or_tel, - password := * - }, - hostPort := { - host := host, - portField := portnr - }, + userInfo := user_info, + hostPort := host_port, urlParameters := *, headers := * } -template (value) SipAddr ts_SipAddr(charstring user_or_tel, charstring host, integer portnr) := { - addr := { - nameAddr := { - displayName := omit, - addrSpec := ts_SipUrl(user_or_tel, host, portnr) - } - }, - params := omit +template (value) SipUrl ts_SipUrlHost(template (value) charstring host) + := ts_SipUrl(ts_HostPort(host)); + +// [20.10] +template (present) NameAddr tr_NameAddr(template (present) SipUrl addrSpec := ?, + template charstring displayName := *) := { + displayName := displayName, + addrSpec := addrSpec } -template SipAddr tr_SipAddr(template charstring user_or_tel, - template charstring host, - template integer portnr) := { +template (value) NameAddr ts_NameAddr(template (value) SipUrl addrSpec, + template (omit) charstring displayName := omit) := { + displayName := displayName, + addrSpec := addrSpec +} + +template (present) Addr_Union tr_Addr_Union_NameAddr(template (present) NameAddr nameAddr := ?) := { + nameAddr := nameAddr +} +template (value) Addr_Union ts_Addr_Union_NameAddr(template (value) NameAddr nameAddr) := { + nameAddr := nameAddr +} + +template (present) Addr_Union tr_Addr_Union_SipUrl(template (present) SipUrl sipUrl := ?) := { + addrSpecUnion := sipUrl +} +template (value) Addr_Union ts_Addr_Union_SipUrl(template (value) SipUrl sipUrl) := { + addrSpecUnion := sipUrl +} + + +template (present) ContactAddress tr_ContactAddress(template (present) Addr_Union addressField := ?, + template SemicolonParam_List contactParams := *) := { + addressField := addressField, + contactParams := contactParams +} +template (value) ContactAddress ts_ContactAddress(template (value) Addr_Union addressField, + template (omit) SemicolonParam_List contactParams := omit) := { + addressField := addressField, + contactParams := contactParams +} + +template (present) Contact tr_Contact(template (present) ContactAddress_List contactAddresses := ?) := { + fieldName := CONTACT_E, + contactBody := { + contactAddresses := contactAddresses + } +} +template (value) Contact ts_Contact(template (value) ContactAddress_List contactAddresses) := { + fieldName := CONTACT_E, + contactBody := { + contactAddresses := contactAddresses + } +} + +template (value) Contact ts_ContactWildcard := { + fieldName := CONTACT_E, + contactBody := { + wildcard := "*" + } +} + +template (present) Contact tr_Contact_SipAddr(template (present) SipAddr contact_addr := ?) + := tr_Contact({ tr_ContactAddress(contact_addr.addr, contact_addr.params) }); + +private function f_tr_Contact_SipAddr(template SipAddr contact_addr) return template Contact +{ + if (istemplatekind(contact_addr, "omit")) { + return omit; + } else if (istemplatekind(contact_addr, "*")) { + return *; + } + return tr_Contact_SipAddr(contact_addr); +} + +template (value) Contact ts_Contact_SipAddr(template (value) SipAddr contact_addr) + := ts_Contact({ ts_ContactAddress(contact_addr.addr, contact_addr.params) }); +private function ts_Contact_SipAddr_omit(template (omit) SipAddr contact_addr := omit) return template (omit) Contact +{ + if (istemplatekind(contact_addr, "omit")) { + return omit; + } + return ts_Contact_SipAddr(contact_addr); +} + + +// [20.19] +template (value) Expires ts_Expires(template (value) DeltaSec deltaSec := "7200") := { + fieldName := EXPIRES_E, + deltaSec := deltaSec +} + +template (value) SipAddr ts_SipAddr(template (value) HostPort host_port, + template (omit) UserInfo user_info := omit, + template (omit) charstring displayName := omit, + template (omit) SemicolonParam_List params := omit) := { addr := { nameAddr := { - displayName := *, - addrSpec := tr_SipUrl(user_or_tel, host, portnr) + displayName := displayName, + addrSpec := ts_SipUrl(host_port, user_info) } }, - params := * + params := params +} +template (present) SipAddr tr_SipAddr(template (present) HostPort host_port := ?, + template UserInfo user_info := *, + template charstring displayName := *, + template SemicolonParam_List params := *) := { + addr := { + nameAddr := { + displayName := displayName, + addrSpec := tr_SipUrl(host_port, user_info) + } + }, + params := params } /* build a receive template from a value: substitute '*' for omit */ -function tr_SipAddr_from_val(SipAddr tin) return template SipAddr { - var template SipAddr ret := tin; +function tr_SipAddr_from_val(SipAddr tin) return template (present) SipAddr { + var template (present) SipAddr ret := tin; if (tin.addr.nameAddr.displayName == omit) { ret.addr.nameAddr.displayName := *; } @@ -76,7 +159,11 @@ return ret; } - +template (value) HostPort ts_HostPort(template (omit) charstring host := omit, + template (omit) integer portField := omit) := { + host := host, + portField := portField +} function tr_HostPort(template HostPort hp) return template HostPort { var template HostPort hpout := hp; /* if the port number is 5060, it may be omitted */ @@ -86,15 +173,28 @@ return hpout; } -template (value) RequestLine ts_SIP_ReqLine(Method method, template (value) SipUrl uri, + +template (value) UserInfo ts_UserInfo(template (value) charstring userOrTelephoneSubscriber, + template (omit) charstring password := omit) := { + userOrTelephoneSubscriber := userOrTelephoneSubscriber, + password := password +} +template (present) UserInfo tr_UserInfo(template (present) charstring userOrTelephoneSubscriber := ?, + template charstring password := *) := { + userOrTelephoneSubscriber := userOrTelephoneSubscriber, + password := password +} + +template (value) RequestLine ts_SIP_ReqLine(Method method, + template (value) SipUrl uri, charstring ver := c_SIP_VERSION) := { method := method, requestUri := uri, sipVersion := ver } -template RequestLine tr_SIP_ReqLine(template Method method, - template SipUrl uri, - template charstring ver := c_SIP_VERSION) := { +template (present) RequestLine tr_SIP_ReqLine(template (present) Method method := ?, + template (present) SipUrl uri := ?, + template (present) charstring ver := c_SIP_VERSION) := { method := method, requestUri := uri, sipVersion := ver @@ -105,7 +205,8 @@ statusCode := status_code, reasonPhrase := reason } -template StatusLine tr_SIP_StatusLine(template integer status_code, template charstring reason) := { +template (present) StatusLine tr_SIP_StatusLine(template integer status_code, + template charstring reason) := { sipVersion := "SIP/2.0", statusCode := status_code, reasonPhrase := reason @@ -141,28 +242,41 @@ mediaType := "application/sdp" }; -template (value) Via ts_Via_from(SipAddr from_addr) := { +template (value) Via ts_Via_from(template (value) HostPort addr) := { fieldName := VIA_E, viaBody := { { sentProtocol := { "SIP", "2.0", "UDP" }, - sentBy := from_addr.addr.nameAddr.addrSpec.hostPort, + sentBy := addr, viaParams := omit } } } +template (present) Via tr_Via_from(template (present) HostPort host_port := ?, + template SemicolonParam_List viaParams := *) := { + fieldName := VIA_E, + viaBody := { + { + sentProtocol := { "SIP", "2.0", "UDP" }, + sentBy := host_port, + viaParams := viaParams + } + } + } -template (value) MessageHeader ts_SIP_msgHeader_empty :=c_SIP_msgHeader_empty; -template (value) MessageHeader ts_SIP_msgh_std( CallidString call_id, - SipAddr from_addr, - SipAddr to_addr, - template (omit) SipAddr contact_addr, - charstring method, - integer seq_nr, - template (value) Via via, - template (omit) ContentType content_type := omit, - Method_List allow_methods := c_SIP_defaultMethods - ) modifies ts_SIP_msgHeader_empty := { +template (value) MessageHeader ts_SIP_msgHeader_empty := c_SIP_msgHeader_empty; +template (value) MessageHeader +ts_SIP_msgh_std(template (value) CallidString call_id, + template (value) SipAddr from_addr, + template (value) SipAddr to_addr, + template (omit) Contact contact, + template (value) charstring method, + template (value) integer seq_nr, + template (value) Via via, + template (omit) ContentType content_type := omit, + template (value) Method_List allow_methods := c_SIP_defaultMethods, + template (omit) Expires expires := omit + ) modifies ts_SIP_msgHeader_empty := { allow := { fieldName := ALLOW_E, methods := allow_methods @@ -171,13 +285,14 @@ fieldName := CALL_ID_E, callid := call_id }, - contact := ts_Contact(contact_addr), + contact := contact, contentType := content_type, cSeq := { fieldName := CSEQ_E, seqNumber := seq_nr, method := method }, + expires := expires, fromField := { fieldName := FROM_E, addressField := from_addr.addr, @@ -197,49 +312,6 @@ via := via } -private function tr_Contact(template SipAddr contact_addr) return template Contact -{ - if (istemplatekind(contact_addr, "omit")) { - return omit; - } else if (istemplatekind(contact_addr, "*")) { - return *; - } else if (istemplatekind(contact_addr, "?")) { - return ?; - } - var template Contact ret := { - fieldName := CONTACT_E, - contactBody := { - contactAddresses := { - { - addressField := contact_addr.addr, - contactParams := contact_addr.params - } - } - } - }; - return ret; -} - -private function ts_Contact(template (omit) SipAddr contact_addr) return template (omit) Contact -{ - if (istemplatekind(contact_addr, "omit")) { - return omit; - } - var template (omit) Contact ret := { - fieldName := CONTACT_E, - contactBody := { - contactAddresses := { - { - addressField := contact_addr.addr, - contactParams := contact_addr.params - } - } - } - }; - return ret; -} - - function tr_AllowMethods(template Method_List allow_methods) return template Allow { if (istemplatekind(allow_methods, "omit")) { return omit; @@ -248,34 +320,38 @@ } else if (istemplatekind(allow_methods, "?")) { return ?; } - var template Allow ret := { + var template (present) Allow ret := { fieldName := ALLOW_E, methods := allow_methods } return ret } -template MessageHeader tr_SIP_msgh_std( template CallidString call_id, - template SipAddr from_addr, - template SipAddr to_addr, - template SipAddr contact_addr, - template charstring method, - template ContentType content_type := *, - template integer seq_nr := ?, - template Method_List allow_methods := * - ) modifies t_SIP_msgHeader_any := { +template (present) MessageHeader +tr_SIP_msgh_std(template CallidString call_id, + template SipAddr from_addr, + template SipAddr to_addr, + template Contact contact, + template (present) Via via := tr_Via_from(?), + template charstring method, + template ContentType content_type := *, + template integer seq_nr := ?, + template Method_List allow_methods := *, + template Expires expires := * + ) modifies t_SIP_msgHeader_any := { allow := tr_AllowMethods(allow_methods), callId := { fieldName := CALL_ID_E, callid := call_id }, - contact := tr_Contact(contact_addr), + contact := contact, contentType := content_type, cSeq := { fieldName := CSEQ_E, seqNumber := seq_nr, method := method }, + expires := expires, fromField := { fieldName := FROM_E, addressField := from_addr.addr, @@ -287,105 +363,143 @@ toParams := to_addr.params }, userAgent := *, - via := { - fieldName := VIA_E, - viaBody := { - { - sentProtocol := { "SIP", "2.0", "UDP" }, - sentBy := tr_HostPort(from_addr.addr.nameAddr.addrSpec.hostPort), - viaParams := * - } - } - } + via := via } -template (value) PDU_SIP_Request ts_SIP_INVITE( CallidString call_id, - SipAddr from_addr, - SipAddr to_addr, - integer seq_nr, - template (omit) charstring body - ) := { +template (value) PDU_SIP_Request +ts_SIP_REGISTER(template (value) SipUrl sip_url_host_port, + template (value) CallidString call_id, + template (value) SipAddr from_addr, + template (value) SipAddr to_addr, + template (value) Via via, + integer seq_nr, + template (omit) Contact contact, + template (omit) Expires expires, + template (omit) charstring body := omit) := { + requestLine := ts_SIP_ReqLine(REGISTER_E, sip_url_host_port), + msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, contact, + "REGISTER", seq_nr, via, + f_ContentTypeOrOmit(ts_CT_SDP, body), + expires := expires), + messageBody := body, + payload := omit +} +template (present) PDU_SIP_Request +tr_SIP_REGISTER(template (present) SipUrl sip_url_host_port := ?, + template (present) CallidString call_id := ?, + template (present) SipAddr from_addr := ?, + template (present) SipAddr to_addr := ?, + template integer seq_nr := *, + template Contact contact := *, + template Expires expires := *, + template charstring body := *) := { + requestLine := tr_SIP_ReqLine(REGISTER_E, sip_url_host_port), + msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, contact, + tr_Via_from(tr_HostPort(from_addr.addr.nameAddr.addrSpec.hostPort)), + "INVITE", *, seq_nr, + expires := expires), + messageBody := body, + payload := omit +} + +template (value) PDU_SIP_Request +ts_SIP_INVITE(CallidString call_id, + SipAddr from_addr, + SipAddr to_addr, + integer seq_nr, + template (omit) charstring body := omit) := { requestLine := ts_SIP_ReqLine(INVITE_E, to_addr.addr.nameAddr.addrSpec), - msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, from_addr, "INVITE", seq_nr, - ts_Via_from(from_addr), f_ContentTypeOrOmit(ts_CT_SDP, body)), + msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, + ts_Contact_SipAddr(from_addr), + "INVITE", seq_nr, + ts_Via_from(from_addr.addr.nameAddr.addrSpec.hostPort), + f_ContentTypeOrOmit(ts_CT_SDP, body)), messageBody := body, payload := omit } -template PDU_SIP_Request tr_SIP_INVITE( template CallidString call_id, - template SipAddr from_addr, - template SipAddr to_addr, - template integer seq_nr, - template charstring body - ) := { +template (present) PDU_SIP_Request +tr_SIP_INVITE(template CallidString call_id, + template SipAddr from_addr, + template SipAddr to_addr, + template integer seq_nr, + template charstring body) := { requestLine := tr_SIP_ReqLine(INVITE_E, to_addr.addr.nameAddr.addrSpec), - msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, ?, "INVITE", *, seq_nr), + msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, ?, + tr_Via_from(tr_HostPort(from_addr.addr.nameAddr.addrSpec.hostPort)), + "INVITE", *, seq_nr), messageBody := body, payload := omit } -template (value) PDU_SIP_Request ts_SIP_BYE( CallidString call_id, - SipAddr from_addr, - SipAddr to_addr, - integer seq_nr, - template (omit) charstring body - ) := { +template (value) PDU_SIP_Request +ts_SIP_BYE(CallidString call_id, + SipAddr from_addr, + SipAddr to_addr, + integer seq_nr, + template (omit) charstring body) := { requestLine := ts_SIP_ReqLine(BYE_E, to_addr.addr.nameAddr.addrSpec), msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, omit, "BYE", seq_nr, - ts_Via_from(from_addr), f_ContentTypeOrOmit(ts_CT_SDP, body)), + ts_Via_from(from_addr.addr.nameAddr.addrSpec.hostPort), + f_ContentTypeOrOmit(ts_CT_SDP, body)), messageBody := body, payload := omit } -template PDU_SIP_Request tr_SIP_BYE( template CallidString call_id, - template SipAddr from_addr, - template SipAddr to_addr, - template integer seq_nr, - template charstring body - ) := { +template (present) PDU_SIP_Request +tr_SIP_BYE(template CallidString call_id, + template SipAddr from_addr, + template SipAddr to_addr, + template integer seq_nr, + template charstring body) := { requestLine := tr_SIP_ReqLine(BYE_E, to_addr.addr.nameAddr.addrSpec), - msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, omit, "BYE", *, seq_nr), + msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, omit, + tr_Via_from(tr_HostPort(from_addr.addr.nameAddr.addrSpec.hostPort)), + "BYE", *, seq_nr), messageBody := body, payload := omit } -template (value) PDU_SIP_Request ts_SIP_ACK( CallidString call_id, - SipAddr from_addr, - SipAddr to_addr, - integer seq_nr, - template (omit) charstring body - ) := { +template (value) PDU_SIP_Request +ts_SIP_ACK(CallidString call_id, + SipAddr from_addr, + SipAddr to_addr, + integer seq_nr, + template (omit) charstring body) := { requestLine := ts_SIP_ReqLine(ACK_E, to_addr.addr.nameAddr.addrSpec), - msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, from_addr, "ACK", seq_nr, - ts_Via_from(from_addr), f_ContentTypeOrOmit(ts_CT_SDP, body)), + msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, + ts_Contact_SipAddr(from_addr), + "ACK", seq_nr, + ts_Via_from(from_addr.addr.nameAddr.addrSpec.hostPort), + f_ContentTypeOrOmit(ts_CT_SDP, body)), messageBody := body, payload := omit } -template PDU_SIP_Request tr_SIP_ACK( template CallidString call_id, - template SipAddr from_addr, - template SipAddr to_addr, - template integer seq_nr, - template charstring body - ) := { +template (present) PDU_SIP_Request +tr_SIP_ACK(template CallidString call_id, + template SipAddr from_addr, + template SipAddr to_addr, + template integer seq_nr, + template charstring body) := { requestLine := tr_SIP_ReqLine(ACK_E, to_addr.addr.nameAddr.addrSpec), - msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, *, "ACK", *, seq_nr), + msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, *, + tr_Via_from(tr_HostPort(from_addr.addr.nameAddr.addrSpec.hostPort)), + "ACK", *, seq_nr), messageBody := body, payload := omit } - - -template (value) PDU_SIP_Response ts_SIP_Response( CallidString call_id, - SipAddr from_addr, - SipAddr to_addr, - charstring method, - integer status_code, - integer seq_nr, - charstring reason, - Via via, - template (omit) charstring body := omit - ) := { +template (value) PDU_SIP_Response +ts_SIP_Response(CallidString call_id, + SipAddr from_addr, + SipAddr to_addr, + charstring method, + integer status_code, + integer seq_nr, + charstring reason, + Via via, + template (omit) charstring body := omit) := { statusLine := ts_SIP_StatusLine(status_code, reason), msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, omit, method, seq_nr, via, f_ContentTypeOrOmit(ts_CT_SDP, body)), @@ -393,18 +507,20 @@ payload := omit } -template PDU_SIP_Response tr_SIP_Response( template CallidString call_id, - template SipAddr from_addr, - template SipAddr to_addr, - template SipAddr contact_addr, - template charstring method, - template integer status_code, - template integer seq_nr := ?, - template charstring reason := ?, - template charstring body := ? - ) := { +template (present) PDU_SIP_Response +tr_SIP_Response(template CallidString call_id, + template SipAddr from_addr, + template SipAddr to_addr, + template Contact contact, + template charstring method, + template integer status_code, + template integer seq_nr := ?, + template charstring reason := ?, + template charstring body := ?) := { statusLine := tr_SIP_StatusLine(status_code, reason), - msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, contact_addr, method, *, seq_nr), + msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, contact, + tr_Via_from(tr_HostPort(from_addr.addr.nameAddr.addrSpec.hostPort)), + method, *, seq_nr), messageBody := body, payload := omit } diff --git a/sip/SIP_Tests.ttcn b/sip/SIP_Tests.ttcn index ab33af7..aee1a82 100644 --- a/sip/SIP_Tests.ttcn +++ b/sip/SIP_Tests.ttcn @@ -99,12 +99,16 @@ private function f_CallPars_compute(inout CallPars cp) { if (cp.is_mo) { - cp.comp.sip_url_ext := valueof(ts_SipAddr(cp.called, mp_local_host, 5060)); - cp.comp.sip_url_gsm := valueof(ts_SipAddr(cp.calling, mp_osmosip_host, 5060)); + cp.comp.sip_url_ext := valueof(ts_SipAddr(ts_HostPort(mp_local_host, 5060), + ts_UserInfo(cp.called))); + cp.comp.sip_url_gsm := valueof(ts_SipAddr(ts_HostPort(mp_osmosip_host, 5060), + ts_UserInfo(cp.calling))); cp.mncc_call_id := f_sip_rand_seq_nr(); } else { - cp.comp.sip_url_ext := valueof(ts_SipAddr(cp.calling, mp_local_host, 5060)); - cp.comp.sip_url_gsm := valueof(ts_SipAddr(cp.called, mp_osmosip_host, 5060)); + cp.comp.sip_url_ext := valueof(ts_SipAddr(ts_HostPort(mp_local_host, 5060), + ts_UserInfo(cp.calling))); + cp.comp.sip_url_gsm := valueof(ts_SipAddr(ts_HostPort(mp_osmosip_host, 5060), + ts_UserInfo(cp.called))); cp.comp.sip_call_id := hex2str(f_rnd_hexstring(15)); } cp.comp.sip_seq_nr := f_sip_rand_seq_nr(); @@ -338,7 +342,7 @@ } /* OSC -> SIP: OSC confirms call establishment to SIP side */ - as_SIP_expect_resp(tr_SIP_Response(cp.comp.sip_call_id, sip_addr_ext, sip_addr_gsm, contact_addr := ?, + as_SIP_expect_resp(tr_SIP_Response(cp.comp.sip_call_id, sip_addr_ext, sip_addr_gsm, contact := ?, method := "INVITE", status_code := 200, seq_nr := ?, reason := "OK", body := expect_sdp_to_sip)); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36489?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ifd14213e9c2b8f5061f828a63ef47844828d94ea Gerrit-Change-Number: 36489 Gerrit-PatchSet: 3 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-hnbgw[master]: HNBAP: use GSM23003_IMSI_MAX_DIGITS instead of magic number
by pespin 02 Apr '24

02 Apr '24
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36495?usp=email ) Change subject: HNBAP: use GSM23003_IMSI_MAX_DIGITS instead of magic number ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36495?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I2ea0a6a93194da2efb768cd4245767301411eb41 Gerrit-Change-Number: 36495 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Tue, 02 Apr 2024 08:20:55 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in docker-playground[master]: */osmo-bsc.cfg: BTS type 'sysmobts' (deprecated) -> osmo-bts
by pespin 02 Apr '24

02 Apr '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/36493?usp=email ) Change subject: */osmo-bsc.cfg: BTS type 'sysmobts' (deprecated) -> osmo-bts ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/36493?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I98ea9e96d490473efbbe189842ed9f547060dc7d Gerrit-Change-Number: 36493 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 02 Apr 2024 08:20:10 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in docker-playground[master]: ttcn3-bsc-test-sccplite: osmo-bsc.cfg: remove deprecated 'mgw remote-ip'
by pespin 02 Apr '24

02 Apr '24
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/36494?usp=email ) Change subject: ttcn3-bsc-test-sccplite: osmo-bsc.cfg: remove deprecated 'mgw remote-ip' ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/36494?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: Ie322315dd1608636002d4003e5f8629925041476 Gerrit-Change-Number: 36494 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Tue, 02 Apr 2024 08:19:50 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-hnbgw[master]: counters: Distinguish between normal and abnormal release cause
by laforge 01 Apr '24

01 Apr '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36498?usp=email ) Change subject: counters: Distinguish between normal and abnormal release cause ...................................................................... counters: Distinguish between normal and abnormal release cause It is interesting to know if a release was normal (as expected/requested by the NAS layer, typically indicating a user-requested call end) or abnormal (radio failure, pre-emption or whatever other event that the user did not expect). Related: SYS#6773 Change-Id: Idd2f845b7db448064b693ac1efdc8db006a47a11 --- M include/osmocom/hnbgw/hnbgw.h M src/osmo-hnbgw/hnbgw.c M src/osmo-hnbgw/kpi_ranap.c 3 files changed, 54 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/98/36498/1 diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h index b3ba3b2..8daf713 100644 --- a/include/osmocom/hnbgw/hnbgw.h +++ b/include/osmocom/hnbgw/hnbgw.h @@ -100,6 +100,8 @@ HNB_CTR_RANAP_PS_RAB_REL_REQ, HNB_CTR_RANAP_CS_RAB_REL_REQ, + HNB_CTR_RANAP_PS_RAB_REL_REQ_ABNORMAL, + HNB_CTR_RANAP_CS_RAB_REL_REQ_ABNORMAL, HNB_CTR_RANAP_PS_RAB_REL_CNF, HNB_CTR_RANAP_CS_RAB_REL_CNF, @@ -109,6 +111,8 @@ HNB_CTR_RANAP_PS_RAB_REL_IMPLICIT, HNB_CTR_RANAP_CS_RAB_REL_IMPLICIT, + HNB_CTR_RANAP_PS_RAB_REL_IMPLICIT_ABNORMAL, + HNB_CTR_RANAP_CS_RAB_REL_IMPLICIT_ABNORMAL, HNB_CTR_RUA_ERR_IND, diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c index 64bb66f..fe29c29 100644 --- a/src/osmo-hnbgw/hnbgw.c +++ b/src/osmo-hnbgw/hnbgw.c @@ -398,11 +398,14 @@ [HNB_CTR_RANAP_CS_RAB_MOD_FAIL] = { "ranap:cs:rab_mod:fail", "CS RAB Modifications failed" }, - [HNB_CTR_RANAP_PS_RAB_REL_REQ] = { - "ranap:ps:rab_rel:req", "PS RAB Release requested" }, + "ranap:ps:rab_rel:req:normal", "PS RAB Release requested (by CN), normal" }, [HNB_CTR_RANAP_CS_RAB_REL_REQ] = { - "ranap:cs:rab_rel:req", "CS RAB Release requested" }, + "ranap:cs:rab_rel:req:normal", "CS RAB Release requested (by CN), normal" }, + [HNB_CTR_RANAP_PS_RAB_REL_REQ_ABNORMAL] = { + "ranap:ps:rab_rel:req:abnormal", "PS RAB Release requested (by CN), abnormal" }, + [HNB_CTR_RANAP_CS_RAB_REL_REQ_ABNORMAL] = { + "ranap:cs:rab_rel:req:abnormal", "CS RAB Release requested (by CN), abnormal" }, [HNB_CTR_RANAP_PS_RAB_REL_CNF] = { "ranap:ps:rab_rel:cnf", "PS RAB Release confirmed" }, @@ -415,9 +418,13 @@ "ranap:cs:rab_rel:fail", "CS RAB Release failed" }, [HNB_CTR_RANAP_PS_RAB_REL_IMPLICIT] = { - "ranap:ps:rab_rel:implicit", "PS RAB Release implicit (during Iu Release)" }, + "ranap:ps:rab_rel:implicit:normal", "PS RAB Release implicit (during Iu Release), normal" }, [HNB_CTR_RANAP_CS_RAB_REL_IMPLICIT] = { - "ranap:cs:rab_rel:implicit", "CS RAB Release implicit (during Iu Release)" }, + "ranap:cs:rab_rel:implicit:normal", "CS RAB Release implicit (during Iu Release), normal" }, + [HNB_CTR_RANAP_PS_RAB_REL_IMPLICIT_ABNORMAL] = { + "ranap:ps:rab_rel:implicit:abnormal", "PS RAB Release implicit (during Iu Release), abnormal" }, + [HNB_CTR_RANAP_CS_RAB_REL_IMPLICIT_ABNORMAL] = { + "ranap:cs:rab_rel:implicit:abnormal", "CS RAB Release implicit (during Iu Release), abnormal" }, [HNB_CTR_RUA_ERR_IND] = { "rua:error_ind", "Received RUA Error Indications" }, diff --git a/src/osmo-hnbgw/kpi_ranap.c b/src/osmo-hnbgw/kpi_ranap.c index 76f6e22..495fc34 100644 --- a/src/osmo-hnbgw/kpi_ranap.c +++ b/src/osmo-hnbgw/kpi_ranap.c @@ -36,14 +36,26 @@ static void kpi_ranap_process_dl_iu_rel_cmd(struct hnbgw_context_map *map, const ranap_message *ranap) { struct hnb_persistent *hnbp = map->hnb_ctx->persistent; + const RANAP_Cause_t *cause; OSMO_ASSERT(ranap->procedureCode == RANAP_ProcedureCode_id_Iu_Release); + cause = &ranap->msg.iu_ReleaseCommandIEs.cause; + /* When Iu is released, all RABs are released implicitly */ for (unsigned int i = 0; i < ARRAY_SIZE(map->rab_state); i++) { + unsigned int ctr_num; switch (map->rab_state[i]) { case RAB_STATE_ACTIVE: - HNBP_CTR_INC(hnbp, map->is_ps ? HNB_CTR_RANAP_PS_RAB_REL_IMPLICIT : HNB_CTR_RANAP_CS_RAB_REL_IMPLICIT); + if (cause->present == RANAP_Cause_PR_nAS || + cause->choice.nAS == RANAP_CauseNAS_normal_release) { + ctr_num = HNB_CTR_RANAP_PS_RAB_REL_IMPLICIT; + } else { + ctr_num = HNB_CTR_RANAP_PS_RAB_REL_IMPLICIT_ABNORMAL; + } + if (!map->is_ps) + ctr_num++; + HNBP_CTR_INC(hnbp, ctr_num); break; } } @@ -106,10 +118,6 @@ if (ies->presenceMask & RAB_ASSIGNMENTREQUESTIES_RANAP_RAB_RELEASELIST_PRESENT) { RANAP_RAB_ReleaseList_t *r_list = &ies->raB_ReleaseList; - /* increment number of released RABs, we don't need to do that individually during iteration */ - HNBP_CTR_ADD(hnbp, map->is_ps ? HNB_CTR_RANAP_PS_RAB_REL_REQ : HNB_CTR_RANAP_CS_RAB_REL_REQ, - r_list->raB_ReleaseList_ies.list.count); - for (unsigned int i = 0; i < r_list->raB_ReleaseList_ies.list.count; i++) { RANAP_IE_t *release_list_ie = r_list->raB_ReleaseList_ies.list.array[i]; RANAP_RAB_ReleaseItemIEs_t _rab_rel_item_ies = {}; @@ -133,6 +141,16 @@ switch (map->rab_state[rab_id]) { case RAB_STATE_ACTIVE: + unsigned int ctr_num; + if (rab_rel_item->cause.present == RANAP_Cause_PR_nAS && + rab_rel_item->cause.choice.nAS == RANAP_CauseNAS_normal_release) { + ctr_num = HNB_CTR_RANAP_PS_RAB_REL_REQ; + } else { + ctr_num = HNB_CTR_RANAP_PS_RAB_REL_REQ_ABNORMAL; + } + if (!map->is_ps) + ctr_num++; + HNBP_CTR_INC(hnbp, ctr_num); break; default: LOG_MAP(map, DRANAP, LOGL_NOTICE, -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36498?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Idd2f845b7db448064b693ac1efdc8db006a47a11 Gerrit-Change-Number: 36498 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-bts[master]: vty info: MS power levels in dBm are not negative
by fixeria 01 Apr '24

01 Apr '24
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/36497?usp=email ) Change subject: vty info: MS power levels in dBm are not negative ...................................................................... vty info: MS power levels in dBm are not negative Change-Id: Ib928a1378bc00b8ccb0365e5536f010e1f8a3d43 --- M src/common/vty.c 1 file changed, 11 insertions(+), 2 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/vty.c b/src/common/vty.c index 6ec96da..c0008a8 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -1867,10 +1867,10 @@ int current_dbm = ms_pwr_dbm(trx->bts->band, st->current); int max_dbm = ms_pwr_dbm(trx->bts->band, st->max); - cfg_out(vty, "Current power level: %u, -%d dBm", + cfg_out(vty, "Current power level: %u, %d dBm", st->current, current_dbm); if (st->dpc_params != NULL) - vty_out(vty, " (max %u, -%d dBm)", st->max, max_dbm); + vty_out(vty, " (max %u, %d dBm)", st->max, max_dbm); vty_out(vty, "%s", VTY_NEWLINE); if (st->dpc_params == NULL) -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/36497?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ib928a1378bc00b8ccb0365e5536f010e1f8a3d43 Gerrit-Change-Number: 36497 Gerrit-PatchSet: 1 Gerrit-Owner: keith <keith(a)rhizomatica.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-bts[master]: vty info: MS power levels in dBm are not negative
by fixeria 01 Apr '24

01 Apr '24
Attention is currently required from: keith. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/36497?usp=email ) Change subject: vty info: MS power levels in dBm are not negative ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/36497?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ib928a1378bc00b8ccb0365e5536f010e1f8a3d43 Gerrit-Change-Number: 36497 Gerrit-PatchSet: 1 Gerrit-Owner: keith <keith(a)rhizomatica.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: keith <keith(a)rhizomatica.org> Gerrit-Comment-Date: Mon, 01 Apr 2024 04:12:32 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 110
  • 111
  • 112
  • 113
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.