Add documentation for Docker usage 44/6044/1
authorelinuxhenrik <henrik.b.andersson@est.tech>
Mon, 10 May 2021 10:53:34 +0000 (12:53 +0200)
committerelinuxhenrik <henrik.b.andersson@est.tech>
Mon, 10 May 2021 10:53:39 +0000 (12:53 +0200)
Change-Id: Idf4d03e09d70a703c12e3da68549c8730c14548d
Isue-ID: NONRTRIC-495
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
test/usecases/linkfailure/README.md
test/usecases/linkfailure/app/main.py

index dbdaa3c..f9e0248 100644 (file)
@@ -4,7 +4,7 @@
 The Link Failure use case test provides a python script that regularly polls DMaaP Message Router (MR) for "CUS Link Failure"
 messages.
 
-When such a message appears with the "eventSeverity" set to "CRITICAL" a configuration change message with the
+When such a message appears with the "eventSeverity" set to anything but "NORMAL", a configuration change message with the
 "administrative-state" set to "UNLOCKED" will be sent to the O-DU mapped to the O-RU that sent the alarm.
 
 When such a message appears with the "eventSeverity" set to "NORMAL" a printout will be made to signal that the
@@ -17,13 +17,42 @@ the `app` folder: `pip install -r requirements.txt`
 Also, the MR needs to be up and running with a topic created for the alarms and there must be an endpoint for the
 configuration change event that will accept these.
 
+The host names and the ports to the MR and SDNR services can be provided when the container is started if the default
+values are not correct. The topic can also be changed.
+
+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
+a different file when starting the application.
+
 For convenience, a message generator and a change event endpoint simulator are provided.
 
-# How to run
+# How to run from command line
 Go to the `app/` folder and run `python3 main.py`. The script will start and run until stopped. Use the `-h` option to
 see the options available for the script.
 
 
+# How to run in Docker
+Go to the `app/` folder and run `docker build -t oru-app .`.
+
+The container must be connected to the same network as the MR and SDNR are running in. Some of the parameters to the application
+can be provided with the `-e PARAM_NAME=PARAM_VALUE` notation. Start the container by using the command, with available params listed:
+ `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`.
+
+To build the image for the message generator, run the following command from the `simulators` folder:
+`docker build -f Dockerfile-message-generator -t message-generator .`
+
+The message generator's container must be connected to the same network as the other components are running in. Some of the
+parameters to the application can be provided with the `-e PARAM_NAME=PARAM_VALUE` notation. Start the container by
+using the command, with available params listed:
+ `docker run --network [NETWORK NAME] --name message-generator -e MR-HOST=[HOST NAME OF MR] -e MR-PORT=[PORT OF MR] message-generator`.
+
+To build the image for the SDNR simulator, run the following command from the `simulators` folder:
+`docker build -f Dockerfile-sdnr-sim -t message-generator .`
+
+The SDNR simulator's container must be connected to the same network as the the other components are running in. Some of the
+parameters to the application can be provided with the `-e PARAM_NAME=PARAM_VALUE` notation. Start the container by
+using the command, with available params listed:
+ `docker run --network [NETWORK NAME] --name sdnr-simulator -e MR-HOST=[HOST NAME OF MR] -e MR-PORT=[PORT OF MR] sdnr-simulator`.
+
 ## License
 
 Copyright (C) 2021 Nordix Foundation.
index 394af8d..30541d4 100644 (file)
@@ -91,13 +91,13 @@ def read_o_ru_to_o_du_map_from_file(map_file):
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(prog='PROG')
-    parser.add_argument('--mrHost', help='The URL of the MR host', default="http://message-router.onap")
-    parser.add_argument('--mrPort', help='The port of the MR host', type=int, default=3904)
-    parser.add_argument('--mrTopic', help='The topic to poll messages from', default="unauthenticated.SEC_FAULT_OUTPUT")
-    parser.add_argument('--sdnrHost', help='The URL of the SNDR host', default="http://localhost")
-    parser.add_argument('--sdnrPort', help='The port of the SDNR host', type=int, default=9990)
-    parser.add_argument('--oRuTooDuMapFile', help='A file with the mapping between O-RU ID and O-DU ID as a dictionary', default="o-ru-to-o-du-map.txt")
-    parser.add_argument('--pollTime', help='The time between polls', type=int, default=10)
+    parser.add_argument('--mrHost', help='The URL of the MR host (default: %(default)s)', default="http://message-router.onap")
+    parser.add_argument('--mrPort', help='The port of the MR host (default: %(default)d)', type=int, default=3904)
+    parser.add_argument('--mrTopic', help='The topic to poll messages from (default: %(default)s)', default="unauthenticated.SEC_FAULT_OUTPUT")
+    parser.add_argument('--sdnrHost', help='The URL of the SNDR host (default: %(default)s)', default="http://localhost")
+    parser.add_argument('--sdnrPort', help='The port of the SDNR host (default: %(default)d)', type=int, default=9990)
+    parser.add_argument('--oRuTooDuMapFile', help='A file with the mapping between O-RU ID and O-DU ID as a dictionary (default: %(default)s)', default="o-ru-to-o-du-map.txt")
+    parser.add_argument('--pollTime', help='The time between polls (default: %(default)d)', type=int, default=10)
     parser.add_argument('-v', '--verbose', action='store_true', help='Turn on verbose printing')
     parser.add_argument('--version', action='version', version='%(prog)s 1.0')
     args = vars(parser.parse_args())