Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

callback_reciever repo:

https://gerrit.o-ran-sc.org/r/gitweb?p=nonrtric.git;a=tree;f=test/cr;hb=refs/changes/02/4502/5##

callback receiver - a stub interface to receive

...

callbacks 

The callback receiver is intended for function tests to simulate a RAPP.
The callback receiver exposes the read and write urls, used by the agent, as configured in service.

The callback receiver receives notifications from PMS when synchronization happens synchronisation happens between PMS and RICs.


# Ports and certificates

The CR normally opens the port 8090 for http. If a certificate and a key are provided the simulator will also open port 8091 for https.
The certificate and key shall be placed in the same dir and the dir shall be mounted to /usr/src/app/cert in the container.

| Port Port        | Protocol |
| --------  | -------- |
| 8090 | http 8090      | http        |
| 8091 | https 8091       | https      |

The dir cert contains a self-signed cert. Use the script generate_cert_and_key.sh to generate a new certificate and key. The password of the certificate must be set 'test'.
The same urls are available on both the http port 8090 and the https port 8091. If using curl and https, the flag -k shall be given to make curl ignore checking the certificate.

### Control interface ###

The control interface can be used by any test script.
The following REST operations are available:
>
Send a message to CR<br>
This method puts a request message from PMS to notify that sychronization between PMS and certain RIC happens.<br>
```URI :
URI and payload, (PUT or POST): /callbacks/<id> <json array of response messages>```<br><br>
```responsemessages>
response: OK 200 or 500 for other errors```errors
>
Metrics - counters<br>
There are a number of counters that can be read to monitor the message processing. Do a http GET on any of the current counters and an integer value will be returned with http response code 200.
```/counter/received_callbacks```callbacks - The total number of received callbacks<br>
```/counter/fetched_callbacks```callbacks - The total number of fetched callbacks<br>
```/counter/current_messages```messages - The current number of callback messages waiting to be fetched<br>
###

Build and start ###
>Build image<br>
```docker build -t

Build image:

Code Block
languagebash
titleBuild image
docker build -t callback-receiver

...

 .


Start the image on both http and https:

...

Code Block
languagebash
title
Start the image on both http and https

...

:
docker run -it -p 8090:8090 -p 8091:8091 callback-

...

receiver


It will listen to http 8090 port and https 8091 port(using default certificates) at the same time.

By default, this image has default certificates under /usr/src/app/cert
file "cert.crt" is the certificate file
file "key.crt" is the key file
file "generate_cert_and_key.sh" is a shell script to generate certificate and key
file "pass" stores the password when you run the shell script

This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose"
In 'docker run', use field:
--volume "$PWD/certificate:/usr/src/app/cert" a1test
```docker run -it -p 8090:8090 -p 8091:8091 -v


Code Block
languagebash
titleMount external cert/key
docker run -it -p 8090:8090 -p 8091:8091 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" callback-

...

receiver


In 'docker-compose.yml', use field:
volumes:
- ./certificate:/usr/src/app/cert:ro

The script ```crstubcrstub-build-start.sh```sh  do the above two steps in one go. This starts the callback-receiver container in stand-alone mode for basic test.<br>

If the callback-receiver should be executed manually with the agent, replace docker run with this command to connect to the docker network with the correct service name (--name shall be aligned with the other components, i.e. the host named given in all callback urls).
```docker run -it -p

Code Block
languagebash
titlestart callback_reciever with network parameter
docker run -it -p 8090:8090 -p 8091:8091 --network nonrtric-docker-net --name callback-receiver callback-

...

receiver

...



Start the image on http only:

Code Block
languagebash
titlestart

...

the image on http only

...

...

docker run -it -p 8090:8090 callback-

...

receiver


### Basic test ###

Basic test is made with the script```basic:

Code Block
languagebash
titlerun basic test with script
basic_test.sh nonsecure|secure

secure```which tests all the available urls with a subset of the possible operations.

Use the script```cr:

Code Block
languagebash
titlestart the container with script
cr-build-start.sh

sh```to start the callback-receiver in a container first.