5 - [Documentation](#documentation)
6 - [Compilation](#compilation)
7 - [Installation](#installation)
8 - [Running unit tests](#running-unit-tests)
9 - [Using SDL in application pod](#using-sdl-in-application-pod)
13 Documentation is generated with `doxygen` tool. Dependency to `doxygen`
14 tool is optional. If not installed, then `doxygen-doc` target will not
15 be created to Makefile.
17 By default `make doxygen-doc` creates HTML, PDF and PS documents (if
18 the needed tools are available). The documents are created to:
20 1. doxygen-doc/html/index.html
21 2. doxygen-doc/shareddatalayer.pdf
22 3. doxygen-doc/shareddatalayer.ps
24 Creation of different document formats can be controlled with various
25 `--enable-doxygen-*` and `--disable-doxygen-*` configuration
26 options. For example if only HTML document is needed, then run:
28 ./configure --disable-doxygen-pdf --disable-doxygen-ps
33 These instructions assume that the project has been cloned into
34 directory named `shareddatalayer`.
38 Build-time dependencies:
40 libboost (system, filesystem, program-options)
47 Commands to install dependent packages in Fedora:
49 sudo dnf install boost-devel
50 sudo dnf install hiredis-devel
52 sudo dnf install valgrind
53 sudo dnf install autoconf-archive
54 sudo dnf install doxygen
56 Commands to install dependent packages in Debian/Ubuntu:
58 sudo apt install libboost-filesystem-dev
59 sudo apt install libboost-program-options-dev
60 sudo apt install libboost-system-dev
61 sudo apt install libhiredis-dev
63 sudo apt install valgrind
64 sudo apt install autoconf-archive
65 sudo apt install doxygen
67 ### Compilation in the source directory
74 ### Compilation outside the source directory
81 ../shareddatalayer/configure
86 By default the shared library is installed to `/usr/local/lib` and
87 headers into to `/usr/local/include`. If this is not desired, then
88 provide different path when running `configure`, for example:
90 ./configure --prefix=$HOME/usr/local
92 In above example SDL pkg-config .pc file is installed to `$HOME/usr/local/lib/pkgconfig`
93 directory. This directory should be included to `PKG_CONFIG_PATH` while building
94 the application which is using the SDL API library.
96 Note that `configure` command allows plethora of additional options.
101 After configuration has been done, run:
105 In some cases dynamic linker cache needs to be manually refreshed after SDL API
106 has been re-installed:
112 When Redis is used, SDL requires that the following Redis extension commands
113 have been installed to runtime environment:
122 Redis v4.0 or greater is required. Older versions do not support extension
125 Implementation for these commands is produced by RIC DBaaS:
126 https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/dbaas
128 In official RIC deployments these commands are installed by `dbaas` service to
131 In development environment you may want install commands manually to pod/container
132 which is running Redis.
134 Installation to default system directory:
141 Following line should be added to `redis.conf` file:
143 loadmodule <path>/libredismodule.so
145 `<path>` should be replaced to match library installation directory path.
146 `redis-server` must be restarted after configuration file update.
148 Notice that `redis-server` takes path to configuration file as an argument.
149 If not given it will start with default parameter values and above made
150 `loadmodule` option is not effective. Refer to `redis-server --help`.
152 SDL API will check in connection setup phase that all required commands are
153 available, if not then execution is aborted and error log is written to identify
154 that which commands are missing.
156 ## Running unit tests
158 Unit tests are compiled and executed by simply running:
162 By default all unit tests are executed. If `valgrind` is installed,
163 then by default unit test execution is analyzed with `valgrind`.
164 Running specific test cases can be achieved by using `GTEST_FILTER`
165 environment variable. For example:
167 make test GTEST_FILTER=ConnectionTest*
169 If `valgrind` is not desired (even if installed), then it can be
170 disabled with `USE_VALGRIND` environment variable:
172 make test USE_VALGRIND=false
174 Additional `valgrind` arguments can be specified with `VALGRIND_EXTRA_ARGS`
175 environment variable. For example:
177 make test VALGRIND_EXTRA_ARGS='--track-fds=yes --log-file=mylog.txt'
179 It is also possible to use the `testrunner` binary directly (after it
180 has been compiled). The `testrunner` binary supports all the command
181 line options gtest supports, for example:
186 ## Running unit tests with gcov
188 Enable unit test gcov code coverage analysis by configuring gcov reporting
191 configure --with-gcov-report-dir=DIR
193 Directory can be an absolute path or a relative path to an SDL source root.
194 Unit test build creates directory if it does not exist.
196 Build and run unit tests with code coverage analysis:
200 After successful unit test run code coverage (.gcov) result files are in
201 a directory, what was defined by '--with-gcov-report-dir' configure option.
203 In addition, graphical gcov front-ends such as lcov can be used for coverage
206 lcov --directory tst/ --directory src --capture --output-file coverage.info
207 genhtml coverage.info --output-directory out
209 Open the out/index.html using any web browser.
213 It's also possible to test SDL compilation, run unit tests and test building of
214 rpm and Debian packages in a Docker:
216 docker build --no-cache -f docker_test/Dockerfile-Test -t sdltest:latest .
218 If needed, ready rpm and Debian packages can be copied from Docker to host. In
219 below example packages are copied to host's /tmp/sdltest-packages directory:
221 docker run -v /tmp/sdltest-packages:/export sdltest:latest /export
223 ## Using SDL in application pod
225 SDL is not yet available in O-RAN-SC PackageCloud.io repository.
227 Plan is to add it, but in the meantime SDL API needs to be complied and installed
228 in SDL client Dockerfiles (refer instructions above). You may need to execute
229 `RUN ldconfig` command to Dockerfile after SDL API installation.
231 RIC DBaaS service must be running before starting application pod which is using SDL
232 API. DBaaS defines environment variables which are used to contact DBaaS service
233 (offering backend for SDL). Those environment variables are exposed inside application
234 container only if DBaaS service is running when application container is started.
236 You may test SDL connectivity to its backend with `sdltool test-connectivity`
237 command inside your application container.