how does it work
oaisim needs three sets of configuration file for working.
-
The first set is the configuration file given on the command line with the -c option. This file configure the eNodeB parameters.
-
The second set is for defining the ue behaviour on radio link. These files are in the ./SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results directory. The base directory can be set by the OPENAIR_TARGETS and OPENAIR1_DIR environment variables.
-
The third set is for defining the usim parameter and the permanent data of UEs These files are in binary form and hidden in the filesystem:
- .ue.nvramX
- .ue_emm.nvramX
- .usim.nvramX
Where X is the index of the UE
By default, the build scrip will generate these file in the target/bin directory for one ue:
./targets/bin/.usim.nvram0
./targets/bin/.ue_emm.nvram0
./targets/bin/.ue.nvram0
With the new system, these files are generated from a configuration file. The generator is called conf2uedata :
root@devenv4:~# conf2uedata
No output option found
usage: conf2uedata [OPTION]...
[-c] Config file to use
[-o] output file directory
[-h] Display this usage
This programm can be found in ./targets/bin/
The configuration file used by default is openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf
setup
make a configuration file for UEs permanent data
Here are an excerpt from a configuration file:
# List of known PLMNS
PLMN: {
PLMN0: {
FULLNAME="Test network";
SHORTNAME="OAI4G";
MNC="01";
MCC="001";
};
PLMN1: {
FULLNAME="SFR France";
SHORTNAME="SFR";
MNC="10";
MCC="208";
};
[... other plmns]
};
UE0:
{
USER: {
IMEI="356113022094149";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="0100001111";
USIM_API_K="fec86ba6eb707ed08905757b1bb44b8f";
OPC="00000000000000000000000000000000";
MSISDN="33611123456";
};
# Home PLMN Selector with Access Technology
HPLMN= "20810";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20893", "310280", "310028");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
EHPLMN_LIST= ("20811", "20813");
};
UE1: { [...] }
[... other UEs]
You must first define networks in the PLMN section, before using it in an UE section.
The important fields for connecting an UE are:
-
HPLMN: network operator of the UE
-
MSIN: subscribe identifiaction of the UE
Note: The concatenation of HPLMN and MSIN defines the IMSI
-
USIM_API_K: The key of the sim card
-
OPC: The OPc code computed from the OP and USIM_API_K
Note: USIM_API_K, OPC are the necessary security fields to authenticate to the hss
generate binary files
Once you have your configuration file, you can generate the .nvramX files with the following command:
conf2uedata -c <my_config_file> -o <output path>
oaisim will search for .nvramX files in the current directory. But you can change it by setting NVRAM_DIR environment variable for .ue_emm.nvramX and .ue.nvramX files, and by setting USIM_DIR for .usim.nvramX files.
launch oaisim for multiple UE
Launching oaisim for multiple user just need to set the right number of UE to the -u option.
An example from the real world launching 3 UEs:
/usr/sbin/oaisim.Rel10 --enb-conf /etc/ugw-oaisim/enb.band7.generic.conf -u3 -s15 -AAWGN -y1 -b1 -Q0 -a
You should see in the logs these lines to confirm it successfully read permanent data for each UE:
[NAS][I] .../openair3/NAS/UE/EMM/emm_main.c:208 EMM-MAIN - USIM application data successfully read
[NAS][I] .../openair3/NAS/UE/EMM/emm_main.c:362 EMM-MAIN - EMM data successfully read
[NAS][I] .../openair3/NAS/UE/EMM/emm_main.c:208 EMM-MAIN - USIM application data successfully read
[NAS][I] .../openair3/NAS/UE/EMM/emm_main.c:362 EMM-MAIN - EMM data successfully read
[NAS][I] .../openair3/NAS/UE/EMM/emm_main.c:208 EMM-MAIN - USIM application data successfully read
[NAS][I] .../openair3/NAS/UE/EMM/emm_main.c:362 EMM-MAIN - EMM data successfully read
managing ue
each UE listen on an udp port to receive hayes AT commands. The default port is 10000 for the first UE, 10001 for the second on so on ...
You can see this in the oaisim logs:
[NAS][I] .../openair3/NAS/UE/API/USER/user_api.c:152 USR-API - User's UDP socket 37 is BOUND to devenv4-ugw-testing-ue-lte/10000
[NAS][I] .../openair3/NAS/UE/API/USER/user_api.c:152 USR-API - User's UDP socket 39 is BOUND to devenv4-ugw-testing-ue-lte/10001
[NAS][I] .../openair3/NAS/UE/API/USER/user_api.c:152 USR-API - User's UDP socket 40 is BOUND to devenv4-ugw-testing-ue-lte/10002
By default, oaisim will autoconnect UE with the CFUN and CGATT command. You can modify this behaviour when compiling source by setting the flag NAS_UE_AUTOSTART to 0 in nas_ue_task.c
So for example you can detach the first UE with these command:
# first enter pin code on the modem
echo -en "AT+CPIN=0000\r" | nc -u -w 1 localhost 10000
# second send the detach command
echo -en "AT+CGATT=0\r" | nc -u -w 1 localhost 10000
Then if you wan't to attach again the ue:
echo -en "AT+CGATT=1\r" | nc -u -w 1 localhost 10000
Note: you need a shell that supports the -en option of echo like bash