6b59388d5521b6b8a99f990d5a27e18197c2dea4
[nonrtric/rapp/orufhrecovery.git] / scriptversion / README.md
1 # Use case Link Failure
2
3 ## General
4
5 The Link Failure use case test provides a python script that regularly polls DMaaP Message Router (MR) for "CUS Link Failure"
6 messages.
7
8 When such a message appears with the "eventSeverity" set to anything but "NORMAL", a configuration change message with the
9 "administrative-state" set to "UNLOCKED" will be sent to the O-DU mapped to the O-RU that sent the alarm.
10
11 When such a message appears with the "eventSeverity" set to "NORMAL" a printout will be made to signal that the
12 alarm has been cleared, provided that the verbose option has been used when the test was started.
13
14 ## Prerequisits
15
16 To run this script Python3 needs to be installed. To install the script's dependencies, run the following command from
17 the `app` folder: `pip install -r requirements.txt`
18
19 Also, the MR needs to be up and running with a topic created for the alarms and there must be an endpoint for the
20 configuration change event that will accept these.
21
22 The host names and the ports to the MR and SDNR services can be provided when the container is started if the default
23 values are not correct. The topic can also be changed.
24
25 The mapping from O-RU ID to O-DU ID is specified in the file `o-ru-to-o-du-map.txt`. This can be replaced by providing
26 a different file when starting the application.
27
28 For convenience, a message generator and a change event endpoint simulator are provided.
29
30 ## How to run from command line
31
32 Go to the `app/` folder and run `python3 main.py`. The script will start and run until stopped. Use the `-h` option to
33 see the options available for the script.
34
35 ## How to run in Docker
36
37 Go to the `app/` folder and run `docker build -t oru-app .`.
38
39 The container must be connected to the same network as the MR and SDNR are running in. Some of the parameters to the application
40 can be provided with the `-e PARAM_NAME=PARAM_VALUE` notation. Start the container by using the command, with available params listed:
41  `docker run --network [NETWORK NAME] --name oru-app -e VERBOSE=on -e MR-HOST=[HOST NAME OF MR] -e MR-PORT=[PORT OF MR] -e SDNR-HOST=[HOST NAME OF SDNR] -e SDNR-PORT=[PORT OF SDNR] oru-app`.
42
43 To build the image for the message generator, run the following command from the `simulators` folder:
44 `docker build -f Dockerfile-message-generator -t message-generator .`
45
46 The message generator's container must be connected to the same network as the other components are running in. Some of the
47 parameters to the application can be provided with the `-e PARAM_NAME=PARAM_VALUE` notation. Start the container by
48 using the command, with available params listed:
49  `docker run --network [NETWORK NAME] --name message-generator -e MR-HOST=[HOST NAME OF MR] -e MR-PORT=[PORT OF MR] message-generator`.
50
51 To build the image for the SDNR simulator, run the following command from the `simulators` folder:
52 `docker build -f Dockerfile-sdnr-sim -t sdnr-simulator .`
53
54 The SDNR simulator's container must be connected to the same network as the the other components are running in. Some of the
55 parameters to the application can be provided with the `-e PARAM_NAME=PARAM_VALUE` notation. Start the container by
56 using the command, with available params listed:
57  `docker run --network [NETWORK NAME] --name sdnr-simulator -e MR-HOST=[HOST NAME OF MR] -e MR-PORT=[PORT OF MR] sdnr-simulator`.
58
59 ## Use docker-compose
60
61 Go to the `docker-compose/` folder and run `bash start.sh`.
62
63 This scripts will start up four components:
64 dmaap-mr
65 oru-app
66 sdnr-simulator
67 message-generator
68
69 ## License
70
71 Copyright (C) 2021 Nordix Foundation.
72 Licensed under the Apache License, Version 2.0 (the "License")
73 you may not use this file except in compliance with the License.
74 You may obtain a copy of the License at
75
76       http://www.apache.org/licenses/LICENSE-2.0
77
78 Unless required by applicable law or agreed to in writing, software
79 distributed under the License is distributed on an "AS IS" BASIS,
80 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81 See the License for the specific language governing permissions and
82 limitations under the License.
83
84 For more information about license please see the [LICENSE](LICENSE.txt) file for details.