Updated documentation for mock a1 tool
[ric-app/admin.git] / test / README.md
1 This directory contains various unit tests as well as mock-ups for integration testing.
2
3 Several unit test cases are provided to test and illustrate usage of various components of the AC xAPP. The unit tests use the CATCH framework(https://github.com/catchorg/Catch2).  It is a header only framework which can be installed simply by retreiving the header and placing it in the search path. To install : 
4  wget -nv  --directory-prefix=/usr/local/include/Catch2 https://github.com/catchorg/Catch2/releases/download/v2.9.1/catch.hpp
5
6 In addition all the other requirements to compile the AC xAPP (as listed under src/README.md) must be already in place
7
8 The unit tests can be run by first compiling them (make all_tests)  and then executing them (./run_tests.sh)
9 The default make does not do any optimizations and instead aims to generate coverage files (this can be changed by specifying MODE=perf when compiling the tests)
10
11 If gcovr is installed (https://github.com/gcovr/gcovr) the script  will  also generates a coverage report (as ../coverage_report.html)
12
13 Apart from unit test cases, the test directory also includes three mock-up components to test the AC xAPP.
14 1. A mock E2 Term : This executable can be created as 'make  mock-e2term-server'.  The mock e2 term server, listens for subscription requests/deletes,
15 responds to them and when a subscription is active, sends X2 SgNB Addition Requests (encapsulated in E2AP Indication) at a specified rate. This
16 mimics the E2Term + RAN behaviour.  The executable can be invoked as :
17 ./mock-e2term-server -p <e2term port number> -r <rate to send at>
18
19 The e2term port number must match the configured port number in the RMR route table. For example, in the provided uta_rtg.rt example file, E2term
20 port is assumed to be 38000 
21
22 2. A mock VES collector : This is basically a cherrypy server configured to expose a JSON end point, collect the metrics and extract some relevant
23 stats from the provided scripts. Note  that this is NOT the actual VES collector. The web server simply suffices to mock up the interaction between
24 the xAPP and the VES collector.  By default, the ves collector is configured to start up and listen on 127.0.0.1:6350, but it can be changed.
25 Whatever URL is configured on the mock ves collector must match the URL supplied to the AC xAPP (see src/README.md -u option under RUNNING ADMISSION CONTROL xAPP)
26 Pre-requisities for running the mock ves collector are :
27 1. python 2.7
28 2. cherrypy module (pip install cherrypy)
29
30 The mock ves collector can be simply invoked as python ./mock_ves_collector.py
31
32
33 3. A mock A1 mediator : The mock up a1 mediator executable sends various JSON (valid/invalid) payloads in sequence to illustrate the behaviour and response of the AC xAPP. It can be compiled  as 'make mock-a1-server'
34 To execute the mock-a1-server,  it requires as argument a port to listen and send on (can be any port that does not conflict with others). The A1 mediator uses rts send/receive and hence bypasses the routing table. 
35 ./mock-a1-server -p <port number>