This method receives a callback for create job. The request shall contain a job json. The request is checked towards what has been setup (armed) and the response will be set accordingly.
URI and payload, (POST): /callbacks/job/<producer_id>, <job-json>
response: 200/201 (or configured response) or 400 for other errors
Delete callback
This method receives a callback for delete job. The request is checked towards what has been setup (armed) and the response will be set accordingly.
URI and payload, (DELETE): /callbacks/job/<producer_id>
response: 204 (or configured response) or 400 for other errors
Supervision callback
This method receives a callback for producer supervision. The request is checked towards what has been setup (armed) and the response will be set accordingly.
URI and payload, (GET): /callbacks/supervision/<producer_id>
response: 200 (or configured response) or 400 for other errors
The control interface can be used by any test script. The following REST operations are available:
Arm a job create
This method arms a job for creation and sets an optional response code for create/update
URI and payload, (PUT): /arm/create/<producer_id>/<job_id>[?response=<resonsecode>]
response: 200 or 400 for other errors
Arm a job delete
This method arms a job for deletion and sets an optional response code for delete
URI and payload, (PUT): /arm/delete/<producer_id>/<job_id>[?response=<resonsecode>]
response: 200 or 400 for other errors
Arm a producer supervision
This method arms a supervision and sets an optional response code for supervision calls
URI and payload, (PUT): /arm/delete/<producer_id>[?response=<resonsecode>]
response: 200 or 400 for other errors
Arm a type for a producer
This method arms a type for a producer
URI and payload, (PUT): /arm/type/<producer_id>/<ype-id>
response: 200 or 400 for other errors
Disarm a type for a producer
This method disarms a type for a producer
URI and payload, (DELETE): /arm/type/<producer_id>/<ype-id>
response: 200 or 400 for other errors
Get job data parameters
This method fetches the job data parameters of a job
URI and payload, (GET): /jobdata/<producer_id>job_id>
response: 200 or 400 for other errors
Remove job data parameters
This method removes the job data parameters from a job
URI and payload, (DELETE): /jobdata/<producer_id>job_id>
response: 200 or 400 for other errors
Start/stop job data delivery
This method start (or stops) delivering job data to the configured target url. Action is either 'start' or s'stop'
URI and payload, (POST): /jobdata/<producer_id>job_id>?action=action
response: 200 or 400 for other errors
Counter for create job
This method returns the number of create/update calls to a job
URI and payload, (GET): /counter/create/producer_id>/<job_id>
response: <integer> 200 or 400 for other errors
Counter for delete job
This method returns the number of delete calls to a job
URI and payload, (GET): /counter/delete/producer_id>/<job_id>
response: <integer> 200 or 400 for other errors
Counter for producer supervision
This method returns the number of supervision calls to a producer
URI and payload, (GET): /counter/supervision/producer_id>
response: <integer> 200 or 400 for other errors
Get internal db
This method dumps the internal db of producer and jobs as a json file
URI and payload, (GET): /status
response: <json> 200 or 400 for other errors
Reset
This method makes a full reset by removing all producers and jobs
URI and payload, (GET or PUT or POST): /reset
response: <json> 200 or 400 for other errors
Build image
docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t producer-stub .
Start the image on both http and https
docker run --rm -it -p 8092:8092 -p 8093:8093 --name producer-stub producer-stub
It will listen to http 8092 port and https 8093 port(using default certificates) at the same time.
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 container without specifing external certificates:
docker run --rm -it --p 8092:8092 -p 8093:8093 producer-stub
It will listen to http 8092 port and https 8093 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 8092:8092 -p 8093:8093 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" producer-stub
In 'docker-compose.yml', use field:
volumes: - ./certificate:/usr/src/app/cert:ro
The script prodstub-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 producer-stub should be executed manually with the a1pms, 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 8092:8092 -p 8093:8093 --name producer-stub producer-stub
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 prodstub-build-start.sh
to start the producer-stub 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.