tree: b2d01f1cd9aed09eb2e0a0f24e603a3c4fd99775 [path history] [tgz]
  1. .gitignore
  2. basic_test.sh
  3. cr-build-start.sh
  4. cr.py
  5. Dockerfile
  6. README.md
  7. requirements.txt
test/cr/README.md

callback receiver - a stub interface to receive callbacks

The mrstub is intended for function tests to simulate a message router. The mrstub exposes the read and write urls, used by the agent, as configured in consul. In addition, request messages can be fed to the mrstub and the response messages can be read by polling.

Control interface

The control interface can be used by any test script. The following REST operations are available:

Send a message to MR
This method puts a request message in the queue for the agent to pick up. The returned correlationId (auto generated by the mrstub) is used when polling for the reposone message of this particular request.
URI and parameter, (GET): /get-event/<id>

response: message + 200 or 204

Receive a message response for MR for the included correlation id
The method is for polling of messages, returns immediately containing the received response (if any) for the supplied correlationId.
URI and payload, (PUT or POST): /callbacks/<id> <json array of response messages>

response: OK 200 or 500 for other errors

Metrics - counters
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 - The total number of received callbacks
/counter/fetched_callbacks - The total number of fetched callbacks
/counter/current_messages - The current number of callback messages waiting to be fetched

Build and start

Build image
docker build -t callback-receiver .

Start the image
docker run -it -p 8090:8090 callback-receiver

The script crstub-build-start.sh do the above two steps in one go. This starts the callback-receiver container in stand-alone mode for basic test.
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 8090:8090 --network nonrtric-docker-net --name callback-receiver callback-receiver

Basic test

Basic test is made with the script basic_test.sh which tests all the available urls with a subset of the possible operations. Use the script cr-build-start.sh to start the callback-receiver in a container first.

License

Copyright (C) 2020 Nordix Foundation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.