Compare commits

..

321 Commits

Author SHA1 Message Date
Robert Schmidt
ee287d62f4 Merge branch 'integration_2023_w47' into 'develop'
See merge request oai/openairinterface5g!2450

* !2440 hotfix: set PDCP t-reordering to 100ms
* !2439 rfsimulator: ignore PIPE signal
* !2441 minor: documentation: advertise correct default value for --ssb
* !2446 chore(ci): displaying the ASN1C commit
* !2443 CI documentation: updates and how to reproduce
* !2355 NR UE improve handling of MSG4 feedback in default PUCCH
* !2408 NR UE MAC config improvements
* !2431 T: isolate generated .h files when using make
* !2442 nr pdcp: rework reestablishment
* !2448 lte: switch to RRC release 16.13.0
* !2088 Implementation of logical channel prioritization at UE
* correctly read timing advance option `-A` in gNB
* set sample advance for OAIUE test to make it more stable
* set gain for OAIUE test to make it more stable
* !2445 Correctly allocate SCC n_TimingAdvanceOffset
* !2454 bugfix: fix NSA CI test
2023-11-28 06:38:49 +00:00
Robert Schmidt
79a1b1cf69 Merge remote-tracking branch 'origin/ci-fix-nsa-sanitycheck-test' into integration_2023_w47 2023-11-27 17:52:48 +01:00
Robert Schmidt
728fc34296 Merge remote-tracking branch 'origin/Fix_n_TimingAdvanceOffset' into integration_2023_w47 2023-11-27 17:52:39 +01:00
Robert Schmidt
f3ff41befe Correct RX gain for OAI UE test 2023-11-27 14:36:50 +01:00
Cedric Roux
ff38130196 bugfix: fix NSA CI test
It seems like initialDLBWPcontrolResourceSetZero needs to be set
otherwise the quectel UE does not accept the Reconfiguration.
2023-11-27 12:29:48 +01:00
Robert Schmidt
9acfaaabcb Set timing advance for gNB & UE to make OAI UE test more stable 2023-11-27 11:42:06 +01:00
Robert Schmidt
b04e166e59 gNB: take into account timing_advance option -A 2023-11-27 11:41:58 +01:00
Robert Schmidt
3e9d310093 Merge remote-tracking branch 'origin/implement_logical_channel_prioritization_ue' into integration_2023_w47 2023-11-24 17:55:45 +01:00
Robert Schmidt
67b0c006f5 Merge remote-tracking branch 'origin/lte-rrc-rel16' into integration_2023_w47 2023-11-24 14:12:26 +01:00
Robert Schmidt
ec3de01377 Merge remote-tracking branch 'origin/nr-pdcp-reestablishment-procedure' into integration_2023_w47 2023-11-24 14:12:20 +01:00
Robert Schmidt
1b1c8e22a2 Merge remote-tracking branch 'origin/t-tracer-isolation' into integration_2023_w47 2023-11-24 14:12:13 +01:00
Cedric Roux
18e59d3c2e lte: switch to RRC release 16.13.0
A COTS UE is sending UE capabilities with accessStratumRelease "rel16"
which is not decoded by our RRC. Switching to RRC 16.13.0 lets our RRC
accept these capabilities (and as a positive side effect lets this
particular UE work nicely in NSA fr1).
2023-11-24 12:32:48 +01:00
luis_pereira87
d6abd0117a Add config file for FDD band 1 and 15 kHz SCS 2023-11-24 09:11:41 +00:00
Robert Schmidt
b704f45daa Merge remote-tracking branch 'origin/NR_UE_MAC_conifg_improvements' into integration_2023_w47 2023-11-24 10:08:40 +01:00
Robert Schmidt
e24145fd85 Merge remote-tracking branch 'origin/NR_UE_improve_handling_msg4_feedback' into integration_2023_w47 2023-11-24 10:08:32 +01:00
Robert Schmidt
75d8c05c24 Merge remote-tracking branch 'origin/doc-ci-repro' into integration_2023_w47 2023-11-23 14:21:47 +01:00
Robert Schmidt
3217a3745b Merge remote-tracking branch 'origin/ci-display-asn1c-commit' into integration_2023_w47 2023-11-23 14:21:36 +01:00
Robert Schmidt
041758a13a Merge remote-tracking branch 'origin/minor-fix-doc-ssb-default-value' into integration_2023_w47 2023-11-23 14:21:29 +01:00
Robert Schmidt
38d46be372 Merge remote-tracking branch 'origin/fix-sigpipe-rfsimulator' into integration_2023_w47 2023-11-23 14:21:21 +01:00
francescomani
d241506043 fix for L2 simulator 2023-11-23 12:14:39 +01:00
Raphael Defosseux
59125df278 CI Doc: correct CPP-Check pipeline resource
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-11-23 11:12:27 +01:00
francescomani
65bcbabdca improve handling of MSG4 feedback in default PUCCH 2023-11-23 10:28:04 +01:00
Robert Schmidt
ea369e403d Separate Image Build and Test pipelines, list dockerfiles 2023-11-22 14:04:01 +01:00
Robert Schmidt
9ab67ad87c CI doc: clarify Interop-F1 pipeline purpose 2023-11-22 09:35:09 +00:00
francescomani
c6e5ead2a9 some more RRC cleanup 2023-11-21 11:07:21 +01:00
Raphael Defosseux
207f65992e chore(ci): displaying the ASN1C commit
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-11-21 09:46:24 +01:00
luis_pereira87
088bdf234e Fix read n_TimingAdvanceOffset from the configuration file 2023-11-20 21:42:52 +00:00
Cedric Roux
9e46a6a6ae nr pdcp: introduce nr_pdcp_get_rb() and some cleanup
cleanup means:
- typo: susbend -> suspend
- call nr_pdcp_manager_unlock() where needed
- simplify LOG_XX (remove __FILE__, __LINE__, __FUNCTION__)

note:
nr_pdcp_release_srb() and nr_pdcp_release_drb() don't use
nr_pdcp_release_drb() because they modify the arrays, so
it does not make sense to "abstract" the accesses to
->srb and ->drb.
2023-11-20 14:55:34 +01:00
francescomani
273562f345 fix for do-ra and phy-test mode 2023-11-20 14:21:49 +01:00
francescomani
2715c7efdd improve MAC configuration from RRC 2023-11-20 14:21:01 +01:00
francescomani
848f5767d7 unified handling of cellgroup config at MAC 2023-11-20 14:21:01 +01:00
francescomani
df917624db function to configure cellgroup at RRC 2023-11-20 14:10:30 +01:00
francescomani
4d8bb4ef25 unify handling of reconfiguration with sync 2023-11-20 12:14:59 +01:00
francescomani
5661b20e9e improving init for dora and phytest 2023-11-20 12:14:59 +01:00
francescomani
8013d5d8cc removing CellGroup dependance from MAC common functions 2023-11-20 11:36:46 +01:00
Robert Schmidt
4599969f89 Describe how to reproduce CI 2023-11-20 11:32:09 +01:00
Robert Schmidt
36479a0ac5 TESTBenches.md: identify tags/labels to run pipeline 2023-11-20 11:31:47 +01:00
Robert Schmidt
623092e130 Update TESTBenches: add missing pipelines, remove networked deviewes, update machines 2023-11-20 11:07:59 +01:00
Cedric Roux
2c2915dad8 reestablish only exisiting RBs 2023-11-20 11:00:23 +01:00
Robert Schmidt
7ae790afb6 doc: Remove RAN-SA-AmariS-CN5G pipeline, superseded by RAN-SA-AW2S-CN5G 2023-11-20 10:43:54 +01:00
Cedric Roux
107913d6b2 nr pdcp: rework reestablishment
Security part needs to be checked, may fail to work.
But if it fails, it was probably not working before either.

This commit also contains adding 'static' to nr_pdcp_entity_release()
and nr_pdcp_entity_delete() (it was too complicated to do a separate
commit for this).

We also update stats in free_rx_list() (again, too complicated for
a separate commit).

openair2/RRC/NR/rrc_gNB.c probably needs some more work, it is a
bit ugly to reestablish all the drbs without checking if they
exit. It will generate warnings at runtime. I didn't do it because
I don't know the proper way.
2023-11-19 16:57:03 +01:00
Cedric Roux
7a7d8a1766 nr pdcp: stats: count delivered sdus 2023-11-19 16:49:55 +01:00
Cedric Roux
470af5f497 nr pdcp: bugfix: discard pdu if integrity fails 2023-11-19 16:49:11 +01:00
Cedric Roux
f265b04593 nr pdcp: bugfix: use proper size for t_reordering_start 2023-11-19 16:47:58 +01:00
Cedric Roux
7203e5aba8 nr pdcp: minor: set function scope to static 2023-11-19 16:46:08 +01:00
Cedric Roux
07ee33f024 nr pdcp: minor: fix spacing 2023-11-19 16:43:57 +01:00
Cedric Roux
69a2f103ea minor: documentation: advertise correct default value for --ssb 2023-11-18 22:16:53 +01:00
Cedric Roux
13757862fb hotfix: set PDCP t-reordering to 100ms
The function generateDRB() sets the value to 100ms but the function
rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ() sets it to 0ms.

So what happens is that the UE gets the value 100ms in the
RRC Reconfiguration but the gNB creates the PDCP entity with 0ms.
Let's create it with 100ms instead, to be aligned with how we configure
the UE.

And also avoid some PDCP warnings at runtime when some packets
are retransmitted but rejected because of the 0ms timer. This is
the warning:

    [PDCP]   discard NR PDU rcvd_count=68469, entity->rx_deliv 68481,sdu_in_list 0

This is just a hotfix. A real solution is to have the RB creation in
only one place. And we should also have those parameters configurable.
Work for later.
2023-11-18 21:56:42 +01:00
Cedric Roux
578cd23d59 rfsimulator: ignore PIPE signal
When au UE disconnects, a write on the rf simulator socket may
generate a PIPE signal in the gnb and crash it.

Let's ignore this signal.
2023-11-18 21:44:21 +01:00
Sriharsha Korada
31a63bc919 Update UE feature set 2023-11-16 09:20:14 +01:00
Sriharsha Korada
b0b8c90fd2 clean up 2023-11-16 09:07:05 +01:00
sriharsha
f248b2fdff fix: avoid freeing rlc config structure 2023-11-16 09:07:05 +01:00
sriharsha
e5ab3e022e Handling of mac-LogicalChannelConfig during reconfiguration 2023-11-16 09:07:05 +01:00
sriharsha
43036eb83d Add implementation of logical channel prioritization at UE
- Reorder the logical channels based on priority
- Handling of configuration and release of logical channel bearer
- Add changes in the implementation of lcp procedure for equal priority logical channels
- Restructure the lcp parameters as a separate structure
- Further code clean up
2023-11-16 09:07:05 +01:00
Robert Schmidt
0accb601e4 Merge branch 'integration_2023_w44' into 'develop'
Closes #685 and #698

See merge request oai/openairinterface5g!2425

* !2404 NR UE MCS for retransmission v2
* !2420 Scan build: Argument with 'nonnull' attribute passed null
* !2422 Fix AssertFatal when using NR band n1
* !2418 NR UE resynchronization fix
* !2376 Save NSSAI params of PDU session coming from AMF
* add `build_oai` option for thread sanitizer
* update 60 MHz 2x2 phytest-timing threshold
* !2423 Free F1 UE data struct only on UE release
* !2428 Prevent CU-UP UE ID management if integrated CU
* !2390 NR PTRS improvements
* !2291 Pass config object instead of using implicit global
* !2421 Change UL_TTI.request PRACH PDU beamforming pack/unpack handling
* !2406 CI:AW2S - test with 10 AmariUEs
* !2401 ue-rrc-coarse-cleaning
* !2366 Remove F1 BWP switching logic
* !2426 F1: support multiple DUs per CU
* !2432 Remove cblas dependency for 5G targets
2023-11-15 02:44:13 +00:00
Robert Schmidt
5e5ab86d47 Merge remote-tracking branch 'origin/remove-cblas-oai-5g' into integration_2023_w44 2023-11-14 15:12:41 +01:00
Laurent THOMAS
18951bad4d remove-cblas-oai-5g 2023-11-14 11:47:38 +01:00
Robert Schmidt
e989ae834a Merge remote-tracking branch 'origin/Fix-Zero-Member-Alloc-FAPI-PDU' into integration_2023_w44 2023-11-13 16:24:09 +01:00
Robert Schmidt
23597c9193 Merge remote-tracking branch 'origin/f1-multiple-du' into integration_2023_w44 2023-11-13 16:23:58 +01:00
Robert Schmidt
b07691643d Merge remote-tracking branch 'origin/f1-bwp-switching' into integration_2023_w44 2023-11-13 15:10:27 +01:00
Robert Schmidt
0c51db05ad Merge remote-tracking branch 'origin/UE-rrc-coarse-cleaning' into integration_2023_w44 2023-11-13 15:10:20 +01:00
Robert Schmidt
ad93072e0a Merge remote-tracking branch 'origin/ci-aw2s-add-ues' into integration_2023_w44 2023-11-13 15:10:09 +01:00
Cedric Roux
e98acd7c5a T: set dependancies for generated files
This commit follows the previous one and adds a dependancy for the
generated .h files so that when we change T_messages.txt to add a
T trace, the compilation succeeds when using ninja in
cmake_targets/ran_build/build.
2023-11-12 14:07:11 +01:00
Cedric Roux
1111eccac6 T: isolate generated .h files when using make
When using the make system to generate T files, if you change
T_messages.txt you may have problems compiling the gnb with ninja.

If you want to see the problem:
First run: cd cmake_targets; ./build_oai --ninja --gNB
Then: cd common/utils/T
edit T_messages.txt, add a trace, for example:
---
ID = ENB_PHY_UL_TOCK
    DESC = eNodeB uplink tick - one tick per ms at start of uplink processing
    GROUP = ALL:PHY:GRAPHIC:ENB
    FORMAT = int,eNB_ID : int,frame : int,subframe
---
then run: make
then: cd cmake_targets/ran_build/build; ninja nr-softmodem
You should have an error looking like this:
---
[3/81] Checking validity of VCD files
FAILED: common/utils/T/CMakeFiles/check_vcd /tmp/develop/cmake_targets/ran_build/build/common/utils/T/CMakeFiles/check_vcd
cd /tmp/develop/cmake_targets/ran_build/build/common/utils/T && /tmp/develop/cmake_targets/ran_build/build/common/utils/T/_check_vcd /tmp/develop/common/utils/T/T_messages.txt /tmp/develop/common/utils/T/../LOG/vcd_signal_dumper.h
error: VCD_FIRST_VARIABLE is not correct in T_defs.h

You probably added a VCD trace (variable or function) but you did not
update T_messages.txt and/or T_defs.h in common/utils/T/
[...]
---

Let's first isolate the generated T .h files when using make because
we have two versions of T_IDs.h and T_messages.txt.h when mixing
make/cmake.

A next commit will regenerate T_IDs.h and T_messages.txt.h when
T_messages.txt chages for the cmake system, because this commit
does not solve the problem.
2023-11-12 14:04:36 +01:00
Robert Schmidt
610a886da7 Merge remote-tracking branch 'origin/multi-config' into integration_2023_w44 2023-11-12 05:14:36 +01:00
Robert Schmidt
3fd45922b7 Merge remote-tracking branch 'origin/NR_PTRS_improvements' into integration_2023_w44 2023-11-12 05:14:25 +01:00
Laurent THOMAS
dd059343d9 ue-rrc-coarse-cleaning 2023-11-10 17:43:59 +01:00
Robert Schmidt
3bede49b9b Merge remote-tracking branch 'origin/fix-double-use-cudata' into integration_2023_w44 2023-11-10 17:29:40 +01:00
Robert Schmidt
8e4ff595a0 Merge remote-tracking branch 'origin/fix-no-f1uedata-when-in-mac' into integration_2023_w44 2023-11-10 17:29:28 +01:00
Robert Schmidt
45dd4813c9 Update FEP TX precoding time threshold for 60 MHz 2x2 phytest-timing test 2023-11-10 17:29:09 +01:00
Jaroslava Fiedlerova
c2255a4168 Change PRACH Configuration Index in AW2S gNB config file
- PRACH Configuration Index = 98 is not suSpported by the Amarisoft UE simulator, as a number of PRACH occasions within the PRACH slot is > 1
- for PRACH Configuration Index = 100, number of time-domain PRACH occasions within a PRACH slot is 1
2023-11-10 16:52:43 +01:00
Robert Schmidt
0d85903d09 Add build_oai/cmake option to build with thread sanitizer 2023-11-10 16:15:05 +01:00
Robert Schmidt
58edc4a57b Remove further unnecessary RRC references in gNB MAC scheduler 2023-11-10 16:01:41 +01:00
rmagueta
8551260243 Clean up previous BWP switching implementation that was not F1 compliant 2023-11-10 16:01:33 +01:00
Robert Schmidt
196e0a2c85 Rewrite F1 documentation 2023-11-10 15:29:45 +01:00
Robert Schmidt
39274212fe 5G RFsim F1 test: start 3 DUs, with 1 UE each, PING ONLY 2023-11-10 15:29:45 +01:00
Robert Schmidt
1e565f6b7b 5G RFsim F1 test: docker-compose: add two more DUs with one UE each 2023-11-10 15:29:45 +01:00
Robert Schmidt
eefffef55b UndeployGenObject(): allow multiple gNBs/DUs/CUs for log file analysis, like UE 2023-11-10 15:29:45 +01:00
Robert Schmidt
a6c95537fb Simplify F1 config files 2023-11-10 15:29:45 +01:00
Robert Schmidt
01a095a268 assoc_id only to be stored for DU 2023-11-10 15:29:45 +01:00
Robert Schmidt
e9d91de50b RFsimulator serverport is a number 2023-11-10 15:29:45 +01:00
Robert Schmidt
41c5ea94ae Start RRC ITTI task only in CU or monolithic 2023-11-10 15:29:45 +01:00
Robert Schmidt
96dfb44ae7 Print DU information in periodic RRC stats printing 2023-11-10 15:29:45 +01:00
Robert Schmidt
59a25c48ff RRC UE context lookup by RNTI: use assoc_id 2023-11-10 15:29:45 +01:00
Robert Schmidt
6520dbc95a Implement F1 Setup Failure to originate at RRC 2023-11-10 15:29:45 +01:00
Robert Schmidt
97d574229d Check PCI/nrCellID non-overlapping 2023-11-10 15:29:38 +01:00
Robert Schmidt
7c4ec50e23 PLMN check F1 Setup: cellId does not necessarily match
Multiple DUs host cells, whose cell ID cannot match (to identify them
uniquely). Hence, don't check for equality with CU, because otherwise,
we can never connect multiple DUs.
2023-11-10 15:29:38 +01:00
Robert Schmidt
ac5c4efd4e Merge remote-tracking branch 'origin/nssai-rlc-mac-if' into integration_2023_w44 2023-11-10 14:39:03 +01:00
Robert Schmidt
6fe68a574b Merge remote-tracking branch 'origin/NR_UE_resync_hotfix' into integration_2023_w44 2023-11-10 14:38:55 +01:00
Laurent THOMAS
f50d5f5a9b make multiple config instead of one implicit global 2023-11-10 10:23:11 +01:00
Sakthivel Velumani
3a7f17ebb8 Create functions for getting LCID 2023-11-09 09:02:59 -05:00
Rúben Soares da Silva
fff5497f45 Remove leftover comment 2023-11-09 10:18:00 +00:00
Robert Schmidt
c36eb7c9b4 Hack: Prevent CU-UP UE ID management if integrated CU
This is a workaround for a problem described in #706. In short, we
cannot reuse the cu_add/remove_f1_ue_data() functions if we are in an
integrated CU-UP/CP ("CU"), but then we can also not reliably use
different UE IDs in CU-UP and CU-CP (except if using even more hacks).
2023-11-08 17:34:42 +01:00
Robert Schmidt
c812cea143 Multiple DUs in a tree 2023-11-08 10:18:52 +01:00
Robert Schmidt
e155080ece Assoc ID CU->DU 2023-11-08 10:18:52 +01:00
Robert Schmidt
a377e5231c Set UE DU assoc_id to 0 on DU disconnect
An assoc_id of 0 is used to mark UEs whose DU is "offline" (not
connected). In this patch, if a DU disconnects, we go through all UEs
and set their assoc_id to 0 if they belong to a UE that just went
offline.
2023-11-08 10:18:52 +01:00
Robert Schmidt
e5684d217c Assoc ID DU->CU 2023-11-08 10:18:52 +01:00
Robert Schmidt
843a1dc0a3 Introduce lookup functions for DUs 2023-11-08 10:18:52 +01:00
Robert Schmidt
1af4e81951 Paging: not fully implemented, make clear is dummy 2023-11-08 10:18:52 +01:00
Robert Schmidt
8cdb23639b Bugfix: on reestablishment, save new gNB DU UE ID, not RNTI 2023-11-08 10:18:52 +01:00
Robert Schmidt
3a5cff17d7 Combine rrc_gNB_process_initial_ul_rrc_message() and nr_rrc_gNB_decode_ccch() 2023-11-08 10:18:52 +01:00
Robert Schmidt
9a092c1433 Put rrcSetupRequest/rrcReestablishmentRequest handling in separate functions 2023-11-08 10:18:52 +01:00
Robert Schmidt
1153e62e45 Move rrc gNB DU handling to separate file 2023-11-08 10:18:52 +01:00
Robert Schmidt
c00b287c60 Remove RRC UE context printing that depends on DU
This code printed BW masks (what is this) and number of MIMO layers. It
was dependent on the current DU, and only showed the information for the
current DU config (SCS, band). On DU disconnect, it leads to segfaults
to this dependency, and IMO is not useful in itself (it could rather be
printed when receiving the UE capabilities, for all bands etc.).
2023-11-08 10:18:52 +01:00
Robert Schmidt
4c2bfe7a1f F1AP: send() functions take assoc_id
To allow to send F1 messages to multiple DUs from the CU, we need to
send these messages via different assoc_id (SCTP association ID,
basically akin to a file descriptor). Currently, the assoc_id is stored
in a context at the F1 module and retrieved in
f1ap_itti_send_sctp_data_req().

To facilitate a later change towards indicating (from the RRC) to which
assoc_id (hence, DU) to send a message, we refactor all
CU_send_*()/DU_send_*() functions to take the assoc_id as a parameter to
which to send messages. In this commit, we then pass the assoc_id from
the context. A later commit changes this (at the CU) to pass the
assoc_id from the message to be sent.
2023-11-08 10:18:52 +01:00
Robert Schmidt
474c3507f1 Allow DUs to reconnect to CU
Previous to this commit, the CU creates an F1 instance and initializes
GTP after a successful connection establishment, and tears the F1
instance down after the DU disconnects. This does not work when trying
to connect multiple DUs, or have them reconnect, as e.g., GTP
re-initialization fails (socket already bound).

This commit makes the CU F1 instance creation and GTP init at CU task
init (only once), and also frees the F1 instance only after the CU task
exits, which is at termination of the application, typically.
2023-11-08 10:18:52 +01:00
Robert Schmidt
05aefb9aaa Correctly read PCI in F1 Setup Response 2023-11-08 10:18:52 +01:00
Robert Schmidt
808b7684a8 F1AP: Remove commented code 2023-11-08 10:18:52 +01:00
Robert Schmidt
11df08a8f0 clang-format: RB_FOREACH is a for_each macro 2023-11-08 10:18:52 +01:00
Robert Schmidt
4ad7e9c5c0 Remove dead code in GTP
Remove dead code, result of 2136ceec0d: we
cannot connect() in GTP on multiple remotes (as then only packets of one
host might be received), but might need to send to multiple remote
sockets.
2023-11-08 10:18:52 +01:00
Rúben Soares da Silva
e6d3a367de Remove PRACH PDU Beamforming allocation from pack procedure, Assert if it has values != 0 2023-11-07 15:37:02 +00:00
Rúben Soares da Silva
f993b075f8 Change Prach PDU Beamforming allocation for pack/unpack procedures 2023-11-07 10:35:11 +00:00
Robert Schmidt
0a05622a20 Merge remote-tracking branch 'origin/Bugfix_NR_Band_n1' into integration_2023_w44 2023-11-06 15:01:32 +01:00
Robert Schmidt
dc7743c4e8 Merge remote-tracking branch 'origin/scan_build_arg_attr_null' into integration_2023_w44 2023-11-06 07:33:37 +01:00
Robert Schmidt
e1e8e10d91 Merge remote-tracking branch 'origin/NR_UE_handling_MCS_for_retransmission_v2' into integration_2023_w44 2023-11-06 07:33:28 +01:00
Robert Schmidt
31ed25acd7 Only print UE caps if DU available
The DU UE capability printing depends on data on SCS and band, which
currently is only stored with the DU. To avoid any assert, we check
that the DU is present. A follow-up commit will rework this.
2023-11-04 16:37:59 +01:00
Robert Schmidt
102cbf0d0c Prevent possible deadlock between scheduler and F1 UE ID 2023-11-04 16:37:59 +01:00
Robert Schmidt
230258370b Free F1 UE data struct only on UE release
Before this commit, as visible in the handler of an F1 UE release, it
can happen that we forward the RRC Release message to a UE and start the
release timer, while also removing the F1 UE data (containing e.g., the
CU UE ID). This can lead to asserts, since there might still be
subsequent traffic for such UE during a short time, while the DU does
not have the secondary UE ID stored anymore.

This commit changes the logic. It introduces function
nr_mac_release_ue() that removes the UE at MAC and RLC, frees the F1 UE
data (if applicable), and sends the complete, after timing expiry. If
the UE is out of sync, this function is used to free the UE immediately.

This fixes #685 and #698.
2023-11-04 16:34:46 +01:00
francescomani
629825aca6 taking into account PTRS in computing G 2023-11-03 10:39:13 +01:00
francescomani
d247abb53d code cleanup 2023-11-03 10:15:25 +01:00
francescomani
a05baa3c77 fixes to avoid double synchronization call 2023-11-03 10:01:53 +01:00
luis_pereira87
5b5b0f9595 Fix AssertFatal when using NR band n1 2023-11-02 18:41:17 +00:00
Jaroslava Fiedlerova
fb1dc668e5 CI:AW2S - use updated AmariUE SW 2023-11-02 15:02:18 +01:00
Jaroslava Fiedlerova
3d63dc0a7e CI:AW2S - modifications to test with 10 UEs 2023-11-02 15:02:18 +01:00
Rúben Soares da Silva
c22fe2bab6 Fix PRACH PDU beamforming allocation to allocate at least 1 member, avoiding creating vector of size 0 2023-11-02 10:55:50 +00:00
Sakthivel Velumani
5f78fa6eed NGAP: put mcc, mnc, nssai inside new plmn struct 2023-10-31 16:12:15 -04:00
Sakthivel Velumani
f381e93237 Set NSSAI config in MAC
Each active LCID at MAC is configured with NSSAI that is sent from AMF with PDU session setup request
2023-10-31 16:12:10 -04:00
Sakthivel Velumani
2bf40fbd17 Pass the NSSAI config via F1 2023-10-31 13:31:33 -04:00
Sakthivel Velumani
89fa5a18a8 Pass the NSSAI config via E1 2023-10-31 13:31:32 -04:00
Sakthivel Velumani
279a55c976 Save NSSAI params from AMF
The NSSAI of PDU sessions coming from AMF are stored in RRC to be sent to lower layers
2023-10-31 12:41:50 -04:00
mir
6a1a17bcff Enhance message 2023-10-31 12:41:10 +01:00
mir
e0ff84f67c Scan build: Argument with 'nonnull' attribute passed null 2023-10-31 11:53:42 +01:00
Robert Schmidt
82597e7e8f Merge branch 'integration_2023_w43' into 'develop'
integration_2023_w43

See merge request oai/openairinterface5g!2415

* !2407 hotfix: UE DCI format 11: only 1 dl_config instead of 2
* !2372 chore(ci): testing up to 10 UEs in 5G RF simulation
* !2396 Add optimized function to count the number of bits set in uint64_t variable
* !2383 E1: implement release bearer, handle multiple CU-UPs
* !2413 Assigned value is garbage or undefined reported by scan-build
* !2387 Small fixes for UE stability and introduction of ITTI "no-thread" mode (separate bug fixes and ITTI changes?)
* !2410 Fix CellGroupConfig-related memory problems
* !2414 fix doxygen
2023-10-30 16:26:11 +00:00
Robert Schmidt
7420de8fc9 Merge remote-tracking branch 'origin/fix-doxygen' into integration_2023_w43 2023-10-30 10:23:45 +01:00
Robert Schmidt
57f0cb134c Merge remote-tracking branch 'origin/fix-cellconfig-segv' into integration_2023_w43 2023-10-30 10:22:23 +01:00
Robert Schmidt
a828da1b3f Merge remote-tracking branch 'origin/itti-no-threads' into integration_2023_w43 2023-10-30 10:22:16 +01:00
Robert Schmidt
803fcb59a9 Merge remote-tracking branch 'origin/assigned_value_is_garbage_or_undefined' into integration_2023_w43 2023-10-30 10:22:03 +01:00
Robert Schmidt
2f7658d7b1 Merge remote-tracking branch 'origin/e1-multiple-cuup' into integration_2023_w43 2023-10-30 10:21:48 +01:00
Robert Schmidt
fa5c4d3a4c Fix SDAP: correct ID, set default
- Set the correct QoS flow ID to associate a correct QoS flow to the
  bearer: the UE would misassociate otherwise
- Set the DRB as the default: the handler applies bool with true==1, so
  use bool value
2023-10-30 08:47:33 +01:00
Robert Schmidt
a51c5299c6 Merge remote-tracking branch 'origin/polar-encoder-perf-improv' into integration_2023_w43 2023-10-27 14:21:23 +02:00
Laurent THOMAS
a198239084 Introduce no-thread mode in ITTI
Introduce a --no-itti-threads command line option to disable threading
in ITTI, and call message handlers in the current thread. This is being
introduced in order to increase repeatability when testing the nrUE with
the IQPlayer. Without this feature, runs with the IQPlayer will end up
differently, depending on the timing of ITTI threads, mostly when
sending messages to RRC and NAS.
2023-10-27 13:02:36 +02:00
Laurent THOMAS
724c8c014c Simplify ITTI task definition 2023-10-27 13:02:33 +02:00
Laurent THOMAS
75cc625fe9 Use recursive mutex in PDCP to prevent deadlocks 2023-10-27 13:02:31 +02:00
Laurent THOMAS
1fb68160b0 config: harmonize number array parameters 2023-10-27 13:02:28 +02:00
Laurent THOMAS
b257734c6f Fix tPool calls: symmetric to pushing messages
Messages are pushed using pushNotifiedFIFO(), so we pullNotifiedFIFO()
2023-10-27 13:02:24 +02:00
Robert Schmidt
679b497891 Merge remote-tracking branch 'origin/ci-add-more-ues-rf-sim-test' into integration_2023_w43 2023-10-27 12:44:25 +02:00
Robert Schmidt
4cea368a17 Correct typo in test case description 2023-10-27 10:38:58 +00:00
mir
364f98ac11 Avoid double initialization 2023-10-27 11:50:40 +02:00
rmagueta
60d867a978 Fix read servingCellConfigDedicated from config file 2023-10-27 10:52:52 +02:00
Robert Schmidt
7317efea00 Clone pusch_Config to prevent double free 2023-10-27 10:52:52 +02:00
Robert Schmidt
10a0a52604 Allocate second but same coreset to prevent double-free 2023-10-27 10:52:52 +02:00
Robert Schmidt
dc88ca3b6d Read DMRS_UplinkConfig from BWP info when needed
Before this commit, the DMRS_UplinkConfig was stored in a separate
DMRS-related structure, although it is always referenced in the
PUSCHConfig of the current UL BWP.

Through certain code paths (e.g., retransmission), it could happen that
an old DMRS_UplinkConfig was accessed that was freed (through new
CellGroupConfig).

In this commit, we always look up the DMRS_UplinkConfig in the current
PUSCH config, which should always be up to date.
2023-10-27 10:52:52 +02:00
Robert Schmidt
90bb405e0d Deep-copy PDCCH ConfigCommon for SIB1
Until this commit, the SIB1's PDCCH_configCommon was set (via a pointer,
i.e., an indirection) to the one of the ServingCellConfigCommon (SCC).
Afterwards, the SIB1 code further populated this PDCCH configCommon,
indirectly populating the one of the the SCC, on which code later
depends.

Not only did this create possibilities for double-frees (since freeing
the memory of SIB1, then SCC would free the PDCCH configcommon twice),
but also it makes it harder to track where certain structures are
populated. Hence, this commit solves both issues:

- The SCC is correctly populated on initialization of the SCC
- The SIB1 makes a deep copy of the SCC' PDCCH configCommon

This resolves the two issues above.
2023-10-27 10:52:52 +02:00
Robert Schmidt
d1740c9d8e Deep-copy PDSCH_ConfigCommon to prevent double-free 2023-10-27 10:36:33 +02:00
Robert Schmidt
8062af94b5 Deep-copy RACH_ConfigCommont to prevent double-free 2023-10-27 10:36:10 +02:00
Robert Schmidt
d442e21f3c Deep-copy PUSCH&PUCCH_ConfigCommon to prevent double-free 2023-10-27 10:35:26 +02:00
Robert Schmidt
a87cad57b7 Fix: correct SD index 2023-10-27 10:34:53 +02:00
Robert Schmidt
38a6e92fdf Deep-copy genericParameters to prevent double-free 2023-10-27 10:22:55 +02:00
Robert Schmidt
d4cc2c8597 Deep-copy asn1c structures to prevent double free 2023-10-27 10:22:55 +02:00
Robert Schmidt
2dc36ffcf7 Initialize struct on stack
Not initalizing this struct makes asn1c free the memory incorrectly,
leading to a segfault.
2023-10-27 10:22:55 +02:00
Robert Schmidt
9001ad2d7c Correct calloc_or_fail() signature 2023-10-27 10:22:55 +02:00
Robert Schmidt
5fb151e195 Rework E1 documentation 2023-10-27 09:07:51 +02:00
Robert Schmidt
eb475f7747 Remove useless warning 2023-10-27 09:07:51 +02:00
Robert Schmidt
c2f0bf16d7 Rename non-existing gNB_CU_ID to existing gNB_ID in all configs 2023-10-27 09:07:51 +02:00
Robert Schmidt
2f87a2b0e5 Remove superfluous security section from gNB-CU-UP configs 2023-10-27 09:07:51 +02:00
Robert Schmidt
781d01d5de Remove (almost) unused e1ap_api.h 2023-10-27 09:07:51 +02:00
Robert Schmidt
2e252dd377 Implement E1 bearer release 2023-10-27 09:07:51 +02:00
Robert Schmidt
fb5b125110 Implement Bearer Context Modification Response in E1 2023-10-27 09:07:51 +02:00
Robert Schmidt
ec60fd8157 E1 bearer modification: harmonize code 2023-10-27 09:07:51 +02:00
Robert Schmidt
380151faa7 E1 Bearer Context Setup Request: harmonize code
- harmonize monolithic and E1AP case
- use ITTI message to send bearer context setup response to RRC
2023-10-27 09:07:51 +02:00
Robert Schmidt
9546166ebc Create files to handle E1AP messages at CU-UP 2023-10-27 09:07:51 +02:00
Robert Schmidt
70ddc0e7fb CUUP: set F1-U remote port for GTP module 2023-10-27 09:07:51 +02:00
Robert Schmidt
c5006cf4ed e1ap_common.h without E1AP ASN dependency 2023-10-27 09:07:51 +02:00
Robert Schmidt
2136ceec0d Do not bind on remote address in GTP
This allows to communicate with multiple remote hosts. A further
improvement would be to refactor this piece of code into a function and
call it only when necessary, i.e., when we know the remote host, or want
to add one to a list of hosts.
2023-10-27 09:07:51 +02:00
Robert Schmidt
0a6998db4b Select CU-UP based on slice 2023-10-27 09:07:51 +02:00
Laurent THOMAS
bba9aac079 fix most of doxygen warnings and errors 2023-10-26 16:47:19 +02:00
rmagueta
e14903cd96 Call __builtin_popcountll function to count the number of bits set in uint64_t variable for polar codes 2023-10-26 12:23:20 +02:00
Robert Schmidt
e07a741ee0 Handle multiple CU-UPs in one CU-CP
This commit introduces the capability to handle multiple CU-UPs. It uses
a RB tree and puts the CU-UPs into the tree. Upon the connection, it
associates UEs to CU-UPs in a round-robin fashion.
2023-10-25 20:22:32 +02:00
Robert Schmidt
b08ce59bc2 Pass assoc_id to RRC and use when sending E1AP messages 2023-10-25 20:22:32 +02:00
Robert Schmidt
1d3127bb99 Read and forward CU UP name in E1AP Setup Request 2023-10-25 20:22:32 +02:00
Robert Schmidt
7d37143bac Read and forward NSSAI in E1AP Setup Request 2023-10-25 20:22:32 +02:00
Robert Schmidt
75b055711a Setup Request: store in E1 only for CU-UP 2023-10-25 20:22:32 +02:00
Robert Schmidt
b26dcc1ee5 Store E1 Setup Request at RRC 2023-10-25 20:22:32 +02:00
Robert Schmidt
23eaea4b8d Move CU-UP related processing to separate file
A later commit will introduce an RB tree to manage multiple CU-UPs. The
RB tree implementation relies on some macros that generate RB tree
functions. Functions using the RB tree implementation will be grouped in
this file.
2023-10-25 20:22:32 +02:00
Robert Schmidt
f721b13982 Fix: E1 PDU Session has NSSAI, not only SST 2023-10-25 20:22:32 +02:00
Robert Schmidt
c3927fa6b7 Fix bug: correct PLMN in check in E1AP Setup Req handler 2023-10-25 20:22:32 +02:00
Robert Schmidt
a23984c7ae Split out E1AP net config from Setup Request
The E1AP Setup Request contained the network configuration (IP address,
ports) as well as the actual E1AP Setup Request application data
(Supported PLMNs, ...). This has the drawbacks that
- The E1AP Setup Request is stored to retrieve IP addresses in the E1AP
  module, which is confusing as the Setup Request, per standard, has no IP
  info
- The CU-CP received an E1 Setup Request for configuration during start
  up, but it did not actually receive such Setup Request, but merely the
  IP configuration to set up the socket

This commit splits the E1AP Setup Request into a "real" Setup Request
for application data, and creates a new type e1ap_net_config_t to group
all IP configuration data. Further, a new ITTI message type
E1AP_REGISTER_REQ is introduced to group both types. What happens is
- RCconfig_NR_CU_E1() reads both E1AP application-level data and IP
  configuration, as previously
