4 # Copyright 2016 RIFT.IO Inc
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
27 if [ "$1" == "pong" ];
29 if [ "$2" == "enable" ];
34 -H "Accept: application/vnd.yang.data+xml" \
35 -H "Content-Type: application/vnd.yang.data+json" \
37 -d "{\"enable\":true}" \
38 http
://${pong_ip}:${pong_port}/api
/v
1/pong
/adminstatus
/state
40 if [ "$2" == "disable" ];
45 -H "Accept: application/vnd.yang.data+xml" \
46 -H "Content-Type: application/vnd.yang.data+json" \
48 -d "{\"enable\":false}" \
49 http
://${pong_ip}:${pong_port}/api
/v
1/pong
/adminstatus
/state
52 if [ "$2" == "server" ];
57 -H "Accept: application/vnd.yang.data+xml" \
58 -H "Content-Type: application/vnd.yang.data+json" \
60 -d "{\"ip\":\"$3\", \"port\":$4}" \
61 http
://${pong_ip}:${pong_port}/api
/v
1/pong
/server
67 if [ "$1" == "ping" ];
69 if [ "$2" == "enable" ];
74 -H "Accept: application/vnd.yang.data+xml" \
75 -H "Content-Type: application/vnd.yang.data+json" \
77 -d "{\"enable\":true}" \
78 http
://${ping_ip}:${ping_port}/api
/v
1/ping
/adminstatus
/state
80 if [ "$2" == "disable" ];
85 -H "Accept: application/vnd.yang.data+xml" \
86 -H "Content-Type: application/vnd.yang.data+json" \
88 -d "{\"enable\":false}" \
89 http
://${ping_ip}:${ping_port}/api
/v
1/ping
/adminstatus
/state
93 if [ "$2" == "rate" ];
98 -H "Accept: application/vnd.yang.data+xml" \
99 -H "Content-Type: application/vnd.yang.data+json" \
102 http
://${ping_ip}:${ping_port}/api
/v
1/ping
/rate
106 if [ "$2" == "server" ];
110 curl
-D /dev
/stdout \
111 -H "Accept: application/vnd.yang.data+xml" \
112 -H "Content-Type: application/vnd.yang.data+json" \
114 -d "{\"ip\":\"$3\", \"port\":$4}" \
115 http
://${ping_ip}:${ping_port}/api
/v
1/ping
/server
122 if [ "$1" == "stats" ];
125 curl http
://${ping_ip}:${ping_port}/api
/v
1/ping
/stats
129 curl http
://${pong_ip}:${pong_port}/api
/v
1/pong
/stats
133 if [ "$1" == "config" ];
136 curl http
://${ping_ip}:${ping_port}/api
/v
1/ping
/server
139 curl http
://${ping_ip}:${ping_port}/api
/v
1/ping
/rate
141 echo "ping admin status:"
142 curl http
://${ping_ip}:${ping_port}/api
/v
1/ping
/adminstatus
/state
145 curl http
://${pong_ip}:${pong_port}/api
/v
1/pong
/server
147 echo "pong admin status:"
148 curl http
://${pong_ip}:${pong_port}/api
/v
1/pong
/adminstatus
/state