Improvements from anna fork
[anna.git] / example / diameter / launcher / deployments / aots / agents / HTTPMOCK / Provision.sh
1 #!/bin/bash
2
3 usage() {
4   cat << EOF
5
6   Usage: $0 <test id> <step id> <test path> <address> <mock json> <method: POST|PUT|GET|DELETE> <uri>
7
8 EOF
9   exit 1
10 }
11
12 [ -z "$7" ] && usage
13
14 control_post_request=$(mktemp)
15 cat << EOF > ${control_post_request}
16 {
17   "control": {
18     "flowId": "$1",
19     "flowStepId": "$2",
20     "flowPath":"$3"
21   },
22   "action": {
23     "id": "serve_json",
24     "arguments": {
25       "json": "$5",
26       "method": "$6",
27       "uri": "$7"
28     }
29   }
30 }
31 EOF
32
33 CONTROL_URI=http://$4/aots-control/v1/ctrl/action/annotate
34 CURL="curl -s --http2-prior-knowledge"
35 ${CURL} -d@${control_post_request} -H "Content-Type: application/json" -X $6 ${CONTROL_URI}/serve_json >/dev/null
36 rm ${control_post_request}