- The data is sent to the CU-CP. It discards the E1AP Setup Request
  data, and only uses the network configuration to set up the socket
- The data is sent to the CU-UP. It uses the network configuration to
  connect to the CU-CP, and then sends the E1AP Setup Request to the
  CU-CP.

Currently, the CU-CP still stores the Setup Request locally, which will
be changed in the next commit to send it to the RRC.
2023-10-25 20:22:32 +02:00
Robert Schmidt
5c07c326ea E1AP: use assoc_id in instance, do not pass Setup Request around
- e1ap_encode_send(): do not use E1AP Setup Request
- store assoc_id in the instance, and reuse that
2023-10-25 20:22:32 +02:00
Robert Schmidt
e4a28cfabd Remove unused variables 2023-10-25 20:22:32 +02:00
Robert Schmidt
5215cc921f Lower E1AP log verbosity 2023-10-25 20:22:32 +02:00
Robert Schmidt
d1e5ee2bab extract_SETUP_REQUEST(): assoc_id: remove comment 2023-10-25 20:22:32 +02:00
Robert Schmidt
0070bf11fc Fix fill_BEARER_CONTEXT_SETUP_REQUEST() 2023-10-25 20:22:32 +02:00
Robert Schmidt
29212d4e94 E1AP: remove unused functions 2023-10-25 20:22:32 +02:00
Robert Schmidt
e37f67ccce Make E1AP function check_transac_id() static 2023-10-25 20:22:32 +02:00
Robert Schmidt
6eba667813 Delete unused/write-only E1AP variables 2023-10-25 20:22:31 +02:00
Robert Schmidt
ed0923c2ec E1AP messages: Remove DRBList and CN Support fields
The DRBLists inside E1AP message are for E-UTRAN. We don't support that
with our CU-CP/UP yet, so remove it to reduce ambiguity and complexity.
For the same reason, we remove the CN Support, which for us is always
"NR".
2023-10-25 20:22:31 +02:00
Robert Schmidt
c3f19a4ead Move "UM on default DRB" param to RRC config, make it bool 2023-10-25 20:22:31 +02:00
Robert Schmidt
d58ebfcaab Remove unused RRC variables 2023-10-25 20:22:31 +02:00
Robert Schmidt
453f483c7a bugfix CU: set remote port in GTP-U module 2023-10-25 20:22:31 +02:00
Robert Schmidt
e49608339a Add TODO regarding E1 & reestablishment
For the reestablishment, we need to tell the PDCP it needs to reset the
SN counters. This does not work over E1; add a TODO in the code.
2023-10-25 20:22:31 +02:00
Robert Schmidt
4852354dac Correct banner mail 2023-10-25 20:22:31 +02:00
Laurent THOMAS
4a52b17386 fix-doxygen 2023-10-25 18:10:40 +02:00
Raphael Defosseux
c3405d39df fix(ci): cosmetic fix for parallel display
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-25 14:17:58 +02:00
Raphael Defosseux
65549745ee fix(ci): proper automatic undeployment
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-25 14:16:25 +02:00
Raphael Defosseux
a88c3d2ba4 chore(ci): provisioning for 10 UEs for RF-sim test
* Adding test for connecting 10 UEs

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-25 14:15:41 +02:00
mir
2ccc58f6d3 Assigned value is garbage or undefined reportedt by scan-build 2023-10-25 11:51:33 +02:00
Laurent THOMAS
3b57e3ba51 hot-fix-ue-dci-format-11 2023-10-24 13:53:50 +02:00
Raphael Defosseux
9a57514bf9 fix(ci): hard coding the lock resource
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-23 20:29:26 +02:00
Robert Schmidt
a062be47cc Merge branch 'integration_2023_w42' into 'develop'
Integration Branch 2023.w42

See merge request oai/openairinterface5g!2403

* !2368 NR UE SRB0
* !2399 build_oai: Auto-detect if terminal supports colors
* !2398 Correctly load channel models
* !2365 Change PDU_Length and tlv length calculation to be inline with SCF 222.10.02
* !2402 chore(ci): enabling the ARM cross-compilation pipeline
* !2397 fix(ci): improve for parallelism issue in Groovy
* !2405 Clean IDE files and remove old documentation
2023-10-23 17:32:07 +00:00
Raphael Defosseux
b7073ebdbc Merge remote-tracking branch 'origin/clean-ide-files-old-doc' into integration_2023_w42 2023-10-23 13:54:58 +02:00
Robert Schmidt
6568d40eca Remove outdated documentation 2023-10-23 13:06:58 +02:00
Robert Schmidt
877efbbb99 .gitignore for common IDE files 2023-10-23 12:56:27 +02:00
Robert Schmidt
dce7b4446d Remove unused iperf/bash performance testing script 2023-10-23 12:54:10 +02:00
Robert Schmidt
9762b63cae Remove VSCode config 2023-10-23 12:52:58 +02:00
Raphael Defosseux
c8168ed4a7 chore(ci): post-review comments fixes
* properly formatted the finalizeSlaveJob function
  * explained the reason and gave an explicit name to the global variable

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-23 11:10:53 +02:00
francescomani
73244eae4d storing TBS and R at MAC instead of PHY 2023-10-20 18:00:34 +02:00
Raphael Defosseux
94d4cd7cce Merge remote-tracking branch 'origin/ci-fix-groovy-parallelism-issue' into integration_2023_w42 2023-10-20 11:46:59 +02:00
Raphael Defosseux
24ac96cd40 Merge remote-tracking branch 'origin/Fix_FAPI_PDU_Length' into integration_2023_w42 2023-10-20 11:46:33 +02:00
Raphael Defosseux
470ea73175 Merge remote-tracking branch 'origin/channel_model_fix' into integration_2023_w42 2023-10-20 11:46:07 +02:00
Raphael Defosseux
bd551a6ac1 Merge remote-tracking branch 'origin/nr_ue_use_srb0' into integration_2023_w42 2023-10-20 11:45:44 +02:00
Raphael Defosseux
191ab1a934 Merge remote-tracking branch 'origin/ci-no-color-codes' into integration_2023_w42 2023-10-20 11:45:17 +02:00
Raphael Defosseux
0caa65231f chore(ci): triggering the child pipeline from parent
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-20 11:36:45 +02:00
Raphael Defosseux
80c2bc3fcb fix(arm-build): immintrin.h is not available
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-20 11:36:39 +02:00
Raphael Defosseux
146edd2f4c chore(ci): having a variable to choose simde version
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-20 11:36:29 +02:00
Raphael Defosseux
43d9895caf fix(ci): in case of build failure, having a bit of debug info
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-20 11:36:22 +02:00
Robert Schmidt
bab4ad2d85 Auto-detect if terminal supports colors
This enables build_oai to detect if the output terminal supports colors.
If it does, it will use colors in its output. If it does not, it will
just print the text, without color codes, improving legibility.
2023-10-17 07:16:49 +02:00
Robert Schmidt
09af6d1c31 Remove unused color codes 2023-10-17 07:09:12 +02:00
Rúben Soares da Silva
bfd12e4aa0 Change PDU_Length and TLV length calculation to be inline with SCF 222.10.02
PDU Length is as per SCF 222.10.02: The total length (in bytes) of the
PDU description and  PDU data, without the padding bytes. From
TX_DATA.request we get 8 (2 bytes PDU_Length + 2 bytes PDU_Index + 4
bytes num_TLV ) and from each TLV we get 4 + value size ( 2 bytes tag +
2 bytes length + value size without pading)

Therefore, add function to compute PDU_length() value for
TX_Data.request, taking into account how many TLVs there are.
compute_PDU_length() does not rely on access to `nfapi_nr_pdu_t`.
Put it into nr_mac_common.c to avoid introducing dependencies.
2023-10-17 04:33:57 +02:00
Arash Sahbafard
e46eeffe2a There was a simple bug in detecting the channel models in rfsim which is fixed.
modified:   radio/rfsimulator/simulator.c
2023-10-16 18:08:55 +02:00
francescomani
79cd189160 fix sim compilation 2023-10-16 16:36:38 +02:00
Robert Schmidt
a62bdf36de Merge branch 'integration_2023_w41' into 'develop'
integration_2023_w41

See merge request oai/openairinterface5g!2394

* !2389 Remove global variable rx_spatial_power
* !2364 NR UE PUCCH2 sanitize errors
* !2352 Break DCI processing function into smaller pieces
* !2391 Remove calloc from L1 at CSIRS_PDU conversion function
* !2393 Fix UE assertion due to PUCCH resource lookup all BWPs
* !2307 Improve documentation for L2sim Readme
* !2310 doc(websvr): how to install properly the dependencies
2023-10-16 14:17:11 +00:00
Raphael Defosseux
33e5d7f66e fix(ci): improve for parallelism
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-16 15:46:02 +02:00
Robert Schmidt
5231b9777d Merge remote-tracking branch 'origin/doc-websrv-build-fixes' into integration_2023_w41 2023-10-14 08:18:56 +02:00
Robert Schmidt
362d44c7ba Updade webserver documentation: organize, make less verbose output 2023-10-14 08:18:31 +02:00
Robert Schmidt
f88a6e36b5 Merge remote-tracking branch 'origin/ImprovDocL2sim' into integration_2023_w41 2023-10-14 08:18:11 +02:00
Robert Schmidt
afb770d1b3 Merge remote-tracking branch 'origin/NR-UE-fix-seg-fault-add-bwp' into integration_2023_w41 2023-10-13 11:07:36 +02:00
Robert Schmidt
d6fe889abe Merge remote-tracking branch 'origin/Remove-convert-csirs-pdu-calloc' into integration_2023_w41 2023-10-13 11:05:43 +02:00
Robert Schmidt
7f0dbde135 Merge remote-tracking branch 'origin/break_dci_processing_function_in_smaller_pieces' into integration_2023_w41 2023-10-13 11:05:33 +02:00
Robert Schmidt
be9a3375ed Correctly format nr_ue_process_dci_dl_11() 2023-10-12 21:11:38 +02:00
Robert Schmidt
2f0c31637b Assert when encountering unhandled DCI formats 2023-10-12 21:10:24 +02:00
Robert Schmidt
821ab37f49 Fix table lookup in nr_ue_process_dci_dl_11() 2023-10-12 21:09:12 +02:00
Robert Schmidt
e3b3495488 Merge remote-tracking branch 'origin/NR_UE_sanitize_PUCCH2' into integration_2023_w41 2023-10-12 20:57:48 +02:00
Rúben Soares da Silva
80a6a3e8c3 Fix memory leak and improve convert_csirs_pdu()
- Remove calloc from convert_csirs_pdu function, change return value
  from 'nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *' to
  'nfapi_nr_dl_tti_csi_rs_pdu_rel15_t' to not require call to 'free()'
- Set parameter pointer as const as it's not modified
- Remove cast to fapi_nr_dl_config_csirs_pdu_rel15_t in csi_rx.c as
  ue->csirs_vars[gNB_id]->csirs_config_pdu is already of type
  fapi_nr_dl_config_csirs_pdu_rel15_t.
- Remove casted parameter in call to convert_csirs_pdu and replace with
  csirs_config_pdu obtained earlier from
  ue->csirs_vars[gNB_id]->csirs_config_pdu.
2023-10-12 20:52:17 +02:00
Sakthivel Velumani
f75519978e fix UE asserver due to PUCCH resource lookup all BWPs 2023-10-12 12:17:46 -04:00
Robert Schmidt
8d2b8895df Review commit 2023-10-12 07:12:06 +00:00
Laurent THOMAS
6b56b46811 Break UE DCI processing function in smaller pieces 2023-10-12 07:46:45 +02:00
Robert Schmidt
34e64ab1eb Remove unused/useless Ethernet variables 2023-10-12 07:46:45 +02:00
Laurent THOMAS
838b284aa4 remove-global-rx_spatial_power_in_gnb 2023-10-10 15:45:21 +02:00
Robert Schmidt
91a30e9a2a Correct return type of do_RRCSetupRequest() 2023-10-10 15:40:26 +02:00
Robert Schmidt
7157e7fd9a Remove unused fields of NR_RRC_MAC_CCCH_DATA_IND message 2023-10-10 15:40:26 +02:00
Robert Schmidt
9aee7bf745 srb0 rnti 2023-10-10 15:40:26 +02:00
francescomani
9189129985 Use SRB0 at UE
- Use SRB0 TM entity at UE for Msg.3/RRC Setup Request
- Msg3 data request sent upon reception of Msg2, then we get data from
  rlc when needed
2023-10-10 15:40:26 +02:00
Robert Schmidt
be9b84c03f Refactor interface SRB0: no gNB MAC 2023-10-10 15:40:26 +02:00
Robert Schmidt
bba1418811 Merge branch 'integration_2023_w40' into 'develop'
integration_2023_w40

See merge request oai/openairinterface5g!2381

* !2345 fix bug for IE cause in pdu session accept
* !2361 Fix Msg3 MAC CE C-RNTI
* !2371 fix(ci): printing the warning and error lines for CI purposes
* !2374 Fix SSB ARFCN: wrong ARFCNs in FDD
* !2379 fix the selection of DCI candidates at UE
* !2369 Add bwp_size and bwp_start fields to CSI_RS PDU struct at NR UE
* !2349 E2AP Version 1,2,3 and KPM version 2, 3
* !2375 increase the max fd of rfsim, that have been shorten to tightly for cpu saving
* !2367 chore(ci): improve GitLab <-> Jenkins contributor experience
* !2378 F1AP: correct message handling
* !2370 NR PDCP RB suspend
* !2107 Compute RI based on SRS up to 4
* !2339 PUCCH power computation
* !2382 Remove dead code in NR UE
* !2229 PUSCH LLR 128/256 SIMDe routines for ARM/x86
2023-10-10 05:35:04 +00:00
Robert Schmidt
7957b466d4 Merge remote-tracking branch 'origin/pusch-llr-SIMDe' into integration_2023_w40 2023-10-09 16:48:37 +02:00
Robert Schmidt
2635cf4817 Merge remote-tracking branch 'origin/remove-dead-code-nrue' into integration_2023_w40 2023-10-09 08:12:43 +02:00
Robert Schmidt
a8fa1b0e52 Merge remote-tracking branch 'origin/develop-pucch-power' into integration_2023_w40 2023-10-08 17:48:26 +02:00
Robert Schmidt
16e15b3393 Merge remote-tracking branch 'origin/develop-UL-RI' into integration_2023_w40 2023-10-08 17:48:06 +02:00
Robert Schmidt
08fca7ebce Merge remote-tracking branch 'origin/NR_RB_suspend' into integration_2023_w40 2023-10-08 14:56:17 +02:00
Robert Schmidt
653e66594d Merge remote-tracking branch 'origin/f1ap-msg-correction' into integration_2023_w40 2023-10-08 14:56:09 +02:00
Robert Schmidt
4ff2c4e781 Merge remote-tracking branch 'origin/ci-improve-jenkins-ux' into integration_2023_w40 2023-10-08 14:54:52 +02:00
Robert Schmidt
e160e083d8 Merge remote-tracking branch 'origin/fix-rfsimulator-max-fd' into integration_2023_w40 2023-10-08 14:54:44 +02:00
Robert Schmidt
146217fc90 Merge remote-tracking branch 'origin/e2ap_v3_v2' into integration_2023_w40 2023-10-08 14:54:32 +02:00
Robert Schmidt
bcbb0d5905 Merge remote-tracking branch 'origin/Fix-CSI_RS-PDU-at-UE' into integration_2023_w40 2023-10-08 12:35:54 +02:00
Robert Schmidt
806842a087 Merge remote-tracking branch 'origin/NR_UE_DCI_candidates' into integration_2023_w40 2023-10-08 12:35:42 +02:00
Robert Schmidt
c3df9c277f Remove warning about new CellGroupConfig
It is *normal* to receive new CellGroupConfigs from the DU, hence a
warning is not warranted.
2023-10-08 12:28:30 +02:00
Robert Schmidt
4066fd4ba2 UE Context Modification Handler: also trigger CellConfig if only UE Capability changes 2023-10-08 12:28:30 +02:00
Robert Schmidt
aaef0b5e74 F1 UE Ctxt Modif Req: forward Capabilities, ignore other CU2DU
- forward capabilities to update CellGroupConfig
- Do not require measConfig/cG_ConfigInfo to be NULL, but ignore them,
  as it is not implemented
2023-10-08 12:27:38 +02:00
Laurent THOMAS
584fb235cd remove-dead-code-nrue 2023-10-06 18:00:18 +02:00
Quency Lin
f451f62c9c Fix cannot pass sanitizer, Align to 16 for 2 contiguous 256 SIMDe 2023-10-06 16:39:51 +02:00
Robert Schmidt
68a82e0b7d F1 Initial UL RRC message: fill PLMN and Cell ID 2023-10-06 15:56:36 +02:00
Robert Schmidt
84ffd14a8f Correctly handle UE Ctxt Modif RRC container
The RRC container is to be handled by the msg handler in
mac_rrc_dl_handler.c. Therefore, don't forward the RRC message, but copy
it into the message so the handler can take the action.
2023-10-06 15:56:30 +02:00
Robert Schmidt
21795b3b88 Correctly encode NRCGI in F1 UE Ctxt Modif Req
The two hardcoded PLMNs are never executed: they are in an if(0) block
2023-10-06 15:56:23 +02:00
Robert Schmidt
b7746e9bfd Merge remote-tracking branch 'origin/fix-ssb-arfcn' into integration_2023_w40 2023-10-06 15:38:42 +02:00
Robert Schmidt
8de0f50087 Merge remote-tracking branch 'origin/ci-fix-warning-recovery' into integration_2023_w40 2023-10-06 15:38:35 +02:00
Robert Schmidt
fe3aa3ddc3 Merge remote-tracking branch 'origin/fix-Msg3-MAC-CE-CRNTI' into integration_2023_w40 2023-10-06 15:38:28 +02:00
Robert Schmidt
8a80517a2d Merge remote-tracking branch 'origin/fix-pdu-session-accept-cause' into integration_2023_w40 2023-10-06 15:38:20 +02:00
Laurent THOMAS
f8c122a7cf increase the max fd of rfsim, that have been shorten to tightly for cpu saving 2023-10-06 11:21:27 +02:00
francescomani
8934c7db10 fix the selection of DCI candidates at UE 2023-10-05 18:09:02 +02:00
mir
3fbc20412a Bug in j and i idx 2023-10-05 15:04:47 +02:00
mir
58134a29d9 Fixes from Teodora applied 2023-10-05 14:54:39 +02:00
Rúben Soares da Silva
9bee85dbe2 Remove previously added bwp_size and bwp_start fields from struct fapi_nr_dl_config_csirs_pdu_rel15_t.
Create function to obtain nfapi_nr_dl_tti_csi_rs_pdu_rel15_t from fapi_nr_dl_config_csirs_pdu_rel15_t without bwp_size and bwp_start.
Replace previously problematic cast with call to created function.
2023-10-04 18:46:54 +01:00
Robert Schmidt
06efde1ed9 u0.25prb 2023-10-04 19:03:37 +02:00
Robert Schmidt
072620aa0a Make different Point A/SSB ARFCN multiple of 30kHz 2023-10-04 16:51:45 +02:00
Raphael Defosseux
ed4c634186 fix(ci): printing the warning and error lines for CI purposes
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-04 15:03:57 +02:00
Robert Schmidt
d6285354e4 Properly formulate assert message 2023-10-04 14:30:27 +02:00
mir
0ffb01b9c3 NG-RAN was not compiling due to struct definition missing 2023-10-04 14:20:30 +02:00
Quency Lin
999bdc01c8 fix: Remove miss-hardcoded #define USE_128BIT 2023-10-04 13:57:07 +02:00
mir
12e09526e8 E2AP Version 1,2,3 and KPM version 2, 3 2023-10-04 12:12:53 +02:00
francescomani
832bea2482 implementing PDCP entity suspend 2023-10-04 10:32:38 +02:00
rmagueta
169a9be8cd Fix Msg3 MAC CE C-RNTI
Reset Msg4_ACKed to not schedule ULSCH and DLSCH before RRC Reconfiguration
2023-10-04 06:55:24 +01:00
Quency Lin
e92c827820 fix: SISO 128 SIMDe due to rebase to 2023.w39 2023-10-03 23:49:30 +02:00
Quency Lin
cdcb403538 Refactor: Caculate bit_met_s[0..63] in for-loop 2023-10-03 22:13:31 +02:00
Quency Lin
5424843190 misc: remove debug print and fix wrong index accessing array
Before this MR, openair1/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c:
nr_ulsch_qam64_qam64():
    xmm3 = simde_mm256_max_epi16(bit_met_m5_p1, bit_met_m5_p1);

Should be instead:
    xmm3 = simde_mm256_max_epi16(bit_met_m5_p1, bit_met_m7_p1);
2023-10-03 22:13:31 +02:00
Raphael Defosseux
058eb64ed9 chore(ci): adapting to new python build framework.
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-03 22:13:31 +02:00
Quency Lin
8b1f42423b Refactor: 16QAM LLR 128 SIMDe assign 2023-10-03 22:13:31 +02:00
Quency Lin
e8bcd1882c Refactor: minor refactors
* [x] `register simde__m128i xmm0;` -\> `simde__m128i xmm0;`
* [x] `simde__m128i xmm0 = simde_mm_abs_epi16(rxF\[i\]);` declaration in for loop
* [x] `int nb_re64 = nb_re >> 1;` would be better as `int last2re = (nb_re >> 1) - 1;`
* [x] `simde_m_punpckhdq()` is better known as `simde_mm_unpackhi_pi32()`
2023-10-03 22:13:31 +02:00
Quency Lin
7d6a955b49 Fix: variable typo when referencing 2023-10-03 22:06:42 +02:00
Quency Lin
0c4993249f fix: CI failure due to SIMD misalignment 2023-10-03 22:03:40 +02:00
Quency Lin
797f8cec80 Refactor: Make qam64_qam64 more compact
Use local arrays and for-loop to replace duplicated statements.
For reference, here is the table of index v.s. old local variable
qam64 qam64
psi_r_, psi_i_, a_r_, a_i_, psi_a_, a_sq_, bit_met_
 0 p7_p7    16 p3_p7    32 m1_p7    48 m5_p7
 1 p7_p5    17 p3_p5    33 m1_p5    49 m5_p5
 2 p7_p3    18 p3_p3    34 m1_p3    50 m5_p3
 3 p7_p1    19 p3_p1    35 m1_p1    51 m5_p1
 4 p7_m1    20 p3_m1    36 m1_m1    52 m5_m1
 5 p7_m3    21 p3_m3    37 m1_m3    53 m5_m3
 6 p7_m5    22 p3_m5    38 m1_m5    54 m5_m5
 7 p7_m7    23 p3_m7    39 m1_m7    55 m5_m7
 8 p5_p7    24 p1_p7    40 m3_p7    56 m7_p7
 9 p5_p5    25 p1_p5    41 m3_p5    57 m7_p5
10 p5_p3    26 p1_p3    42 m3_p3    58 m7_p3
11 p5_p1    27 p1_p1    43 m3_p1    59 m7_p1
12 p5_m1    28 p1_m1    44 m3_m1    60 m7_m1
13 p5_m3    29 p1_m3    45 m3_m3    61 m7_m3
14 p5_m5    30 p1_m5    46 m3_m5    62 m7_m5
15 p5_m7    31 p1_m7    47 m3_m7    63 m7_m7

y0
 0 y0_p_7_7   16 y0_p_3_7
 1 y0_p_7_5   17 y0_p_3_5
 2 y0_p_7_3   18 y0_p_3_3
 3 y0_p_7_1   19 y0_p_3_1
 4 y0_m_7_1   20 y0_m_3_1
 5 y0_m_7_3   21 y0_m_3_3
 6 y0_m_7_5   22 y0_m_3_5
 7 y0_m_7_7   23 y0_m_3_7
 8 y0_p_5_7   24 y0_p_1_7
 9 y0_p_5_5   25 y0_p_1_5
10 y0_p_5_3   26 y0_p_1_3
11 y0_p_5_1   27 y0_p_1_1
12 y0_m_5_1   28 y0_m_1_1
13 y0_m_5_3   29 y0_m_1_3
14 y0_m_5_5   30 y0_m_1_5
15 y0_m_5_7   31 y0_m_1_7

rho_r
 0 pi_7_7   16 pi_3_7
 1 pi_7_5   17 pi_3_5
 2 pi_7_3   18 pi_3_3
 3 pi_7_1   19 pi_3_1
 4 mi_7_1   20 mi_3_1
 5 mi_7_3   21 mi_3_3
 6 mi_7_5   22 mi_3_5
 7 mi_7_7   23 mi_3_7
 8 pi_5_7   24 pi_1_7
 9 pi_5_5   25 pi_1_5
10 pi_5_3   26 pi_1_3
11 pi_5_1   27 pi_1_1
12 mi_5_1   28 mi_1_1
13 mi_5_3   29 mi_1_3
14 mi_5_5   30 mi_1_5
15 mi_5_7   31 mi_1_7
2023-10-03 22:03:40 +02:00
Quency Lin
465fc55e20 Refactor: Make qam16_qam16 more compact
Use local arrays and for-loop to replace duplicated statements.
For reference, here is the table of index v.s. old local variable
suffix.
 0 p1_p1            0 rpi_1_1
 1 p1_p3            1 rpi_1_3
 2 p3_p1            2 rpi_3_1
 3 p3_p3            3 rpi_3_3
 4 p1_m1            4 rmi_1_1
 5 p1_m3            5 rmi_1_3
 6 p3_m1            6 rmi_3_1
 7 p3_m3            7 rmi_3_3
 8 m1_p1
 9 m1_p3
10 m3_p1
11 m3_p3
12 m1_m1
13 m1_m3
14 m3_m1
15 m3_m3
2023-10-03 22:03:40 +02:00
Tsung-Yu Chan
526363dfad fix / add the static for max_epi16 2023-10-03 22:03:40 +02:00
Quency
e241edf287 feat / SISO: Use 128/256 SIMDe for ARM64/x86 2023-10-03 22:03:40 +02:00
Quency
b46479889d misc / Reorder inlines and add architecture guard 2023-10-03 21:32:55 +02:00
Quency
3ce1f6517d fix / warnings in nr_ulsch_llr_computation.c 2023-10-03 21:32:55 +02:00
Quency
7e9968451f feat / Turn #define into static inline functions 2023-10-03 21:32:55 +02:00
Quency
a7af689d50 feat / MIMO: Use 128/256 SIMDe for ARM64/x86 2023-10-03 21:32:55 +02:00
rmagueta
313419180f PUCCH power computation in a different way 2023-10-03 17:06:49 +01:00
Rúben Soares da Silva
c603bcc146 Add bwp_size and bwp_start fields to struct fapi_nr_dl_config_csirs_pdu_rel15_t, for usage in the UE
Fill bwp_size and bwp_start fields with values from BWP.
2023-10-03 13:36:15 +01:00
Raphael Defosseux
f9ab9ca137 chore(ci): the failing test-case bullet will directly point to the HTML report
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-02 14:08:11 +02:00
Raphael Defosseux
06e63f7cca chore(ci): report in the GitLab MR comment the list of failing test stages
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-02 13:27:05 +02:00
Raphael Defosseux
c481aad0c8 chore(ci): all pipelines should have the MR ID and branch in the description
Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
2023-10-02 13:26:26 +02:00
Rúben Soares da Silva
602879539c Change section "Adapt the 'docker-compose' to your environment" to reflect the contents of docker-compose.yaml 2023-09-29 11:14:13 +01:00
francescomani
23c1ea021b fix for errors caught with sanitize in PUCCH2 2023-09-28 18:08:02 +02:00
Laurent THOMAS
4de550f040 fix bug for IE cause in pdu session accept 2023-09-25 15:26:51 +02:00
rmagueta
e5804c48d6 Add UE capability config file for 4 ports 2023-09-20 17:19:29 +01:00
rmagueta
6787689537 Compute RI based on SRS up to 4 2023-09-20 17:19:29 +01:00
rmagueta
2fcd538082 SRS processing time measurement 2023-09-20 17:19:29 +01:00
maaroufi
e273f80fa8 Apply changes requested by the maintainer 2023-08-31 14:25:09 +02:00
maaroufi
416edd1980 Corrected some typos 2023-08-22 10:24:58 +02:00
maaroufi
02c7387c0d Corrected some typos, stripped dollars from bash commands to make it easier to copy and moved section 5 to the beginning because it needs to be followed at the beginning of the tutorial 2023-08-22 10:24:58 +02:00
526 changed files with 41237 additions and 24650 deletions

View File

@@ -60,6 +60,7 @@ ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
- RB_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'

5
.gitignore vendored
View File

@@ -9,8 +9,11 @@ cmake_targets/nas_sim_tools/build/
log/
lte_build_oai/
# vscode
# IDE files
.vscode
.cproject
.project
.settings
# Tags for vim/global
GPATH

31
.vscode/launch.json vendored
View File

