MockServer
Introduction
MockServer is an open source tool to mock any system with REST interface. The tool is implemented in java, and REST APIs are provided to configure and query it. See more details at http://www.mock-server.com/.
Installation
Install MockServer docker on Robot VM
|
You can restart MockServer container or reset it anytime with the following commands:
|
Configuration
You can set the expectations in MockServer with REST APIs, e.g.:
# DCI Overlay
curl -v -X PUT "http://localhost:1080/expectation" -d '{
"httpRequest": {
"method": "POST",
"path": "/v2.0/l3-dci-connects"
},
"httpResponse": {
"statusCode": 201
},
"times" : {
"unlimited" : true
},
"timeToLive" : {
"unlimited" : true
}
}'
Verification
Verify all requests received by MockServer with REST API. e.g.:
|
or a particular request filtered by url, e.g.:
|
Also, you can tail the log file inside MockServer container:
ubuntu@onap-robot:~/mockserverclient$ sudo docker exec -it mockserver bash
bash-4.4# tail -f mockserver.lo