events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=<timeout>&limit=<limit>
Messages to the MR can be written using this url http(s) POST/PUT:
/events/A1-POLICY-AGENT-WRITE
One or more messages can be written in the same operation.
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 a1pms 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 parameters (GET): /send-request?operation=<GET|PUT|POST|DELETE>&url=<url>
response: <correlation-id> (http 200) or 400 for parameter error or 500 for other errors
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 parameter, (GET): /receive-response?correlationId=<correlationid>
response: <json-array of 1 response> 200 or empty 204 or other errors 500
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/requests_submitted
- The total number of requests sent from the application
/counter/requests_fetched
- The total number of requests picked up by the a1pms
/counter/responses_submitted
- The total number of responses written by the a1pms
/counter/responses_fetched
- The total number of responses picked up by the application
/counter/current_requests
- The current number of requests waiting to be picked up by the a1pms
/counter/current_responses
- The current number of responses waiting to be picked up by the application
Build image
docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t mrstub .
Start the image on http only
docker run --rm -it -p 3905:3905 mrstub
Start the image on http and https
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
Start the a1-interface container without specifing external certificates:
docker run --rm -it -p 3905:3905 -p 3906:3906 mrstub
It will listen to http 3905 port and https 3906 port(using default certificates) at the same time.
This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose" In 'docker run', use field:
-v "$PWD/certificate:/usr/src/app/cert"
eg:
docker run --rm -it -p 3905:3905 -p 3906:3906 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" mrstub
In 'docker-compose.yml', use field:
volumes: - ./certificate:/usr/src/app/cert:ro
The script mrstub-build-start.sh
do the build and docker run in one go. This starts the stub container in stand-alone mode for basic test.
If the mrstub 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 the same as configured in consul for the read and write streams).
docker run --rm -it -p 3905:3905 --network nonrtric-docker-net --name message-router mrstub
Basic test is made with the script basic_test.sh nonsecure|secure
which tests all the available urls with a subset of the possible operations. Choose nonsecure for http and secure for https. Use the script mrstub-build-start.sh
to start the mrstub in a container first.
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.