@@ -1,31 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/cmake_targets/ran_build/build/lte-softmodem",
"args": [
"-O", "../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf",
"--noS1"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/cmake_targets",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "${workspaceFolder}/cmake_targets/sudo-gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

View File

@@ -193,6 +193,13 @@ if (SANITIZE_ADDRESS)
# wrong in the pthread library, or something subtly wrong in this CMakeLists.txt. Use Ubuntu 20.04 instead.
endif ()
add_boolean_option(SANITIZE_THREAD False "enable the address sanitizer (TSan)" ON)
if (SANITIZE_THREAD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -fno-omit-frame-pointer -fno-common")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer -fno-common")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
endif()
add_boolean_option(SANITIZE_UNDEFINED False "enable the undefined behavior sanitizer (UBSan)" ON)
if (SANITIZE_UNDEFINED)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
@@ -289,6 +296,15 @@ add_definitions(-DHAVE_NETINET_IN_H)
set(E2_AGENT "OFF" CACHE STRING "O-RAN-compliant E2 Agent")
set_property(CACHE E2_AGENT PROPERTY STRINGS "ON" "OFF")
set(E2AP_VERSION "E2AP_V2" CACHE STRING "E2AP version")
set_property(CACHE E2AP_VERSION PROPERTY STRINGS "E2AP_V1" "E2AP_V2" "E2AP_V3")
message(STATUS "Selected E2AP_VERSION: ${E2AP_VERSION}")
set(KPM_VERSION "KPM_V2" CACHE STRING "The KPM SM version to use")
set_property(CACHE KPM_VERSION PROPERTY STRINGS "KPM_V2" "KPM_V3")
message(STATUS "Selected KPM Version: ${KPM_VERSION}")
##################################################
# ASN.1 grammar C code generation & dependencies #
##################################################
@@ -454,19 +470,23 @@ add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
set (CONFIG_ROOTDIR ${OPENAIR_DIR}/common/config)
add_library(config_internals OBJECT
${CONFIG_ROOTDIR}/config_common.c
)
add_library(CONFIG_LIB
${CONFIG_ROOTDIR}/config_load_configmodule.c
${CONFIG_ROOTDIR}/config_userapi.c
${CONFIG_ROOTDIR}/config_cmdline.c
)
target_link_libraries(CONFIG_LIB PRIVATE config_internals dl UTIL)
# CONFIG_LIB is a wrapper around a particular config implementation, default is
# libconfig in params_libconfig below
pkg_check_modules(libconfig REQUIRED libconfig)
target_link_libraries(CONFIG_LIB PRIVATE dl UTIL)
add_library(params_libconfig MODULE ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c)
target_include_directories(params_libconfig PRIVATE ${libconfig_INCLUDE_DIRS})
target_link_libraries(params_libconfig PRIVATE ${libconfig_LIBRARIES})
target_link_libraries(params_libconfig PRIVATE config_internals ${libconfig_LIBRARIES})
# shared library loader
add_library(shlib_loader OBJECT common/utils/load_module_shlib.c)
@@ -1207,6 +1227,10 @@ set(NR_PDCP_SRC
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia1.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c
openair2/LAYER2/nr_pdcp/cuup_cucp_if.c
openair2/LAYER2/nr_pdcp/cuup_cucp_direct.c
openair2/LAYER2/nr_pdcp/cuup_cucp_e1ap.c
)
set(NR_SDAP_SRC
@@ -1258,7 +1282,6 @@ set(L2_NR_SRC
${NR_SDAP_SRC}
${NR_RRC_DIR}/rrc_gNB.c
${NR_RRC_DIR}/nr_rrc_common.c
${NR_RRC_DIR}/L2_nr_interface.c
${NR_RRC_DIR}/mac_rrc_dl_direct.c
${NR_RRC_DIR}/mac_rrc_dl_f1ap.c
${NR_RRC_DIR}/nr_rrc_config.c
@@ -1268,6 +1291,8 @@ set(L2_NR_SRC
${NR_RRC_DIR}/rrc_gNB_UE_context.c
${NR_RRC_DIR}/rrc_gNB_NGAP.c
${NR_RRC_DIR}/rrc_gNB_radio_bearers.c
${NR_RRC_DIR}/rrc_gNB_cuup.c
${NR_RRC_DIR}/rrc_gNB_du.c
)
set(L2_SRC_UE
@@ -1409,9 +1434,11 @@ add_library(L2
)
target_link_libraries(L2 PRIVATE x2ap s1ap lte_rrc m2ap)
target_link_libraries(L2 PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
if(E2_AGENT)
target_link_libraries(L2 PUBLIC e2_agent e2_ran_func)
target_compile_definitions(L2 PRIVATE E2_AGENT)
target_compile_definitions(L2 PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
@@ -1434,15 +1461,10 @@ add_library(e1_if
target_link_libraries(e1_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap SECURITY ${OPENSSL_LIBRARIES} e1ap GTPV1U)
add_library(e1_pdcp_if
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_e1_api.c
)
target_link_libraries(e1_pdcp_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
target_link_libraries(L2_NR PRIVATE f1ap x2ap s1ap ngap nr_rrc e1ap nr_rlc)
if(E2_AGENT)
target_link_libraries(L2_NR PUBLIC e2_agent e2_ran_func)
target_compile_definitions(L2_NR PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
target_compile_definitions(L2_NR PRIVATE E2_AGENT)
endif()
@@ -1868,8 +1890,6 @@ set (SIMUSRC
)
add_library(SIMU STATIC ${SIMUSRC} )
target_include_directories(SIMU PUBLIC ${OPENAIR1_DIR}/SIMULATION/TOOLS ${OPENAIR1_DIR}/SIMULATION/RF)
target_link_libraries(SIMU PRIVATE ${blas_LIBRARIES} ${cblas_LIBRARIES} ${lapacke_LIBRARIES})
target_include_directories(SIMU PRIVATE ${blas_INCLUDE_DIRS} ${lapacke_INCLUDE_DIRS})
# Qt-based scope
add_boolean_option(ENABLE_NRQTSCOPE OFF "Build the Qt-Scope" OFF)
@@ -1965,6 +1985,7 @@ target_link_libraries(lte-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
if(E2_AGENT)
target_compile_definitions(lte-softmodem PRIVATE E2_AGENT)
target_compile_definitions(lte-softmodem PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
add_executable(oairu
@@ -2061,6 +2082,11 @@ target_link_libraries(nr-softmodem PRIVATE
target_link_libraries(nr-softmodem PRIVATE pthread m CONFIG_LIB rt sctp)
target_link_libraries(nr-softmodem PRIVATE ${T_LIB})
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
target_link_libraries(nr-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
if(E2_AGENT)
target_compile_definitions(nr-softmodem PRIVATE ${E2AP_VERSION} ${KPM_VERSION})
endif()
add_dependencies(nr-softmodem ldpc_orig ldpc_optim ldpc_optim8seg ldpc)
@@ -2088,7 +2114,7 @@ add_executable(nr-cuup
target_link_libraries(nr-cuup PRIVATE
CONFIG_LIB ITTI SCTP_CLIENT
GTPV1U e1ap e1_pdcp_if f1ap SIMU_ETH
GTPV1U e1ap f1ap SIMU_ETH
z sctp dl pthread shlib_loader ${T_LIB})
target_link_libraries(nr-cuup PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
@@ -2350,7 +2376,7 @@ if (${T_TRACER})
PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX
L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_UE_NR ngap
CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT SIMU SIMU_ETH OPENAIR0_LIB
ldpc_orig ldpc_optim ldpc_optim8seg ldpc dfts)
ldpc_orig ldpc_optim ldpc_optim8seg ldpc dfts config_internals)
if (TARGET ${i})
add_dependencies(${i} generate_T)
endif()

View File

@@ -31,6 +31,9 @@ def do5Gtest = false
//
def gitCommitAuthorEmailAddr
// list of failing stages
def failingStages = ""
pipeline {
agent {
label nodeExecutor
@@ -117,44 +120,49 @@ pipeline {
}
}
// Build Stages are Mandatory
// Later we will add a Ubuntu20 build
stage ("Image Building Processes") {
when { expression {doBuild} }
parallel {
stage ("Ubuntu18-Image-Builder") {
stage ("Ubuntu-Image-Builder") {
steps {
script {
triggerSlaveJob ('RAN-Ubuntu18-Image-Builder', 'Ubuntu18-Image-Builder')
triggerSlaveJob ('RAN-Ubuntu18-Image-Builder', 'Ubuntu-Image-Builder')
}
}
post {
always {
script {
finalizeSlaveJob('RAN-Ubuntu18-Image-Builder')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
ubuntuBuildStatus = finalizeSlaveJob('RAN-Ubuntu18-Image-Builder')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += ubuntuBuildStatus
}
}
}
}
stage ("RHEL8-Cluster-Image-Builder") {
stage ("RHEL-Cluster-Image-Builder") {
steps {
script {
triggerSlaveJob ('RAN-RHEL8-Cluster-Image-Builder', 'RHEL8-Cluster-Image-Builder')
triggerSlaveJob ('RAN-RHEL8-Cluster-Image-Builder', 'RHEL-Cluster-Image-Builder')
}
}
post {
always {
script {
finalizeSlaveJob('RAN-RHEL8-Cluster-Image-Builder')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
rhelBuildStatus = finalizeSlaveJob('RAN-RHEL8-Cluster-Image-Builder')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += rhelBuildStatus
}
}
}
@@ -168,12 +176,37 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-cppcheck')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
cppcheckStatus = finalizeSlaveJob('RAN-cppcheck')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += cppcheckStatus
}
}
}
}
stage ("ARM-Cross-Compile") {
steps {
script {
triggerSlaveJob ('RAN-ARM-Cross-Compile-Builder', 'ARM-Cross-Compilation')
}
}
post {
always {
script {
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
armBuildStatus = finalizeSlaveJob('RAN-ARM-Cross-Compile-Builder')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += armBuildStatus
}
}
}
@@ -193,12 +226,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-PhySim-Cluster')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
physimStatus = finalizeSlaveJob('RAN-PhySim-Cluster')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += physimStatus
}
}
}
@@ -213,12 +249,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-RF-Sim-Test-4G')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
rfSim4GStatus = finalizeSlaveJob('RAN-RF-Sim-Test-4G')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += rfSim4GStatus
}
}
}
@@ -233,12 +272,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-RF-Sim-Test-5G')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
rfSim5GStatus = finalizeSlaveJob('RAN-RF-Sim-Test-5G')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += rfSim5GStatus
}
}
}
@@ -253,12 +295,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-L2-Sim-Test-4G')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
l2Sim4GStatus = finalizeSlaveJob('RAN-L2-Sim-Test-4G')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += l2Sim4GStatus
}
}
}
@@ -273,12 +318,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-L2-Sim-Test-5G')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
l2Sim5GStatus = finalizeSlaveJob('RAN-L2-Sim-Test-5G')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += l2Sim5GStatus
}
}
}
@@ -293,12 +341,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-LTE-FDD-LTEBOX-Container')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
lteTDDB200Status = finalizeSlaveJob('RAN-LTE-FDD-LTEBOX-Container')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += lteTDDB200Status
}
}
}
@@ -314,12 +365,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-LTE-FDD-OAIUE-OAICN4G-Container')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
lteFDDB200OAIUEStatus = finalizeSlaveJob('RAN-LTE-FDD-OAIUE-OAICN4G-Container')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += lteFDDB200OAIUEStatus
}
}
}
@@ -334,12 +388,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-LTE-TDD-LTEBOX-Container')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
lteFDDB200Status = finalizeSlaveJob('RAN-LTE-TDD-LTEBOX-Container')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += lteFDDB200Status
}
}
}
@@ -354,12 +411,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-NSA-B200-Module-LTEBOX-Container')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
nsaTDDB200Status = finalizeSlaveJob('RAN-NSA-B200-Module-LTEBOX-Container')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += nsaTDDB200Status
}
}
}
@@ -374,12 +434,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-SA-B200-Module-SABOX-Container')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
saTDDB200Status = finalizeSlaveJob('RAN-SA-B200-Module-SABOX-Container')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += saTDDB200Status
}
}
}
@@ -394,12 +457,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-gNB-N300-Timing-Phytest-LDPC')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
phytestLDPCoffloadStatus = finalizeSlaveJob('RAN-gNB-N300-Timing-Phytest-LDPC')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += phytestLDPCoffloadStatus
}
}
}
@@ -414,12 +480,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-LTE-TDD-2x2-Container')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
lteTDD2x2N3xxStatus = finalizeSlaveJob('RAN-LTE-TDD-2x2-Container')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += lteTDD2x2N3xxStatus
}
}
}
@@ -434,12 +503,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-SA-AW2S-CN5G')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
saAW2SStatus = finalizeSlaveJob('RAN-SA-AW2S-CN5G')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += saAW2SStatus
}
}
}
@@ -454,12 +526,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-Interop-F1')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
f1InteropStatus = finalizeSlaveJob('RAN-Interop-F1')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += f1InteropStatus
}
}
}
@@ -474,12 +549,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('OAI-CN5G-COTS-UE-Test')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
cn5gCOTSUESanityCheck = finalizeSlaveJob('OAI-CN5G-COTS-UE-Test')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += cn5gCOTSUESanityCheck
}
}
}
@@ -494,12 +572,15 @@ pipeline {
post {
always {
script {
finalizeSlaveJob('RAN-SA-OAIUE-CN5G')
// Using a unique variable name for each test stage to avoid overwriting on a global variable
// due to parallel-time concurrency
saOAIUEStatus = finalizeSlaveJob('RAN-SA-OAIUE-CN5G')
}
}
failure {
script {
currentBuild.result = 'FAILURE'
failingStages += saOAIUEStatus
}
}
}
@@ -518,6 +599,7 @@ pipeline {
script {
echo "Push to Docker-Hub KO"
currentBuild.result = 'FAILURE'
failingStages += '\n * RAN-DockerHub-Push'
}
}
}
@@ -541,7 +623,8 @@ pipeline {
script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): failed (" + BUILD_URL + ")"
if ("MERGE".equals(env.gitlabActionType)) {
addGitLabMRComment comment: message
def fullMessage = message + '\n\nList of failing test stages:' + failingStages
addGitLabMRComment comment: fullMessage
def message2 = message + " -- MergeRequest #" + env.gitlabMergeRequestIid + " (" + env.gitlabMergeRequestTitle + ")"
sendSocialMediaMessage('ci-enb', 'danger', message2)
} else {
@@ -644,21 +727,29 @@ def triggerSlaveJobNoGitLab (jobName) {
}
def finalizeSlaveJob(jobName) {
// In case of any non-success, we are retrieving the HTML report of the last completed
// slave job. The only drop-back is that we may retrieve the HTML report of a previous build
if (jobName == 'OAI-CN5G-COTS-UE-Test') {
fileName = "test_results_oai_cn5g_cots_ue.html"
} else {
fileName = "test_results-${jobName}.html"
}
if (!fileExists(fileName)) {
copyArtifacts(projectName: jobName,
filter: 'test_results*.html',
selector: lastCompleted())
if (fileExists(fileName)) {
sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}"
archiveArtifacts artifacts: fileName
lock ('Parent-Lock') {
// In case of any non-success, we are retrieving the HTML report of the last completed
// slave job. The only drop-back is that we may retrieve the HTML report of a previous build
if (jobName == 'OAI-CN5G-COTS-UE-Test') {
fileName = "test_results_oai_cn5g_cots_ue.html"
} else {
fileName = "test_results-${jobName}.html"
}
artifactUrl = BUILD_URL
if (!fileExists(fileName)) {
copyArtifacts(projectName: jobName,
filter: 'test_results*.html',
selector: lastCompleted())
if (fileExists(fileName)) {
sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' ${fileName}"
archiveArtifacts artifacts: fileName
// BUILD_URL is like http://server:port/jenkins/job/foo/15/
// no need to add a prefixed '/'
artifactUrl += 'artifact/' + fileName
}
}
artifactUrl = "\n * [${jobName}](${artifactUrl})"
return artifactUrl
}
}

View File

@@ -67,6 +67,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ('Verify Parameters') {
steps {
script {

View File

@@ -61,6 +61,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ('Verify Parameters') {
steps {
script {

View File

@@ -61,6 +61,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ('Verify Parameters') {
steps {
script {

View File

@@ -66,6 +66,13 @@ pipeline {
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ("Verify Parameters") {
steps {
script {

View File

@@ -54,6 +54,13 @@ pipeline {
lock(extra: lockResources)
}
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ("Verify Parameters") {
steps {
script {

View File

@@ -66,32 +66,14 @@ pipeline {
ansiColor('xterm')
lock(extra: lockResources)
}
// the following parameter options are commented out so it shows the ones
// that you SHALL have to run the job.
// You can use them as template
/*
parameters {
//node-test parameters
string(name: 'pythonExecutor', defaultValue: 'nodea', description: 'Node where the pipeline - python scripts will be executed')
string(name: 'pythonTestXmlFile', defaultValue: 'enb_usrpB210_band7_50PRB.xml', description: 'Location of the Test XML to be run')
string(name: 'pipelineTestStageName', defaultValue: 'Test COTS-UE - OAI eNB - LTEBOX EPC', description: 'Naming of the Test Stage')
booleanParam(name: 'pipelineZipsConsoleLog', defaultValue: 'True', description: 'If true, the pipeline script retrieves the job console log, zips it and archives it as artifact')
string(name: 'lockResources', defaultValue: 'CI-Bench-1-Phones', description: 'Lockeable Resource to prevent multiple jobs to run simultaneously with the same resource')
//eNB parameters
string(name: 'eNB_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of eNB')
credentials(name: 'eNB_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for eNB')
string(name: 'eNB_SourceCodePath', defaultValue: '/tmp/CI-enb', description: 'Full path of eNB source code')
//EPC parameters
string(name: 'EPC_IPAddress', defaultValue: '192.168.XX.XX', description: 'IP Address of EPC')
string(name: 'EPC_Type', defaultValue: 'ltebox', description: 'EPC type: OAI or ltebox')
credentials(name: 'EPC_Credentials', defaultValue: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', credentialType: "Username with password", required: true, description: 'Credentials for EPC')
string(name: 'EPC_SourceCodePath', defaultValue: '/tmp/CI-enb', description: 'Full path of EPC source code')
}
*/
stages {
stage("Build Init") {
steps {
// update the build name and description
buildName "${params.eNB_MR}"
buildDescription "Branch : ${params.eNB_Branch}"
}
}
stage ("Verify Parameters") {
steps {
script {

View File

@@ -49,75 +49,75 @@ adb_ue_2:
amarisoft_ue:
Host: amariue
InitScript: /root/2023-06-10/lteue-linux-2023-06-10/lteue /root/oaicicd/ran_sa_aw2s_asue/aw2s-multi-20897-2x2.cfg &
TermScript: /root/2023-06-10/libs/ws.js -t 10 127.0.0.1:9002 '{"message":"quit"}' || killall -KILL lteue-avx2
InitScript: /root/lteue-linux-2023-10-27/ue/lteue /root/oaicicd/ran_sa_aw2s_asue/aw2s-multi-20897-2x2.cfg &
TermScript: /root/2023-10-27/libs/ws.js -t 10 127.0.0.1:9002 '{"message":"quit"}' || killall -KILL lteue-avx2
amarisoft_ue_1:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":1}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":1}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":1}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":1}'
NetworkScript: ip netns exec ue1 ip a show dev pdn0
CmdPrefix: ip netns exec ue1
MTU: 1500
amarisoft_ue_2:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":2}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":2}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":2}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":2}'
NetworkScript: ip netns exec ue2 ip a show dev pdn0
CmdPrefix: ip netns exec ue2
MTU: 1500
amarisoft_ue_3:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":3}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":3}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":3}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":3}'
NetworkScript: ip netns exec ue3 ip a show dev pdn0
CmdPrefix: ip netns exec ue3
MTU: 1500
amarisoft_ue_4:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":4}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":4}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":4}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":4}'
NetworkScript: ip netns exec ue4 ip a show dev pdn0
CmdPrefix: ip netns exec ue4
MTU: 1500
amarisoft_ue_5:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":5}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":5}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":5}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":5}'
NetworkScript: ip netns exec ue5 ip a show dev pdn0
CmdPrefix: ip netns exec ue5
MTU: 1500
amarisoft_ue_6:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":6}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":6}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":6}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":6}'
NetworkScript: ip netns exec ue6 ip a show dev pdn0
CmdPrefix: ip netns exec ue6
MTU: 1500
amarisoft_ue_7:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":7}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":7}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":7}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":7}'
NetworkScript: ip netns exec ue7 ip a show dev pdn0
CmdPrefix: ip netns exec ue7
MTU: 1500
amarisoft_ue_8:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":8}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":8}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":8}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":8}'
NetworkScript: ip netns exec ue8 ip a show dev pdn0
CmdPrefix: ip netns exec ue8
MTU: 1500
amarisoft_ue_9:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":9}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":9}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":9}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":9}'
NetworkScript: ip netns exec ue9 ip a show dev pdn0
CmdPrefix: ip netns exec ue9
MTU: 1500
amarisoft_ue_10:
Host: amariue
AttachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":10}'
DetachScript: /root/2023-06-10/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":10}'
AttachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_on","ue_id":10}'
DetachScript: /root/2023-10-27/libs/ws.js 127.0.0.1:9002 '{"message":"power_off","ue_id":10}'
NetworkScript: ip netns exec ue10 ip a show dev pdn0
CmdPrefix: ip netns exec ue10
MTU: 1500
@@ -161,6 +161,78 @@ rfsim5g_ue2:
DetachScript: docker stop rfsim5g-oai-nr-ue2
MTU: 1500
rfsim5g_ue3:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue3 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue3
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue3
DetachScript: docker stop rfsim5g-oai-nr-ue3
MTU: 1500
rfsim5g_ue4:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue4 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue4
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue4
DetachScript: docker stop rfsim5g-oai-nr-ue4
MTU: 1500
rfsim5g_ue5:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue5 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue5
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue5
DetachScript: docker stop rfsim5g-oai-nr-ue5
MTU: 1500
rfsim5g_ue6:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue6 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue6
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue6
DetachScript: docker stop rfsim5g-oai-nr-ue6
MTU: 1500
rfsim5g_ue7:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue7 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue7
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue7
DetachScript: docker stop rfsim5g-oai-nr-ue7
MTU: 1500
rfsim5g_ue8:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue8 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue8
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue8
DetachScript: docker stop rfsim5g-oai-nr-ue8
MTU: 1500
rfsim5g_ue9:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue9 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue9
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue9
DetachScript: docker stop rfsim5g-oai-nr-ue9
MTU: 1500
rfsim5g_ue10:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-nr-ue10 ip a show dev oaitun_ue1
CmdPrefix: docker exec rfsim5g-oai-nr-ue10
IF: oaitun_ue1
AttachScript: docker start rfsim5g-oai-nr-ue10
DetachScript: docker stop rfsim5g-oai-nr-ue10
MTU: 1500
rfsim5g_ext_dn:
Host: localhost
NetworkScript: docker exec rfsim5g-oai-ext-dn ip a show dev eth0

View File

@@ -289,6 +289,7 @@ class Containerize():
self.proxyCommit = None
self.eNB_instance = 0
self.eNB_serverId = ['', '', '']
self.deployKind = [True, True, True]
self.yamlPath = ['', '', '']
self.services = ['', '', '']
self.nb_healthy = [0, 0, 0]
@@ -433,7 +434,7 @@ class Containerize():
if ret.returncode != 0:
logging.error('\u001B[1m Could not build properly ran-base\u001B[0m')
# Recover the name of the failed container?
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs {self.cli} rm -f")
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs --no-run-if-empty {self.cli} rm -f")
cmd.run(f"{self.cli} image prune --force")
cmd.close()
logging.error('\u001B[1m Building OAI Images Failed\u001B[0m')
@@ -466,8 +467,8 @@ class Containerize():
cmd.run(f'sed -i -e "s#{baseImage}:latest#{baseImage}:{baseTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}')
if image != 'ran-build':
cmd.run(f'sed -i -e "s#ran-build:latest#ran-build:{imageTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}')
cmd.run(f'{self.cli} build {self.cliBuildOptions} --target {image} --tag {image}:{imageTag} --file docker/Dockerfile.{pattern}{self.dockerfileprefix} . > cmake_targets/log/{image}.log 2>&1', timeout=1200)
if image == 'ran-build':
ret = cmd.run(f'{self.cli} build {self.cliBuildOptions} --target {image} --tag {image}:{imageTag} --file docker/Dockerfile.{pattern}{self.dockerfileprefix} . > cmake_targets/log/{image}.log 2>&1', timeout=1200)
if image == 'ran-build' and ret.returncode == 0:
cmd.run(f"docker run --name test-log -d {image}:{imageTag} /bin/true")
cmd.run(f"docker cp test-log:/oai-ran/cmake_targets/log/ cmake_targets/log/{image}/")
cmd.run(f"docker rm -f test-log")
@@ -479,7 +480,7 @@ class Containerize():
logging.error('\u001B[1m Could not build properly ' + image + '\u001B[0m')
status = False
# Here we should check if the last container corresponds to a failed command and destroy it
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs {self.cli} rm -f")
cmd.run(f"{self.cli} ps --quiet --filter \"status=exited\" -n1 | xargs --no-run-if-empty {self.cli} rm -f")
allImagesSize[image] = 'N/A -- Build Failed'
break
else:
@@ -835,6 +836,7 @@ class Containerize():
HELP.GenericHelp(CONST.Version)
sys.exit('Insufficient Parameter')
logging.debug('\u001B[1m Deploying OAI Object on server: ' + lIpAddr + '\u001B[0m')
self.deployKind[self.eNB_instance] = True
mySSH = SSH.SSHConnection()
mySSH.open(lIpAddr, lUserName, lPassWord)
@@ -1037,6 +1039,7 @@ class Containerize():
logging.debug('\u001B[1m Checking Services to deploy\u001B[0m')
# Implicitly we are running locally
myCmd = cls_cmd.LocalCmd(d = self.yamlPath[0])
self.deployKind[0] = False
cmd = 'docker-compose config --services'
listServices = myCmd.run(cmd)
if listServices.returncode != 0:
@@ -1242,7 +1245,7 @@ class Containerize():
fullStatus = True
if anyLogs:
# Analyzing log file(s)!
listOfPossibleRanContainers = ['enb', 'gnb', 'cu', 'du']
listOfPossibleRanContainers = ['enb*', 'gnb*', 'cu*', 'du*']
for container in listOfPossibleRanContainers:
filenames = './*-oai-' + container + '.log'
cmd = f'ls {filenames}'

View File

@@ -43,7 +43,7 @@ import logging
import datetime
import signal
import statistics as stat
from multiprocessing import SimpleQueue
from multiprocessing import SimpleQueue, Lock
import concurrent.futures
#import our libs
@@ -494,7 +494,7 @@ class OaiCiTest():
messages = [f.result() for f in futures]
HTML.CreateHtmlTestRowQueue('NA', 'OK', messages)
def Ping_common(self, EPC, ue, RAN):
def Ping_common(self, EPC, ue, RAN, printLock):
# Launch ping on the EPC side (true for ltebox and old open-air-cn)
ping_status = 0
ueIP = ue.getIP()
@@ -551,6 +551,8 @@ class OaiCiTest():
avg_msg = f'RTT(Avg) : {rtt_avg} ms'
max_msg = f'RTT(Max) : {rtt_max} ms'
# adding a lock for cleaner display in command line
printLock.acquire()
logging.info(f'\u001B[1;37;44m ping result for {ue_header} \u001B[0m')
logging.info(f'\u001B[1;34m {pal_msg} \u001B[0m')
logging.info(f'\u001B[1;34m {min_msg} \u001B[0m')
@@ -563,6 +565,7 @@ class OaiCiTest():
if float(packetloss) > float(self.ping_packetloss_threshold):
message += '\nPacket Loss too high'
logging.error(f'\u001B[1;37;41m Packet Loss too high; Target: {self.ping_packetloss_threshold}%\u001B[0m')
printLock.release()
return (False, message)
elif float(packetloss) > 0:
message += '\nPacket Loss is not 0%'
@@ -573,7 +576,9 @@ class OaiCiTest():
ping_rttavg_error_msg = f'RTT(Avg) too high: {rtt_avg} ms; Target: {self.ping_rttavg_threshold} ms'
message += f'\n {ping_rttavg_error_msg}'
logging.error('\u001B[1;37;41m'+ ping_rttavg_error_msg +' \u001B[0m')
printLock.release()
return (False, message)
printLock.release()
return (True, message)
@@ -587,8 +592,9 @@ class OaiCiTest():
ues = [cls_module_ue.Module_UE(n.strip()) for n in self.ue_ids]
logging.debug(ues)
pingLock = Lock()
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = [executor.submit(self.Ping_common, EPC, ue, RAN) for ue in ues]
futures = [executor.submit(self.Ping_common, EPC, ue, RAN, pingLock) for ue in ues]
results = [f.result() for f in futures]
# each result in results is a tuple, first member goes to successes, second to messages
successes, messages = map(list, zip(*results))
@@ -1358,7 +1364,10 @@ class OaiCiTest():
for instance in range(0, len(CONTAINERS.yamlPath)):
if CONTAINERS.yamlPath[instance]!='':
CONTAINERS.eNB_instance=instance
CONTAINERS.UndeployObject(HTML,RAN)
if CONTAINERS.deployKind[instance]:
CONTAINERS.UndeployObject(HTML,RAN)
else:
CONTAINERS.UndeployGenObject(HTML,RAN, self)
RAN.prematureExit=True
#this function is called only if eNB/gNB fails to start
@@ -1385,7 +1394,10 @@ class OaiCiTest():
for instance in range(0, len(CONTAINERS.yamlPath)):
if CONTAINERS.yamlPath[instance]!='':
CONTAINERS.eNB_instance=instance
CONTAINERS.UndeployObject(HTML,RAN)
if CONTAINERS.deployKind[instance]:
CONTAINERS.UndeployObject(HTML,RAN)
else:
CONTAINERS.UndeployGenObject(HTML,RAN,self)
RAN.prematureExit=True
def IdleSleep(self,HTML):

View File

@@ -75,15 +75,11 @@ security = {
drb_ciphering = "yes";
drb_integrity = "no";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="debug";
pdcp_log_level ="info";
rrc_log_level ="info";
f1ap_log_level ="debug";
ngap_log_level ="debug";
};
log_config : {
global_log_level = "info";
pdcp_log_level = "info";
rrc_log_level = "info";
f1ap_log_level = "info";
ngap_log_level = "info";
};

View File

@@ -8,7 +8,7 @@ gNBs =
(
{
////////// Identification parameters:
gNB_CU_ID = 0xe00;
gNB_ID = 0xe00;
# cell_type = "CELL_MACRO_GNB";

View File

@@ -8,7 +8,7 @@ gNBs =
(
{
////////// Identification parameters:
gNB_CU_ID = 0xe00;
gNB_ID = 0xe00;
# cell_type = "CELL_MACRO_GNB";

View File

@@ -7,7 +7,7 @@ gNBs =
(
{
////////// Identification parameters:
gNB_CU_ID = 0xe00;
gNB_ID = 0xe00;
# cell_type = "CELL_MACRO_GNB";
@@ -56,32 +56,9 @@ gNBs =
}
);
security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
# valid values: nia0, nia1, nia2, nia3
integrity_algorithms = ( "nia2", "nia0" );
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
log_config : {
global_log_level = "info";
pdcp_log_level = "info";
f1ap_log_level = "info";
ngap_log_level = "info";
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="debug";
pdcp_log_level ="info";
rrc_log_level ="info";
f1ap_log_level ="info";
ngap_log_level ="debug";
};

View File

@@ -7,7 +7,7 @@ gNBs =
(
{
////////// Identification parameters:
gNB_CU_ID = 0xe00;
gNB_ID = 0xe00;
# cell_type = "CELL_MACRO_GNB";
@@ -56,23 +56,6 @@ gNBs =
}
);
security = {
# preferred ciphering algorithms
# the first one of the list that an UE supports in chosen
# valid values: nea0, nea1, nea2, nea3
ciphering_algorithms = ( "nea0" );
# preferred integrity algorithms
# the first one of the list that an UE supports in chosen
# valid values: nia0, nia1, nia2, nia3
integrity_algorithms = ( "nia2", "nia0" );
# setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter
# what 'ciphering_algorithms' configures; same thing for 'drb_integrity'
drb_ciphering = "yes";
drb_integrity = "no";
};
log_config: {
global_log_level = "info";
};

View File

@@ -217,7 +217,7 @@ THREAD_STRUCT = (
rfsimulator: {
serveraddr = "server";
serverport = "4043";
serverport = 4043;
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs"

View File

@@ -217,21 +217,17 @@ THREAD_STRUCT = (
);
rfsimulator: {
serveraddr = "server";
serverport = "4043";
serverport = 4043;
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs"
}
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="info";
mac_log_level ="info";
rlc_log_level ="info";
pdcp_log_level ="info";
rrc_log_level ="info";
f1ap_log_level ="debug";
ngap_log_level ="debug";
};
log_config: {
global_log_level = "info";
hw_log_level = "info";
phy_log_level = "info";
mac_log_level = "info";
rlc_log_level = "info";
f1ap_log_level = "info";
};

View File

@@ -63,6 +63,7 @@ gNBs =
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
initialDLBWPcontrolResourceSetZero = 0;
#rach-ConfigCommon
#rach-ConfigGeneric
prach_ConfigurationIndex = 98;

View File

@@ -32,7 +32,7 @@ gNBs =
absoluteFrequencySSB = 432990;
dl_frequencyBand = 66;
# this is 3600 MHz
dl_absoluteFrequencyPointA = 430000;
dl_absoluteFrequencyPointA = 430002;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing
@@ -53,7 +53,7 @@ gNBs =
#uplinkConfigCommon
#frequencyInfoUL
ul_frequencyBand = 66;
ul_absoluteFrequencyPointA = 350000;
ul_absoluteFrequencyPointA = 350002;
#scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
@@ -230,7 +230,7 @@ THREAD_STRUCT = (
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
serverport = 4043;
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";

View File

@@ -32,7 +32,7 @@ gNBs =
absoluteFrequencySSB = 430590;
dl_frequencyBand = 66;
# this is 2150 MHz
dl_absoluteFrequencyPointA = 430000;
dl_absoluteFrequencyPointA = 430002;
#scs-SpecificCarrierList
dl_offstToCarrier = 0;
# subcarrierSpacing
@@ -54,7 +54,7 @@ gNBs =
#frequencyInfoUL
ul_frequencyBand = 66;
# this is 1750 MHz
ul_absoluteFrequencyPointA = 350000;
ul_absoluteFrequencyPointA = 350002;
#scs-SpecificCarrierList
ul_offstToCarrier = 0;
# subcarrierSpacing
@@ -240,7 +240,7 @@ THREAD_STRUCT = (
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
serverport = 4043;
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";

View File

@@ -6,7 +6,7 @@ gNBs =
(
{
////////// Identification parameters:
gNB_CU_ID = 0xe00;
gNB_ID = 0xe00;
gNB_name = "gNB-OAI";
@@ -220,7 +220,7 @@ RUs = (
att_rx = 0;
bands = [78];
max_pdschReferenceSignalPower = -27;
max_rxgain = 75;
max_rxgain = 65;
eNB_instances = [0];
##beamforming 1x2 matrix: 1 layer x 2 antennas
bf_weights = [0x00007fff, 0x0000];

View File

@@ -232,7 +232,7 @@ THREAD_STRUCT = (
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
serverport = 4043;
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";

View File

@@ -10,7 +10,7 @@ gNBs =
(
{
////////// Identification parameters:
gNB_CU_ID = 0xe00;
gNB_ID = 0xe00;
gNB_name = "gNB-Eurecom-n78_20";
@@ -75,7 +75,7 @@ gNBs =
initialULBWPsubcarrierSpacing = 1;
#rach-ConfigCommon
#rach-ConfigGeneric
prach_ConfigurationIndex = 98;
prach_ConfigurationIndex = 100;
#prach_msg1_FDM
#0 = one, 1=two, 2=four, 3=eight
prach_msg1_FDM = 0;

View File

@@ -230,7 +230,7 @@ THREAD_STRUCT = (
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
serverport = 4043;
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";

View File

@@ -229,7 +229,7 @@ THREAD_STRUCT = (
rfsimulator :
{
serveraddr = "server";
serverport = "4043";
serverport = 4043;
options = (); #("saviq"); or/and "chanmod"
modelname = "AWGN";
IQfile = "/tmp/rfsimulator.iqs";

View File

@@ -8,7 +8,7 @@ ColNames :
- Average vs Reference Deviation (Reference Value; Acceptability Threshold)
Ref :
feprx : 84.0
feptx_prec : 11.0
feptx_prec : 14.0
feptx_ofdm : 35.0
feptx_total : 100.0
L1 Tx processing : 400.0

View File

@@ -32,9 +32,8 @@
000022
000023
000024
000025
020021
020022
030021
100021
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
@@ -72,33 +71,33 @@
<testCase id="000023">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G DU RF sim SA</desc>
<desc>Deploy 3 OAI 5G DUs RF sim SA</desc>
<yaml_path>yaml_files/5g_f1_rfsimulator</yaml_path>
<services>oai-du</services>
<nb_healthy>8</nb_healthy>
<services>oai-du oai-du2 oai-du3</services>
<nb_healthy>10</nb_healthy>
</testCase>
<testCase id="000024">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G NR-UE RF sim SA</desc>
<yaml_path>yaml_files/5g_f1_rfsimulator</yaml_path>
<services>oai-nr-ue</services>
<nb_healthy>9</nb_healthy>
<services>oai-nr-ue oai-nr-ue2</services>
<nb_healthy>12</nb_healthy>
</testCase>
<testCase id="000025">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G NR-UE RF sim SA</desc>
<yaml_path>yaml_files/5g_f1_rfsimulator</yaml_path>
<services>oai-nr-ue3</services>
<nb_healthy>13</nb_healthy>
</testCase>
<testCase id="020021">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
<id>rfsim5g_ue</id>
<ping_args> -c 20 192.168.72.135</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
<testCase id="020022">
<class>Ping</class>
<desc>Ping NR-UE from ext-dn</desc>
<id>rfsim5g_ext_dn</id>
<ping_args>-c 20 12.1.1.2</ping_args>
<desc>Ping ext-dn from all NR-UEs</desc>
<id>rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3</id>
<ping_args> -c 20 192.168.72.135 -i0.25</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>

View File

@@ -33,10 +33,15 @@
000002
000003
000004
000005
000006
000007
020001
020002
020003
020004
020105
444445
030001
030002
444444
@@ -44,7 +49,7 @@
020005
444444
333333
020005
020006
100001
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
@@ -96,6 +101,30 @@
<nb_healthy>9</nb_healthy>
</testCase>
<testCase id="000005">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G NR-UEs (#3, #4, #5) RF sim SA</desc>
<yaml_path>yaml_files/5g_rfsimulator</yaml_path>
<services>oai-nr-ue3 oai-nr-ue4 oai-nr-ue5</services>
<nb_healthy>12</nb_healthy>
</testCase>
<testCase id="000006">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G NR-UEs (#6, #7, #8) RF sim SA</desc>
<yaml_path>yaml_files/5g_rfsimulator</yaml_path>
<services>oai-nr-ue6 oai-nr-ue7 oai-nr-ue8</services>
<nb_healthy>15</nb_healthy>
</testCase>
<testCase id="000007">
<class>DeployGenObject</class>
<desc>Deploy OAI 5G NR-UEs (#9, #10) RF sim SA</desc>
<yaml_path>yaml_files/5g_rfsimulator</yaml_path>
<services>oai-nr-ue9 oai-nr-ue10</services>
<nb_healthy>17</nb_healthy>
</testCase>
<testCase id="020001">
<class>Ping</class>
<desc>Ping ext-dn from NR-UE</desc>
@@ -136,6 +165,22 @@
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
<testCase id="020006">
<class>Ping</class>
<desc>Ping ext-dn from both UEs</desc>
<id>rfsim5g_ue rfsim5g_ue2</id>
<ping_args>-c 20 192.168.72.135</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
<testCase id="020105">
<class>Ping</class>
<desc>Ping ext-dn from all UEs</desc>
<id>rfsim5g_ue rfsim5g_ue2 rfsim5g_ue3 rfsim5g_ue4 rfsim5g_ue5 rfsim5g_ue6 rfsim5g_ue7 rfsim5g_ue8 rfsim5g_ue9 rfsim5g_ue10</id>
<ping_args>-c 100 192.168.72.135 -i 0.2 -s 1016</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
<testCase id="030001">
<class>IperfFromContainer</class>
<desc>Iperf UDP Downlink</desc>
@@ -166,6 +211,12 @@
<id>rfsim5g_ue rfsim5g_ue2</id>
</testCase>
<testCase id="444445">
<class>Detach_UE</class>
<desc>Detach OAI UE 2 to 10</desc>
<id>rfsim5g_ue3 rfsim5g_ue4 rfsim5g_ue5 rfsim5g_ue6 rfsim5g_ue7 rfsim5g_ue8 rfsim5g_ue9 rfsim5g_ue10</id>
</testCase>
<testCase id="100001">
<class>UndeployGenObject</class>
<desc>Undeploy all OAI 5G stack</desc>

View File

@@ -35,6 +35,11 @@
002003
002004
002005
002006
002007
002008
002009
002010
000100
000010
000020
@@ -97,12 +102,42 @@
<id>amarisoft_ue_5</id>
</testCase>
<testCase id="002006">
<class>Attach_UE</class>
<desc>Attach UE</desc>
<id>amarisoft_ue_6</id>
</testCase>
<testCase id="002007">
<class>Attach_UE</class>
<desc>Attach UE</desc>
<id>amarisoft_ue_7</id>
</testCase>
<testCase id="002008">
<class>Attach_UE</class>
<desc>Attach UE</desc>
<id>amarisoft_ue_8</id>
</testCase>
<testCase id="002009">
<class>Attach_UE</class>
<desc>Attach UE</desc>
<id>amarisoft_ue_9</id>
</testCase>
<testCase id="002010">
<class>Attach_UE</class>
<desc>Attach UE</desc>
<id>amarisoft_ue_10</id>
</testCase>
<testCase id="000010">
<class>Iperf</class>
<desc>iperf (DL/20Mbps/UDP)(30 sec)(multi-ue profile)</desc>
<iperf_args>-u -b 60M -t 30 -i 1 -R</iperf_args>
<desc>iperf (DL/7Mbps/UDP)(30 sec)(multi-ue profile)</desc>
<iperf_args>-u -b 70M -t 30 -i 1 -R</iperf_args>
<direction>IPERF3</direction>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3</id>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5 amarisoft_ue_6 amarisoft_ue_7 amarisoft_ue_8 amarisoft_ue_9 amarisoft_ue_10</id>
<iperf_packetloss_threshold>25</iperf_packetloss_threshold>
<iperf_bitrate_threshold>80</iperf_bitrate_threshold>
<iperf_profile>balanced</iperf_profile>
@@ -110,10 +145,10 @@
<testCase id="000020">
<class>Iperf</class>
<desc>iperf (UL/5Mbps/UDP)(30 sec)(multi-ue profile)</desc>
<iperf_args>-u -b 15M -t 30 -i 1 </iperf_args>
<desc>iperf (UL/2Mbps/UDP)(30 sec)(multi-ue profile)</desc>
<iperf_args>-u -b 20M -t 30 -i 1 </iperf_args>
<direction>IPERF3</direction>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3</id>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5 amarisoft_ue_6 amarisoft_ue_7 amarisoft_ue_8 amarisoft_ue_9 amarisoft_ue_10</id>
<iperf_packetloss_threshold>25</iperf_packetloss_threshold>
<iperf_bitrate_threshold>80</iperf_bitrate_threshold>
<iperf_profile>balanced</iperf_profile>
@@ -122,7 +157,7 @@
<testCase id="000100">
<class>Ping</class>
<desc>Ping: 20pings in 20sec, multi-ue</desc>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5</id>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5 amarisoft_ue_6 amarisoft_ue_7 amarisoft_ue_8 amarisoft_ue_9 amarisoft_ue_10</id>
<ping_args>-c 20 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>25</ping_rttavg_threshold>
@@ -131,7 +166,7 @@
<testCase id="000200">
<class>Ping</class>
<desc>Ping: 100pings in 20sec, multi-ue</desc>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5</id>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5 amarisoft_ue_6 amarisoft_ue_7 amarisoft_ue_8 amarisoft_ue_9 amarisoft_ue_10</id>
<ping_args>-c 100 -i 0.2 %cn_ip%</ping_args>
<ping_packetloss_threshold>1</ping_packetloss_threshold>
<ping_rttavg_threshold>30</ping_rttavg_threshold>
@@ -140,7 +175,7 @@
<testCase id="003000">
<class>Detach_UE</class>
<desc>Detach UE</desc>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5</id>
<id>amarisoft_ue_1 amarisoft_ue_2 amarisoft_ue_3 amarisoft_ue_4 amarisoft_ue_5 amarisoft_ue_6 amarisoft_ue_7 amarisoft_ue_8 amarisoft_ue_9 amarisoft_ue_10</id>
</testCase>
<testCase id="004000">

View File

@@ -198,6 +198,42 @@ services:
interval: 10s
timeout: 5s
retries: 5
oai-du2:
image: oaisoftwarealliance/oai-gnb:develop
privileged: true
container_name: rfsim5g-oai-du2
environment:
USE_ADDITIONAL_OPTIONS: --sa --rfsim --gNBs.[0].gNB_ID 0xe01 --gNBs.[0].nr_cellid 87654321 --gNBs.[0].servingCellConfigCommon.[0].physCellId 1 --MACRLCs.[0].local_n_address 192.168.71.143 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-cu
networks:
public_net:
ipv4_address: 192.168.71.143
volumes:
- ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
timeout: 5s
retries: 5
oai-du3:
image: oaisoftwarealliance/oai-gnb:develop
privileged: true
container_name: rfsim5g-oai-du3
environment:
USE_ADDITIONAL_OPTIONS: --sa --rfsim --gNBs.[0].gNB_ID 0xe02 --gNBs.[0].nr_cellid 11111111 --gNBs.[0].servingCellConfigCommon.[0].physCellId 2 --MACRLCs.[0].local_n_address 192.168.71.144 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-cu
networks:
public_net:
ipv4_address: 192.168.71.144
volumes:
- ../../conf_files/gnb-du.sa.band78.106prb.rfsim.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:
test: /bin/bash -c "pgrep nr-softmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
@@ -216,6 +252,42 @@ services:
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue2:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue2
environment:
USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3619200000 --rfsimulator.serveraddr 192.168.71.143 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-du2
networks:
public_net:
ipv4_address: 192.168.71.151
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue3:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue3
environment:
USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3619200000 --rfsimulator.serveraddr 192.168.71.144 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-du3
networks:
public_net:
ipv4_address: 192.168.71.152
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
networks:
public_net:

File diff suppressed because one or more lines are too long

View File

@@ -185,7 +185,7 @@ services:
privileged: true
container_name: rfsim5g-oai-nr-ue
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 --band 66 -C 2169080000 --CO -400000000 --ssb 378 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 --band 66 -C 2169090000 --CO -400000000 --ssb 378 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:

View File

@@ -12,18 +12,81 @@
</tr>
</table>
This page is only valid for an `Ubuntu18` host.
This page is valid for an `Ubuntu18` host.
It is also valid for `Ubuntu 20.04`.
This tutorial is only valid once this file is merged into the `develop` branch.
# 1. Adapt the `docker-compose` to your environment #
The yaml file is in the following directory: `ci-scripts/yaml_files/5g_l2sim_tdd`
# 1. Retrieving the images on Docker-Hub #
In the `SMF` section, provide your own DNS IP address:
```yaml
DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100
```
gNB section:
All the parameter values will be taken from the mounted config file:
```yaml
oai-gnb:
[...]
volumes:
- ../../conf_files/gnb.sa.band78.106prb.l2sim.conf:/opt/oai-gnb/etc/gnb.conf
```
You need to provide your docker-host primary IP address and interface name: in our case `172.21.16.128` and `eno1`.
The following refers to the contents of the previously mentioned .conf file
```yaml
GNB_NGA_IF_NAME: eno1
GNB_NGA_IP_ADDRESS: 172.21.16.128
GNB_NGU_IF_NAME: eno1
GNB_NGU_IP_ADDRESS: 172.21.16.128
```
For the UE, all the parameter values will be taken from the mounted config
file, in the section `oai-nr-ue0`:
```yaml
oai-nr-ue0:
[...]
volumes:
- ../../conf_files/nrue.band78.106prb.l2sim.conf:/opt/oai-nr-ue/etc/nr-ue.conf
- ../../../openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results:/opt/oai-nr-ue/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results
```
In this section, you need to set the proper values for `local_n_if_name` and `remote_n_address`
where the UE configuration (mounted to `/opt/oai-nr-ue/etc/nr-ue.conf`) reads:
```libconfig
MACRLCs = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "eno1";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
...
```
This tutorial is a first draft. This nFAPI feature and the proxy are still under development.
At time of writing, we were able to run in `host-mode`, 1 `NR-UE` and just ping traffic.
# 2. Retrieving the images on Docker-Hub #
Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`.
Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`.
```bash
$ docker login
docker login
```
```bash
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username:
Password:
@@ -32,33 +95,33 @@ Password:
Now pull images.
```bash
$ docker pull mysql:8.0
$ docker pull oaisoftwarealliance/oai-amf:v1.5.0
$ docker pull oaisoftwarealliance/oai-nrf:v1.5.0
$ docker pull oaisoftwarealliance/oai-smf:v1.5.0
$ docker pull oaisoftwarealliance/oai-spgwu-tiny:v1.5.0
$ docker pull oaisoftwarealliance/trf-gen-cn5g:focal
docker pull mysql:8.0
docker pull oaisoftwarealliance/oai-amf:v1.5.0
docker pull oaisoftwarealliance/oai-nrf:v1.5.0
docker pull oaisoftwarealliance/oai-smf:v1.5.0
docker pull oaisoftwarealliance/oai-spgwu-tiny:v1.5.0
docker pull oaisoftwarealliance/trf-gen-cn5g:focal
$ docker pull oaisoftwarealliance/oai-gnb:develop
$ docker pull oaisoftwarealliance/oai-nr-ue:develop
$ docker pull oaisoftwarealliance/proxy:develop
docker pull oaisoftwarealliance/oai-gnb:develop
docker pull oaisoftwarealliance/oai-nr-ue:develop
docker pull oaisoftwarealliance/proxy:develop
```
And **re-tag** them for tutorials' docker-compose file to work.
```bash
$ docker image tag oaisoftwarealliance/proxy:develop oai-lte-multi-ue-proxy:latest
docker image tag oaisoftwarealliance/proxy:develop oai-lte-multi-ue-proxy:latest
```
```bash
$ docker logout
docker logout
```
Note that the proxy image is based on the source available at [https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy](https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy).
At time of writing, the `latest` tag corresponded to `56cfdc046a5f96d5e67d42a2fc2bf6ba2fe58b41` commit.
# 2. Deploy containers #
# 3. Deploy containers #
**CAUTION: this SHALL be done in multiple steps.**
@@ -72,11 +135,13 @@ The `gNB`, `proxy` and `NR-UE` containers will be deployed in `host`-mode. It wi
sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up
```
## 2.1. Deploy OAI 5G Core Network ##
## 3.1. Deploy OAI 5G Core Network ##
```bash
$ cd ci-scripts/yaml_files/5g_l2sim_tdd
$ docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn
cd ci-scripts/yaml_files/5g_l2sim_tdd
docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn
```
```bash
Creating network "l2sim-oai-public-net" with driver "bridge"
Creating network "l2sim-oai-traffic_net-net" with driver "bridge"
Creating l2sim-oai-nrf ... done
@@ -90,7 +155,9 @@ Creating l2sim-oai-ext-dn ... done
Wait for a bit.
```bash
$ docker-compose ps -a
docker-compose ps -a
```
```bash
Name Command State Ports
-------------------------------------------------------------------------------------------------
l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
@@ -104,7 +171,9 @@ l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 880
At this point, you can prepare a capture on the newly-created public docker bridges:
```bash
$ ifconfig
ifconfig
```
```bash
...
l2sim-public: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.71.129 netmask 255.255.255.192 broadcast 192.168.71.191
@@ -124,16 +193,19 @@ l2sim-traffic: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
TX packets 3999 bytes 23367972 (23.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
...
$ sudo nohup tshark -f "(host 192.168.72.135 and icmp) or (not host 192.168.72.135 and not arp and not port 53 and not port 2152 and not port 2153)" -i l2sim-public -i l2sim-traffic -w /tmp/capture_5g_l2sim_tdd.pcap > /tmp/tshark.log 2>&1 &
```
```bash
sudo nohup tshark -f "(host 192.168.72.135 and icmp) or (not host 192.168.72.135 and not arp and not port 53 and not port 2152 and not port 2153)" -i l2sim-public -i l2sim-traffic -w /tmp/capture_5g_l2sim_tdd.pcap > /tmp/tshark.log 2>&1 &
```
## 2.2. Deploy OAI gNB in Standalone Mode as a VNF ##
## 3.2. Deploy OAI gNB in Standalone Mode as a VNF ##
**CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).**
```bash
$ docker-compose up -d oai-gnb
docker-compose up -d oai-gnb
```
```bash
l2sim-oai-nrf is up-to-date
l2sim-oai-spgwu is up-to-date
l2sim-oai-ext-dn is up-to-date
@@ -144,6 +216,8 @@ Wait for a bit.
```bash
$ docker-compose ps -a
```
```bash
Name Command State Ports
-------------------------------------------------------------------------------------------------
l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
@@ -157,8 +231,10 @@ l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 880
You can verify that the `gNB` is connected with the `AMF`:
```bagh
$ docker logs rfsim5g-oai-amf
```bash
docker logs l2sim-oai-amf
```
```bash
...
[AMF] [amf_app] [info ] |----------------------------------------------------gNBs' information-------------------------------------------|
[AMF] [amf_app] [info ] | Index | Status | Global ID | gNB Name | PLMN |
@@ -167,10 +243,12 @@ $ docker logs rfsim5g-oai-amf
...
```
## 2.3. Deploy OAI NR-UE and proxy
## 3.3. Deploy OAI NR-UE and proxy
```bash
$ docker-compose up -d proxy oai-nr-ue0
docker-compose up -d proxy oai-nr-ue
```
```bash
l2sim-mysql is up-to-date
l2sim-oai-nrf is up-to-date
l2sim-oai-amf is up-to-date
@@ -185,7 +263,9 @@ Creating l2sim-proxy ... done
Wait for a bit.
```bash
$ docker-compose ps -a
docker-compose ps -a
```
```bash
Name Command State Ports
-------------------------------------------------------------------------------------------------
l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
@@ -197,8 +277,11 @@ l2sim-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/
l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp
l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp
l2sim-proxy /oai-lte-multi-ue-proxy/bi ... Up (healthy)
$ docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}} {{.MemUsage}}\t{{.MemPerc}}" l2sim-mysql l2sim-oai-amf l2sim-oai-ext-dn l2sim-oai-gnb l2sim-oai-nr-ue0 l2sim-oai-nrf l2sim-oai-smf l2sim-oai-spgwu l2sim-proxy
```
```bash
docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}} {{.MemUsage}}\t{{.MemPerc}}" l2sim-mysql l2sim-oai-amf l2sim-oai-ext-dn l2sim-oai-gnb l2sim-oai-nr-ue0 l2sim-oai-nrf l2sim-oai-smf l2sim-oai-spgwu l2sim-proxy
```
```bash
CONTAINER CPU % MEM USAGE / LIMIT MEM %
l2sim-mysql 0.03% 206.7MiB / 62.54GiB 0.32%
l2sim-oai-amf 4.05% 29.49MiB / 62.54GiB 0.05%
@@ -216,7 +299,9 @@ l2sim-proxy 6.97% 290.4MiB / 62.54GiB 0.45%
But the CPU speed matters; I am running on a fast server:
```bash
$ lscpu
lscpu
```
```bash
Architecture: x86_64
CPU(s): 16
...
@@ -239,7 +324,9 @@ We will work on this issue.
Making sure the OAI UE is connected:
```bash
$ docker exec -it l2sim-oai-nr-ue /bin/bash
docker exec -it l2sim-oai-nr-ue0 /bin/bash
```
```bash
root@bb4d400a832d:/opt/oai-nr-ue# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.71.137 netmask 255.255.255.192 broadcast 192.168.71.191
@@ -266,14 +353,19 @@ oaitun_ue1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```
# 3. Check traffic #
# 4. Check traffic #
## 3.1. Check your Internet connectivity ##
## 4.1. Check your Internet connectivity ##
You can also check with the `ext-dn` container (IP address is `192.168.72.135` in docker-compose)
```bash
$ docker exec -it l2sim-oai-nr-ue /bin/bash
docker exec -it l2sim-oai-nr-ue0 /bin/bash
```
```bash
ping -I oaitun_ue1 -c 20 192.168.72.135
```
```bash
root@bb4d400a832d# ping -I oaitun_ue1 -c 20 192.168.72.135
PING 192.168.72.135 (192.168.72.135) from 12.1.1.2 oaitun_ue1: 56(84) bytes of data.
64 bytes from 192.168.72.135: icmp_seq=1 ttl=63 time=65.1 ms
@@ -287,10 +379,12 @@ PING 192.168.72.135 (192.168.72.135) from 12.1.1.2 oaitun_ue1: 56(84) bytes of d
rtt min/avg/max/mdev = 16.413/120.639/209.673/57.159 ms
```
# 4. Un-deployment #
# 5. Un-deployment #
```bash
$ docker-compose down
docker-compose down
```
```bash
Stopping l2sim-oai-nr-ue2 ... done
Stopping l2sim-oai-nr-ue ... done
Stopping l2sim-oai-gnb ... done
@@ -313,68 +407,3 @@ Removing network l2sim-oai-public-net
Removing network l2sim-oai-traffic-net
```
# 5. Adapt the `docker-compose` to your environment #
In the `SMF` section, provide your own DNS IP address:
```yaml
DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100
```
gNB section:
All the parameter values will be taken from the mounted config file
```yaml
oai-gnb:
[...]
volumes:
- ../../conf_files/gnb.sa.band78.106prb.l2sim.conf:/opt/oai-gnb/etc/gnb.conf
```
with the configuration file having something like:
```libconfig
NETWORK_INTERFACES :
{
GNB_INTERFACE_NAME_FOR_NG_AMF = "eno1";
GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.21.16.128";
GNB_INTERFACE_NAME_FOR_NGU = "eno1";
GNB_IPV4_ADDRESS_FOR_NGU = "172.21.16.128";
GNB_PORT_FOR_NGU = 2152; # Spec 2152
};
```
For the UE, all the parameter values will be taken from the mounted config
file. Example:
```yaml
oai-nr-ue0:
[...]
volumes:
- ../../conf_files/nrue.band78.106prb.l2sim.conf:/opt/oai-nr-ue/etc/nr-ue.conf
- ../../../openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results:/opt/oai-nr-ue/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results
```
where the UE configuration (mounted to `/opt/oai-nr-ue/etc/nr-ue.conf`) reads
```libconfig
MACRLCs = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "eno1";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
...
```
This tutorial is a first draft. This nFAPI feature and the proxy are still under development.
At time of writing, we were able to run in `host-mode`, 1 `NR-UE` and just ping traffic.
Later development will include:
- deploying `gNB-VNF`, `proxy` and `UE` in isolated containers (with their own IP address)
- more UEs
- more traffic (`UDP` and `TCP`)

View File

@@ -184,7 +184,7 @@ services:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue
environment:
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
@@ -198,12 +198,11 @@ services:
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue2:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue2
environment:
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
@@ -217,6 +216,150 @@ services:
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue3:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue3
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.152
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue4:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue4
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001103 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.153
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue5:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue5
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001104 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.154
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue6:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue6
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001105 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.155
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue7:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue7
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001106 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.156
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue8:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue8
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001107 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.157
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue9:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue9
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001108 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.158
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
oai-nr-ue10:
image: oaisoftwarealliance/oai-nr-ue:develop
privileged: true
container_name: rfsim5g-oai-nr-ue10
environment:
USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001109 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:
public_net:
ipv4_address: 192.168.71.159
volumes:
- ../../conf_files/nrue.uicc.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:
test: /bin/bash -c "pgrep nr-uesoftmodem"
interval: 10s
timeout: 5s
retries: 5
networks:
public_net:

File diff suppressed because one or more lines are too long

View File

@@ -186,7 +186,7 @@ services:
privileged: true
container_name: rfsim5g-oai-nr-ue
environment:
USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152250000 --CO -400000000 --ssb 76 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152260000 --CO -400000000 --ssb 76 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time
depends_on:
- oai-gnb
networks:

View File

@@ -7,7 +7,7 @@ services:
container_name: oai-gnb
environment:
TZ: Europe/Paris
USE_ADDITIONAL_OPTIONS: --sa --tune-offset 20000000 --log_config.global_log_options level,nocolor,time
USE_ADDITIONAL_OPTIONS: --sa --tune-offset 20000000 -A 45 --log_config.global_log_options level,nocolor,time
volumes:
- ../../conf_files/gnb.sa.band78.106prb.n310.7ds2u.conf:/opt/oai-gnb/etc/gnb.conf
healthcheck:

View File

@@ -8,7 +8,7 @@ services:
#entrypoint: /bin/bash -c "sleep infinity"
environment:
TZ: Europe/Paris
USE_ADDITIONAL_OPTIONS: --usrp-args type=n3xx,name=ni-n3xx-31641B9,addr=192.168.20.2 -r 106 --numerology 1 --band 78 -C 3511200000 --sa --ue-fo-compensation --ue-rxgain 65 --tune-offset 20000000 --log_config.global_log_options level,nocolor,time --uicc0.imsi 208970000000111 --uicc0.nssai_sd 16777215
USE_ADDITIONAL_OPTIONS: --usrp-args type=n3xx,name=ni-n3xx-31641B9,addr=192.168.20.2 -r 106 --numerology 1 --band 78 -C 3511200000 --sa --ue-fo-compensation --ue-rxgain 65 --tune-offset 20000000 -A 45 --log_config.global_log_options level,nocolor,time --uicc0.imsi 208970000000111 --uicc0.nssai_sd 16777215
volumes:
- ../../conf_files/ue.sa.conf:/opt/oai-nr-ue/etc/nr-ue.conf
healthcheck:

View File

@@ -158,6 +158,8 @@ Options:
Enable the memory sanitizer on all targets. Requires clang, and is
incompatible with ASan/UBSan. To build, issue:
CC=/usr/bin/clang CXX=/usr/bin/clang++ ./build_oai ... --sanitize-memory
--sanitize-thread | -fsanitize=thread
Enable the thread sanitizer on all targets
-h | --help
Print this help"
}
@@ -338,10 +340,11 @@ function main() {
echo_info "Will compile with verbose instructions"
shift;;
--build-doxygen)
CMAKE_CMD="$CMAKE_CMD -DGENERATE_DOXYGEN=ON"
BUILD_DOXYGEN=1
echo_info "Will build doxygen support"
shift;;
CMAKE_CMD="$CMAKE_CMD -DGENERATE_DOXYGEN=ON"
TARGET_LIST="$TARGET_LIST doc"
BUILD_DOXYGEN=1
echo_info "Will build doxygen support"
shift;;
--disable-T-Tracer)
CMAKE_CMD="$CMAKE_CMD -DT_TRACER=False"
echo_info "Disabling the T tracer"
@@ -415,6 +418,9 @@ function main() {
CMAKE_CMD="$CMAKE_CMD -DTRACE_ASN1C_ENC_DEC=ON"
echo_info "Enabling asn1c internal traces via OAI logging system"
shift 1;;
--sanitize-thread | -fthread=address)
CMAKE_CMD="$CMAKE_CMD -DSANITIZE_THREAD=True"
shift;;
-h | --help)
print_help
exit 1;;
@@ -490,6 +496,12 @@ function main() {
echo_info "Running \"$CMAKE_CMD\""
eval $CMAKE_CMD
compilations $BUILD_DIR all.txt $TARGET_LIST
###################
# Doxygen Support #
###################
if [ "$BUILD_DOXYGEN" = "1" ] ; then
echo_info "Built Doxygen based documentation. The documentation file is located here: $OPENAIR_DIR/$BUILD_DIR/build/html/index.html"
fi
if [ "$UE" = 1 ] ; then
@@ -513,18 +525,6 @@ function main() {
fi
fi
###################
# Doxygen Support #
###################
if [ "$BUILD_DOXYGEN" = "1" ] ; then
doxygen_log=$OPENAIR_DIR/cmake_targets/log/doxygen.log
echo_info "Building Doxygen based documentation. The documentation file is located here: $OPENAIR_DIR/targets/DOCS/html/index.html"
echo_info "Doxygen generation log is located here: $doxygen_log"
echo_info "Generating Doxygen files....please wait"
(
$CMAKE --build . --target doc
) >& $doxygen_log
fi
##############
# Auto-tests #

View File

@@ -54,16 +54,17 @@ fi
###############################
## echo and family
###############################
black='\E[30m'
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[1;34m'
magenta='\E[35m'
cyan='\E[36m'
white='\E[37m'
reset_color='\E[00m'
COLORIZE=1
# only emit color if connected to a terminal, and if it supports colors
if [ -t 1 ]; then
num_colors=$(tput colors)
if [ -n "$num_colors" ] && [ "$num_colors" -ge 8 ]; then
red='\E[31m'
green='\E[32m'
yellow='\E[33m'
blue='\E[1;34m'
reset_color='\E[00m'
fi
fi
cecho() {
# Color-echo
@@ -72,8 +73,7 @@ cecho() {
local default_msg="No Message."
message=${1:-$default_msg}
color=${2:-$green}
[ "$COLORIZE" = "1" ] && message="$color$message$reset_color"
echo -e "$message"
echo -e "$color$message$reset_color"
return
}
@@ -233,6 +233,8 @@ compilations() {
$CMAKE --build . $verbose --target $targets -- -j$(nproc)
ret=$?
} > $dlog/$logfile 2>&1
# Print the errors and warnings for CI purposes
egrep -A3 "warning:|error:" $dlog/$logfile || true
check_warnings "$dlog/$logfile"
if [[ $ret -eq 0 ]]; then
echo_success "$targets compiled"
@@ -665,6 +667,8 @@ install_asn1c_from_source(){
git clone https://github.com/mouse07410/asn1c /tmp/asn1c
cd /tmp/asn1c
git checkout vlm_master
# Showing which version is used
git log -n1
autoreconf -iv
./configure --prefix /opt/asn1c/
make -j`nproc`
@@ -683,6 +687,15 @@ install_simde_from_source(){
$SUDO rm -rf /tmp/simde
git clone https://github.com/simd-everywhere/simde-no-tests.git /tmp/simde
cd /tmp/simde
# we can specify a given version of SIMDE (sha-one or tag)
if [[ -v SIMDE_VERSION ]]; then
git checkout -f $SIMDE_VERSION
else
# At time of writing, last working commit for OAI
git checkout 389f360a66d4a3bec62b7d71ad8be877487809ba
fi
# Showing which version is used
git log -n1
# brute force copy into /usr/include
$SUDO \cp -rv ../simde /usr/include
}

View File

@@ -11,7 +11,7 @@ paramdef_t someoptions[] = {
{"opt1", "<help opt1>", 0, uptr:&varopt1, defuintval:0, TYPE_UINT, 0 },
};
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
config_get( someoptions,sizeofArray(someoptions),"somesection");
```
new code:
@@ -31,7 +31,7 @@ paramdef_t someoptions[] = {
{"opt2", "<help opt2>", 0, strptr:&varopt2,defstrval:"",TYPE_STRING,0 },
};
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
config_get( someoptions,sizeofArray(someoptions),"somesection");
```

View File

@@ -105,7 +105,7 @@ character string, used as a prefix for the section name. It has to be specified
list to be read is under another section.
*/
config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,
sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t),
sizeofArray(NbIoT_MacRLC_Params),
NULL);
/*

View File

@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file common/config/cmdline/config_libconfig.c
/*! \file config_cmdline.c
* \brief configuration module, command line parsing implementation
* \author Francois TABURET
* \date 2017
@@ -37,9 +37,11 @@
#include <errno.h>
#include <platform_types.h>
#include "config_userapi.h"
#include "config_common.h"
#include "../utils/LOG/log.h"
int parse_stringlist(paramdef_t *cfgoptions, char *val) {
static int parse_stringlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *val)
{
char *atoken;
char *tokctx = NULL;
char *tmpval=strdup(val);
@@ -57,21 +59,22 @@ int parse_stringlist(paramdef_t *cfgoptions, char *val) {
AssertFatal(MAX_LIST_SIZE > numelt,
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
MAX_LIST_SIZE );
config_check_valptr(cfgoptions, sizeof(char*), numelt);
config_check_valptr(cfg, cfgoptions, sizeof(char *), numelt);
cfgoptions->numelt=numelt;
atoken=strtok_r(val, ",",&tokctx);
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
snprintf(cfgoptions->strlistptr[i],DEFAULT_EXTRA_SZ,"%s",atoken);
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
printf_params(cfg, "[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname, i, cfgoptions->strlistptr[i]);
atoken=strtok_r(NULL, ",",&tokctx);
}
return (cfgoptions->numelt > 0);
}
int processoption(paramdef_t *cfgoptions, char *value) {
static int processoption(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *value)
{
char *tmpval = value;
int optisset=0;
char defbool[2]="1";
@@ -79,6 +82,7 @@ int processoption(paramdef_t *cfgoptions, char *value) {
if ( value == NULL) {
if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
AssertFatal(false, "[CONFIG] command line, requires an argument\n");
} else { /* boolean value option without argument, set value to true*/
tmpval = defbool;
}
@@ -89,19 +93,18 @@ int processoption(paramdef_t *cfgoptions, char *value) {
case TYPE_STRING:
if (cfgoptions->numelt == 0 )
config_check_valptr(cfgoptions, 1,
strlen(tmpval)+1);
config_check_valptr(cfg, cfgoptions, 1, strlen(tmpval) + 1);
if (cfgoptions->numelt < (strlen(tmpval)+1)) {
CONFIG_PRINTF_ERROR("[CONFIG] command line option %s value too long\n",
cfgoptions->optname);
}
snprintf(*cfgoptions->strptr, cfgoptions->numelt ,"%s",tmpval);
printf_cmdl("[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
printf_cmdl(cfg, "[CONFIG] %s set to %s from command line\n", cfgoptions->optname, tmpval);
optisset=1;
break;
case TYPE_STRINGLIST:
optisset=parse_stringlist(cfgoptions,tmpval);
optisset = parse_stringlist(cfg, cfgoptions, tmpval);
break;
case TYPE_UINT32:
@@ -110,8 +113,8 @@ int processoption(paramdef_t *cfgoptions, char *value) {
case TYPE_INT16:
case TYPE_UINT8:
case TYPE_INT8:
config_check_valptr(cfgoptions, sizeof(*cfgoptions->iptr), 1);
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,&charptr,0));
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->iptr), 1);
config_assign_int(cfg, cfgoptions, cfgoptions->optname, (int32_t)strtol(tmpval, &charptr, 0));
if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
@@ -122,14 +125,14 @@ int processoption(paramdef_t *cfgoptions, char *value) {
case TYPE_UINT64:
case TYPE_INT64:
config_check_valptr(cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
*(cfgoptions->i64ptr)=strtoll(tmpval,&charptr,0);
if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
}
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*cfgoptions->i64ptr);
printf_cmdl(cfg, "[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*cfgoptions->i64ptr);
optisset=1;
break;
@@ -138,14 +141,14 @@ int processoption(paramdef_t *cfgoptions, char *value) {
break;
case TYPE_DOUBLE:
config_check_valptr(cfgoptions, sizeof(*cfgoptions->dblptr), 1);
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->dblptr), 1);
*cfgoptions->dblptr = strtof(tmpval,&charptr);
if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires a double argument\n",cfgoptions->optname);
}
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
printf_cmdl(cfg, "[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
optisset=1;
break;
@@ -167,7 +170,8 @@ int processoption(paramdef_t *cfgoptions, char *value) {
/*--------------------------------------------------------------------*/
/* check unknown options in the command line
*/
int config_check_unknown_cmdlineopt(char *prefix) {
int config_check_unknown_cmdlineopt(configmodule_interface_t *cfg, char *prefix)
{
int unknowndetected=0;
char testprefix[CONFIG_MAXOPTLENGTH];
int finalcheck = 0;
@@ -182,18 +186,21 @@ int config_check_unknown_cmdlineopt(char *prefix) {
}
}
for (int i=1; i<config_get_if()->argc ; i++) {
if ( !finalcheck && strstr(config_get_if()->argv[i],testprefix) == NULL ) continue;
for (int i = 1; i < cfg->argc; i++) {
if (!finalcheck && strstr(cfg->argv[i], testprefix) == NULL)
continue;
if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue;
if (!finalcheck && testprefix[0] == 0 && index(cfg->argv[i], '.') != NULL)
continue;
if ( !finalcheck && isdigit(config_get_if()->argv[i][0])) continue;
if (!finalcheck && isdigit(cfg->argv[i][0]))
continue;
if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue;
if (!finalcheck && cfg->argv[i][0] == '-' && isdigit(cfg->argv[i][1]))
continue;
if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) {
fprintf(stderr,"[CONFIG] unknown option: %s\n",
config_get_if()->argv[i] );
if ((cfg->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0) {
fprintf(stderr, "[CONFIG] unknown option: %s\n", cfg->argv[i]);
unknowndetected++;
}
}
@@ -204,10 +211,11 @@ int config_check_unknown_cmdlineopt(char *prefix) {
}
return unknowndetected;
} /* config_check_unknown_cmdlineopt */
} /* config_check_unknown_cmdlineopt */
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
int c = config_get_if()->argc;
int config_process_cmdline(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
{
int c = cfg->argc;
int i,j;
char *pp;
char cfgpath[CONFIG_MAXOPTLENGTH];
@@ -215,15 +223,16 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
i = 0;
while (c > 0 ) {
char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
char *oneargv =
strdup(cfg->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */
if(!oneargv) abort();
/* first check help options, either --help, -h or --help_<section> */
if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) {
char *tokctx = NULL;
pp=strtok_r(oneargv, "_",&tokctx);
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
cfg->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
if (pp == NULL || strcasecmp(pp, cfg->argv[i]) == 0) {
if( prefix == NULL) {
config_printhelp(cfgoptions,numoptions,"(root section)");
@@ -263,10 +272,10 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
char *valptr=NULL;
int ret;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
cfg->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
if (c > 0) {
pp = config_get_if()->argv[i+1];
pp = cfg->argv[i + 1];
if (pp != NULL ) {
ret = strlen(pp);
@@ -280,11 +289,11 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
}
}
j += processoption(&(cfgoptions[n]), valptr);
j += processoption(cfg, &(cfgoptions[n]), valptr);
if ( valptr != NULL ) {
i++;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
cfg->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
c--;
}
@@ -298,6 +307,6 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
c--;
} /* fin du while */
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
printf_cmdl(cfg, "[CONFIG] %s %i options set from command line\n", ((prefix == NULL) ? "(root)" : prefix), j);
return j;
} /* parse_cmdline*/
} /* parse_cmdline*/

View File

@@ -0,0 +1,313 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <dlfcn.h>
#include <arpa/inet.h>
#include <platform_types.h>
#include "config_common.h"
#include "../utils/LOG/log.h"
static int managed_ptr_sz(configmodule_interface_t *cfg, void *ptr)
{
AssertFatal(cfg->numptrs < CONFIG_MAX_ALLOCATEDPTRS,
"This code use fixed size array as #define CONFIG_MAX_ALLOCATEDPTRS %d\n",
CONFIG_MAX_ALLOCATEDPTRS);
int i;
pthread_mutex_lock(&cfg->memBlocks_mutex);
int numptrs=cfg->numptrs;
for (i=0; i<numptrs; i++ )
if (cfg->oneBlock[i].ptrs == ptr)
break;
pthread_mutex_unlock(&cfg->memBlocks_mutex);
if ( i == numptrs )
return -1;
else
return cfg->oneBlock[i].sz;
}
void config_check_valptr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int elt_sz, int nb_elt)
{
const bool toFree=!(cfgoptions->paramflags & PARAMFLAG_NOFREE);
// let's see if the value has been read
// the datamodel is more difficult than it should be
// and it is not thread safe
if (cfgoptions->voidptr) {
int sz;
if ( cfgoptions-> type == TYPE_STRING)
sz = managed_ptr_sz(cfg, *cfgoptions->strptr);
else
sz = managed_ptr_sz(cfg, cfgoptions->voidptr);
if ( sz != -1 ) // the same variable pointer has been used!
cfgoptions->numelt=sz;
}
if (cfgoptions->voidptr != NULL
&& (cfgoptions->type == TYPE_INTARRAY
|| cfgoptions->type == TYPE_UINTARRAY
|| cfgoptions->type == TYPE_STRINGLIST )) {
int sz;
if (cfgoptions->type == TYPE_STRING || cfgoptions->type == TYPE_STRINGLIST)
sz = managed_ptr_sz(cfg, *cfgoptions->strptr);
else
sz = managed_ptr_sz(cfg, cfgoptions->voidptr);
if ( sz == -1) {
fprintf(stderr,"[CONFIG] %s NOT SUPPORTED not NULL pointer with array types", cfgoptions->optname);
return ;
}
}
if (cfgoptions->voidptr == NULL ) {
if (cfgoptions->type == TYPE_STRING) {
// difficult datamodel
cfgoptions->strptr = config_allocate_new(cfg, sizeof(*cfgoptions->strptr), toFree);
} else if ( cfgoptions->type == TYPE_STRINGLIST) {
AssertFatal(nb_elt<MAX_LIST_SIZE,
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
MAX_LIST_SIZE );
cfgoptions->strlistptr = config_allocate_new(cfg, sizeof(char *) * MAX_LIST_SIZE, toFree);
for (int i=0; i<MAX_LIST_SIZE; i++)
cfgoptions->strlistptr[i] = config_allocate_new(cfg, DEFAULT_EXTRA_SZ, toFree);
} else {
if ( cfgoptions->type == TYPE_INTARRAY || cfgoptions->type == TYPE_UINTARRAY )
nb_elt=max(nb_elt, MAX_LIST_SIZE); // make room if the list is larger than the default one
cfgoptions->voidptr = config_allocate_new(cfg, elt_sz * nb_elt, toFree);
}
}
if (cfgoptions->type == TYPE_STRING && *cfgoptions->strptr == NULL) {
*cfgoptions->strptr = config_allocate_new(cfg, nb_elt + DEFAULT_EXTRA_SZ, toFree);
cfgoptions->numelt=nb_elt+DEFAULT_EXTRA_SZ;
}
}
void *config_allocate_new(configmodule_interface_t *cfg, int sz, bool autoFree)
{
void *ptr = calloc(sz, 1);
AssertFatal(ptr, "calloc fails\n");
// add the memory piece in the managed memory pieces list
pthread_mutex_lock(&cfg->memBlocks_mutex);
int newBlockIdx=cfg->numptrs++;
oneBlock_t* tmp=&cfg->oneBlock[newBlockIdx];
tmp->ptrs = (char *)ptr;
tmp->ptrsAllocated = true;
tmp->sz=sz;
tmp->toFree=autoFree;
pthread_mutex_unlock(&cfg->memBlocks_mutex);
return ptr;
}
int config_setdefault_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
{
int status = 0;
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->iptr), 1);
if (((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
config_assign_int(cfg, cfgoptions, cfgoptions->optname, cfgoptions->defintval);
status=1;
printf_params(cfg, "[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
}
return status;
}
int config_setdefault_int64(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
{
int status = 0;
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
if (((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions->u64ptr) = cfgoptions->defuintval;
status=1;
printf_params(cfg,
"[CONFIG] %s.%s set to default value %llu\n",
((prefix == NULL) ? "" : prefix),
cfgoptions->optname,
(long long unsigned)(*(cfgoptions->u64ptr)));
}
return status;
}
int config_setdefault_intlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
{
int status = 0;
if (cfgoptions->defintarrayval != NULL) {
config_check_valptr(cfg, cfgoptions, sizeof(cfgoptions->iptr), cfgoptions->numelt);
cfgoptions->iptr = cfgoptions->defintarrayval;
status=1;
for (int j = 0; j < cfgoptions->numelt; j++) {
printf_params(cfg, "[CONFIG] %s[%i] set to default value %i\n", cfgoptions->optname, j, (int)cfgoptions->iptr[j]);
}
}
return status;
}
int config_setdefault_string(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
{
int status = 0;
if (cfgoptions->defstrval != NULL) {
status=1;
if (cfgoptions->numelt == 0)
config_check_valptr(cfg, cfgoptions, 1, strlen(cfgoptions->defstrval) + 1);
if (cfgoptions->numelt < strlen(cfgoptions->defstrval) + 1) {
fprintf(stderr,"[CONFIG] %s size too small\n", cfgoptions->optname);
}
snprintf(*cfgoptions->strptr, cfgoptions->numelt, "%s", cfgoptions->defstrval);
printf_params(cfg,
"[CONFIG] %s.%s set to default value \"%s\"\n",
((prefix == NULL) ? "" : prefix),
cfgoptions->optname,
*cfgoptions->strptr);
}
return status;
}
int config_setdefault_stringlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
{
int status = 0;
if (cfgoptions->defstrlistval != NULL) {
cfgoptions->strlistptr = cfgoptions->defstrlistval;
status=1;
for (int j = 0; j < cfgoptions->numelt; j++)
printf_params(cfg,
"[CONFIG] %s.%s[%i] set to default value %s\n",
((prefix == NULL) ? "" : prefix),
cfgoptions->optname,
j,
cfgoptions->strlistptr[j]);
}
return status;
}
int config_setdefault_double(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
{
int status = 0;
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->dblptr), 1);
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions->dblptr)=cfgoptions->defdblval;
status=1;
printf_params(cfg, "[CONFIG] %s set to default value %lf\n", cfgoptions->optname, *(cfgoptions->dblptr));
}
return status;
}
int config_assign_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *ipv4addr)
{
config_check_valptr(cfg, cfgoptions, sizeof(*cfgoptions->uptr), 1);
int rst=inet_pton(AF_INET, ipv4addr,cfgoptions->uptr );
if (rst == 1 && *(cfgoptions->uptr) > 0) {
printf_params(cfg, "[CONFIG] %s: %s\n", cfgoptions->optname, ipv4addr);
return 1;
} else {
if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
printf_params(cfg, "[CONFIG] %s:%s (INADDR_ANY) \n", cfgoptions->optname, ipv4addr);
*cfgoptions->uptr=INADDR_ANY;
return 1;
} else {
fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
return -1;
}
}
return 0;
}
int config_setdefault_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix)
{
int status = 0;
if (cfgoptions->defstrval != NULL) {
status = config_assign_ipv4addr(cfg, cfgoptions, cfgoptions->defstrval);
}
return status;
}
void config_assign_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *fullname, int val)
{
int tmpval=val;
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
tmpval =1;
}
switch (cfgoptions->type) {
case TYPE_UINT8:
*(cfgoptions->u8ptr) = (uint8_t)tmpval;
printf_params(cfg, "[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
break;
case TYPE_INT8:
*(cfgoptions->i8ptr) = (int8_t)tmpval;
printf_params(cfg, "[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
break;
case TYPE_UINT16:
*(cfgoptions->u16ptr) = (uint16_t)tmpval;
printf_params(cfg, "[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
break;
case TYPE_INT16:
*(cfgoptions->i16ptr) = (int16_t)tmpval;
printf_params(cfg, "[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
break;
case TYPE_UINT32:
*(cfgoptions->uptr) = (uint32_t)tmpval;
printf_params(cfg, "[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
break;
case TYPE_MASK:
*(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
printf_params(cfg, "[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
break;
case TYPE_INT32:
*(cfgoptions->iptr) = (int32_t)tmpval;
printf_params(cfg, "[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
break;
default:
fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
break;
}
}

View File

@@ -0,0 +1,58 @@
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/config/config_userapi.h
* \brief: configuration module, include file to be used by the source code calling the
* configuration module to access configuration parameters
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#ifndef INCLUDE_CONFIG_COMMON_H
#define INCLUDE_CONFIG_COMMON_H
#include "config_load_configmodule.h"
#include "common/utils/utils.h"
#ifdef __cplusplus
extern "C"
{
#endif
void config_check_valptr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int elt_sz, int nb_elt);
/* functions to set a parameter to its default value */
int config_setdefault_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
int config_setdefault_int64(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
int config_setdefault_intlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
int config_setdefault_string(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
int config_setdefault_stringlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
int config_setdefault_double(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
int config_setdefault_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *prefix);
void *config_allocate_new(configmodule_interface_t *cfg, int sz, bool autoFree);
void config_assign_int(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *fullname, int val);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -44,6 +44,25 @@
#include "../utils/LOG/log.h"
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
#include "nfapi/oai_integration/vendor_ext.h"
#include "config_common.h"
// clang-format off
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \
debugflags can also be defined in the config section of the config file\n \
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
4->print command line processing debug messages\n \
incp parameter can be used to define the include path used for config files (@include directive)\n \
defaults is set to the path of the main config file.\n";
static paramdef_t Config_Params[] = {
/*--------------------------------------------------------------------------------------------------------------------------*/
/* config parameters for config module */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------*/
{CONFIGP_DEBUGFLAGS, config_helpstr, 0, .uptr = NULL, .defintval = 0, TYPE_MASK, 0},
{CONFIGP_TMPDIR, CONFIG_HELP_TMPDIR, PARAMFLAG_NOFREE, .strptr = NULL, .defstrval = "/tmp", TYPE_STRING, 0},
};
// clang-format on
int load_config_sharedlib(configmodule_interface_t *cfgptr) {
void *lib_handle;
@@ -52,7 +71,7 @@ int load_config_sharedlib(configmodule_interface_t *cfgptr) {
int st;
st=0;
sprintf(libname,CONFIG_SHAREDLIBFORMAT,cfgptr->cfgmode);
lib_handle = dlopen(libname,RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
lib_handle = dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE);
if (!lib_handle) {
fprintf(stderr,"[CONFIG] %s %d Error calling dlopen(%s): %s\n",__FILE__, __LINE__, libname,dlerror());
@@ -65,7 +84,7 @@ int load_config_sharedlib(configmodule_interface_t *cfgptr) {
printf("[CONFIG] %s %d no function %s for config mode %s\n",
__FILE__, __LINE__,fname, cfgptr->cfgmode);
} else {
st=cfgptr->init(cfgptr->cfgP,cfgptr->num_cfgP);
st = cfgptr->init(cfgptr);
printf("[CONFIG] function %s returned %i\n",
fname, st);
}
@@ -121,14 +140,18 @@ int nooptfunc(void) {
return 0;
};
int config_cmdlineonly_getlist(paramlist_def_t *ParamList,
paramdef_t *params, int numparams, char *prefix) {
int config_cmdlineonly_getlist(configmodule_interface_t *cfg,
paramlist_def_t *ParamList,
paramdef_t *params,
int numparams,
char *prefix)
{
ParamList->numelt = 0;
return 0;
}
int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
int config_cmdlineonly_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
{
int defval;
int fatalerror=0;
int numdefvals=0;
@@ -138,11 +161,11 @@ int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
switch(cfgoptions[i].type) {
case TYPE_STRING:
defval=config_setdefault_string(&(cfgoptions[i]), prefix);
defval = config_setdefault_string(cfg, &cfgoptions[i], prefix);
break;
case TYPE_STRINGLIST:
defval=config_setdefault_stringlist(&(cfgoptions[i]), prefix);
defval = config_setdefault_stringlist(cfg, &cfgoptions[i], prefix);
break;
case TYPE_UINT8:
@@ -152,25 +175,25 @@ int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
case TYPE_UINT32:
case TYPE_INT32:
case TYPE_MASK:
defval=config_setdefault_int(&(cfgoptions[i]), prefix);
defval = config_setdefault_int(cfg, &cfgoptions[i], prefix);
break;
case TYPE_UINT64:
case TYPE_INT64:
defval=config_setdefault_int64(&(cfgoptions[i]), prefix);
defval = config_setdefault_int64(cfg, &cfgoptions[i], prefix);
break;
case TYPE_UINTARRAY:
case TYPE_INTARRAY:
defval=config_setdefault_intlist(&(cfgoptions[i]), prefix);
defval = config_setdefault_intlist(cfg, &cfgoptions[i], prefix);
break;
case TYPE_DOUBLE:
defval=config_setdefault_double(&(cfgoptions[i]), prefix);
defval = config_setdefault_double(cfg, &cfgoptions[i], prefix);
break;
case TYPE_IPV4ADDR:
defval=config_setdefault_ipv4addr(&(cfgoptions[i]), prefix);
defval = config_setdefault_ipv4addr(cfg, &cfgoptions[i], prefix);
break;
default:
@@ -231,7 +254,7 @@ configmodule_interface_t *load_configmodule(int argc,
OWoptIdx = i;
}
if ( strstr(argv[i], "help_config") != NULL ) {
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME);
config_printhelp(Config_Params, sizeofArray(Config_Params), CONFIG_SECTIONNAME);
exit(0);
}
@@ -271,8 +294,12 @@ configmodule_interface_t *load_configmodule(int argc,
modeparams=cfgmode;
cfgmode=strdup(CONFIG_LIBCONFIGFILE);
}
if (cfgptr == NULL) {
cfgptr = calloc(sizeof(configmodule_interface_t),1);
static configmodule_interface_t *cfgptr;
if (cfgptr)
printf("ERROR: Call load_configmodule more than one time\n");
// The macros are not thread safe print_params and similar
cfgptr = calloc(sizeof(configmodule_interface_t), 1);
/* argv_info is used to memorize command line options which have been recognized */
/* and to detect unrecognized command line options which might have been specified */
cfgptr->argv_info = calloc(sizeof(int32_t), argc+10);
@@ -314,11 +341,10 @@ configmodule_interface_t *load_configmodule(int argc,
atoken = strtok_r(NULL,":",&strtokctx);
}
printf("[CONFIG] get parameters from %s ",cfgmode);
}
for (i=0; i<cfgptr->num_cfgP; i++) {
printf("%s ",cfgptr->cfgP[i]);
}
printf("[CONFIG] get parameters from %s ", cfgmode);
for (i = 0; i < cfgptr->num_cfgP; i++) {
printf("%s ", cfgptr->cfgP[i]);
}
if (cfgptr->rtflags & CONFIG_PRINTPARAMS) {
cfgptr->status = malloc(sizeof(configmodule_status_t));
@@ -328,11 +354,11 @@ configmodule_interface_t *load_configmodule(int argc,
if (i == 0) {
printf("[CONFIG] config module %s loaded\n",cfgmode);
int idx = config_paramidx_fromname(Config_Params, CONFIG_PARAMLENGTH(Config_Params), CONFIGP_DEBUGFLAGS);
int idx = config_paramidx_fromname(Config_Params, sizeofArray(Config_Params), CONFIGP_DEBUGFLAGS);
Config_Params[idx].uptr = &(cfgptr->rtflags);
idx = config_paramidx_fromname(Config_Params, CONFIG_PARAMLENGTH(Config_Params), CONFIGP_TMPDIR);
idx = config_paramidx_fromname(Config_Params, sizeofArray(Config_Params), CONFIGP_TMPDIR);
Config_Params[idx].strptr = &(cfgptr->tmpdir);
config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME );
config_get(cfgptr, Config_Params, sizeofArray(Config_Params), CONFIG_SECTIONNAME);
} else {
fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode);
cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT;
@@ -351,7 +377,7 @@ configmodule_interface_t *load_configmodule(int argc,
if (cfgmode != NULL) free(cfgmode);
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME );
config_printhelp(Config_Params, sizeofArray(Config_Params), CONFIG_SECTIONNAME);
// exit(-1);
}
@@ -359,10 +385,11 @@ configmodule_interface_t *load_configmodule(int argc,
}
/* Possibly write config file, with parameters which have been read and after command line parsing */
void write_parsedcfg(void)
void write_parsedcfg(configmodule_interface_t *cfgptr)
{
if (cfgptr->status && (cfgptr->rtflags & CONFIG_SAVERUNCFG)) {
printf_params("[CONFIG] Runtime params creation status: %i null values, %i errors, %i empty list or array, %i successfull \n",
printf_params(cfgptr,
"[CONFIG] Runtime params creation status: %i null values, %i errors, %i empty list or array, %i successfull \n",
cfgptr->status->num_err_nullvalue,
cfgptr->status->num_err_write,
cfgptr->status->emptyla,
@@ -371,19 +398,20 @@ void write_parsedcfg(void)
if (cfgptr != NULL) {
if (cfgptr->write_parsedcfg != NULL) {
printf("[CONFIG] calling config module write_parsedcfg function...\n");
cfgptr->write_parsedcfg();
cfgptr->write_parsedcfg(cfgptr);
}
}
}
/* free memory allocated when reading parameters */
/* config module could be initialized again after this call */
void end_configmodule(void) {
write_parsedcfg();
void end_configmodule(configmodule_interface_t *cfgptr)
{
write_parsedcfg(cfgptr);
if (cfgptr != NULL) {
if (cfgptr->end != NULL) {
printf ("[CONFIG] calling config module end function...\n");
cfgptr->end();
cfgptr->end(cfgptr);
}
pthread_mutex_lock(&cfgptr->memBlocks_mutex);
@@ -408,8 +436,3 @@ void end_configmodule(void) {
cfgptr=NULL;
}
}

View File

@@ -59,11 +59,14 @@
#define CONFIG_HELP (1<<20) // print help message
#define CONFIG_ABORT (1<<21) // config failed,abort execution
#define CONFIG_NOOOPT (1<<22) // no -O option found when parsing command line
typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
struct configmodule_interface;
typedef int (*configmodule_getfunc_t)(struct configmodule_interface *, paramdef_t *, int numparams, char *prefix);
typedef int (
*configmodule_getlistfunc_t)(struct configmodule_interface *, paramlist_def_t *, paramdef_t *, int numparams, char *prefix);
typedef int (*configmodule_setfunc_t)(paramdef_t *cfgoptions, int numoptions, char *prefix);
typedef void(*configmodule_endfunc_t)(void);
typedef void (*configmodule_endfunc_t)(struct configmodule_interface *cfg);
typedef int (*configmodule_initfunc_t)(struct configmodule_interface *cfg);
typedef struct configmodule_status {
int num_paramgroups;
@@ -105,41 +108,23 @@ typedef struct configmodule_interface {
configmodule_status_t *status; // allocated in debug mode only
} configmodule_interface_t;
#ifdef CONFIG_LOADCONFIG_MAIN
configmodule_interface_t *cfgptr=NULL;
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \
debugflags can also be defined in the config section of the config file\n \
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
4->print command line processing debug messages\n \
incp parameter can be used to define the include path used for config files (@include directive)\n \
defaults is set to the path of the main config file.\n";
#define CONFIG_HELP_TMPDIR "<Repository to create temporary file>"
#define CONFIG_SECTIONNAME "config"
#define CONFIGP_DEBUGFLAGS "debugflags"
#define CONFIGP_TMPDIR "tmpdir"
// clang-format off
static paramdef_t Config_Params[] = {
/*--------------------------------------------------------------------------------------------------------------------------*/
/* config parameters for config module */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------*/
{CONFIGP_DEBUGFLAGS, config_helpstr, 0, .uptr = NULL, .defintval = 0, TYPE_MASK, 0},
{CONFIGP_TMPDIR, CONFIG_HELP_TMPDIR, PARAMFLAG_NOFREE, .strptr = NULL, .defstrval = "/tmp", TYPE_STRING, 0},
};
// clang-format on
// extern configmodule_interface_t *cfgptr;
#else
extern configmodule_interface_t *cfgptr;
#endif
#define printf_params(cfg, ...) \
if ((cfg->rtflags & (CONFIG_PRINTPARAMS)) != 0) { \
printf(__VA_ARGS__); \
}
#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); }
#define printf_cmdl(cfg, ...) \
if ((cfg->rtflags & (CONFIG_DEBUGCMDLINE)) != 0) { \
printf(__VA_ARGS__); \
}
#define CONFIG_ENABLECMDLINEONLY (1<<1)
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
@@ -148,8 +133,8 @@ extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32
* should be used as soon as there is no need to read parameters but doesn't prevent
* a new config module init
*/
extern void end_configmodule(void);
extern void write_parsedcfg(void);
void end_configmodule(configmodule_interface_t *cfg);
void write_parsedcfg(configmodule_interface_t *cfg);
/* free all config module memory, to be used at end of program as
* it will free parameters values even those specified with the PARAMFLAG_NOFREE flag */

View File

@@ -33,7 +33,6 @@
#ifndef INCLUDE_CONFIG_PARAMDESC_H
#define INCLUDE_CONFIG_PARAMDESC_H
#define MAX_OPTNAME_SIZE 64
#define CONFIG_MAXOPTLENGTH 512 /* max full option length, full option name exemple: (prefix1.[<index>].prefix2.optname */
@@ -56,42 +55,47 @@
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
#define CONFIG_MAX_NUMCHECKVAL 20
typedef struct paramdef paramdef_t;
typedef struct configmodule_interface configmodule_interface_t;
typedef union checkedparam {
struct {
int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
int (*f1)(configmodule_interface_t *cfg, paramdef_t *param); /* check an integer against a list of authorized values */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
int num_okintval; /* number of valid values in the checkingval array */
} s1;
struct {
int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
int (*f1a)(configmodule_interface_t *cfg,
paramdef_t *param); /* check an integer against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okintval; /* number of valid values in the checkingval array */
} s1a;
struct {
int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
int (*f2)(configmodule_interface_t *cfg,
paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
} s2;
struct {
int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
int (*f3)(configmodule_interface_t *cfg, paramdef_t *param); /* check a string against a list of authorized values */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int num_okstrval; /* number of valid values in the checkingval array */
} s3;
struct {
int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
int (*f3a)(configmodule_interface_t *cfg,
paramdef_t *param); /* check a string against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okstrval; /* number of valid values in the checkingval array */
} s3a;
struct {
int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
int (*f4)(configmodule_interface_t *cfg,
paramdef_t *param); /* generic check function, no arguments but the param description */
} s4;
struct {
void (*checkfunc)(void) ;
void (*checkfunc)(configmodule_interface_t *cfg);
} s5;
} checkedparam_t;
@@ -157,13 +161,10 @@ typedef struct paramdef {
#define TYPE_LIST 55
#define ANY_IPV4ADDR_STRING "0.0.0.0"
typedef struct paramlist_def {
char listname[MAX_OPTNAME_SIZE];
paramdef_t **paramarray;
int numelt ;
} paramlist_def_t;
/* macro helpers for module users */
#define CONFIG_PARAMLENGTH(A) (sizeof(A)/sizeof(paramdef_t))
#endif /* INCLUDE_CONFIG_PARAMDESC_H */

View File

@@ -41,160 +41,12 @@
#include <arpa/inet.h>
#include <platform_types.h>
#include "config_userapi.h"
#include "config_common.h"
#include "../utils/LOG/log.h"
configmodule_interface_t *config_get_if(void) {
if (cfgptr == NULL) {
if (isLogInitDone())
LOG_W(ENB_APP,"[CONFIG] %s %d config module not initialized\n",__FILE__,__LINE__);
}
return cfgptr;
}
static int managed_ptr_sz(void* ptr) {
configmodule_interface_t * cfg=config_get_if();
AssertFatal(cfg->numptrs < CONFIG_MAX_ALLOCATEDPTRS,
"This code use fixed size array as #define CONFIG_MAX_ALLOCATEDPTRS %d\n",
CONFIG_MAX_ALLOCATEDPTRS);
int i;
pthread_mutex_lock(&cfg->memBlocks_mutex);
int numptrs=cfg->numptrs;
for (i=0; i<numptrs; i++ )
if (cfg->oneBlock[i].ptrs == ptr)
break;
pthread_mutex_unlock(&cfg->memBlocks_mutex);
if ( i == numptrs )
return -1;
else
return cfg->oneBlock[i].sz;
}
void *config_allocate_new(int sz, bool autoFree) {
void *ptr = calloc(sz,1);
AssertFatal(ptr, "calloc fails\n");
configmodule_interface_t * cfg=config_get_if();
// add the memory piece in the managed memory pieces list
pthread_mutex_lock(&cfg->memBlocks_mutex);
int newBlockIdx=cfg->numptrs++;
oneBlock_t* tmp=&cfg->oneBlock[newBlockIdx];
tmp->ptrs = (char *)ptr;
tmp->ptrsAllocated = true;
tmp->sz=sz;
tmp->toFree=autoFree;
pthread_mutex_unlock(&cfg->memBlocks_mutex);
return ptr;
}
void config_check_valptr(paramdef_t *cfgoptions, int elt_sz, int nb_elt) {
const bool toFree=!(cfgoptions->paramflags & PARAMFLAG_NOFREE);
// let's see if the value has been read
// the datamodel is more difficult than it should be
// and it is not thread safe
if (cfgoptions->voidptr) {
int sz;
if ( cfgoptions-> type == TYPE_STRING)
sz=managed_ptr_sz(*cfgoptions->strptr);
else
sz=managed_ptr_sz(cfgoptions->voidptr);
if ( sz != -1 ) // the same variable pointer has been used!
cfgoptions->numelt=sz;
}
if (cfgoptions->voidptr != NULL
&& (cfgoptions->type == TYPE_INTARRAY
|| cfgoptions->type == TYPE_UINTARRAY
|| cfgoptions->type == TYPE_STRINGLIST )) {
int sz;
if ( cfgoptions->type == TYPE_STRING ||
cfgoptions->type == TYPE_STRINGLIST )
sz=managed_ptr_sz(*cfgoptions->strptr);
else
sz=managed_ptr_sz(cfgoptions->voidptr);
if ( sz == -1) {
CONFIG_PRINTF_ERROR("[CONFIG] %s NOT SUPPORTED not NULL pointer with array types", cfgoptions->optname);
return ;
}
}
if (cfgoptions->voidptr == NULL ) {
if (cfgoptions->type == TYPE_STRING) {
// difficult datamodel
cfgoptions->strptr = config_allocate_new(sizeof(*cfgoptions->strptr), toFree);
} else if ( cfgoptions->type == TYPE_STRINGLIST) {
AssertFatal(nb_elt<MAX_LIST_SIZE,
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
MAX_LIST_SIZE );
cfgoptions->strlistptr= config_allocate_new(sizeof(char*)*MAX_LIST_SIZE, toFree);
for (int i=0; i<MAX_LIST_SIZE; i++)
cfgoptions->strlistptr[i]= config_allocate_new(DEFAULT_EXTRA_SZ, toFree);
} else {
if ( cfgoptions->type == TYPE_INTARRAY || cfgoptions->type == TYPE_UINTARRAY )
nb_elt=max(nb_elt, MAX_LIST_SIZE); // make room if the list is larger than the default one
cfgoptions->voidptr = config_allocate_new(elt_sz*nb_elt, toFree);
}
}
if (cfgoptions->type == TYPE_STRING && *cfgoptions->strptr == NULL) {
*cfgoptions->strptr = config_allocate_new(nb_elt+DEFAULT_EXTRA_SZ, toFree);
cfgoptions->numelt=nb_elt+DEFAULT_EXTRA_SZ;
}
printf_ptrs("[CONFIG] %s ptr: %p requested size: elt_sz: %d, nb_elt: %d\n",cfgoptions->optname, cfgoptions->voidptr, elt_sz, nb_elt);
}
void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) {
int tmpval=val;
if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) {
tmpval =1;
}
switch (cfgoptions->type) {
case TYPE_UINT8:
*(cfgoptions->u8ptr) = (uint8_t)tmpval;
printf_params("[CONFIG] %s: %u\n", fullname, (uint8_t)tmpval);
break;
case TYPE_INT8:
*(cfgoptions->i8ptr) = (int8_t)tmpval;
printf_params("[CONFIG] %s: %i\n", fullname, (int8_t)tmpval);
break;
case TYPE_UINT16:
*(cfgoptions->u16ptr) = (uint16_t)tmpval;
printf_params("[CONFIG] %s: %hu\n", fullname, (uint16_t)tmpval);
break;
case TYPE_INT16:
*(cfgoptions->i16ptr) = (int16_t)tmpval;
printf_params("[CONFIG] %s: %hi\n", fullname, (int16_t)tmpval);
break;
case TYPE_UINT32:
*(cfgoptions->uptr) = (uint32_t)tmpval;
printf_params("[CONFIG] %s: %u\n", fullname, (uint32_t)tmpval);
break;
case TYPE_MASK:
*(cfgoptions->uptr) = *(cfgoptions->uptr) | (uint32_t)tmpval;
printf_params("[CONFIG] %s: 0x%08x\n", fullname, (uint32_t)tmpval);
break;
case TYPE_INT32:
*(cfgoptions->iptr) = (int32_t)tmpval;
printf_params("[CONFIG] %s: %i\n", fullname, (int32_t)tmpval);
break;
default:
fprintf (stderr,"[CONFIG] %s %i type %i non integer parameter %s not assigned\n",__FILE__, __LINE__,cfgoptions->type,fullname);
break;
}
}
void config_assign_processedint(paramdef_t *cfgoption, int val) {
cfgoption->processedvalue = config_allocate_new(sizeof(int),!(cfgoption->paramflags & PARAMFLAG_NOFREE));
static void config_assign_processedint(configmodule_interface_t *cfg, paramdef_t *cfgoption, int val)
{
cfgoption->processedvalue = config_allocate_new(cfg, sizeof(int), !(cfgoption->paramflags & PARAMFLAG_NOFREE));
if ( cfgoption->processedvalue != NULL) {
*(cfgoption->processedvalue) = val;
@@ -203,14 +55,15 @@ void config_assign_processedint(paramdef_t *cfgoption, int val) {
}
}
int config_get_processedint(paramdef_t *cfgoption) {
int config_get_processedint(configmodule_interface_t *cfg, paramdef_t *cfgoption)
{
int ret;
if ( cfgoption->processedvalue != NULL) {
ret=*(cfgoption->processedvalue);
free( cfgoption->processedvalue);
cfgoption->processedvalue=NULL;
printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *cfgoption->strptr, ret);
printf_params(cfg, "[CONFIG] %s: set from %s to %i\n", cfgoption->optname, *cfgoption->strptr, ret);
} else {
fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
ret=0;
@@ -231,7 +84,8 @@ void config_printhelp(paramdef_t *params,int numparams, char *prefix) {
printf("--------------------------------------------------------------------\n\n");
}
int config_execcheck(paramdef_t *params, int numparams, char *prefix) {
int config_execcheck(configmodule_interface_t *cfg, paramdef_t *params, int numparams, char *prefix)
{
int st=0;
for (int i=0 ; i<numparams ; i++) {
@@ -240,7 +94,7 @@ int config_execcheck(paramdef_t *params, int numparams, char *prefix) {
}
if (params[i].chkPptr->s4.f4 != NULL) {
st += params[i].chkPptr->s4.f4(&(params[i]));
st += params[i].chkPptr->s4.f4(cfg, &(params[i]));
}
}
@@ -261,7 +115,8 @@ int config_paramidx_fromname(paramdef_t *params, int numparams, char *name) {
return -1;
}
int config_get(paramdef_t *params, int numparams, char *prefix) {
int config_get(configmodule_interface_t *cfgif, paramdef_t *params, int numparams, char *prefix)
{
int ret= -1;
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
@@ -269,16 +124,15 @@ int config_get(paramdef_t *params, int numparams, char *prefix) {
return ret;
}
configmodule_interface_t *cfgif = config_get_if();
if (cfgif != NULL) {
ret = config_get_if()->get(params, numparams, prefix);
ret = cfgif->get(cfgif, params, numparams, prefix);
if (ret >= 0) {
config_process_cmdline(params, numparams, prefix);
config_process_cmdline(cfgif, params, numparams, prefix);
if (cfgif->rtflags & CONFIG_SAVERUNCFG) {
config_get_if()->set(params, numparams, prefix);
cfgif->set(params, numparams, prefix);
}
config_execcheck(params, numparams, prefix);
config_execcheck(cfgif, params, numparams, prefix);
}
return ret;
@@ -287,16 +141,13 @@ int config_get(paramdef_t *params, int numparams, char *prefix) {
return ret;
}
int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix) {
int config_getlist(configmodule_interface_t *cfg, paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix)
{
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
return -1;
}
if (!config_get_if())
return -1;
const int ret = config_get_if()->getlist(ParamList, params, numparams, prefix);
const int ret = cfg->getlist(cfg, ParamList, params, numparams, prefix);
if (ret >= 0 && params) {
char *newprefix;
@@ -314,11 +165,11 @@ int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams
for (int i = 0; i < ParamList->numelt; ++i) {
// TODO config_process_cmdline?
sprintf(cfgpath, "%s.[%i]", newprefix, i);
config_process_cmdline(ParamList->paramarray[i],numparams,cfgpath);
if (config_get_if()->rtflags & CONFIG_SAVERUNCFG) {
config_get_if()->set(ParamList->paramarray[i], numparams, cfgpath);
config_process_cmdline(cfg, ParamList->paramarray[i], numparams, cfgpath);
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
cfg->set(ParamList->paramarray[i], numparams, cfgpath);
}
config_execcheck(ParamList->paramarray[i], numparams, cfgpath);
config_execcheck(cfg, ParamList->paramarray[i], numparams, cfgpath);
}
if (prefix)
@@ -347,7 +198,8 @@ void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokva
fprintf(stderr, " \n");
}
int config_check_intval(paramdef_t *param) {
int config_check_intval(configmodule_interface_t *cfg, paramdef_t *param)
{
if ( param == NULL ) {
fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
return -1;
@@ -363,10 +215,15 @@ int config_check_intval(paramdef_t *param) {
return -1;
}
int config_check_modify_integer(paramdef_t *param) {
int config_check_modify_integer(configmodule_interface_t *cfg, paramdef_t *param)
{
for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
printf_params(cfg,
"[CONFIG] %s: read value %i, set to %i\n",
param->optname,
*(param->uptr),
param->chkPptr->s1a.setintval[i]);
*(param->uptr) = param->chkPptr->s1a.setintval [i];
return 0;
}
@@ -376,7 +233,8 @@ int config_check_modify_integer(paramdef_t *param) {
return -1;
}
int config_check_intrange(paramdef_t *param) {
int config_check_intrange(configmodule_interface_t *cfg, paramdef_t *param)
{
if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
return 0;
}
@@ -397,7 +255,8 @@ void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numok
fprintf(stderr, " \n");
}
int config_check_strval(paramdef_t *param) {
int config_check_strval(configmodule_interface_t *cfg, paramdef_t *param)
{
if ( param == NULL ) {
fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
return -1;
@@ -413,10 +272,11 @@ int config_check_strval(paramdef_t *param) {
return -1;
}
int config_checkstr_assign_integer(paramdef_t *param) {
int config_checkstr_assign_integer(configmodule_interface_t *cfg, paramdef_t *param)
{
for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
if (strcasecmp(*param->strptr,param->chkPptr->s3a.okstrval[i] ) == 0) {
config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
config_assign_processedint(cfg, param, param->chkPptr->s3a.setintval[i]);
return 0;
}
}
@@ -430,123 +290,3 @@ void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunction
params[i].chkPptr = &(checkfunctions[i]);
}
}
int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
if( cfgoptions->defstrval != NULL) {
status=1;
if (cfgoptions->numelt == 0 )
config_check_valptr(cfgoptions, 1, strlen(cfgoptions->defstrval)+1);
if ( cfgoptions->numelt < strlen(cfgoptions->defstrval)+1 ) {
CONFIG_PRINTF_ERROR("[CONFIG] %s size too small\n", cfgoptions->optname);
}
snprintf(*cfgoptions->strptr, cfgoptions->numelt, "%s",cfgoptions->defstrval);
printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *cfgoptions->strptr);
}
return status;
}
int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
if( cfgoptions->defstrlistval != NULL) {
cfgoptions->strlistptr=cfgoptions->defstrlistval;
status=1;
for(int j=0; j<cfgoptions->numelt; j++)
printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]);
}
return status;
}
int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
config_check_valptr(cfgoptions, sizeof(*cfgoptions->iptr), 1);
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval);
status=1;
printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname);
}
return status;
}
int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
config_check_valptr(cfgoptions, sizeof(*cfgoptions->i64ptr), 1);
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions->u64ptr)=cfgoptions->defuintval;
status=1;
printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr)));
}
return status;
}
int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
if( cfgoptions->defintarrayval != NULL) {
config_check_valptr(cfgoptions, sizeof(cfgoptions->iptr), cfgoptions->numelt);
cfgoptions->iptr=cfgoptions->defintarrayval;
status=1;
for (int j=0; j<cfgoptions->numelt ; j++) {
printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname,j,(int)cfgoptions->iptr[j]);
}
}
return status;
}
int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
config_check_valptr(cfgoptions, sizeof(*cfgoptions->dblptr), 1);
if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) {
*(cfgoptions->dblptr)=cfgoptions->defdblval;
status=1;
printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname, *(cfgoptions->dblptr));
}
return status;
}
int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) {
config_check_valptr(cfgoptions, sizeof(*cfgoptions->uptr), 1);
int rst=inet_pton(AF_INET, ipv4addr,cfgoptions->uptr );
if (rst == 1 && *(cfgoptions->uptr) > 0) {
printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr);
return 1;
} else {
if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) {
printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr);
*cfgoptions->uptr=INADDR_ANY;
return 1;
} else {
fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname);
return -1;
}
}
return 0;
}
int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix) {
int status = 0;
if (cfgoptions->defstrval != NULL) {
status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval);
}
return status;
}

View File

@@ -33,60 +33,49 @@
#ifndef INCLUDE_CONFIG_USERAPI_H
#define INCLUDE_CONFIG_USERAPI_H
#include "config_load_configmodule.h"
#include "common/utils/utils.h"
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef NOT_uniqCfg
extern configmodule_interface_t *uniqCfg;
#define config_get_if() uniqCfg // Existing code implicit uniq configuration context
#endif
/* utility functions to ease usage of config module structures */
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
#define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] )
#define CONFIG_GETSOURCE ((config_get_if() == NULL) ? NULL : config_get_if()->cfgmode)
#define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P))
#define CONFIG_SETRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags |= P; }
#define CONFIG_CLEARRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags &= (~P); }
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
extern int config_paramidx_fromname(paramdef_t *params,int numparams, char *name);
int config_paramidx_fromname(paramdef_t *params, int numparams, char *name);
/* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void);
void config_check_valptr(paramdef_t *cfgoptions, int elt_sz, int nb_elt);
extern void config_printhelp(paramdef_t *,int numparams, char *prefix);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
void config_printhelp(paramdef_t *, int numparams, char *prefix);
int config_process_cmdline(configmodule_interface_t *cfg, paramdef_t *params, int numparams, char *prefix);
int config_assign_ipv4addr(configmodule_interface_t *cfg, paramdef_t *cfgoptions, char *ipv4addr);
/* apis to get/check parameters, to be used by oai modules, at configuration time */
#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
extern int config_check_unknown_cmdlineopt(char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
int config_check_unknown_cmdlineopt(configmodule_interface_t *cfg, char *prefix);
int config_get(configmodule_interface_t *cfg, paramdef_t *params, int numparams, char *prefix);
int config_getlist(configmodule_interface_t *cfg, paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
/* apis to set some of the paramdef_t fields before using the get/getlist api's */
extern void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams);
void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams);
/* apis to retrieve parameters info after calling get or getlist functions */
extern int config_isparamset(paramdef_t *params,int paramidx);
extern int config_get_processedint(paramdef_t *cfgoption);
int config_isparamset(paramdef_t *params, int paramidx);
int config_get_processedint(configmodule_interface_t *cfg, paramdef_t *cfgoption);
/* functions to be used in parameters definition, to check parameters values */
extern int config_check_intval(paramdef_t *param);
extern int config_check_modify_integer(paramdef_t *param);
extern int config_check_intrange(paramdef_t *param);
extern int config_check_strval(paramdef_t *param);
extern int config_checkstr_assign_integer(paramdef_t *param);
int config_check_intval(configmodule_interface_t *cfg, paramdef_t *param);
int config_check_modify_integer(configmodule_interface_t *cfg, paramdef_t *param);
int config_check_intrange(configmodule_interface_t *cfg, paramdef_t *param);
int config_check_strval(configmodule_interface_t *cfg, paramdef_t *param);
int config_checkstr_assign_integer(configmodule_interface_t *cfg, paramdef_t *param);
/* functions to set a parameter to its default value */
extern int config_setdefault_string(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_int(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_double(paramdef_t *cfgoptions, char *prefix);
extern int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix);
void *config_allocate_new(int sz, bool autoFree);
#define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
#ifdef __cplusplus

View File

@@ -43,6 +43,8 @@
#include "config_libconfig.h"
#include "config_libconfig_private.h"
#define NOT_uniqCfg
#include "../config_common.h"
#include "../config_userapi.h"
#include "errno.h"
#include "assertions.h"
@@ -51,14 +53,15 @@
#define config_setting_lookup config_lookup_from
#endif
void config_libconfig_end(void );
void config_libconfig_end(configmodule_interface_t *cfg);
int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
int read_strlist(configmodule_interface_t *cfg, paramdef_t *cfgoptions, config_setting_t *setting, char *cfgpath)
{
const char *str;
int st;
int numelt;
numelt=config_setting_length(setting);
config_check_valptr(cfgoptions, sizeof(char *), numelt);
config_check_valptr(cfg, cfgoptions, sizeof(char *), numelt);
st=0;
AssertFatal(MAX_LIST_SIZE > numelt,
"This piece of code use fixed size arry of constant #define MAX_LIST_SIZE %d\n",
@@ -71,7 +74,7 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
} else {
snprintf(cfgoptions->strlistptr[i], DEFAULT_EXTRA_SZ, "%s",str);
st++;
printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
printf_params(cfg, "[LIBCONFIG] %s%i: %s\n", cfgpath, i, cfgoptions->strlistptr[i]);
}
}
@@ -79,22 +82,27 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
return st;
}
int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath) {
static int read_intarray(configmodule_interface_t *cfg, paramdef_t *cfgoptions, config_setting_t *setting, char *cfgpath)
{
cfgoptions->numelt=config_setting_length(setting);
if (cfgoptions->numelt > 0) {
cfgoptions->iptr=config_allocate_new(cfgoptions->numelt*sizeof(*cfgoptions->iptr),
!(cfgoptions->paramflags & PARAMFLAG_NOFREE) );
cfgoptions->iptr =
config_allocate_new(cfg, cfgoptions->numelt * sizeof(*cfgoptions->iptr), !(cfgoptions->paramflags & PARAMFLAG_NOFREE));
for (int i=0; i< cfgoptions->numelt && cfgoptions->iptr != NULL; i++) {
cfgoptions->iptr[i]=config_setting_get_int_elem(setting,i);
printf_params("[LIBCONFIG] %s[%i]: %i\n", cfgpath,i,cfgoptions->iptr[i]);
printf_params(cfg, "[LIBCONFIG] %s[%i]: %i\n", cfgpath, i, cfgoptions->iptr[i]);
} /* for loop on array element... */
}
return cfgoptions->numelt;
}
int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_setting_t *asetting, char *prefix)
int config_libconfig_setparams(configmodule_interface_t *cfg,
paramdef_t *cfgoptions,
int numoptions,
config_setting_t *asetting,
char *prefix)
{
int status;
int errors = 0;
@@ -106,7 +114,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
for (int i = 0; i < numoptions; i++) {
if (cfgoptions[i].paramflags & PARAMFLAG_CMDLINEONLY) {
continue;
printf_params("[LIBCONFIG] setting %s.%s skipped (command line only) \n", secprefix, cfgoptions[i].optname);
printf_params(cfg, "[LIBCONFIG] setting %s.%s skipped (command line only) \n", secprefix, cfgoptions[i].optname);
}
status = CONFIG_FALSE;
config_setting_t *psetting;
@@ -115,7 +123,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
psetting = config_lookup(&(libconfig_privdata.runtcfg), spath);
free(spath);
if (psetting != NULL) {
printf_params("[LIBCONFIG] setting %s.%s already created \n", secprefix, cfgoptions[i].optname);
printf_params(cfg, "[LIBCONFIG] setting %s.%s already created \n", secprefix, cfgoptions[i].optname);
continue;
}
switch (cfgoptions[i].type) {
@@ -137,7 +145,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
if (psetting != NULL) {
if (cfgoptions[i].numelt <= 0) {
emptyla++;
printf_params("[LIBCONFIG], no element in list %s\n", cfgoptions[i].optname);
printf_params(cfg, "[LIBCONFIG], no element in list %s\n", cfgoptions[i].optname);
status = CONFIG_TRUE;
}
for (int j = 0; j < cfgoptions[i].numelt; j++) {
@@ -176,7 +184,7 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
if (psetting != NULL) {
if (cfgoptions[i].numelt <= 0) {
emptyla++;
printf_params("[LIBCONFIG], no element in array %s.%s\n", secprefix, cfgoptions[i].optname);
printf_params(cfg, "[LIBCONFIG], no element in array %s.%s\n", secprefix, cfgoptions[i].optname);
status = CONFIG_TRUE;
}
for (int j = 0; j < cfgoptions[i].numelt; j++) {
@@ -222,24 +230,24 @@ int config_libconfig_setparams(paramdef_t *cfgoptions, int numoptions, config_se
fprintf(stderr, "[LIBCONFIG] Error creating setting %i: %s.%s type %i\n", i, secprefix, cfgoptions[i].optname, cfgoptions[i].type);
}
}
printf_params("[LIBCONFIG], in group \"%s\" %i settings \n", secprefix, numoptions);
printf_params(cfg, "[LIBCONFIG], in group \"%s\" %i settings \n", secprefix, numoptions);
if (notused > 0)
printf_params("[LIBCONFIG], ..... %i settings with NULL value pointer\n", notused);
printf_params(cfg, "[LIBCONFIG], ..... %i settings with NULL value pointer\n", notused);
if (errors > 0)
fprintf(stderr, "[LIBCONFIG] .....%i settings creation errors \n", errors);
if (emptyla > 0)
fprintf(stderr, "[LIBCONFIG] .....%i empty lists or arrays settings \n", emptyla);
if (cfgptr->status) {
cfgptr->status->num_err_nullvalue += notused;
cfgptr->status->num_err_write += errors;
cfgptr->status->num_write += numoptions;
cfgptr->status->emptyla += emptyla;
if (cfg->status) {
cfg->status->num_err_nullvalue += notused;
cfg->status->num_err_write += errors;
cfg->status->num_write += numoptions;
cfg->status->emptyla += emptyla;
}
return errors;
}
int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
int config_libconfig_set(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
{
char *tokctx1 = NULL;
int listidx = -1;
@@ -250,13 +258,13 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
prefixbck = strdup(prefix);
prefix_elem1 = strtok_r(prefixbck, ".", &tokctx1);
}
printf_params("[LIBCONFIG], processing prefix %s\n", (prefix == NULL) ? "NULL" : prefix);
printf_params(cfg, "[LIBCONFIG], processing prefix %s\n", (prefix == NULL) ? "NULL" : prefix);
/* parse the prefix , possibly creating groups, lists and list elements */
while (prefix_elem1 != NULL) {
int n1 = strlen(prefix_elem1);
char *prefix_elem2 = prefix_elem1 + n1 + 1;
printf_params("[LIBCONFIG], processing elem1 %s elem2 %s\n", prefix_elem1, prefix_elem2);
printf_params(cfg, "[LIBCONFIG], processing elem1 %s elem2 %s\n", prefix_elem1, prefix_elem2);
/* prefix (the path to the parameter name) may contain groups and elements from a list, which are specified with [] */
if (prefix_elem2[0] != '[') { // not a list
@@ -265,11 +273,11 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
asetting = config_setting_add(asetting, prefix_elem1, CONFIG_TYPE_GROUP);
else
asetting = tmpset;
printf_params("[LIBCONFIG], creating or looking for group %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
printf_params(cfg, "[LIBCONFIG], creating or looking for group %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
} else { // a list
listidx = (int)strtol(prefix_elem2 + 1, NULL, 10);
if (errno == EINVAL || errno == ERANGE) {
printf_params("[LIBCONFIG], Error %s looking for list index in %s \n", strerror(errno), prefix_elem2);
printf_params(cfg, "[LIBCONFIG], Error %s looking for list index in %s \n", strerror(errno), prefix_elem2);
break;
}
config_setting_t *tmpset = config_setting_lookup(asetting, prefix_elem1);
@@ -277,14 +285,17 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
asetting = config_setting_add(asetting, prefix_elem1, CONFIG_TYPE_LIST);
else
asetting = tmpset;
printf_params("[LIBCONFIG], creating or looking for list %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
printf_params(cfg, "[LIBCONFIG], creating or looking for list %s: %s\n", prefix_elem1, (asetting == NULL) ? "NOK" : "OK");
if (asetting != NULL) {
tmpset = config_setting_get_elem(asetting, listidx);
if (tmpset == NULL)
asetting = config_setting_add(asetting, NULL, CONFIG_TYPE_GROUP);
else
asetting = tmpset;
printf_params("[LIBCONFIG], creating or looking for list element %i: %s\n", listidx, (asetting == NULL) ? "NOK" : "OK");
printf_params(cfg,
"[LIBCONFIG], creating or looking for list element %i: %s\n",
listidx,
(asetting == NULL) ? "NOK" : "OK");
}
prefix_elem1 = strtok_r(NULL, ".", &tokctx1); // skip the [x] elements we already took care of it
if (prefix_elem1 == NULL) {
@@ -299,8 +310,8 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
}
free(prefixbck);
if (asetting != NULL) {
config_libconfig_setparams(cfgoptions, numoptions, asetting, prefix);
printf_params("[LIBCONFIG] %i settings added in group %s\n", numoptions, (prefix == NULL) ? "" : prefix);
config_libconfig_setparams(cfg, cfgoptions, numoptions, asetting, prefix);
printf_params(cfg, "[LIBCONFIG] %i settings added in group %s\n", numoptions, (prefix == NULL) ? "" : prefix);
return 0;
} else {
fprintf(stderr, "[LIBCONFIG] Error parsing %s params, skipped...\n", (prefix == NULL) ? "" : prefix);
@@ -308,7 +319,8 @@ int config_libconfig_set(paramdef_t *cfgoptions, int numoptions, char *prefix)
}
}
int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
int config_libconfig_get(configmodule_interface_t *cfg, paramdef_t *cfgoptions, int numoptions, char *prefix)
{
config_setting_t *setting;
char *str;
int i,u;
@@ -330,7 +342,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
}
if( (cfgoptions->paramflags & PARAMFLAG_DONOTREAD) != 0) {
printf_params("[LIBCONFIG] %s.%s ignored\n", cfgpath,cfgoptions[i].optname );
printf_params(cfg, "[LIBCONFIG] %s.%s ignored\n", cfgpath, cfgoptions[i].optname);
continue;
}
@@ -340,14 +352,14 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
switch(cfgoptions[i].type) {
case TYPE_STRING:
if ( config_lookup_string(&(libconfig_privdata.cfg), cfgpath, (const char**)&str)) {
config_check_valptr(&(cfgoptions[i]), 1, strlen(str)+1);
config_check_valptr(cfg, &cfgoptions[i], 1, strlen(str) + 1);
if ( strlen(str)+1 > cfgoptions[i].numelt )
fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n",
cfgpath,str,cfgoptions[i].numelt);
snprintf( *cfgoptions[i].strptr , cfgoptions[i].numelt, "%s", str);
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath, *cfgoptions[i].strptr);
printf_params(cfg, "[LIBCONFIG] %s: \"%s\"\n", cfgpath, *cfgoptions[i].strptr);
} else {
defval=config_setdefault_string(&cfgoptions[i],prefix);
defval = config_setdefault_string(cfg, &cfgoptions[i], prefix);
}
break;
@@ -356,9 +368,9 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
if ( setting != NULL) {
read_strlist(&cfgoptions[i],setting,cfgpath);
read_strlist(cfg, &cfgoptions[i], setting, cfgpath);
} else {
defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix);
defval = config_setdefault_stringlist(cfg, &(cfgoptions[i]), prefix);
}
break;
@@ -371,10 +383,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
case TYPE_INT32:
case TYPE_MASK:
if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) {
config_check_valptr(&(cfgoptions[i]), sizeof(*cfgoptions[i].iptr), 1);
config_assign_int(&(cfgoptions[i]),cfgpath,u);
config_check_valptr(cfg, &(cfgoptions[i]), sizeof(*cfgoptions[i].iptr), 1);
config_assign_int(cfg, &(cfgoptions[i]), cfgpath, u);
} else {
defval=config_setdefault_int(&(cfgoptions[i]),prefix);
defval = config_setdefault_int(cfg, &(cfgoptions[i]), prefix);
}
break;
@@ -382,17 +394,17 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
case TYPE_UINT64:
case TYPE_INT64:
if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) {
config_check_valptr(&cfgoptions[i], sizeof(*cfgoptions[i].i64ptr), 1);
config_check_valptr(cfg, &cfgoptions[i], sizeof(*cfgoptions[i].i64ptr), 1);
if(cfgoptions[i].type==TYPE_UINT64) {
*(cfgoptions[i].u64ptr) = (uint64_t)llu;
printf_params("[LIBCONFIG] %s: %lu\n", cfgpath,*cfgoptions[i].u64ptr);
printf_params(cfg, "[LIBCONFIG] %s: %lu\n", cfgpath, *cfgoptions[i].u64ptr);
} else {
*(cfgoptions[i].i64ptr) = llu;
printf_params("[LIBCONFIG] %s: %ld\n", cfgpath,*cfgoptions[i].i64ptr);
printf_params(cfg, "[LIBCONFIG] %s: %ld\n", cfgpath, *cfgoptions[i].i64ptr);
}
} else {
defval=config_setdefault_int64(&(cfgoptions[i]),prefix);
defval = config_setdefault_int64(cfg, &(cfgoptions[i]), prefix);
}
break;
@@ -402,29 +414,29 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath );
if ( setting != NULL) {
read_intarray(&cfgoptions[i],setting,cfgpath);
read_intarray(cfg, &cfgoptions[i], setting, cfgpath);
} else {
defval=config_setdefault_intlist(&(cfgoptions[i]),prefix);
defval = config_setdefault_intlist(cfg, &(cfgoptions[i]), prefix);
}
break;
case TYPE_DOUBLE:
if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) {
config_check_valptr(&cfgoptions[i],sizeof(*cfgoptions[i].dblptr), 1);
config_check_valptr(cfg, &cfgoptions[i], sizeof(*cfgoptions[i].dblptr), 1);
*cfgoptions[i].dblptr = dbl;
printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) );
printf_params(cfg, "[LIBCONFIG] %s: %lf\n", cfgpath, *(cfgoptions[i].dblptr));
} else {
defval=config_setdefault_double(&(cfgoptions[i]),prefix);
defval = config_setdefault_double(cfg, &(cfgoptions[i]), prefix);
}
break;
case TYPE_IPV4ADDR:
if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) {
defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix);
defval = config_setdefault_ipv4addr(cfg, &(cfgoptions[i]), prefix);
} else {
rst=config_assign_ipv4addr(cfgoptions, str);
rst = config_assign_ipv4addr(cfg, cfgoptions, str);
if (rst < 0) {
fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath);
@@ -478,15 +490,19 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) {
if (fatalerror == 1) {
fprintf(stderr,"[LIBCONFIG] fatal errors found when processing %s \n", libconfig_privdata.configfile );
config_libconfig_end();
end_configmodule();
config_libconfig_end(cfg);
end_configmodule(cfg);
}
return status;
}
int config_libconfig_getlist(paramlist_def_t *ParamList,
paramdef_t *params, int numparams, char *prefix) {
int config_libconfig_getlist(configmodule_interface_t *cfg,
paramlist_def_t *ParamList,
paramdef_t *params,
int numparams,
char *prefix)
{
config_setting_t *setting;
int i,j,status;
char *listpath=NULL;
@@ -502,8 +518,7 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
if ( setting) {
status = ParamList->numelt = config_setting_length(setting);
printf_params("[LIBCONFIG] %i %s in config file %s \n",
ParamList->numelt,listpath,libconfig_privdata.configfile );
printf_params(cfg, "[LIBCONFIG] %i %s in config file %s \n", ParamList->numelt, listpath, libconfig_privdata.configfile);
} else {
printf("[LIBCONFIG] list %s not found in config file %s \n",
listpath,libconfig_privdata.configfile );
@@ -512,10 +527,10 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
}
if (ParamList->numelt > 0 && params != NULL) {
ParamList->paramarray = config_allocate_new(ParamList->numelt * sizeof(paramdef_t *), true);
ParamList->paramarray = config_allocate_new(cfg, ParamList->numelt * sizeof(paramdef_t *), true);
for (i=0 ; i < ParamList->numelt ; i++) {
ParamList->paramarray[i] = config_allocate_new(numparams * sizeof(paramdef_t), true);
ParamList->paramarray[i] = config_allocate_new(cfg, numparams * sizeof(paramdef_t), true);
memcpy(ParamList->paramarray[i], params, sizeof(paramdef_t)*numparams);
for (j=0; j<numparams; j++) {
@@ -523,7 +538,7 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
}
sprintf(cfgpath,"%s.[%i]",listpath,i);
config_libconfig_get(ParamList->paramarray[i], numparams, cfgpath );
config_libconfig_get(cfg, ParamList->paramarray[i], numparams, cfgpath);
} /* for i... */
} /* ParamList->numelt > 0 && params != NULL */
@@ -533,12 +548,15 @@ int config_libconfig_getlist(paramlist_def_t *ParamList,
return status;
}
int config_libconfig_init(char *cfgP[], int numP) {
int config_libconfig_init(configmodule_interface_t *cfg)
{
char **cfgP = cfg->cfgP;
int numP = cfg->num_cfgP;
config_init(&(libconfig_privdata.cfg));
libconfig_privdata.configfile = strdup((char *)cfgP[0]);
config_get_if()->numptrs=0;
pthread_mutex_init(&config_get_if()->memBlocks_mutex, NULL);
memset(config_get_if()->oneBlock,0,sizeof(config_get_if()->oneBlock));
cfg->numptrs = 0;
pthread_mutex_init(&cfg->memBlocks_mutex, NULL);
memset(cfg->oneBlock, 0, sizeof(cfg->oneBlock));
/* search for include path parameter and set config file include path accordingly */
for (int i=0; i<numP; i++) {
if (strncmp(cfgP[i],"incp",4) == 0) {
@@ -569,7 +587,7 @@ int config_libconfig_init(char *cfgP[], int numP) {
}
/* possibly init a libconfig struct for saving really used params */
if (cfgptr->rtflags & CONFIG_SAVERUNCFG) {
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
config_init(&(libconfig_privdata.runtcfg));
// config_set_options (&(libconfig_privdata.runtcfg), CONFIG_OPTION_ALLOW_OVERRIDES, CONFIG_TRUE);
}
@@ -577,25 +595,34 @@ int config_libconfig_init(char *cfgP[], int numP) {
return 0;
}
void config_libconfig_write_parsedcfg(void)
void config_libconfig_write_parsedcfg(configmodule_interface_t *cfg)
{
if (cfgptr->rtflags & CONFIG_SAVERUNCFG) {
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
char *fname = strdup(libconfig_privdata.configfile);
int newcfgflen = strlen(libconfig_privdata.configfile) + strlen(cfgptr->tmpdir) + 20;
cfgptr->status->debug_cfgname = realloc(cfgptr->status->debug_cfgname, newcfgflen);
int newcfgflen = strlen(libconfig_privdata.configfile) + strlen(cfg->tmpdir) + 20;
cfg->status->debug_cfgname = realloc(cfg->status->debug_cfgname, newcfgflen);
time_t t = time(NULL);
struct tm tm = *localtime(&t);
snprintf(cfgptr->status->debug_cfgname, newcfgflen, "%s/%s-run%d_%02d_%02d_%02d%02d", cfgptr->tmpdir, basename(fname), tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min);
if (config_write_file(&(libconfig_privdata.runtcfg), cfgptr->status->debug_cfgname) != CONFIG_TRUE) {
snprintf(cfg->status->debug_cfgname,
newcfgflen,
"%s/%s-run%d_%02d_%02d_%02d%02d",
cfg->tmpdir,
basename(fname),
tm.tm_year + 1900,
tm.tm_mon + 1,
tm.tm_mday,
tm.tm_hour,
tm.tm_min);
if (config_write_file(&(libconfig_privdata.runtcfg), cfg->status->debug_cfgname) != CONFIG_TRUE) {
fprintf(stderr,
"[LIBCONFIG] %s %d file %s - line %d: %s\n",
__FILE__,
__LINE__,
cfgptr->status->debug_cfgname,
cfg->status->debug_cfgname,
config_error_line(&(libconfig_privdata.runtcfg)),
config_error_text(&(libconfig_privdata.runtcfg)));
} else {
printf("[LIBCONFIG] file %s created successfully\n", cfgptr->status->debug_cfgname);
printf("[LIBCONFIG] file %s created successfully\n", cfg->status->debug_cfgname);
}
free(fname);
} else {
@@ -603,9 +630,10 @@ void config_libconfig_write_parsedcfg(void)
}
}
void config_libconfig_end(void ) {
void config_libconfig_end(configmodule_interface_t *cfg)
{
config_destroy(&(libconfig_privdata.cfg));
if (cfgptr->rtflags & CONFIG_SAVERUNCFG) {
if (cfg->rtflags & CONFIG_SAVERUNCFG) {
config_destroy(&(libconfig_privdata.runtcfg));
}
if ( libconfig_privdata.configfile != NULL ) {

View File

@@ -89,7 +89,7 @@ const mapping log_options[] = {{"nocolor", FLAG_NOCOLOR},
{"wall_clock", FLAG_REAL_TIME},
{NULL, -1}};
mapping log_maskmap[] = LOG_MASKMAP_INIT;
const mapping log_maskmap[] = LOG_MASKMAP_INIT;
static const char *const log_level_highlight_start[] =
{LOG_RED, LOG_ORANGE, LOG_GREEN, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */
@@ -283,7 +283,7 @@ void log_getconfig(log_t *g_log)
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
int ret = config_get(config_get_if(), logparams_defaults, sizeofArray(logparams_defaults), CONFIG_STRING_LOG_PREFIX);
if (ret <0) {
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed\n");
@@ -337,8 +337,8 @@ void log_getconfig(log_t *g_log)
}
/* read the per component parameters */
config_get( logparams_level, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_logfile, MAX_LOG_PREDEF_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
config_get(config_get_if(), logparams_level, MAX_LOG_PREDEF_COMPONENTS, CONFIG_STRING_LOG_PREFIX);
config_get(config_get_if(), logparams_logfile, MAX_LOG_PREDEF_COMPONENTS, CONFIG_STRING_LOG_PREFIX);
/* now set the log levels and infile option, according to what we read */
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
@@ -367,10 +367,10 @@ void log_getconfig(log_t *g_log)
logparams_dump[i].numelt = 0;
}
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
config_get(config_get_if(), logparams_debug, sizeofArray(log_maskmap) - 1, CONFIG_STRING_LOG_PREFIX);
config_get(config_get_if(), logparams_dump, sizeofArray(log_maskmap) - 1, CONFIG_STRING_LOG_PREFIX);
if (config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX) > 0)
if (config_check_unknown_cmdlineopt(config_get_if(), CONFIG_STRING_LOG_PREFIX) > 0)
exit(1);
/* set the debug mask according to the debug parameters values */
@@ -855,15 +855,6 @@ void flush_mem_to_file(void)
}
}
const char logmem_log_level[NUM_LOG_LEVEL] = {
[OAILOG_ERR] = 'E',
[OAILOG_WARNING] = 'W',
[OAILOG_ANALYSIS] = 'A',
[OAILOG_INFO] = 'I',
[OAILOG_DEBUG] = 'D',
[OAILOG_TRACE] = 'T',
};
static void log_output_memory(log_component_t *c, const char *file, const char *func, int line, int comp, int level, const char* format,va_list args)
{
//logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)

View File

@@ -64,23 +64,13 @@
extern "C" {
#endif
/** @defgroup _LOG LOG Generator
* @{*/
/* @}*/
/** @defgroup _macro Macro Definition
* @ingroup _LOG
* @brief these macros are used in the code of LOG
* @{*/
/* @}*/
/** @defgroup _max_length Maximum Length of LOG
* @ingroup _macro
* @brief the macros that describe the maximum length of LOG
* @{*/
#define MAX_LOG_TOTAL 16384 /*!< \brief the maximum length of a log */
/* @}*/
/** @}*/
/** @defgroup _log_level Message levels defined by LOG
* @ingroup _macro
@@ -95,8 +85,7 @@ extern "C" {
# define OAILOG_TRACE 5 /*!< \brief second level debug-level messages, for developers, likely impact real-time behavior*/
#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/
/* @}*/
/** @}*/
/** @defgroup _log_format Defined log format
* @ingroup _macro
@@ -112,15 +101,6 @@ extern "C" {
#define LOG_BLUE "\033[34m" /*!< \brief VT100 sequence for blue foreground */
#define LOG_CYBL "\033[40;36m" /*!< \brief VT100 sequence for cyan foreground on black background */
#define LOG_RESET "\033[0m" /*!< \brief VT100 sequence for reset (black) foreground */
/* @}*/
/** @defgroup _syslog_conf Macros for write in syslog.conf
* @ingroup _macro
* @brief Macros used to write lines (local/remote) in syslog.conf
* @{*/
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
@@ -130,6 +110,7 @@ extern "C" {
#define FLAG_THREAD_ID 0x0200
#define FLAG_REAL_TIME 0x0400
#define FLAG_INITIALIZED 0x8000
/** @}*/
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
@@ -333,7 +314,7 @@ typedef struct {
int enable_flag;
} log_mem_cnt_t;
/* @}*/
/** @}*/
/*!\fn int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
\brief Write output file from signal data
@@ -460,8 +441,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
#define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */
# define LOG_MM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 1);} while(0)
/* @}*/
/** @}*/
/** @defgroup _useful_functions useful functions in LOG
* @ingroup _macro
@@ -472,8 +452,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_EXIT(c) do { LOG_END(c); return;}while(0) /*!< \brief Macro to log a message with severity TRACE when exiting a function */
#define LOG_RETURN(c,r) do {LOG_T(c,"Leaving %s (rc = %08lx)\n", __FUNCTION__ , (unsigned long)(r) );return(r);}while(0) /*!< \brief Macro to log a function exit, including integer value, then to return a value to the calling function */
/* @}*/
/** @}*/
#ifdef __cplusplus
}

View File

@@ -25,7 +25,7 @@ extern log_t *g_log;
extern const mapping log_level_names[];
extern const mapping log_options[];
extern mapping log_maskmap[];
extern const mapping log_maskmap[];
extern int log_mem_flag;
extern char * log_mem_filename;
extern char logmem_filename[1024];

View File

@@ -1,7 +1,5 @@
*.o
*.a
T_IDs.h
T_messages.txt.h
genids
tracer/enb
tracer/gnb
@@ -18,3 +16,4 @@ tracer/extract_output_subframe
tracer/extract
tracer/multi
tracee/tracee
incgen

View File

@@ -8,11 +8,12 @@ else()
endif()
add_custom_command(OUTPUT T_IDs.h
COMMAND genids ${CMAKE_CURRENT_SOURCE_DIR}/T_messages.txt T_IDs.h
DEPENDS genids
DEPENDS genids T_messages.txt
COMMENT "Generating T_IDs.h from T_messages.txt"
)
add_custom_command(OUTPUT T_messages.txt.h
COMMAND xxd -i T_messages.txt ${CMAKE_CURRENT_BINARY_DIR}/T_messages.txt.h
DEPENDS T_messages.txt
COMMENT "Generating T_messages.txt.h from T_messages.txt"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

View File

@@ -1,10 +1,10 @@
CC=gcc
CFLAGS=-Wall -g
CFLAGS=-Wall -g -Iincgen
GENIDS=genids
GENIDS_OBJS=genids.o
all : $(GENIDS) T_messages.txt.h T_IDs.h
all : $(GENIDS) incgen/T_messages.txt.h incgen/T_IDs.h
$(GENIDS): $(GENIDS_OBJS)
$(CC) $(CFLAGS) -o $(GENIDS) $(GENIDS_OBJS)
@@ -12,21 +12,24 @@ $(GENIDS): $(GENIDS_OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
T_messages.txt.h: T_messages.txt
xxd -i T_messages.txt T_messages.txt.h
incgen/T_messages.txt.h: T_messages.txt
mkdir -p incgen
xxd -i T_messages.txt incgen/T_messages.txt.h
T_IDs.h: $(GENIDS) T_messages.txt
./$(GENIDS) T_messages.txt T_IDs.h
incgen/T_IDs.h: $(GENIDS) T_messages.txt
mkdir -p incgen
./$(GENIDS) T_messages.txt incgen/T_IDs.h
check_vcd: T_IDs.h T_messages.txt.h
check_vcd: incgen/T_IDs.h incgen/T_messages.txt.h
gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
./_check_vcd T_messages.txt ../LOG/vcd_signal_dumper.h || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
./_check_vcd T_messages.txt ../LOG/vcd_signal_dumper.h || (rm -rf ./_check_vcd ./incgen && false)
rm -f ./_check_vcd
.PHONY: check_vcd
clean:
rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h _check_vcd
rm -f *.o $(GENIDS) core _check_vcd
rm -rf incgen
cleanall: clean
cd tracer && $(MAKE) clean

View File

@@ -192,13 +192,9 @@ void T_Config_Init(void)
int T_nowait = 0;
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
config_get(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t),
TTRACER_CONFIG_PREFIX);
config_get(config_get_if(), ttraceparams, sizeofArray(ttraceparams), TTRACER_CONFIG_PREFIX);
/* compatibility: look for TTracer command line options in root section */
config_process_cmdline(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t),
NULL);
config_process_cmdline(config_get_if(), ttraceparams, sizeofArray(ttraceparams), NULL);
if (T_stdout < 0 || T_stdout > 2) {
printf("fatal error: T_stdout = %d but only values 0, 1, or 2 are allowed\n", T_stdout);

View File

@@ -1,8 +1,10 @@
CC=gcc
CFLAGS=-Wall -g -pthread -DT_TRACER -I.
CFLAGS=-Wall -g -pthread -DT_TRACER -I. -I../incgen
PROG=tracee
OBJS=tracee.o ../T.o ../local_tracer.o
OBJS=tracee.o T.o ../local_tracer.o
all: T_dep $(PROG)
$(PROG): $(OBJS)
$(CC) $(CFLAGS) -o $(PROG) $(OBJS) -lrt
@@ -10,5 +12,11 @@ $(PROG): $(OBJS)
tracee.o: tracee.c
$(CC) $(CFLAGS) -c -o $@ $<
T.o: ../T.c
$(CC) $(CFLAGS) -c -o $@ $<
T_dep:
cd .. && make
clean:
rm -f *.o $(PROG) core

View File

@@ -0,0 +1,14 @@
#ifndef _CONFIG_USERAPI_H_
#define _CONFIG_USERAPI_H_
typedef int paramdef_t;
#ifdef CMDLINE_TTRACEPARAMS_DESC
#undef CMDLINE_TTRACEPARAMS_DESC
#endif
#define CMDLINE_TTRACEPARAMS_DESC {}
#define config_get(dummy, ...) (void)(dummy)
#define config_process_cmdline(...) /**/
#endif /* _CONFIG_USERAPI_H_ */

View File

@@ -6,7 +6,8 @@
int main(void)
{
int frame = 0;
T_init(2021, 1, 0);
T_init(2021, 1);
T_stdout = 0;
while (1) {
getchar();
T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(0), T_INT(0), T_INT(frame), T_INT(0), T_INT(0), T_INT(0));

View File

@@ -1,5 +1,5 @@
CC=gcc
CFLAGS=-Wall -g -pthread -DT_TRACER -I.
CFLAGS=-Wall -g -pthread -DT_TRACER -I. -I../incgen
#CFLAGS += -O3 -ffast-math -fomit-frame-pointer
@@ -66,9 +66,9 @@ gnb: utils.o gnb.o database.o event.o handler.o configuration.o \
filter/filter.a
$(CC) $(CFLAGS) -o gnb $^ $(LIBS) $(XLIBS)
multi.o: ../T_IDs.h
multi.o: ../incgen/T_IDs.h
../T_IDs.h:
../incgen/T_IDs.h: ../T_messages.txt
cd .. && $(MAKE)
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a

View File

@@ -46,7 +46,7 @@ void loader_init(void) {
paramdef_t LoaderParams[] = LOADER_PARAMS_DESC;
loader_data.mainexec_buildversion = PACKAGE_VERSION;
int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),LOADER_CONFIG_PREFIX);
int ret = config_get(config_get_if(), LoaderParams, sizeofArray(LoaderParams), LOADER_CONFIG_PREFIX);
if (ret <0) {
printf("[LOADER] configuration couldn't be performed via config module, parameters set to default values\n");
if (loader_data.shlibpath == NULL) {
@@ -82,7 +82,7 @@ static char *loader_format_shlibpath(char *modname, char *version)
/* shared lib name is formatted as lib<module name><module version>.so */
char cfgprefix[sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16];
sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
ret = config_get(LoaderParams, sizeofArray(LoaderParams), cfgprefix);
ret = config_get(config_get_if(), LoaderParams, sizeofArray(LoaderParams), cfgprefix);
if (ret <0) {
fprintf(stderr, "[LOADER] %s %d couldn't retrieve config from section %s\n", __FILE__, __LINE__, cfgprefix);
}
@@ -214,7 +214,7 @@ int load_module_version_shlib(char *modname, char *version, loader_shlibfunc_t *
int j = 0;
for (; j < shlib->numfunc; ++j) {
if (shlib->funcarray[j].fptr == farray[i].fptr) {
int rc = strcmp(shlib->funcarray[i].fname, farray[i].fname);
int rc = strcmp(shlib->funcarray[j].fname, farray[i].fname);
AssertFatal(rc == 0,
"reloading the same fptr with different fnames (%s, %s)\n",
shlib->funcarray[i].fname, farray[i].fname);

View File

@@ -19,16 +19,16 @@
* contact@openairinterface.org
*/
/*! \file common/utils/prach_utils.h
* \brief computation of some PRACH variables used in both MAC and PHY
* \author R. Knopp
* \date 2020
* \version 0.1
* \company Eurecom
* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
* \note
* \warning
*/
/*! \file prach_utils.h
* \brief computation of some PRACH variables used in both MAC and PHY
* \author R. Knopp
* \date 2020
* \version 0.1
* \company Eurecom
* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it
* \note
* \warning
*/
uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type);
uint8_t get_prach_prb_offset(int frame_type,

View File

@@ -450,7 +450,7 @@ int get_nr_table_idx(int nr_bandP, uint8_t scs_index) {
break;
}
AssertFatal(i > 0 && i < sizeofArray(nr_bandtable), "band is not existing: %d\n",nr_bandP);
AssertFatal(i >= 0 && i < sizeofArray(nr_bandtable), "band is not existing: %d\n",nr_bandP);
LOG_D(PHY, "NR band table index %d (Band %d, dl_min %lu, ul_min %lu)\n", i, nr_bandtable[i].band, nr_bandtable[i].dl_min,nr_bandtable[i].ul_min);
return i;

View File

@@ -30,17 +30,19 @@
extern "C" {
#include <intertask_interface.h>
#include <common/utils/system.h>
#include "executables/softmodem-common.h"
typedef struct timer_elm_s {
timer_type_t type; ///< Timer type
long instance;
long duration;
uint64_t timeout;
void *timer_arg; ///< Optional argument that will be passed when timer expires
} timer_elm_t ;
typedef struct timer_elm_s {
timer_type_t type; ///< Timer type
long instance;
long duration;
uint64_t timeout;
void *timer_arg; ///< Optional argument that will be passed when timer expires
} timer_elm_t;
typedef struct task_list_s {
task_info_t admin;
ittiTask_parms_t task_parms;
pthread_t thread;
pthread_mutex_t queue_cond_lock;
std::vector<MessageDef *> message_queue;
@@ -162,12 +164,12 @@ extern "C" {
pthread_mutex_lock (&t->queue_cond_lock);
int ret=itti_send_msg_to_task_locked(destination_task_id, destinationInstance, message);
while ( t->message_queue.size()>0 && t->admin.func != NULL ) {
while (t->message_queue.size() > 0 && t->task_parms.shortcut_func != NULL) {
if (t->message_queue.size()>1)
LOG_W(ITTI,"queue in no thread mode is %ld\n", t->message_queue.size());
pthread_mutex_unlock (&t->queue_cond_lock);
t->admin.func(NULL);
t->task_parms.shortcut_func(NULL);
pthread_mutex_lock (&t->queue_cond_lock);
}
@@ -327,11 +329,20 @@ extern "C" {
pthread_mutex_unlock (&t->queue_cond_lock);
}
int itti_create_task(task_id_t task_id,
void *(*start_routine)(void *),
void *args_p) {
int itti_create_task(const task_id_t task_id, void *(*start_routine)(void *), const ittiTask_parms_t *parms)
{
task_list_t *t=tasks[task_id];
threadCreate (&t->thread, start_routine, args_p, (char *)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT);
if (get_softmodem_params()->no_itti && task_id < sizeofArray(tasks_info) && parms && parms->shortcut_func) {
LOG_W(ITTI, "not starting the thread for %s, the msg processing will be done in place\n", tasks_info[task_id].name);
t->task_parms.shortcut_func = parms->shortcut_func;
return 0;
}
threadCreate(&t->thread,
start_routine,
parms ? parms->args_to_start_routine : NULL,
(char *)itti_get_task_name(task_id),
-1,
OAI_PRIORITY_RT);
LOG_I(ITTI,"Created Posix thread %s\n", itti_get_task_name(task_id) );
return 0;
}
@@ -353,6 +364,7 @@ extern "C" {
AssertFatal(new_tasks != NULL, "could not realloc() tasks list");
tasks = new_tasks;
tasks[newQueue]= new task_list_t;
tasks[newQueue]->task_parms = {0};
pthread_mutex_unlock (&lock_nb_queues);
LOG_I(ITTI,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue);
pthread_mutex_init(&tasks[newQueue]->queue_cond_lock, NULL);
@@ -361,9 +373,6 @@ extern "C" {
AssertFatal( ( tasks[newQueue]->sem_fd = eventfd(0, EFD_SEMAPHORE) ) >=0, "");
itti_subscribe_event_fd((task_id_t)newQueue, tasks[newQueue]->sem_fd);
if (tasks[newQueue]->admin.threadFunc != NULL)
itti_create_task((task_id_t)newQueue, tasks[newQueue]->admin.threadFunc, NULL);
return newQueue;
}

View File

@@ -275,87 +275,69 @@ typedef uint32_t itti_message_types_t;
typedef unsigned long message_number_t;
#define MESSAGE_NUMBER_SIZE (sizeof(unsigned long))
typedef enum task_priorities_e {
TASK_PRIORITY_MAX = 100,
TASK_PRIORITY_MAX_LEAST = 85,
TASK_PRIORITY_MED_PLUS = 70,
TASK_PRIORITY_MED = 55,
TASK_PRIORITY_MED_LEAST = 40,
TASK_PRIORITY_MIN_PLUS = 25,
TASK_PRIORITY_MIN = 10,
} task_priorities_t;
typedef struct {
task_priorities_t priority;
unsigned int queue_size;
/* Printable name */
char name[256];
void *(*func)(void *) ;
void *(*threadFunc)(void *) ;
} task_info_t;
//
//TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200, NULL,NULL)
//TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL)
//TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)
//TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)
void *rrc_enb_process_msg(void *);
#define FOREACH_TASK(TASK_DEF) \
TASK_DEF(TASK_UNKNOWN, TASK_PRIORITY_MED, 50, NULL, NULL) \
TASK_DEF(TASK_TIMER, TASK_PRIORITY_MED, 10, NULL, NULL) \
TASK_DEF(TASK_L2L1, TASK_PRIORITY_MAX, 200, NULL, NULL) \
TASK_DEF(TASK_BM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PHY_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RLC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_ENB_NB_IoT, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PDCP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PDCP_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DATA_FORWARDING, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_END_MARKER, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_GNB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NGAP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_M2AP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_M2AP_MCE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_M3AP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_M3AP_MME, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_M3AP_MCE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_GNB_APP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MCE_APP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MME_APP, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PHY_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RLC_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PDCP_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000, NULL, NULL) \
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_CUCP_E1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_CUUP_E1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NSA_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NSA_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NAS_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
#define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc },
#define FOREACH_TASK(TASK_DEF) \
TASK_DEF(TASK_UNKNOWN, 50) \
TASK_DEF(TASK_TIMER, 10) \
TASK_DEF(TASK_L2L1, 200) \
TASK_DEF(TASK_BM, 200) \
TASK_DEF(TASK_PHY_ENB, 200) \
TASK_DEF(TASK_MAC_GNB, 200) \
TASK_DEF(TASK_RLC_ENB, 200) \
TASK_DEF(TASK_RRC_ENB_NB_IoT, 200) \
TASK_DEF(TASK_PDCP_ENB, 200) \
TASK_DEF(TASK_PDCP_GNB, 200) \
TASK_DEF(TASK_DATA_FORWARDING, 200) \
TASK_DEF(TASK_END_MARKER, 200) \
TASK_DEF(TASK_RRC_ENB, 200) \
TASK_DEF(TASK_RRC_GNB, 200) \
TASK_DEF(TASK_RAL_ENB, 200) \
TASK_DEF(TASK_S1AP, 200) \
TASK_DEF(TASK_NGAP, 200) \
TASK_DEF(TASK_X2AP, 200) \
TASK_DEF(TASK_M2AP_ENB, 200) \
TASK_DEF(TASK_M2AP_MCE, 200) \
TASK_DEF(TASK_M3AP, 200) \
TASK_DEF(TASK_M3AP_MME, 200) \
TASK_DEF(TASK_M3AP_MCE, 200) \
TASK_DEF(TASK_SCTP, 200) \
TASK_DEF(TASK_ENB_APP, 200) \
TASK_DEF(TASK_GNB_APP, 200) \
TASK_DEF(TASK_MCE_APP, 200) \
TASK_DEF(TASK_MME_APP, 200) \
TASK_DEF(TASK_PHY_UE, 200) \
TASK_DEF(TASK_MAC_UE, 200) \
TASK_DEF(TASK_RLC_UE, 200) \
TASK_DEF(TASK_PDCP_UE, 200) \
TASK_DEF(TASK_RRC_UE, 200) \
TASK_DEF(TASK_RRC_NRUE, 200) \
TASK_DEF(TASK_NAS_UE, 200) \
TASK_DEF(TASK_RAL_UE, 200) \
TASK_DEF(TASK_GTPV1_U, 1000) \
TASK_DEF(TASK_CU_F1, 200) \
TASK_DEF(TASK_DU_F1, 200) \
TASK_DEF(TASK_CUCP_E1, 200) \
TASK_DEF(TASK_CUUP_E1, 200) \
TASK_DEF(TASK_RRC_UE_SIM, 200) \
TASK_DEF(TASK_RRC_GNB_SIM, 200) \
TASK_DEF(TASK_RRC_NSA_UE, 200) \
TASK_DEF(TASK_RRC_NSA_NRUE, 200) \
TASK_DEF(TASK_NAS_NRUE, 200) \
TASK_DEF(TASK_MAX, 200)
#define TASK_DEF(TaskID, qUEUEsIZE) {qUEUEsIZE, #TaskID},
/* Map task id to printable name. */
static const task_info_t tasks_info[] = {
FOREACH_TASK(TASK_DEF)
};
#define TASK_ENUM(TaskID, pRIO, qUEUEsIZE, FuNc,ThreadFunc ) TaskID,
#define TASK_ENUM(TaskID, qUEUEsIZE) TaskID,
//! Tasks id of each task
typedef enum {
FOREACH_TASK(TASK_ENUM)
@@ -502,9 +484,11 @@ void itti_poll_msg(task_id_t task_id, MessageDef **received_msg);
\param args_p Optional argument to pass to the start routine
@returns -1 on failure, 0 otherwise
**/
int itti_create_task(task_id_t task_id,
void *(*start_routine) (void *),
void *args_p);
typedef struct {
void *args_to_start_routine;
void *(*shortcut_func)(void *);
} ittiTask_parms_t;
int itti_create_task(const task_id_t task_id, void *(*start_routine)(void *), const ittiTask_parms_t *args_p);
int itti_create_queue(const task_info_t *task_info);
@@ -568,8 +552,6 @@ void itti_set_task_real_time(task_id_t task_id);
void itti_send_terminate_message(task_id_t task_id);
void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size);
void *calloc_or_fail(size_t size);
void *malloc_or_fail(size_t size);
int memory_read(const char *datafile, void *data, size_t size);
int itti_free(task_id_t task_id, void *ptr);

View File

@@ -844,7 +844,7 @@ static bool exec_moduleinit(char *modname) {
int add_embeddedmodules(void) {
int ret=0;
int pindex = config_paramidx_fromname(telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t), TELNETSRV_OPTNAME_STATICMOD);
int pindex = config_paramidx_fromname(telnetoptions, sizeofArray(telnetoptions), TELNETSRV_OPTNAME_STATICMOD);
for(int i=0; i<telnetoptions[pindex].numelt; i++) {
bool success = exec_moduleinit(telnetoptions[pindex].strlistptr[i]);
if (success)
@@ -856,7 +856,7 @@ int add_embeddedmodules(void) {
int add_sharedmodules(void) {
int ret=0;
int pindex = config_paramidx_fromname(telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t), TELNETSRV_OPTNAME_SHRMOD);
int pindex = config_paramidx_fromname(telnetoptions, sizeofArray(telnetoptions), TELNETSRV_OPTNAME_SHRMOD);
for(int i=0; i<telnetoptions[pindex].numelt; i++) {
char *name = telnetoptions[pindex].strlistptr[i];
char libname[256];
@@ -875,7 +875,7 @@ int add_sharedmodules(void) {
*/
int telnetsrv_autoinit(void) {
memset(&telnetparams,0,sizeof(telnetparams));
config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),"telnetsrv");
config_get(config_get_if(), telnetoptions, sizeofArray(telnetoptions), "telnetsrv");
/* possibly load a exec specific shared lib */
char *execfunc=get_softmodem_function(NULL);
char libname[64];

View File

@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_nrue_measurements.c
/*! \file telnetsrv_5Gue_measurements.c
* \brief: implementation of telnet commands related to nrUE measurments
* \author Francois TABURET
* \date 2021

View File

@@ -71,7 +71,7 @@ int add_bearer(char *buf, int debug, telnet_printfunc_t prnt)
}
// verify it exists in RRC as well
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti);
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], rnti);
if (!rrcue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);
@@ -95,7 +95,7 @@ int release_bearer(char *buf, int debug, telnet_printfunc_t prnt)
}
// verify it exists in RRC as well
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti);
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], rnti);
if (!rrcue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);

View File

@@ -87,7 +87,7 @@ int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt)
rnti = strtol(buf, NULL, 16);
if (rnti < 1 || rnti >= 0xfffe)
ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n");
ue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti);
ue = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], rnti);
if (!ue)
ERROR_MSG_RET("could not find UE with RNTI %04x in RRC\n");
}

View File

@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_phycmd.c
/*! \file telnetsrv_enb_phycmd.c
* \brief: implementation of telnet commands related to softmodem linux process
* \author Francois TABURET
* \date 2017

View File

@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv_proccmd.h
/*! \file telnetsrv_loader.h
* \brief: Include file defining telnet commands related to softmodem linux process
* \author Francois TABURET
* \date 2018

View File

@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv_proccmd.h
/*! \file telnetsrv_phycmd.h
* \brief: Include file defining telnet commands related to softmodem linux process
* \author Francois TABURET
* \date 2017

View File

@@ -511,9 +511,9 @@ int proccmd_exit(char *buf, int debug, telnet_printfunc_t prnt)
int proccmd_restart(char *buf, int debug, telnet_printfunc_t prnt)
{
if (debug > 0)
prnt("process module received %s\n", buf);
end_configmodule();
prnt("process module received %s\n", buf);
configmodule_interface_t *cfg = config_get_if();
end_configmodule(cfg);
execvpe(cfg->argv[0], cfg->argv, environ);
return 0;
}

View File

@@ -176,7 +176,7 @@ void initFloatingCoresTpool(int nbThreads,tpool_t *pool, bool performanceMeas, c
}
#ifdef TEST_THREAD_POOL
volatile int oai_exit=0;
int oai_exit = 0;
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{

View File

@@ -278,8 +278,8 @@ void run_cpumeasur(void) {
void init_meas(void) {
pthread_t thid;
paramdef_t cpumeasur_params[] = CPUMEASUR_PARAMS_DESC;
int numparams=sizeof(cpumeasur_params)/sizeof(paramdef_t);
int rt = config_get( cpumeasur_params,numparams,CPUMEASUR_SECTION);
int numparams = sizeofArray(cpumeasur_params);
int rt = config_get(config_get_if(), cpumeasur_params, numparams, CPUMEASUR_SECTION);
AssertFatal(rt >= 0, "cpumeasur configuration couldn't be performed");
measur_table=calloc(max_cpumeasur,sizeof( time_stats_t *));
AssertFatal(measur_table!=NULL, "couldn't allocate %u cpu measurements entries\n",max_cpumeasur);

View File

@@ -56,23 +56,24 @@ static inline void *malloc16_clear( size_t size ) {
return ptr;
}
static inline void *calloc_or_fail(size_t size) {
void *ptr = calloc(1, size);
static inline void *calloc_or_fail(size_t nmemb, size_t size)
{
void *ptr = calloc(nmemb, size);
if (ptr == NULL) {
fprintf(stderr, "[UE] Failed to calloc %zu bytes", size);
fprintf(stderr, "Failed to calloc() %zu elements of %zu bytes: out of memory", nmemb, size);
exit(EXIT_FAILURE);
}
return ptr;
}
static inline void *malloc_or_fail(size_t size) {
static inline void *malloc_or_fail(size_t size)
{
void *ptr = malloc(size);
if (ptr == NULL) {
fprintf(stderr, "[UE] Failed to malloc %zu bytes", size);
fprintf(stderr, "Failed to malloc() %zu bytes: out of memory", size);
exit(EXIT_FAILURE);
}

View File

@@ -1,164 +1,65 @@
## building the webserver
[[_TOC_]]
# Building the webserver
back-end (the http server) and front-end (the html and javascript code for the browsers) are both built when the build of the `websrv` optional library is requested.
You can include the web server interface components in your build using the build_oai script with the `--build-lib "telnetsrv websrv"` option.
You can include the web server interface components in your build using the `build_oai` script with the `--build-lib "telnetsrv websrv"` option.
The related cmake cache entry in `ran_build/build/CMakeCache.txt` for building the web server
is `ENABLE_WEBSRV:BOOL=ON`
When cmake configuration has been completed, with websrv enabled and all dependencies met,font-end and back-end
When cmake configuration has been completed, with websrv enabled and all dependencies met, font-end and back-end
can be built separately, using respectively `make websrvfront` or `make websrv` from the build repository (replace make by ninja if you
build using ninja).
## Additional dependencies for the backend
To build the webserver frontend, you need additionally
###### build example when back-end dependency is not installed
1. the [ulfius library](https://github.com/babelouest/ulfius)
2. the [jansson library](https://github.com/akheron/jansson-debian)
```
./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
Will compile gNB
Will compile NR UE
Enabling build of optional shared library telnetsrv
Enabling build of optional shared library websrv
Enabling build of optional shared library nrscope
OPENAIR_DIR = /usr/local/oai/develop_unmodified/openairinterface5g
Running "cmake -DOAI_USRP=ON -DENABLE_TELNETSRV=ON -DENABLE_WEBSRV=ON -DENABLE_NRSCOPE=ON ../../.."
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Ccache not found. Consider installing it for faster compilation. Command: sudo apt/dnf install ccache
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Check if /opt/asn1c/bin/asn1c supports -gen-APER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-UPER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-JER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-BER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-OER
-- CMAKE_BUILD_TYPE is RelWithDebInfo
-- CPUARCH x86_64
-- AVX512 intrinsics are OFF
-- AVX2 intrinsics are ON
-- Found Git: /usr/bin/git (found version "2.34.1")
-- Checking for module 'libconfig'
-- Found libconfig, version 1.5
-- Checking for module 'openssl'
-- Found openssl, version 3.0.2
-- Checking for module 'blas'
-- Found blas, version 3.10.3
-- Checking for module 'lapacke'
-- Found lapacke, version 3.10.0
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Add enb specific telnet functions in libtelnetsrv_enb.so
-- No specific telnet functions for gnb
-- No specific telnet functions for 4Gue
-- Add 5Gue specific telnet functions in libtelnetsrv_5Gue.so
-- Add CI specific telnet functions in libtelnetsrv_ci.so
CMake Error at common/utils/websrv/CMakeLists.txt:31 (find_library):
Could not find ULFIUS using the following names: libulfius.so
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```
You can fix this first dependency problem, the backend dependency, by installing the libulfius library:
These libraries are not handled by `build_oai -I`
On ubuntu: `sudo apt-get install libulfius-dev`, for fedora: `dnf install libulfius`. Some distribution don't have
libulfius package, instruction to install it can be found [here](https://github.com/babelouest/ulfius/blob/master/INSTALL.md)
### Ubuntu
###### build example when front-end dependency is not installed
```
./build_oai --build-lib "websrv telnetsrv nrscope"
./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
Will compile gNB
Will compile NR UE
Enabling build of optional shared library telnetsrv
Enabling build of optional shared library websrv
Enabling build of optional shared library nrscope
OPENAIR_DIR = /usr/local/oai/develop_unmodified/openairinterface5g
Running "cmake -DOAI_USRP=ON -DENABLE_TELNETSRV=ON -DENABLE_WEBSRV=ON -DENABLE_NRSCOPE=ON ../../.."
-- Ccache not found. Consider installing it for faster compilation. Command: sudo apt/dnf install ccache
-- Check if /opt/asn1c/bin/asn1c supports -gen-APER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-UPER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-JER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-BER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-OER
-- CMAKE_BUILD_TYPE is RelWithDebInfo
-- CPUARCH x86_64
-- AVX512 intrinsics are OFF
-- AVX2 intrinsics are ON
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Add enb specific telnet functions in libtelnetsrv_enb.so
-- No specific telnet functions for gnb
-- No specific telnet functions for 4Gue
-- Add 5Gue specific telnet functions in libtelnetsrv_5Gue.so
-- Add CI specific telnet functions in libtelnetsrv_ci.so
-- found libulfius for websrv
-- found libjansson for websrv
CMake Error at common/utils/websrv/CMakeLists.txt:45 (find_program):
Could not find NPM using the following names: npm
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```
Currently the web server frontend can run with nodejs 18, you can check the version (if any) installed on your system entering the `node -v` command.
To prevent difficult situations with nodejs or npm versions it is better to specifically install the required nodejs version (after removing existing versions of npm and nodejs), as explained
[here](https://www.stewright.me/2023/04/install-nodejs-18-on-ubuntu-22-04/) for ubuntu. Similar instructions can be found for other distributions.
It is also possible to make several nodejs versions co-habiting on your system, this is beyond this doc.
###### example: installing nodejs 18 on ubuntu
```bash
$ sudo apt-get update
$ sudo apt-get install -y libulfius-dev libjansson-dev npm curl wget
```
curl -s https://deb.nodesource.com/setup_18.x | sudo bash
### Fedora(-based OS)
## Installing the NodeSource Node.js 18.x repo...
```bash
$ sudo dnf update -y
$ sudo dnf install -y jansson-devel npm curl wget
```
ulfius has to be installed as explained [here](https://github.com/babelouest/ulfius/blob/master/INSTALL.md#pre-compiled-packages).
## Additional dependencies for the frontend
Currently the web server frontend can run with nodejs 18, you can check the
version (if any) installed on your system entering the `node -v` command.
To prevent difficult situations with nodejs or npm versions it is better to
specifically install the required nodejs version (after removing existing
versions of npm and nodejs), as explained
[here](https://www.stewright.me/2023/04/install-nodejs-18-on-ubuntu-22-04/) for
ubuntu. Similar instructions can be found for other distributions. It is also
possible to make several nodejs versions co-habiting on your system, this is
beyond this doc.
For example, to install a specific nodeJS version, you can run the below
command, with the typical output printed below for your convenience:
```bash
$ curl -s https://deb.nodesource.com/setup_18.x | sudo bash
## Populating apt-get cache...
+ apt-get update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [305 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [678 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [42.8 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [11.2 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [553 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:10 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [770 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [39.8 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [471 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [892 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [214 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [100 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [714 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [114 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [968 kB]
Get:19 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [648 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [211 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [288 kB]
Get:22 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:23 http://us.archive.ubuntu.com/ubuntu jammy-backports/main amd64 DEP-11 Metadata [4,924 B]
Get:24 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [15.6 kB]
Fetched 7,379 kB in 4s (2,095 kB/s)
Reading package lists... Done
apt-get update
## Confirming "jammy" is supported...
@@ -176,15 +77,6 @@ Reading package lists... Done
## Running `apt-get update` for you...
+ apt-get update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Get:2 https://deb.nodesource.com/node_18.x jammy InRelease [4,563 B]
Get:3 https://deb.nodesource.com/node_18.x jammy/main amd64 Packages [776 B]
Hit:4 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 5,339 B in 1s (7,666 B/s)
Reading package lists... Done
## Run `sudo apt-get install -y nodejs` to install Node.js 18.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
@@ -214,88 +106,46 @@ Preparing to unpack .../nodejs_18.17.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (18.17.1-deb-1nodesource1) ...
Setting up nodejs (18.17.1-deb-1nodesource1) ...
Processing triggers for man-db (2.10.2-1) ...
```
###### build example when dependencies are met
``` bash
./build_oai --ninja -c -C --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
Will compile gNB
Will compile NR UE
Enabling build of optional shared library telnetsrv
Enabling build of optional shared library websrv
Enabling build of optional shared library nrscope
OPENAIR_DIR = /usr/local/oai/develop_unmodified/openairinterface5g
Erased all previously producted files
Running "cmake -GNinja -DOAI_USRP=ON -DENABLE_TELNETSRV=ON -DENABLE_WEBSRV=ON -DENABLE_NRSCOPE=ON ../../.."
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Ccache not found. Consider installing it for faster compilation. Command: sudo apt/dnf install ccache
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Check if /opt/asn1c/bin/asn1c supports -gen-APER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-UPER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-JER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-BER
-- Check if /opt/asn1c/bin/asn1c supports -no-gen-OER
-- CMAKE_BUILD_TYPE is RelWithDebInfo
-- CPUARCH x86_64
-- AVX512 intrinsics are OFF
-- AVX2 intrinsics are ON
-- Found Git: /usr/bin/git (found version "2.34.1")
-- Checking for module 'libconfig'
-- Found libconfig, version 1.5
-- Checking for module 'openssl'
-- Found openssl, version 3.0.2
-- Checking for module 'blas'
-- Found blas, version 3.10.3
-- Checking for module 'lapacke'
-- Found lapacke, version 3.10.0
-- Checking for module 'cblas'
-- No package 'cblas' found
-- Add enb specific telnet functions in libtelnetsrv_enb.so
-- No specific telnet functions for gnb
-- No specific telnet functions for 4Gue
-- Add 5Gue specific telnet functions in libtelnetsrv_5Gue.so
-- Add CI specific telnet functions in libtelnetsrv_ci.so
-- found libulfius for websrv
-- found libjansson for websrv
-- found npm for websrv
-- Configuring webserver backend
-- Configuring webserver frontend
-- No Doxygen documentation requested
-- libforms library, required for scopes, found at /usr/lib/libforms.so
-- Found UHD: /usr/lib/x86_64-linux-gnu/libuhd.so
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
cd /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
Running "cmake --build . --target nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts -- -j8"
Log file for compilation is being written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/log/all.txt
nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts compiled
BUILD SHOULD BE SUCCESSFUL
If you want to put a more recent version, refer to the steps below, which is
common for any OS:
```bash
$ sudo npm -g install @angular/cli@latest npm@latest
$ sudo npm install n -g
# Install the LTS version
$ n lts
# Or install the latest version
$ n latest
$ node --version
```
###### building and installing the front-end after cmake has been successfully configured
## Building the webserver
### Backend
The websrv targets won't be available till cmake has been successfully configured with the websrv option enabled
```bash
$ cd <oai repository>/openairinterface5g/cmake_targets
$ ./build_oai --build-lib websrv
```
cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
make websrvfront
or, without the help of the `build_oai` script:
```bash
$ cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
$ make websrv
```
This will create the `libwebsrv.so` file in the `cmake_targets/ran_build/build` directory.
### Frontend
The frontend targets needs to be triggered explicitly:
```bash
$ cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
$ make websrvfront
up to date, audited 1099 packages in 3s
142 packages are looking for funding
@@ -332,27 +182,59 @@ Built target websrvfront
```
###### building and installing the back-end after cmake has been successfully configured
## Examples
**build example when back-end dependency is not installed**
```bash
cd <oai repository>/openairinterface5g
source oaienv
cd cmake_targets
./build_oai --build-lib websrv
```
or, without the help of the `build_oai` script:
```bash
cd \<oai repository\>/openairinterface5g/cmake_targets/ran_build/build
make websrv
$ ./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
[...]
CMake Error at common/utils/websrv/CMakeLists.txt:31 (find_library):
Could not find ULFIUS using the following names: libulfius.so
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```
This will create the `libwebsrv.so` file in the `targets/bin` and `cmake_targets/ran_build/build` sub directories of the oai repository.
**build example when front-end dependency is not installed**
```bash
$ ./build_oai --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
[...]
-- found libulfius for websrv
-- found libjansson for websrv
CMake Error at common/utils/websrv/CMakeLists.txt:45 (find_program):
Could not find NPM using the following names: npm
When starting the softmodem, you must specify the **_\-\-websrv_** option to load and start the web server. The web server is loaded via the [oai shared library loader](loader).
# Testing the web server interface
-- Configuring incomplete, errors occurred!
See also "/usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build/CMakeFiles/CMakeOutput.log".
build have failed
```
**build example when dependencies are met**
```bash
$ ./build_oai --ninja -c -C --gNB --nrUE -w USRP --build-lib "telnetsrv websrv nrscope"
[...]
-- found libulfius for websrv
-- found libjansson for websrv
-- found npm for websrv
-- Configuring webserver backend
-- Configuring webserver frontend
[...]
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
cd /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/ran_build/build
Running "cmake --build . --target nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts -- -j8"
Log file for compilation is being written to: /usr/local/oai/develop_unmodified/openairinterface5g/cmake_targets/log/all.txt
nr-softmodem nr-cuup nr-uesoftmodem oai_usrpdevif telnetsrv websrv nrscope params_libconfig coding rfsimulator dfts compiled
BUILD SHOULD BE SUCCESSFUL
```
# Running the web server interface
When starting the softmodem, you must specify the `--websrv` option to load and start the web server. The web server is loaded via the [oai shared library loader](loader).
## web server parameters
The web server back-end is using the [oai configuration module](Config/Rtusage). web server parameters must be specified in the websrv section.
@@ -367,7 +249,7 @@ The web server back-end is using the [oai configuration module](Config/Rtusage).
| | | | |
## running the back-end
To trigger the back-end use the `--websrv` option, possibly modifying the parameters as explained in the previous chapter. The two following commands allow starting the oai gNB and the oai 5G UE on the same computer, starting the telnet server and the web interface on both executables.
To trigger the back-end use the `--websrv` option, possibly modifying the parameters as explained in the [previous section](./websrvuse.md#web-server-parameters). The two following commands allow starting the oai gNB and the oai 5G UE on the same computer, starting the telnet server and the web interface on both executables.
`./nr-softmodem -O /usr/local/oai/conf/gnb.band78.sa.fr1.106PRB.usrpb210.conf --rfsim --rfsimulator.serveraddr server --telnetsrv --telnetsrv.listenstdin --websrv --rfsimulator.options chanmod`
@@ -392,6 +274,7 @@ The interface should be intuitive enough, keeping in mind the following restrict
Some front-end objects, which usage are less intuitive provide a tooltip to help interface usage.
## some webserver screenshots
- [main page](main.png)
- [Configuring logs](logscfg.png)
- [scope interface](scope.png)

View File

@@ -753,7 +753,7 @@ int websrv_callback_get_softmodemstatus(const struct _u_request *request, struct
}
websrv_add_modeminfo(modemvars, "command line", cmdline, "string");
if ((config_get_if()->rtflags & CONFIG_SAVERUNCFG) && (config_get_if()->write_parsedcfg != NULL)) {
config_get_if()->write_parsedcfg();
config_get_if()->write_parsedcfg(config_get_if());
websrv_add_modeminfo(modemvars, "Parsed config file", config_get_if()->status->debug_cfgname, "configfile");
}
@@ -819,7 +819,7 @@ void *websrv_autoinit()
{
int ret;
memset(&websrvparams, 0, sizeof(websrvparams));
config_get(websrvoptions, sizeof(websrvoptions) / sizeof(paramdef_t), "websrv");
config_get(websrvoptions, sizeofArray(websrvoptions), "websrv");
/* check if telnet server is loaded or not */
add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
if (addcmd != NULL) {

File diff suppressed because it is too large Load Diff

View File

@@ -2,38 +2,55 @@
# 1. Introduction
E1 is named for the interface that lies between the nodes CU Control Plane (CUCP) and CU User Plane (CUUP). Once the nodes are configured, all user plane traffic flows through CUUP.
E1 is the interface that lies between the nodes CU Control Plane (CUCP) and CU User Plane (CUUP). Once the nodes are configured, all user plane traffic flows through CUUP.
The E1 design in OAI follows the 3GPP specification in TS 38.460. The code design on E1 in OAI is very similar to
F1. The ITTI message passing mechanism is used to exchange messages between E1AP thread, SCTP thread and RRC thread.
The following sequence chart shows the current E1AP message flow.
The E1 design in OAI follows the 3GPP specification in TS 38.460/463. The code
design on E1 in OAI is very similar to F1: OAI uses E1 internally to set up
bearers, even in monolithic gNB, where the actual "way" the messages are passed
is abstracted through function pointers. More specifically, there are handlers
that handle the E1 messages as shown below, *which are the same* no matter if
the CU is integrated or separate in CU-CP/UP. The below sequence diagram lists
the handlers that are executed and the current E1AP message flow (SCTP
connection setup only in split-mode, the rest is the same for CU):
```mermaid
sequenceDiagram
participant c as CUCP
participant u as CUUP
u->>c: SCTP new association
c->>u: SCTP new association response
Note over u: Create UDP sockets for F1-U and N3
u->c: SCTP connection setup (in split mode)
u->>c: E1AP Setup Request
Note over c: Execute rrc_gNB_process_e1_setup_req()
c->>u: E1AP Setup Response
Note over c: Receives PDU session setup request from AMF
c->>u: Bearer Context Setup Request
Note over u: Configure DRBs and create GTP Tunnels for F1-U and N3
Note over u: Execute e1_bearer_context_setup()<br/>Configure DRBs and create GTP Tunnels for F1-U and N3
u->>c: Bearer Context Setup Response
Note over c: Sends F1-U UL TNL info to DU and receives DL TNL info
Note over c: Execute rrc_gNB_process_e1_setup_req()<br/>Sends F1-U UL TNL info to DU and receives DL TNL info
c->>u: Bearer Context Modification Request
Note over u: Updates GTP Tunnels with received info
Note over u: Execute e1_bearer_context_modif()<br/>Updates GTP Tunnels with received info
u->>c: Bearer Context Modification Response
Note over c: Execute rrc_gNB_process_e1_bearer_context_modif_resp()
Note over c: UE release triggered
c->>u: Bearer Context Release Request
Note over u: Execute e1_bearer_release_cmd()<br/>Frees GTP tunnels, PDCP data etc
u->>c: Bearer Context Release Complete
Note over c: Execute rrc_gNB_process_e1_bearer_context_release_cplt()
```
_Note that the E1 bearer release procedures are currently not implemented._
The files that implement the callback towards these handlers are in
- `cucp_cuup_direct.c`: integrated CU (for CP=>UP messages)
- `cucp_cuup_e1ap.c`: E1 split mode (for CP=>UP messages)
- `cuup_cucp_direct.c`: integrated CU (for UP=>CP messages)
- `cuup_cucp_e1ap.c`: E1 split mode (for UP=>CP messages)
# 2. Running the E1 Split
## 2.1 Configuration File
The gNB is started based on the node type that is specified in the configuration file. To start a gNB instance in CUCP or CUUP, the `tr_s_preference` should be set to "f1" and the config member `E1_INTERFACE` should be present in the config file. The `type` parameter within the `E1_INTERFACE` should be set to `cp`, and `nr-softmodem` should be used to run a CU-CP. The type should be `up` and `nr-cuup` should be used to run the CU-UP. Further, there are the parameters `ipv4_cucp` and `ipv4_cuup` to specify the IP addresses of the respective network functions.
The gNB is started based on the node type that is specified in the configuration file. To start a gNB instance in CUCP or CUUP, the `tr_s_preference` should be set to "f1" and the config member `E1_INTERFACE` should be present in the config file. The `type` parameter within the `E1_INTERFACE` should be set to `cp`, and executable `nr-softmodem` should be used to run a CU-CP. The type should be `up` and executable `nr-cuup` should be used to run the CU-UP. Further, there are the parameters `ipv4_cucp` and `ipv4_cuup` to specify the IP addresses of the respective network functions.
For CUCP, a typical `E1_INTERFACE` config looks like
```
@@ -62,7 +79,7 @@ One could take an existing CU configuration file and add the above parameters to
The CUUP uses the IP address specified in `local_s_address` for F1-U and `GNB_IPV4_ADDRESS_FOR_NGU` for N3 links. Note that `local_s_address` is under `gNBs` and `GNB_IPV4_ADDRESS_FOR_NGU` is part of the `NETWORK_INTERFACES` config member.
Alternatively, you can use the config files `ci-scripts/conf_files/gnb-cucp.sa.conf` and `ci-scripts/conf_files/gnb-cuup.sa.conf` which are already in the repository.
Alternatively, you can use the config files `ci-scripts/conf_files/gnb-cucp.sa.f1.conf` and `ci-scripts/conf_files/gnb-cuup.sa.f1.conf`.
## 2.2 Steps to Run the Split in rfsimulator with OAI UE
@@ -73,7 +90,7 @@ Note: A 5G core must be running at this point. Steps to start the OAI 5G core ca
1. Start the CUCP first by running the following command
```
sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb-cucp.sa.conf --gNBs.[0].min_rxtxtime 6 --sa
sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb-cucp.sa.f1.conf --gNBs.[0].min_rxtxtime 6 --sa
```
Note that `min_rxtxtime` should be set to `6` only when you are connecting an OAI UE to the gNB.
@@ -82,7 +99,7 @@ Note that `min_rxtxtime` should be set to `6` only when you are connecting an OA
CUUP (has its own executable):
```
sudo ./nr-cuup -O ../../../ci-scripts/conf_files/gnb-cuup.sa.conf --sa
sudo ./nr-cuup -O ../../../ci-scripts/conf_files/gnb-cuup.sa.f1.conf --sa
```
DU:
@@ -106,3 +123,25 @@ You can also run the nodes on different machines. If you do so please change the
![E1/F1/NG parameters](images/e1-archi.png){width=1200}
[PDF version](images/e1-archi.pdf) | [LaTeX/TikZ version](img/e1-archi.tex) if you want to modify to reflect your setup
# 4. Multiple CU-UP
It is possible to connect multiple CU-UP to the same CU-CP. In the handler of
the E1 Setup Request, the CU-CP verifies that the PLMN(s) (MCC, MNC) between
both nodes match, and that no CU-UP with the same ID exists. Note that the
NSSAIs for the CU-UPs can be different.
During attach, the following rules are used to select a CU-UP at the CU-CP, in
order:
- Select a CU-UP based on slice identifiers:
- If both the SST and SD match exactly, that CU-UP is selected. (If multiple
have the same NSSAI, the first is always selected.)
- Otherwise, the first CU-UP with the same SST but different SD is selected.
- Round-robin across all CU-UPs.
- The first CU-UP.
- If no CU-UP is selected, the CU-CP asserts.
Note that CU-UPs are not released from CU-CP internal structures. That means
that you have to restart the CU-CP if you want to connect the CU-UP again
(e.g., after a crash). The CU-CP might also misfunction during attach if a
CU-UP was connected, but disconnected in the meantime.

View File

@@ -12,204 +12,44 @@
</tr>
</table>
# 1. Introduction
[[_TOC_]]
We use OpenAirInterface source code, and it's regular deployment scheme.
# Introduction
F1 specification is in 3GPP documents: TS 38.470 header document and all documents listed in chapter 2 References of TS 38.470.
The F1 interface is the functional split of 3GPP between the CU (centralized
unit: PDCP, RRC, SDAP) and the DU (distributed unit: RLC, MAC, PHY). It is
standardized in TS 38.470 - 38.473 for 5G NR. No equivalent for 4G exists.
This document explains how the source code works.
We assume that each DU handles only one cell. Multiple DUs connected to one CU
are supported. Mobility over F1 is not yet supported.
Offered features and deployment instructions are described in:
https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/f1-interface
# Control plane status (F1-C)
# 2. Common multi-threading architecture #
## Implementation Status
The CU and DU interfaces are based on ITTI threads (see oai/common/utils/ocp_itti/itti.md)
Note that OAI uses F1 "internally". That means, that even if you run a
monolithic gNB, the internal information exchange uses F1. You can therefore
expect that everything working in a monolithic deployment should also work in
F1. The current implementation is based on R16.3.
All OAI upper layers use the ITTI framework to run isolated threads dedicated to one feature.
The lower layers adopt case by case specific software architecture.
Note that NSA does NOT follow this logic yet, and does not work with F1.
```mermaid
graph TD
Linux[configuration file] --> APP[gNB_app_task]
Socks[Linux UDP] --> GTP[nr_gtpv1u_gNB_task]
APP --> CU
APP --> DU
A[Linux SCTP] -->|sockets| SCTP(OAI itti thread TASK_SCTP)
SCTP-->|TASK_NGAP| NG[ngap_gNB_task]
NG-->|TASK_SCTP| SCTP
SCTP-->|TASK_DU_F1| DU[F1AP_DU_task]
SCTP-->|TASK_CU_F1| CU[F1AP_CU_task]
CU-->|TASK_RRC_GNB| RRC
RRC -->|non ITTI| PHY[OAI L1+L2]
RRC -->|API calls to create tunnels| GTP
PHY --> |user plane| GTP
CU --> |TASK_GTPV1_U| GTP
DU --> |TASK_GTPV1_U| GTP
```
A "task" is a Linux thread running infinite waiting loop on one ITTI queue
The following messages are currently implemented:
app task manages the initial configuration
- F1 Setup Request and F1 Setup Response/Failure
- Initial UL RRC, UL/DL RRC Message Transfer
- F1 UE Context management messages for the "good case"
* Setup Request/Response
* Modification Request/Response
* Release Request/Command/Complete
sctp task mamanges the SCTP Linux sockets
All other messages are not implemented or not working reliably:
CU code runs in the task F1AP_CU_task. It stores it's private data context in a static variable. No mutex is used, as the single interface to CU ITTI tast in incoming ITTI messages. CU task is a single ITTI queue, but multiple CU could exist in one Linux process, using the "instance id" (called "module id" also) to create separate contextual information for each CU instance.
- F1 CU/DU configuration updade
- Paging messages
- Warning Message transmissions
DU code runs in the task F1AP_DU_task. The design is similar to CU task
All GTP-U tunnels are managed in a Linux Thread, that have partially ITTI design:
1. tunnel creation/deletion is by C API functions direct calls (a mutex protects it)
2. outgoing packets are pushed in a ITTI queue to the gtp thread
3. incoming packets are sent to the tunnel creator using a C callback (the callback function is given in tunnel creation order). The callback should not block
# 3. CU F1AP messages #
## startup
CU thread starts when the CU starts. It opens listening socket on F1AP_PORT_NUMBER by sending the appropriate message to TASK_SCTP.
It will accept the first incoming connection on this port
## F1 SETUP
DU has connected, and sent this message.
The CU receives, decode it and send relevant information to RRC thread by message F1AP_SETUP_REQ
## F1 SETUP response
RRC sends two messages to CU F1 task: the information to encode the F1 setup response and a second message to encode F1AP_GNB_CU_CONFIGURATION_UPDATE
Upon reception of these two messages the CU task encodes and sends the messages to the DU
## UE entry
When CCH channel decoding finds a new UE identity, it call rrc_gNB_generate_RRCSetup() that will send F1AP_DL_RRC_MESSAGE to the CU task.
The CU encodes and sends to DU DLRRCMessageTransfer
## UE attach/detach
When rrc_gNB_process_RRCReconfigurationComplete() occurs, the RRC sends to CU task the message F1AP_UE_CONTEXT_SETUP_REQ. The CU task encodes the F1 message UEContextSetup and send it to the DU over F1AP.
This function rrc_gNB_process_RRCReconfigurationComplete() also creates the GTP-U user plane bearers.
## F1AP incoming messages
SCTP tasks sends a ITTI message SCTP_DATA_IND to the CU task.
A array of functions pointers and the F1AP standard identifier "procedureCode", the CU calls the appropriate function
Hereafter the most significant messages processing
### CU_handle_F1_SETUP_REQUEST
Transcodes information to the same message toward RRC (F1AP_SETUP_REQ)
### CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER
Transcodes information to the same message toward RRC (NR_RRC_MAC_CCCH_DATA_IND)
### CU_handle_UL_RRC_MESSAGE_TRANSFER
Encode and send data to PDCP (calling pdcp_data_ind ()) for processing UL data.
# DU F1 Messages
## Startup
The task "gNB app" after rzading the configuration file, sends a first message F1AP_SETUP_REQ to DU task
Using this message, the uniq DU task (Linux Thread) creates a DU instance context memory space, calls SCTP task to create a socket to the CU.
When it receives from the SCTP task the socket creation success, the DU task encodes+sends the F1 setup message to the CU.
## F1AP_INITIAL_UL_RRC_MESSAGE
When MAC layer push UL data to DU task, the DU sends to CU the message InitialULRRCMessageTransfer
## F1AP_UL_RRC_MESSAGE
In case of SRB bearer, the RLC layer use this message to push rlc bearer payload to DU task, that forward to CU
## pdcp_data_ind
This function call in RLC, when it is a DRB will be replaced by F1-U transport to CU
## F1AP incoming messages
SCTP tasks sends a ITTI message SCTP_DATA_IND to the DU task.
A array of functions pointers and the F1AP standard identifier "procedureCode", the DU calls the appropriate function
Hereafter the most significant messages processing
### DU_send_F1_SETUP_RESPONSE
Decode the CU message, then encode a message to TASK_GNB_APP. The thread "APP" extracts the system information block and reconfigure the DU with: du_extract_and_decode_SI(), configure_gnb_du_mac()
### DU_handle_gNB_CU_CONFIGURATION_UPDATE
No developped
### DU_handle_UE_CONTEXT_SETUP_REQUEST
Push data to RLC layer for transmisstion in DL (to the UE) by calling enqueue_rlc_data_req()
### DU_handle_DL_RRC_MESSAGE_TRANSFER
Depending on the content, adds UE context in DU low layers and/or send data to the UE with rlc_data_req()
# F1-U messages
The data path by itself doesn't make any difficulty:
1. for UL, rlc calls pdcp_data_ind (DRB) or sends a message to RRC (SRB). So, we can replace pdcp_data_ind() by du_pdcp_data_ind() that will push the message in the GTP tunnel. In CU, assuming the tunnel is in place, the right call back decapsulate the transport (cu_ul_recv()), then calls pdcp_data_ind() in CU
The SRB are sent in DU RRC tasks via itti F1AP_UL_RRC_MESSAGE (see above the processing)
2. For DL, pdcp (in CU for DRBs) calls rlc_data_req (by a decoupling queue and thread rlc_data_req_thread, so function du_rlc_data_req() or enqueue_rlc_data_req()). in DU, assuming the gtp-u tunnel exists, a reception call back (du_dl_recv()) decapsulate the gtp-u packet and calls du_rlc_data_req()
Hereafter the processing design, that doesn't require to setup a new context storage, as we can use the GTP-U internal tables: rnti+rb=>teid for outgoing gtp-u packets and teid=>rnti+rb for incoming gtp-u packets
In CU case, the DRB tunnel to DU and the tunnel on N3 have the same key (rnti, rb id), but they run in two different GTP-U instances.
Each instance binds on diffrent sockets.
For F1-U, both DU and CU binds on the full quadruplet (IP source, port source, IP destination, port destination) from the configuration file parameters:
local_s_address, remote_s_address,local_s_portd, remote_s_portd
These 4 values are in:
CU: at cell level (same level as nr_cellid parameter), they are read if tr_s_preference = "f1"; is set
DU: in block MACRLCs, if tr_n_preference = "f1"; is set in this block
## tunnels setup
In GTP-U, TS 29.281 specifies a option header (NR RAN Container This extension header may be transmitted in a G-PDU over the X2-U, Xn-U and F1-U user plane interfaces), but it is not mandatory optional header (as is the N3 one).
So, we can use this header a something reliable with other vendors implementation.
In DL, we need to associate the packet with: rnti, rb (radio bearer) and "mui" (a OAI internal id that is optional and may be removed soon) to call rlc_data_req()
In UL, we need also the RNTI, the rb
So, we need to create a gtp-u tunnel for each rb over F1, then manage in CU and DU the association between a uniq TEid and the pair(rnti, rb). This is already what we have in existing OAI GTP-U layer interface.
In F1AP, for each "DRB to Be Setup Item IEs", we have a field TNL (transport network layer) to set a specific GTP tunnel (@IP, TEid, udp port is always 2152). This is the same for each message related to DRBs. (F1AP carries the SRB payload inside F1AP).
So, For each F1AP containing DRB setup/modification/deletion, the related GTP-U tunnels will be modified one to one.
The exception is the intialisation of new tunnel: in the call to tunnel creation, we need to send the remote TEID, but we don't know yet if we are the initial source. In this case, we issue a dummy (0xFFFF) remote teid; when we receive the remote answer, we get the source teid, that we can inform GTP-U with (using update tunnel).
## processing on GTP-U incoming message
Du_dl_recv() or cu_ul_recv() are called because we have set this callbacks in creat/update tunnel calls to gtp-u. As gtp-u maintains a pair(rnti,rbid) associated to each tunnel, the functions can be very simple stateless callback that calls pdcp_data_ind() or rlc_data_req() to get back in normal processing path
## CU/DU outgoing
DU rlc north output goes to du_pdcp_data_ind() that push a outgoing packet request to gtp-u, using the rnti+rb as ids. GTP-U must have the tunnel existing, then it simply implement the same as in N3 for exemple.
CU pdcp south output calls cu_rlc_data_ind() that do the same symetric processing.
# High-level F1-C code structure
## High-level F1-C code structure
The F1 interface is used internally between CU (mostly RRC) and DU (mostly MAC)
to exchange information. In DL, the CU sends messages as defined by the
@@ -252,3 +92,233 @@ Monolithic: mac_rrc_dl_direct.c | |
| |
+-------------+
```
# Data plane status (F1-U)
F1-U uses GTP-U for information exchange. The GTP protocol uses some extensions
for NR-U protocol to report buffer status, but this is not properly tested and
might malfunction. One limitation is that the current implementation
acknowledges each packet individually.
Multiple DUs at one CU are supported in the data plane (as in the control plane).
# How to run
As mentioned earlier, OAI uses F1 internally. It is always compiled in.
To start CU/DU, you use `./nr-softmodem` with the appropriate configuration
files, for instance:
```
sudo cmake_targets/ran_build/build/nr-softmodem --sa -O ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf
sudo cmake_targets/ran_build/build/nr-softmodem --sa -O ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf
```
These files are tested in the CI, and are configured for use in docker,
see [this `docker-compose` file](../ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml).
## Configuration of F1 IP/port information
For a local deployment, you should update the following fields.
We assume that the CU will bind on `192.168.70.129` towards the core,
`127.0.0.3` towards the DU, and the DU `127.0.0.4` towards the CU.
In the CU file:
- Update the `gNBs.[0].amf_ip_address` and `gNBs.[0].NETWORK_INTERFACES`
section towards the core (typically, OAI CN is configured to provide a docker
bridge on `192.168.70.129` and the AMF is on `192.168.70.132`):
- `gNBs.[0].amf_ip_address.[0].ipv4 192.168.70.132`
- `gNBs.[0].NETWORK_INTERFACES.GNB_IPV4_ADDRESS_FOR_NG_AMF 192.168.70.129`
- `gNBs.[0].NETWORK_INTERFACES.GNB_IPV4_ADDRESS_FOR_NGU 192.168.70.132`
- Set `gNBs.[0].tr_s_preference` (transport south-bound) to `f1`
- Update the `gNBs.[0].local_s_address` (CU-local south address) for the F1-C
south-bound interface: `127.0.0.3`
- Note: the `gNBs.[0].remote_s_address` (CU-remote/DU south address) is
ignored, but we recommend to put `0.0.0.0` ("any")
- Ports should match the ones in the DU config, but for simplicity and
standards-conformity, simply set all to 2152:
- `local_s_portc` in CU should match `remote_n_portc` in DU
- `local_s_portd` in CU should match `remote_n_portd` in DU
- `remote_s_portc` in CU should match `local_n_portc` in DU
- `remote_s_portd` in CU should match `local_n_portd` in DU
In the DU file:
- Set `MACRLCs.[0].tr_n_preference` to `f1`
- Update `MACRLCs.[0].local_n_address` (local north-bound address of the DU) to
`127.0.0.4`
- Update `MACRLCs.[].remote_n_address` (remote north-bound address of the CU)
to `127.0.0.3`
Note: all `local_*_if_name` parameters are ignored.
## Configuration of multiple DUs
Upon F1 Setup Request of a new DU, the CU cross-checks that
- no DUs have the same gNB-DU IDs, taken from `gNBs.[0].gNB_ID`, and
- no cells have the same NR Cell ID, taken from `gNBs.[0].nr_cellid`, and
- no cells have the same physical cell IDs, taken from `gNBs.[0].servingCellConfigCommon.[0].physCellId`.
If any of these are the same, the CU will reject the DU with an F1 Setup
Failure. Thus, you should make sure that in the DU's configs, these parameters
are set differently.
You have to of course make sure that the local interface of the DU
(`MACRLCs.[0].local_n_address`) is different as well.
Assuming you use RFsim, you should make the RFsimulator server side (typically
the gNB) bind on different hosts (`rfsimulator.serverport`).
# Code documentation
## Common multi-threading architecture
The CU and DU interfaces are based on ITTI threads (see `common/utils/ocp_itti/itti.md`)
adopted by all OAI upper layers to run isolated threads dedicated to one feature.
```mermaid
graph TD
Linux[configuration file] --> APP[gNB_app_task]
Socks[Linux UDP] --> GTP[nr_gtpv1u_gNB_task]
APP --> CU
APP --> DU
A[Linux SCTP] -->|sockets| SCTP(OAI itti thread TASK_SCTP)
SCTP-->|TASK_NGAP| NG[ngap_gNB_task]
NG-->|TASK_SCTP| SCTP
SCTP-->|TASK_DU_F1| DU[F1AP_DU_task]
SCTP-->|TASK_CU_F1| CU[F1AP_CU_task]
CU-->|TASK_RRC_GNB| RRC
RRC -->|non ITTI| PHY[OAI L1+L2]
RRC -->|API calls to create tunnels| GTP
PHY --> |user plane| GTP
CU --> |TASK_GTPV1_U| GTP
DU --> |TASK_GTPV1_U| GTP
```
A "task" is a Linux thread running an infinite waiting loop on one ITTI queue.
The `app` task manages the initial configuration; the `sctp` task manages the
SCTP Linux sockets.
The CU encoding/decoding runs in the task executing `F1AP_CU_task()`. It stores its private data context in a static variable.
The DU encoding/decoding runs in the task executing `F1AP_DU_task()`. The design is similar to CU task.
All GTP-U tunnels are managed in a Linux Thread, that have partially ITTI design:
1. tunnel creation/deletion is by C API functions direct calls (a mutex protects it)
2. outgoing packets are pushed in a ITTI queue to the gtp thread
3. incoming packets are sent to the tunnel creator using a C callback (the callback function is given in tunnel creation order). The callback should not block
## F1-C messages towards the CU
The CU thread starts when the CU starts. It opens listening socket on the
configuration-specified IP/port by sending the appropriate message to
`TASK_SCTP`. It will accept any incoming connection and forward any F1 message
to RRC.
You can trace any message by looking up the handler
`cu_task_handle_sctp_data_ind()`, which ultimately triggers a corresponding
ITTI message sent to RRC. All ITTI messages arriving are dispatched in the ITTI
message handling function in `rrc_gNB.c`. For your convenience, find below a
table of same messages that might arrive from the DU and how they are
forwarded.
After handling messages, the RRC uses a callback that determines if messages go
directly to the MAC or are sent to the CU ITTI task (see
[above](#high-level-f1-c-code-structure))
You might also want to consult TS 38.401 regarding the message exchange.
| Incoming F1 message | ITTI message to RRC | RRC handler | Comments |
|---------------------|---------------------|-------------|----------|
| F1 Setup Request | `F1AP_SETUP_REQ` | `rrc_gNB_process_f1_setup_req()` | will trigger either a response or failure |
| Initial UL RRC Message Transfer | `F1AP_INITIAL_UL_RRC_MESSAGE` | `rrc_gNB_process_initial_ul_rrc_message()` | first message from UE, follows up with RRC Setup or Reestablishment |
| UL RRC Message Transfer | `F1AP_UL_RRC_MESSAGE` | `rrc_gNB_decode_dcch()` | UL RRC messages contain DCCH |
| UE Context Response | `F1AP_UE_CONTEXT_SETUP_RESP` | `rrc_CU_process_ue_context_setup_response()` | does not trigger a follow-up, as UE sends Security Response |
| UE Context Modification Response | `F1AP_UE_CONTEXT_MODIFICATION_RESP` | `rrc_CU_process_ue_context_modification_response()` | triggers Reconfiguration if CellGroup in answer |
| UE Context Modification Required | `F1AP_UE_CONTEXT_MODIFICATION_REQUIRED` | `rrc_CU_process_ue_modification_required()` | triggers Reconfiguration |
| UE Context Release Request | `F1AP_UE_CONTEXT_RELEASE_REQ` | `rrc_CU_process_ue_context_release_request()` | RRC will trigger UE release |
| UE Context Release Complete | `F1AP_UE_CONTEXT_RELEASE_COMPLETE` | `rrc_CU_process_ue_context_release_complete()` | frees UE Context, signals to NGAP |
## F1-C Messages towards the DU
The task "gNB app", after reading the configuration file, sends a message
`F1AP_DU_REGISTER_REQ` to the DU task. This message contains network
configuration for the establishment of the SCTP connection, as well as the F1
Setup Request to be sent to the CU.
Using the network configuration, the DU task sets up an SCTP connection via the
SCTP task. When it receives from the SCTP task the socket creation success,
the DU task encodes and sends the F1 setup message to the CU.
Similarly as for the CU, you can trace any message by looking up the handler
`du_task_handle_sctp_data_ind()`. Unlike in the CU, the decoders do NOT send an
ITTI message, but directly call into the scheduler via a message handling
function. This handler acquires the scheduler mutex and executes the
corresponding message handling functionality. All handlers are in
`mac_rrc_dl_handler.c`.
After handling messages, the MAC uses a callback that determines if messages
are sent back to RRC via ITTI, or are sent to the DU ITTI task (see
[above](#high-level-f1-c-code-structure))
You might also want to consult TS 38.401 regarding the message exchange.
| Incoming F1 message | MAC handler | Comments |
|---------------------|-------------|----------|
| F1 Setup Response | `f1_setup_response()` | the DU does not start the radio before receiving this message |
| DL RRC Message Transfer | `dl_rrc_message_transfer()` | Processing timer started if reconfiguration is present[^footnote-reconfig] |
| UE Context Setup Request | `ue_context_setup_request()` | |
| UE Context Modification Request | `ue_context_modification_request()` | |
| UE Context Modification Confirm | `ue_context_modification_confirm()` | |
| UE Context Modification Refuse | `ue_context_modification_refuse()` | Will trigger release request |
| UE Context Release Command | `ue_context_release_command()` | Starts timer for release if UE in sync |
[^footnote-reconfig]: The DU does not decode RRC messages, and does not know
whether an RRC message is a reconfiguration. However, the spec mandates that
a reconfiguration has to be triggered if the CU receives a CellGroupConfig,
originating at the DU. See also flag `expect_reconfiguration`.
## F1-U messages
### General
In the DU in UL, RLC checks in `deliver_sdu()` if we are operating in split
mode, and either (direct) calls `pdcp_data_ind` (DRB) or (f1ap) sends an
`GTPV1U_TUNNEL_DATA_REQ` ITTI message to the GTP task.
In the CU in UL, assuming the tunnel is in place, GTP decapsulates the packet
and calls the callback `cu_f1u_data_req()`, which calls `pdcp_data_ind()` in CU.
In the CU in DL, the PDCP function `deliver_pdu_drb_gnb()` either (direct) calls
into the RLC via `enqueue_rlc_data_req()`, or (f1ap) sends a
`GTPV1U_TUNNEL_DATA_REQ` ITTI message to the GTP task.
In the DU in DL, assuming the GTP-U tunnel exists, GTP decapsulates the packet
and calls the reception call back `du_rlc_data_req()`, which calls
`enqueue_rlc_data_req()` in turn.
## Tunnel Setup
In GTP-U, TS 29.281 specifies a optional header (NR RAN Container). This
extension header may be transmitted in a G-PDU over the X2-U, Xn-U and F1-U user
plane interfaces, but it is not mandatory.
Note that the GTP-U uses internal tables. Instead of exposing TEIDs, it uses the
UE ID (RNTI, RRC UE ID) and Radio Bearer ID to map to a TEID for outgoing GTP-U
packets. Upon receiving, it does the reverse and calls the callbacks. In the CU
case, the DRB tunnel to DU and the tunnel on N3 have the same keys (RRC UE ID,
RB ID), but they run in two different GTP-U instances. Each instance binds on
diffrent sockets, which is the reason you cannot have the same interface for
F1-U and N3/NG-U interfaces (this can be considered a design flaw).
In F1AP, for each "DRB to Be Setup Item IEs", we have a field TNL (transport
network layer) to set a specific GTP tunnel (@IP, TEid). This is the same for
each message related to DRBs.
So, For each F1AP containing DRB setup/modification/deletion, the related GTP-U
tunnels will be modified one to one. The exception is the intialisation of new
tunnel: in the call to tunnel creation, we need to send the remote TEID, but we
don't know yet if we are the initial source. In this case, we issue a dummy
(0xFFFF) remote TEID; when we receive the remote answer, we get the source teid,
with which the GTP-U endpoint is updadet.

View File

@@ -305,6 +305,7 @@ Furthermore, the gNB and UE support
- HARQ procedures
* ULSCH scheduler
- Configuration of fapi PDU according to DCI
- Logical channel prioritization of 'data from any logical channel'
* NR-CSIRS scheduler
- Scheduling of NR-CSIRS reception
- Fill UCI for CSI measurement reporting

View File

@@ -95,7 +95,7 @@ Command line parameters for UE in --sa mode:
- `--numerology` : numerology index (default value 1)
- `-r` : bandwidth in terms of RBs (default value 106)
- `--band` : NR band number (default value 78)
- `--ssb` : SSB start subcarrier (default value 512)
- `--ssb` : SSB start subcarrier (default value 516)
You can run this, using USRPs, on two separate machines:

View File

@@ -6,7 +6,7 @@
| Machine | IP address | Lockable Resource | Function | Connected devices |
| ------------- | --------------- | --------------------- | ------------------ | ----------------------------------------------------- |
| asterix | 172.21.16.127 | CI-Asterix-Usage | gNB (n78) | 172.21.19.14 |
| asterix | 172.21.16.127 | CI-Asterix-Usage | *unused* | 172.21.19.14 |
| obelix | 172.21.16.128 | CI-Obelix-Usage | eNB (n40, n78), nrUE | 172.21.19.13, X300 (192.168.60.2) |
| porcepix | 172.21.16.136 | CI-Porcepix | Executor, EPC, 5GC | -- |
| nrmodule2 | 172.21.16.139 | CI-NrModule2 | Quectel | Quectel module |
@@ -15,25 +15,19 @@
| idefix | 172.21.16.135 | CI-Idefix | Quectel | Quectel module |
| caracal | 172.21.16.132 | CI-Caracal | gNB/phytest | N300 (192.168.10.2) |
| amariue | 172.21.16.144 | CI-Amarisoft-UE-Usage | nrUE | Amarisoft UE simulator |
| manarola | 172.21.8.116 | _None_ | gNB | AW2S |
| nano | 172.21.18.48 | CI-Nano-Legacy-EPC | Executor, EPC, adb | 2x COTS (adb) |
| hutch | 172.21.18.46 | CI-Hutch-Legacy-FDD-eNB | eNB (B7) | B200mini (30C5239) |
| starsky | 172.21.18.45 | CI-Starsky-Legacy-TDD-eNB | eNB (B40) | b200mini (30A3E3C) |
| carabe | 172.21.18.47 | CI-Carabe-Legacy-FDD-OAI-LTE-UE | UE (B7UE) | B200mini (30AE8C9) |
| nokiabox | 172.21.19.39 | _None_ | gNB (Nokia), 5GC | _Nokia RF integrated_ |
| avra | 172.21.16.124 | CI-Avra-Usage | gNB (n78) | AW2S Jaguar (192.168.80.239) |
| orion | 172.21.16.134 | CI-Orion-Build-Sanity-Check-Deploy-Test, CI-Orion-DsTester-Deploy-Test | Build | |
| bellatrix | 172.21.16.104 | CI-Bellatrix-RAN-Docker | Static Code Analysis | -- |
Note: The available resources, and their current usage, is indicated here:
- [Lockable resources of jenkins-oai](https://jenkins-oai.eurecom.fr/lockable-resources/):
"New" Jenkins, i.e., with RAN-Container-Parent
## Networked devices
| Type | IP address (mgmt) |
| ------------- | ----------------- |
| USRP N310 | 172.21.19.14 |
| USRP N310 | 172.21.19.13 |
## Testbenches
### 5G OTA Testbench
@@ -82,61 +76,116 @@ Note: The available resources, and their current usage, is indicated here:
### [RAN-Container-Parent](https://jenkins-oai.eurecom.fr/job/RAN-Container-Parent/)
**Purpose**: automatically triggered tests on MR creation or push, from Gitlab
Webhook
Webhook ~documentation ~BUILD-ONLY ~4G-LTE ~5G-NR
- [RAN-cppcheck](https://jenkins-oai.eurecom.fr/job/RAN-cppcheck/1664/)
- obelix
This pipeline has basically two main stages, as follows. For the image build,
please also refer to the [dedicated documentation](../docker/README.md) for
information on how the images are built.
#### Image Build pipelines
- [RAN-ARM-Cross-Compile-Builder](https://jenkins-oai.eurecom.fr/job/RAN-ARM-Cross-Compile-Builder/)
~BUILD-ONLY ~4G-LTE ~5G-NR
- orion: Cross-compilation from Intel to ARM
- base image from `Dockerfile.base.ubuntu20.cross-arm64`
- build image from `Dockerfile.build.ubuntu20.cross-arm64` (no target images)
- [RAN-cppcheck](https://jenkins-oai.eurecom.fr/job/RAN-cppcheck/)
~BUILD-ONLY ~4G-LTE ~5G-NR
- bellatrix
- performs static code analysis, currently not actively enforced
- [RAN-RHEL8-Cluster-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-RHEL8-Cluster-Image-Builder/)
~BUILD-ONLY ~4G-LTE ~5G-NR
- cluster (`Asterix-OC-oaicicd-session` resource): RHEL image build using the OpenShift Cluster (using gcc/clang)
- base image from `Dockerfile.build.rhel9`
- build image from `Dockerfile.build.rhel9`, followed by
- target image from `Dockerfile.eNB.rhel9`
- target image from `Dockerfile.gNB.rhel9`,
- target image from `Dockerfile.gNB.aw2s.rhel9`
- target image from `Dockerfile.nr-cuup.rhel9`
- target image from `Dockerfile.lteUE.rhel9`
- target image from `Dockerfile.nrUE.rhel9`
- build image from `Dockerfile.phySim.rhel9` (creates as direct target physical simulator
image)
- build image from `Dockerfile.clang.rhel9` (compilation only, artifacts not used currently)
- [RAN-Ubuntu18-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu18-Image-Builder/)
~BUILD-ONLY ~4G-LTE ~5G-NR
- obelix: Ubuntu 20 image build using docker (Note: builds U20 images while pipeline is named U18!)
- base image from `Dockerfile.base.ubuntu20`
- build image from `Dockerfile.build.ubuntu20`, followed by
- target image from `Dockerfile.eNB.ubuntu20`
- target image from `Dockerfile.gNB.ubuntu20`
- target image from `Dockerfile.nr-cuup.ubuntu20`
- target image from `Dockerfile.nrUE.ubuntu20`
- target image from `Dockerfile.lteUE.ubuntu20`
- target image from `Dockerfile.lteRU.ubuntu20`
#### Image Test pipelines
- [OAI-CN5G-COTS-UE-Test](https://jenkins-oai.eurecom.fr/job/OAI-CN5G-COTS-UE-Test/)
~5G-NR
- using 5GC bench (resources `CI-Cetautomatix-OC-oaicicd-session`, `CI-Dogmatix-CN5G-gNB`): Attach/Detach of UE with multiple PDU sessions
- [RAN-gNB-N300-Timing-Phytest-LDPC](https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-gNB-N300-Timing-Phytest-LDPC/)
~5G-NR
- caracal + N310
- pure performance test through phy-test scheduler, see command line for more details
- [RAN-Interop-F1](https://jenkins-oai.eurecom.fr/job/RAN-Interop-F1/)
~5G-NR
- ofqot (DU, 1x UE)
- F1 interoperability testing: sets up connection to Accelleran CU, UE connection and connectivity test
- F1 interoperability: set up connection between Accelleran CU and OAI DU and pass all traffic over F1
- 3rd-party gNB/CU interoperability: set up connection between Accelleran CU and OAI UE and test connectivity
- [RAN-L2-Sim-Test-4G](https://jenkins-oai.eurecom.fr/job/RAN-L2-Sim-Test-4G/)
~4G-LTE
- obelix (eNB, 1x UE, OAI EPC)
- L2simulator: skips physical layer and uses proxy between eNB and UE
- [RAN-L2-Sim-Test-5G](https://jenkins-oai.eurecom.fr/job/RAN-L2-Sim-Test-5G/)
~5G-NR
- obelix (gNB, 1x UE, OAI 5GC)
- L2simulator: skips physical layer and uses proxy between gNB and UE, currently only ping
- [RAN-LTE-FDD-LTEBOX-Container](https://jenkins-oai.eurecom.fr/job/RAN-LTE-FDD-LTEBOX-Container/)
~4G-LTE
- hutch + B210, nano w/ ltebox + 2x UE
- tests RRC inactivity timers, different bandwidths, IF4p5 fronthaul
- [RAN-LTE-FDD-OAIUE-OAICN4G-Container](https://jenkins-oai.eurecom.fr/job/RAN-LTE-FDD-OAIUE-OAICN4G-Container/)
~4G-LTE
- hutch + B210 (eNB), carabe + B210 (4G UE), nano w/ OAI 4GC
- tests OAI 4G for 10 MHz/TM1; known to be unstable
- [RAN-LTE-TDD-2x2-Container](https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-LTE-TDD-2x2-Container/)
~4G-LTE
- obelix + N310, porcepix, nrmodule2 + Quectel
- TM1 and TM2 test, IF4p5 fronthaul
- [RAN-LTE-TDD-LTEBOX-Container](https://jenkins-oai.eurecom.fr/job/RAN-LTE-TDD-LTEBOX-Container/)
~4G-LTE
- starsky + B210, nano w/ ltebox + 2x UE
- TM1 over bandwidths 5, 10, 20 MHz in Band 40, default scheduler for 20 MHz
- [RAN-NSA-B200-Module-LTEBOX-Container](https://jenkins-oai.eurecom.fr/job/RAN-NSA-B200-Module-LTEBOX-Container/)
~4G-LTE ~5G-NR
- nepes + B200 (eNB), ofqot + B200 (gNB), idefix + Quectel, nepes w/ ltebox
- basic NSA test
- [RAN-PhySim-Cluster](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster/)
~4G-LTE ~5G-NR
- cluster (`Asterix-OC-oaicicd-session` resource), tests in OpenShift Cluster
- unitary simulators (`nr_dlsim`, etc.)
- [RAN-RF-Sim-Test-4G](https://jenkins-oai.eurecom.fr/job/RAN-RF-Sim-Test-4G/)
~4G-LTE
- obelix (eNB, lteUE, OAI EPC)
- uses RFsimulator, for FDD 5, 10, 20MHz with core, 5MHz noS1
- [RAN-RF-Sim-Test-5G](https://jenkins-oai.eurecom.fr/job/RAN-RF-Sim-Test-5G/)
~5G-NR
- obelix (gNB, nrUE, OAI 5GC)
- uses RFsimulator, TDD 40MHz, FDD 40MHz, F1 split
- [RAN-RHEL8-Cluster-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-RHEL8-Cluster-Image-Builder/)
- cluster (`Asterix-OC-oaicicd-session` resource): RHEL 8 image build using the OpenShift Cluster
- [RAN-SA-AW2S-CN5G](https://jenkins-oai.eurecom.fr/job/RAN-SA-AW2S-CN5G/)
~5G-NR
- 5G-NR SA test setup: avra(RHEL9.1) + AW2S, amariue, OAI CN5G
- uses OpenShift cluster for CN deployment and container images for gNB deployment
- multi UE testing
- multi UE testing using Amarisoft UE simulator
- [RAN-SA-B200-Module-SABOX-Container](https://jenkins-oai.eurecom.fr/job/RAN-SA-B200-Module-SABOX-Container/)
~5G-NR
- ofqot + B200, idefix + Quectel, nepes w/ sabox
- basic SA test (20 MHz TDD), F1, reestablishment, ...
- [RAN-SA-OAIUE-CN5G](https://jenkins-oai.eurecom.fr/job/RAN-SA-OAIUE-CN5G/)
~5G-NR
- 5G-NR SA test setup: gNB on avra(RHEL9.2) + N310, OAIUE on caracal(RHEL9.1) + N310, OAI CN5G
- OpenShift cluster for CN deployment and container images for gNB and UE deployment
- [RAN-Ubuntu18-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu18-Image-Builder/)
- obelix: Ubuntu 20 image build using docker (Note: builds U20 images while pipeline is named U18!)
### RAN-CI-NSA-Trigger
@@ -148,6 +197,53 @@ Webhook
- [RAN-SA-Module-CN5G](https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-Module-CN5G/)
- asterix + N310 (gNB), nrmodule2 + Quectel, porcepix w/ OAI 5GC
- NR 2x2 (standalone)
- [RAN-SA-AmariS-CN5G](https://jenkins-oai.eurecom.fr/view/RAN/job/RAN-SA-AmariS-CN5G/)
- asterix + N310, amariue (1x UE), porcepix w/ OAI 5GC
- Amarisoft UE simulator: expected to be increased to more UEs
## How to reproduce CI results
The CI builds docker images at the beginning of every test run. To see the
exact command line steps, please refer to the `docker/Dockerfile.build.*`
files. Note that the console log of each pipeline run also lists the used
docker files.
The CI uses these images for *most* of the pipelines. It uses docker-compose to
orchestrate the images. To identify the docker-compose file, follow these
steps:
1. Each CI test run HTML lists the XML file used for a particular test run.
Open the corresponding XML file under `ci-scripts/xml_files/`.
2. The XML file has a "test case" that refers to deployment of the image; it
will reference a directory containing a YAML file (the docker-compose file)
using option `yaml_path`, which will be under `ci-scripts/yaml_files/`. Go
to this directory and open the docker-compose file.
3. The docker-compose file can be used to run images locally, or you can infer
the used configuration file and possible additional options that are to be
passed to the executable to run from source.
For instance, to see how the CI runs the multi-UE 5G RFsim test case, the above
steps look like this:
1. The first tab in the 5G RFsim test mentions
`xml_files/container_5g_rfsim.xml`, so open
`ci-scripts/xml_files/container_5g_rfsim.xml`.
2. This XML file has a `DeployGenObject` test case, referencing the directory
`yaml_files/5g_rfsimulator`. The corresponding docker-compose file path is
`ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml`.
3. To know how to run the gNB, realize that there is a section `oai-gnb`. It
mounts the configuration
`ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf` (note that the path
is relative to the directory in which the docker-compose file is located).
Further, an environment variable `USE_ADDITIONAL_OPTIONS` is declared,
referencing the relevant options `--sa -E --rfsim` (you can ignore logging
options). You would therefore run the gNB from source like this:
```
sudo ./cmake_targets/ran_build/build/nr-softmodem -O ci-scripts/conf_files/gnb.sa.band78.106prb.rfsim.conf --sa -E --rfsim
```
To run this on your local machine, assuming you have a 5GC installed, you
might need to change IP information in the config to match your core.
If you wish, you can rebuild CI images locally following [these
steps](../docker/README.md) and then use the docker-compose file directly.
Some tests are run from source (e.g.
`ci-scripts/xml_files/gnb_phytest_usrp_run.xml`), which directly give the
options they are run with.

View File

@@ -29,6 +29,8 @@
FROM ubuntu:focal AS ran-base
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
# Specifying a working version of SIMDE for ARM:
ENV SIMDE_VERSION=389f360a66d4a3bec62b7d71ad8be877487809ba
#install developers pkg/repo
RUN apt-get update && \

View File

@@ -34,14 +34,19 @@ COPY . .
# build all targets so final targets can be created afterwards
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p ran_build/build ran_build/build-cross && \
mkdir -p log ran_build/build ran_build/build-cross && \
cd ran_build/build && \
cmake ../../.. -GNinja && \
echo "====== Start of log for host-tools ======" && \
ninja ldpc_generators generate_T && \
ninja ldpc_generators generate_T > ../../log/host-tools.txt 2>&1 && \
echo "====== End of log for host-tools ======" && \
cd ../build-cross/ && \
cmake ../../.. -GNinja -DCMAKE_TOOLCHAIN_FILE=../../../cmake_targets/cross-arm.cmake -DNATIVE_DIR=../build && \
echo "====== Start of log for cross-build executables ======" && \
ninja dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem params_libconfig coding rfsimulator && \
# making always passing so we can analyze the all.txt file
ninja dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem params_libconfig coding rfsimulator > ../../log/all.txt 2>&1; \
# displaying errors and warnings
egrep -A3 "warning:|error:" ../../log/all.txt || true && \
# will fail only for errors
egrep -L "error:" ../../log/all.txt && \
echo "====== End of log for cross-build executables ======"

View File

@@ -47,8 +47,8 @@ int create_tasks_ue(uint32_t ue_nb) {
if (users == NULL) abort();
users->count = ue_nb;
if (itti_create_task (TASK_NAS_UE, nas_ue_task, users) < 0) {
ittiTask_parms_t parms = {users, NULL};
if (itti_create_task(TASK_NAS_UE, nas_ue_task, &parms) < 0) {
LOG_E(NAS, "Create task for NAS UE failed\n");
return -1;
}

View File

@@ -2889,7 +2889,7 @@ RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mas
int i = 0;
paramdef_t RUParams[] = RUPARAMS_DESC;
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
config_getlist(config_get_if(), &RUParamList, RUParams, sizeofArray(RUParams), NULL);
RU_t **ru=NULL;
if ( RUParamList.numelt > 0) {
ru = (RU_t **)malloc(nb_RU*sizeof(RU_t *));

View File

@@ -289,10 +289,10 @@ void exit_function(const char *file, const char *function, const int line, const
}
}
static void get_options(void) {
static void get_options(configmodule_interface_t *cfg)
{
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
get_common_options(SOFTMODEM_ENB_BIT );
get_common_options(cfg, SOFTMODEM_ENB_BIT);
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
@@ -313,10 +313,6 @@ static void get_options(void) {
}
}
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
int CC_id;
@@ -438,7 +434,7 @@ static void wait_nfapi_init(char *thread_name) {
pthread_mutex_unlock(&nfapi_sync_mutex);
printf( "NFAPI: got sync (%s)\n", thread_name);
}
configmodule_interface_t *uniqCfg = NULL;
int main ( int argc, char **argv )
{
int CC_id = 0;
@@ -446,7 +442,7 @@ int main ( int argc, char **argv )
start_background_system();
if ( load_configmodule(argc,argv,0) == NULL) {
if ((uniqCfg = load_configmodule(argc, argv, 0)) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
@@ -454,7 +450,7 @@ int main ( int argc, char **argv )
logInit();
set_latency_target();
printf("Reading in command-line options\n");
get_options ();
get_options(uniqCfg);
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
@@ -617,7 +613,7 @@ int main ( int argc, char **argv )
create_tasks_mbms(1);
sleep(1);
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
config_check_unknown_cmdlineopt(uniqCfg, CONFIG_CHECKALLSECTIONS);
// wait for end of program
LOG_UI(ENB_APP,"TYPE <CTRL-C> TO TERMINATE\n");

View File

@@ -270,7 +270,8 @@ void exit_function(const char *file, const char *function, const int line, const
extern int16_t dlsch_demod_shift;
uint16_t node_number;
static void get_options(void) {
static void get_options(configmodule_interface_t *cfg)
{
int CC_id=0;
int tddflag=0;
int dumpframe=0;
@@ -281,11 +282,11 @@ static void get_options(void) {
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
/* unknown parameters on command line will be checked in main
after all init have been performed */
get_common_options(SOFTMODEM_4GUE_BIT );
get_common_options(cfg, SOFTMODEM_4GUE_BIT);
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
config_process_cmdline(cfg, cmdline_uemodeparams, sizeofArray(cmdline_uemodeparams), NULL);
config_process_cmdline(cfg, cmdline_ueparams, sizeofArray(cmdline_ueparams), NULL);
nfapi_setmode(nfapi_mode);
get_softmodem_params()->hw_timing_advance = timingadv;
@@ -356,7 +357,6 @@ static void get_options(void) {
}
}
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
int CC_id;
@@ -518,6 +518,7 @@ AssertFatal(false,"");
}
int NB_UE_INST = 1;
configmodule_interface_t *uniqCfg = NULL;
int main( int argc, char **argv ) {
@@ -525,11 +526,10 @@ int main( int argc, char **argv ) {
uint8_t abstraction_flag=0;
// Default value for the number of UEs. It will hold,
// if not changed from the command line option --num-ues
configmodule_interface_t *config_mod;
start_background_system();
config_mod = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY);
uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY);
if (config_mod == NULL) {
if (uniqCfg == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
@@ -541,7 +541,7 @@ int main( int argc, char **argv ) {
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
get_options ();
get_options(uniqCfg);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
sf_ahead = 1;
@@ -680,7 +680,7 @@ int main( int argc, char **argv ) {
if(IS_SOFTMODEM_DOSCOPE)
load_softscope("ue",NULL);
config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS);
config_check_unknown_cmdlineopt(uniqCfg, CONFIG_CHECKALLSECTIONS);
printf("Sending sync to all threads (%p,%p,%p)\n",&sync_var,&sync_cond,&sync_mutex);
pthread_mutex_lock(&sync_mutex);
sync_var=0;

View File

@@ -115,20 +115,15 @@ void exit_function(const char *file, const char *function, const int line, const
}
}
static void get_options(void) {
static void get_options(configmodule_interface_t *cfg)
{
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
get_common_options(SOFTMODEM_ENB_BIT );
get_common_options(cfg, SOFTMODEM_ENB_BIT);
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
//RCConfig();
// RCConfig();
}
extern void phy_free_RU(RU_t *);
nfapi_mode_t nfapi_getmode(void) {
@@ -144,17 +139,17 @@ void wait_eNBs(void){ return; }
uint64_t downlink_frequency[MAX_NUM_CCs][4];
configmodule_interface_t *uniqCfg = NULL;
int main ( int argc, char **argv )
{
if ( load_configmodule(argc,argv,0) == NULL) {
if ((uniqCfg = load_configmodule(argc, argv, 0)) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
logInit();
printf("Reading in command-line options\n");
get_options ();
get_options(uniqCfg);
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n");
@@ -180,7 +175,7 @@ int main ( int argc, char **argv )
paramdef_t RUParams[] = RUPARAMS_DESC;
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
config_getlist(config_get_if(), &RUParamList, RUParams, sizeofArray(RUParams), NULL);
int j=0;
uint64_t ru_mask=1;
@@ -366,8 +361,8 @@ int main ( int argc, char **argv )
phy_free_RU(ru);
free_lte_top();
end_configmodule();
end_configmodule(uniqCfg);
if (ru->rfdevice.trx_end_func) {
ru->rfdevice.trx_end_func(&ru->rfdevice);
ru->rfdevice.trx_end_func = NULL;

View File

@@ -95,12 +95,6 @@ void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Beare
abort();
}
int nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(const protocol_ctxt_t *const ctxt_pP, const gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp_p, int offset)
{
abort();
return 0;
}
void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p, e1ap_bearer_setup_resp_t *e1ap_resp)
{
abort();
@@ -108,20 +102,20 @@ void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_contex
f1ap_cudu_inst_t *getCxt(instance_t instanceP)
{
abort();
return NULL;
// the E1 module uses F1's getCxt() to decide whether there is F1-U and if
// so, what is the GTP instance. In the CU-UP, we don't start the F1 module,
// and instead, E1 handles the GTP-U endpoint. In the following, we fake the
// instance and put the right GTP-U instance number in.
const e1ap_upcp_inst_t *e1inst = getCxtE1(instanceP);
static f1ap_cudu_inst_t fake = {0};
fake.gtpInst = e1inst->gtpInstF1U;
return &fake;
}
NR_DRB_ToAddModList_t *fill_DRB_configList(gNB_RRC_UE_t *ue)
{
abort();
return NULL;
}
configmodule_interface_t *uniqCfg = NULL;
int main(int argc, char **argv)
{
/// static configuration for NR at the moment
if (load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY) == NULL) {
if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) {
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
}
logInit();
@@ -134,7 +128,7 @@ int main(int argc, char **argv)
AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
rc = itti_create_task(TASK_CUUP_E1, E1AP_CUUP_task, NULL);
AssertFatal(rc >= 0, "Create task for CUUP E1 failed\n");
nr_pdcp_layer_init();
nr_pdcp_layer_init(true);
cu_init_f1_ue_data(); // for CU-UP/CP mapping: we use the same
MessageDef *msg = RCconfig_NR_CU_E1(true);
AssertFatal(msg != NULL, "Send init to task for E1AP UP failed\n");

View File

@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file lte-enb.c
/*! \file nr-gnb.c
* \brief Top-level threads for gNodeB
* \author R. Knopp, F. Kaltenberger, Navid Nikaein
* \date 2012
@@ -290,7 +290,7 @@ void rx_func(void *param)
pushTpool(&gNB->threadPool, res);
}
} else if (get_softmodem_params()->continuous_tx) {
notifiedFIFO_elt_t *res = pullTpool(&gNB->L1_tx_free, &gNB->threadPool);
notifiedFIFO_elt_t *res = pullNotifiedFIFO(&gNB->L1_tx_free);
if (res == NULL)
return; // Tpool has been stopped
processingData_L1tx_t *syncMsg = (processingData_L1tx_t *)NotifiedFifoData(res);
@@ -420,10 +420,8 @@ void *nrL1_stats_thread(void *param) {
// two parallel L1 tx threads.
void *tx_reorder_thread(void* param) {
PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param;
notifiedFIFO_elt_t *resL1Reserve = NULL;
resL1Reserve = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
notifiedFIFO_elt_t *resL1Reserve = pullNotifiedFIFO(&gNB->L1_tx_out);
AssertFatal(resL1Reserve != NULL, "pullTpool() did not return start message in %s\n", __func__);
int next_tx_slot=((processingData_L1tx_t *)NotifiedFifoData(resL1Reserve))->slot;
@@ -436,15 +434,15 @@ void *tx_reorder_thread(void* param) {
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) {
LOG_E(PHY,"order mistake\n");
resL1Reserve = NULL;
resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
resL1 = pullNotifiedFIFO(&gNB->L1_tx_out);
}
} else {
resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
} else {
resL1 = pullNotifiedFIFO(&gNB->L1_tx_out);
if (resL1 != NULL && ((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot) {
if (resL1Reserve)
LOG_E(PHY,"error, have a stored packet, then a second one\n");
resL1Reserve = resL1;
resL1 = pullTpool(&gNB->L1_tx_out, &gNB->threadPool);
resL1 = pullNotifiedFIFO(&gNB->L1_tx_out);
if (((processingData_L1tx_t *)NotifiedFifoData(resL1))->slot != next_tx_slot)
LOG_E(PHY,"error, pull two msg, none is good\n");
}

View File

@@ -94,17 +94,15 @@ extern void nr_phy_config_request(NR_PHY_Config_t *gNB);
//extern PARALLEL_CONF_t get_thread_parallel_conf(void);
//extern WORKER_CONF_t get_thread_worker_conf(void);
void init_NR_RU(char *);
void start_NR_RU();
void stop_RU(int nb_ru);
void configure_ru(int idx, void *arg);
void configure_rru(int idx, void *arg);
int attach_rru(RU_t *ru);
int connect_rau(RU_t *ru);
static void NRRCconfig_RU(void);
static void NRRCconfig_RU(configmodule_interface_t *cfg);
extern uint32_t timing_advance;
extern int emulate_rf;
extern int numerology;
@@ -849,11 +847,11 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
txp[i] = (void *)&ru->common.txdata[i][fp->get_samples_slot_timestamp(slot, fp, 0)] - sf_extension * sizeof(int32_t);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST,
(timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance) & 0xffffffff);
(timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - timing_advance) & 0xffffffff);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1);
// prepare tx buffer pointers
txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - sf_extension,
timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - timing_advance - sf_extension,
txp,
siglen + sf_extension,
ru->nb_tx,
@@ -863,7 +861,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
"returned %d, E %f\n",
ru->idx,
i,
(long long unsigned int)(timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - sf_extension),
(long long unsigned int)(timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - timing_advance - sf_extension),
frame,
slot,
proc->frame_tx_unwrap,
@@ -1784,7 +1782,8 @@ void set_function_spec_param(RU_t *ru) {
} // switch on interface type
}
void init_NR_RU(char *rf_config_file) {
void init_NR_RU(configmodule_interface_t *cfg, char *rf_config_file)
{
int ru_id;
RU_t *ru;
PHY_VARS_gNB *gNB_RC;
@@ -1797,7 +1796,7 @@ void init_NR_RU(char *rf_config_file) {
pthread_cond_init(&RC.ru_cond,NULL);
// read in configuration file)
printf("configuring RU from file\n");
NRRCconfig_RU();
NRRCconfig_RU(cfg);
LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_nr_L1_inst,RC.nb_RU,get_nprocs());
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
@@ -1884,7 +1883,6 @@ void start_NR_RU()
start_RU_proc(ru);
}
void stop_RU(int nb_ru) {
for (int inst = 0; inst < nb_ru; inst++) {
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
@@ -1895,19 +1893,19 @@ void stop_RU(int nb_ru) {
/* --------------------------------------------------------*/
/* from here function to use configuration module */
static void NRRCconfig_RU(void)
static void NRRCconfig_RU(configmodule_interface_t *cfg)
{
paramdef_t RUParams[] = RUPARAMS_DESC;
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
config_getlist(&RUParamList, RUParams, sizeof(RUParams)/sizeof(paramdef_t), NULL);
config_getlist(cfg, &RUParamList, RUParams, sizeofArray(RUParams), NULL);
paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
paramdef_t GNBParams[] = GNBPARAMS_DESC;
paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0};
config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL);
config_get(cfg, GNBSParams, sizeofArray(GNBSParams), NULL);
int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt;
AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS);
config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL);
config_getlist(cfg, &GNBParamList, GNBParams, sizeofArray(GNBParams), NULL);
int N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr;
int N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr;
int XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr;

Some files were not shown because too many files have changed in this diff Show More