Commit d18236fa authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance UT sequence (AT+COPTS=2 is crashing)

parent e50b84f1
Loading
Loading
Loading
Loading
+1 −1
Changes for etc/AtsNGAP/AtsNGAP_GNB_p_net.cfg_: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ LibNGAP_Pixits.PX_NAS_MNC := '40'H
LibNGAP_Pixits.PX_UT_PLMN_MCC      := '999'H;
LibNGAP_Pixits.PX_UT_PLMN_MNC      := '39'H;

# The real UE (modem) is taken off the network, then registers on this PLMN on demand (AT+COPS), without a restart
# The real UE (modem) radio is switched off and on, then it registers on this PLMN (AT+COPS), without a restart
LibNGAP_Pixits.PX_UT_PLMN_MANUAL_SELECT := true
LibNGAP_Pixits.PX_UT_PLMN_MCC      := '999'H
LibNGAP_Pixits.PX_UT_PLMN_MNC      := '40'H
+90 −0
Changes for scripts/fast_rebuild.sh: 90 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/bin/bash
#set -e

# Rebuilds only the given modules (by base name, e.g. NGAP_PDU_Descriptions NGAP_Steps) and
# relinks the ATS binary, instead of letting `make` recompile every translation unit.
#
# Why this is needed: the TTCN-3 compiler always rewrites every .cc/.hh on each run (it embeds
# a per-run timestamp comment, so the content differs even when nothing meaningful changed),
# which makes `make` think every .o is stale. For AtsNGAP two of those ~140 objects alone
# (NGAP_IEs.cc, NGAP_PDU_Contents.cc) are ASN.1-derived translation units over 1M and 300K
# lines respectively, and recompiling them routinely exhausts memory. Editing one function in
# one module should not require that.
#
# This script regenerates the .cc/.hh for ALL modules first (needed for correct cross-module
# codegen, but cheap: well under a second for the whole NGAP library), then compiles with g++
# ONLY the modules named on the command line, and relinks using whatever .o files are already
# on disk for everything else. The exact compile/link commands are extracted from
# `make -n -B` rather than duplicated here, so this script can never drift from the Makefile's
# actual flags, defines and include paths.

if [ -z "$ATS" ]
then
    echo "ATS shall be defined"
    exit 1
fi

if [ $# -eq 0 ]
then
    echo "Usage: ATS=<ats_name> $0 <module1> [module2 ...]"
    echo "Example: ATS=AtsNGAP $0 NGAP_PDU_Descriptions NGAP_Steps"
    exit 1
fi

cd "$(dirname "$0")/.." || exit 1

OUT_DIR=build/${ATS}
START_TS=$(date +%s)

echo "=== Regenerating .cc/.hh for ${ATS} (all modules, but cheap) ==="
make ATS=${ATS} "${OUT_DIR}/.generate"
if [ $? -ne 0 ]
then
    echo "Code generation failed"
    exit 1
fi

for module in "$@"
do
    cc_file="${OUT_DIR}/${module}.cc"
    o_file="${OUT_DIR}/${module}.o"

    if [ ! -f "$cc_file" ]
    then
        echo "No such generated file: $cc_file (check the module name)"
        exit 1
    fi

    echo "=== Compiling ${module} ==="
    compile_cmd=$(make ATS=${ATS} -n -B "$o_file" | grep '^g++ ' | grep -F -- "-o $o_file ")
    if [ -z "$compile_cmd" ]
    then
        echo "Could not extract the compile command for $o_file"
        exit 1
    fi
    eval "$compile_cmd"
    if [ $? -ne 0 ]
    then
        echo "Compilation of $module failed"
        exit 1
    fi
done

echo "=== Linking ${ATS} ==="
link_cmd=$(make ATS=${ATS} -n -B all | grep '^g++ ' | grep -v ' -c ')
if [ -z "$link_cmd" ]
then
    echo "Could not extract the link command"
    exit 1
fi
eval "$link_cmd"
if [ $? -ne 0 ]
then
    echo "Linking failed"
    exit 1
fi

END_TS=$(date +%s)
echo "Done: bin/${ATS} rebuilt from {$*} in $((END_TS - START_TS))s."

exit 0
+15 −8
Changes for ttcn/AtsNGAP/NGAP_Steps.ttcn: 15 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -604,23 +604,28 @@ module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NG
                // can be after the Registration Request. The actual results are only visible in the
                // upper tester log; here only the resulting NAS signalling is checked.
                // Two ways to trigger the registration:
                // - PX_UT_PLMN_MANUAL_SELECT: the modem is taken off the network with AT+COPS=2
                //   (DETACH), then registers on demand on the PLMN selected with AT+COPS=1. The modem
                //   is not restarted: it does not keep AT+COPS=2 over a restart and registers by
                //   itself as soon as it is back;
                // - PX_UT_PLMN_MANUAL_SELECT: the radio of the modem is switched off (AT+CFUN=4,
                //   DEREGISTER) and on again (AT+CFUN=1, POWER_ON), and the PLMN is selected at once
                //   with AT+COPS=1, before the modem has found a cell by itself. The modem is not
                //   restarted, as it registers by itself as soon as it is back from a restart.
                //   AT+COPS=2 is not used to keep it off the network: on the RM520N-GL it makes the
                //   following AT+COPS=1 fail with "+CME ERROR: SIM failure";
                // - otherwise: the modem is restarted with AT+CFUN=1,1 and registers by itself, about
                //   30 s later, on the PLMN it selects.
                var UT_COMMON_CNF v_utCnf;

                if (PX_UT_PLMN_MANUAL_SELECT) {
                    log("f_NGAP_gnb_UE_Register: Deregistering the modem");
                    v_utCnf := fl_UT_ApplyCommandRetCnf(utPtcMtcPort, cas_UT_Req(DETACH, LOCAL_CNF_REQUIRED));
                    log("f_NGAP_gnb_UE_Register: Switching the modem radio off");
                    v_utCnf := fl_UT_ApplyCommandRetCnf(utPtcMtcPort, cas_UT_Req(DEREGISTER, LOCAL_CNF_REQUIRED));
                    if (not v_utCnf.Result) {
                        log("*** " & __SCOPE__ & ": FAIL: deregistration could not be sent to the modem");
                        setverdict(fail, "*** " & __SCOPE__ & ": FAIL: deregistration could not be sent to the modem");
                        log("*** " & __SCOPE__ & ": FAIL: radio off could not be sent to the modem");
                        setverdict(fail, "*** " & __SCOPE__ & ": FAIL: radio off could not be sent to the modem");
                        return;
                    }

                    log("f_NGAP_gnb_UE_Register: Switching the modem radio on");
                    fl_UT_ApplyCommand(utPtcMtcPort, cas_UT_Req(POWER_ON, NO_CNF_REQUIRED));

                    log("f_NGAP_gnb_UE_Register: Selecting PLMN manually: MCC=", PX_UT_PLMN_MCC, ", MNC=", PX_UT_PLMN_MNC);
                    fl_UT_ApplyCommand(utPtcMtcPort, cas_UT_Req(PLMN_MANUAL, NO_CNF_REQUIRED, cs_ManualPlmn("\"" & f_ConvertPLMNtoString(fl_NasNN_MCC2PlmnId(PX_UT_PLMN_MCC, PX_UT_PLMN_MNC)) & "\"")));
                } else {
@@ -633,6 +638,8 @@ module NGAP_Steps { // TODO FSCOM f_xxx_UE_SecurityMode to be mmoved into NAG_NG
                    }
                }

                N2_gNBaMF_P.clear; // Delete any NGAP messages that may have been received before the registration request (e.g. automatic registration).

                log("f_NGAP_gnb_UE_Register: Requesting a data call: APN=", PX_UT_DATA_CALL_APN, ", attach timeout=", PX_UT_DATA_CALL_ATTACH_TIMEOUT);
                fl_UT_ApplyCommand(utPtcMtcPort, cas_UT_Req(ACTIVATE_BEARER, NO_CNF_REQUIRED, {
                                                                                               cs_Ut_Parameter_Common("APN", PX_UT_DATA_CALL_APN),
+1 −1
Changes for ttcn/LibNGAP/lib/LibNGAP_Pixits.ttcn: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -737,7 +737,7 @@ module LibNGAP_Pixits {
    modulepar float      PX_UT_DATA_CALL_ATTACH_TIMEOUT := 60.0;

    /** @desc How the real UE (AT commands) is made to register; see f_NGAP_gnb_UE_Register.
     *        true: it is taken off the network (AT+COPS=2), then registers on PX_UT_PLMN_MCC/PX_UT_PLMN_MNC (AT+COPS=1), without a restart.
     *        true: its radio is switched off and on (AT+CFUN=4, AT+CFUN=1), then it registers on PX_UT_PLMN_MCC/PX_UT_PLMN_MNC (AT+COPS=1), without a restart.
     *        false: it is restarted (AT+CFUN=1,1) and registers by itself on the PLMN it selects. */
    modulepar boolean     PX_UT_PLMN_MANUAL_SELECT := false;

+0 −1
Changes for upper_tester/dummy_modem.py: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ DEFAULT_SCRIPT = {
    "AT": ["OK"],
    "AT+CPIN?": ["+CPIN: READY", "OK"],
    "AT+CFUN=4": ["OK"],
    "AT+COPS=2": ["OK"],
    "AT+CGATT=1": ["OK"],
    "AT+CGATT=0": ["OK"],
    'AT+CGDCONT=1,"IPV4V6","ims"': ["OK"],
Loading