3 # ============LICENSE_START===============================================
4 # Copyright (C) 2020 Nordix Foundation. All rights reserved.
5 # ========================================================================
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.
17 # ============LICENSE_END=================================================
20 # This is a script that contains container/service management function
21 # and test functions for Message Router - mr stub
23 ## Access to Message Router
24 # Host name may be changed if app started by kube
25 # Direct access from script
27 MR_STUB_HOST_NAME=$LOCALHOST_NAME
28 MR_DMAAP_HOST_NAME=$LOCALHOST_NAME
29 MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_PORT
30 MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_DMAAP_LOCALHOST_PORT
31 #Docker/Kube internal path
32 if [ $RUNMODE == "KUBE" ]; then
33 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
34 __check_included_image "DMAAPMR"
36 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
38 __check_prestarted_image "DMAAPMR"
40 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
43 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME":"$MR_INTERNAL_PORT
44 __check_included_image "DMAAPMR"
46 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME":"$MR_INTERNAL_PORT
49 MR_ADAPTER_HTTP="http://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_PORT
50 MR_ADAPTER_HTTPS="https://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_SECURE_PORT
58 echo -e $BOLD"MR protocol setting"$EBOLD
59 echo -e " Using $BOLD http $EBOLD towards MR"
61 MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_PORT
62 MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_DMAAP_LOCALHOST_PORT
63 #Docker/Kube internal path
64 if [ $RUNMODE == "KUBE" ]; then
65 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
66 __check_included_image "DMAAPMR"
68 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
70 __check_prestarted_image "DMAAPMR"
72 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_PORT
75 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME":"$MR_INTERNAL_PORT
76 __check_included_image "DMAAPMR"
78 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME":"$MR_INTERNAL_PORT
85 echo -e $BOLD"MR protocol setting"$EBOLD
86 echo -e " Using $BOLD https $EBOLD towards MR"
88 MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_STUB_LOCALHOST_SECURE_PORT
89 MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_DMAAP_LOCALHOST_SECURE_PORT
90 #Docker/Kube internal path
91 if [ $RUNMODE == "KUBE" ]; then
92 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_SECURE_PORT
93 __check_included_image "DMAAPMR"
95 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_SECURE_PORT
97 __check_prestarted_image "DMAAPMR"
99 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXTERNAL_SECURE_PORT
102 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME":"$MR_INTERNAL_SECURE_PORT
103 __check_included_image "DMAAPMR"
104 if [ $? -eq 0 ]; then
105 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME":"$MR_INTERNAL_SECURE_PORT
111 # Create a dmaap mr topic
112 # args: <topic name> <topic-description>
114 echo -ne " Creating read topic: $1"$SAMELINE
116 json_topic="{\"topicName\":\"$1\",\"partitionCount\":\"2\", \"replicationCount\":\"3\", \"transactionEnabled\":\"false\",\"topicDescription\":\"$2\"}"
117 echo $json_topic > ./tmp/$1.json
119 curlString="$MR_DMAAP_PATH/topics/create -X POST -H Content-Type:application/json -d@./tmp/$1.json"
121 while [ $topic_retries -gt 0 ]; do
122 let topic_retries=topic_retries-1
123 result=$(__do_curl "$curlString")
124 if [ $? -eq 0 ]; then
126 echo -e " Creating read topic: $1 $GREEN OK $EGREEN"
128 if [ $? -ne 0 ]; then
129 if [ $topic_retries -eq 0 ]; then
130 echo -e " Creating read topic: $1 $RED Failed $ERED"
141 # Do a pipeclean of a topic - to overcome dmaap mr bug...
142 # args: <topic> <post-url> <read-url>
143 __dmaap_pipeclean() {
145 echo -ne " Doing dmaap-mr pipe cleaning on topic: $1"$SAMELINE
146 while [ $pipeclean_retries -gt 0 ]; do
147 echo "{\"pipeclean-$1\":$pipeclean_retries}" > ./tmp/pipeclean.json
148 let pipeclean_retries=pipeclean_retries-1
149 curlString="$MR_DMAAP_PATH$2 -X POST -H Content-Type:application/json -d@./tmp/pipeclean.json"
150 result=$(__do_curl "$curlString")
151 if [ $? -ne 0 ]; then
154 curlString="$MR_DMAAP_PATH$3"
155 result=$(__do_curl "$curlString")
156 if [ $? -eq 0 ]; then
157 if [ $result != "[]" ]; then
158 echo -e " Doing dmaap-mr pipe cleaning on topic: $1 $GREEN OK $EGREEN"
167 echo -e "Doing dmaap-mr pipe cleaning on topic: $1 $RED Failed $ERED"
171 # Start the Message Router stub interface in the simulator group
173 # (Function for test scripts)
176 echo -e $BOLD"Starting $MR_DMAAP_DISPLAY_NAME and/or $MR_STUB_DISPLAY_NAME"$EBOLD
178 if [ $RUNMODE == "KUBE" ]; then
180 # Table of possible combinations of included mr and included/prestarted dmaap-mr
181 # mr can never be prestarted
182 # mr can be used stand alone
183 # if dmaapmr is included/prestarted, then mr is needed as well as frontend
185 # Inverted logic - 0 mean true, 1 means false
186 # mr prestarted 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
187 # mr included 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
188 # dmaap prestarted 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
189 # dmaap included 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
190 # ==================================================
191 # OK 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1
193 __check_prestarted_image 'MR'
194 retcode_prestarted_mr=$?
195 __check_included_image 'MR'
196 retcode_included_mr=$?
198 __check_prestarted_image 'DMAAPMR'
199 retcode_prestarted_dmaapmr=$?
200 __check_included_image 'DMAAPMR'
201 retcode_included_dmaapmr=$?
205 if [ $retcode_prestarted_mr -ne 0 ] && [ $retcode_included_mr -eq 0 ]; then
206 if [ $retcode_prestarted_dmaapmr -ne 0 ] && [ $retcode_included_dmaapmr -eq 0 ]; then
211 if [ $retcode_prestarted_mr -ne 0 ] && [ $retcode_included_mr -eq 0 ]; then
212 if [ $retcode_prestarted_dmaapmr -eq 0 ] && [ $retcode_included_dmaapmr -ne 0 ]; then
217 if [ $retcode_prestarted_mr -ne 0 ] && [ $retcode_included_mr -eq 0 ]; then
218 if [ $retcode_prestarted_dmaapmr -ne 0 ] && [ $retcode_included_dmaapmr -ne 0 ]; then
223 if [ $paramerror -ne 0 ]; then
224 echo -e $RED"The Message Router apps 'MR' and/or 'DMAAPMR' are not included in this test script"$ERED
225 echo -e $RED"The Message Router will not be started"$ERED
226 echo -e $RED"Both MR and DAAMPMR - or - only MR - need to be included and/or prestarted"
230 if [ $retcode_prestarted_dmaapmr -eq 0 ]; then
231 echo -e " Using existing $MR_DMAAP_APP_NAME deployment and service"
232 __kube_scale deployment $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE 1
235 if [ $retcode_included_dmaapmr -eq 0 ]; then
236 #export MR_DMAAP_APP_NAME
237 export MR_DMAAP_KUBE_APP_NAME=message-router
238 MR_DMAAP_APP_NAME=$MR_DMAAP_KUBE_APP_NAME
239 export KUBE_ONAP_NAMESPACE
240 export MR_EXTERNAL_PORT
241 export MR_INTERNAL_PORT
242 export MR_EXTERNAL_SECURE_PORT
243 export MR_INTERNAL_SECURE_PORT
244 export ONAP_DMAAPMR_IMAGE
246 export MR_KAFKA_BWDS_NAME=akfak-bwds
247 export KUBE_ONAP_NAMESPACE
249 export MR_ZOOKEEPER_APP_NAME
250 export ONAP_ZOOKEEPER_IMAGE
252 #Check if onap namespace exists, if not create it
253 __kube_create_namespace $KUBE_ONAP_NAMESPACE
255 # TODO - Fix domain name substitution in the prop file
256 # Create config maps - dmaapmr app
257 configfile=$PWD/tmp/MsgRtrApi.properties
258 cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/mr/KUBE-MsgRtrApi.properties $configfile
259 output_yaml=$PWD/tmp/dmaapmr_msgrtrapi_cfc.yaml
260 __kube_create_configmap dmaapmr-msgrtrapi.properties $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
262 configfile=$PWD/tmp/logback.xml
263 cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/mr/logback.xml $configfile
264 output_yaml=$PWD/tmp/dmaapmr_logback_cfc.yaml
265 __kube_create_configmap dmaapmr-logback.xml $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
267 configfile=$PWD/tmp/cadi.properties
268 cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/mr/cadi.properties $configfile
269 output_yaml=$PWD/tmp/dmaapmr_cadi_cfc.yaml
270 __kube_create_configmap dmaapmr-cadi.properties $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
272 # Create config maps - kafka app
273 configfile=$PWD/tmp/zk_client_jaas.conf
274 cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/kafka/zk_client_jaas.conf $configfile
275 output_yaml=$PWD/tmp/dmaapmr_zk_client_cfc.yaml
276 __kube_create_configmap dmaapmr-zk-client-jaas.conf $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
278 # Create config maps - zookeeper app
279 configfile=$PWD/tmp/zk_server_jaas.conf
280 cp $SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"mnt/zk/zk_server_jaas.conf $configfile
281 output_yaml=$PWD/tmp/dmaapmr_zk_server_cfc.yaml
282 __kube_create_configmap dmaapmr-zk-server-jaas.conf $KUBE_ONAP_NAMESPACE autotest DMAAPMR $configfile $output_yaml
285 input_yaml=$SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"svc.yaml
286 output_yaml=$PWD/tmp/dmaapmr_svc.yaml
287 __kube_create_instance service $MR_DMAAP_APP_NAME $input_yaml $output_yaml
290 input_yaml=$SIM_GROUP"/"$MR_DMAAP_COMPOSE_DIR"/"app.yaml
291 output_yaml=$PWD/tmp/dmaapmr_app.yaml
292 __kube_create_instance app $MR_DMAAP_APP_NAME $input_yaml $output_yaml
295 echo " Retrieving host and ports for service..."
296 MR_DMAAP_HOST_NAME=$(__kube_get_service_host $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE)
298 MR_EXT_PORT=$(__kube_get_service_port $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE "http")
299 MR_EXT_SECURE_PORT=$(__kube_get_service_port $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE "https")
301 echo " Host IP, http port, https port: $MR_DMAAP_APP_NAME $MR_EXT_PORT $MR_EXT_SECURE_PORT"
303 if [ $MR_HTTPX == "http" ]; then
304 MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_EXT_PORT
305 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_PORT
307 MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_HOST_NAME":"$MR_EXT_SECURE_PORT
308 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_SECURE_PORT
311 __check_service_start $MR_DMAAP_APP_NAME $MR_DMAAP_PATH$MR_DMAAP_ALIVE_URL
315 if [ $retcode_included_mr -eq 0 ]; then
316 #exporting needed var for deployment
317 export MR_STUB_APP_NAME
318 export KUBE_ONAP_NAMESPACE
320 export MR_INTERNAL_PORT
321 export MR_INTERNAL_SECURE_PORT
322 export MR_EXTERNAL_PORT
323 export MR_EXTERNAL_SECURE_PORT
325 if [ $retcode_prestarted_dmaapmr -eq 0 ] || [ $retcode_included_dmaapmr -eq 0 ]; then # Set topics for dmaap
326 export TOPIC_READ="http://$MR_DMAAP_APP_NAME.$KUBE_ONAP_NAMESPACE:$MR_INTERNAL_PORT/events/$MR_READ_TOPIC"
327 export TOPIC_WRITE="http://$MR_DMAAP_APP_NAME.$KUBE_ONAP_NAMESPACE:$MR_INTERNAL_PORT/events/$MR_WRITE_TOPIC/users/mr-stub?timeout=15000&limit=100"
330 export TOPIC_WRITE=""
333 #Check if onap namespace exists, if not create it
334 __kube_create_namespace $KUBE_ONAP_NAMESPACE
337 input_yaml=$SIM_GROUP"/"$MR_STUB_COMPOSE_DIR"/"svc.yaml
338 output_yaml=$PWD/tmp/mr_svc.yaml
339 __kube_create_instance service $MR_STUB_APP_NAME $input_yaml $output_yaml
342 input_yaml=$SIM_GROUP"/"$MR_STUB_COMPOSE_DIR"/"app.yaml
343 output_yaml=$PWD/tmp/mr_app.yaml
344 __kube_create_instance app $MR_STUB_APP_NAME $input_yaml $output_yaml
350 echo " Retrieving host and ports for service..."
351 MR_STUB_HOST_NAME=$(__kube_get_service_host $MR_STUB_APP_NAME $KUBE_ONAP_NAMESPACE)
353 MR_EXT_PORT=$(__kube_get_service_port $MR_STUB_APP_NAME $KUBE_ONAP_NAMESPACE "http")
354 MR_EXT_SECURE_PORT=$(__kube_get_service_port $MR_STUB_APP_NAME $KUBE_ONAP_NAMESPACE "https")
356 echo " Host IP, http port, https port: $MR_STUB_APP_NAME $MR_EXT_PORT $MR_EXT_SECURE_PORT"
357 if [ $MR_HTTPX == "http" ]; then
358 MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_EXT_PORT
359 if [ -z "$MR_SERVICE_PATH" ]; then
360 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_PORT
363 MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_HOST_NAME":"$MR_EXT_SECURE_PORT
364 if [ -z "$MR_SERVICE_PATH" ]; then
365 MR_SERVICE_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_EXT_SECURE_PORT
368 MR_ADAPTER_HTTP="http://"$MR_STUB_HOST_NAME":"$MR_EXT_PORT
369 MR_ADAPTER_HTTPS="https://"$MR_STUB_HOST_NAME":"$MR_EXT_SECURE_PORT
371 __check_service_start $MR_STUB_APP_NAME $MR_STUB_PATH$MR_STUB_ALIVE_URL
373 echo -ne " Service $MR_STUB_APP_NAME - reset "$SAMELINE
374 result=$(__do_curl $MR_STUB_APP_NAME $MR_STUB_PATH/reset)
375 if [ $? -ne 0 ]; then
376 echo -e " Service $MR_STUB_APP_NAME - reset $RED Failed $ERED - will continue"
378 echo -e " Service $MR_STUB_APP_NAME - reset $GREEN OK $EGREEN"
384 __check_included_image 'DMAAPMR'
386 __check_included_image 'MR'
389 if [ $retcode_dmaapmr -ne 0 ] && [ $retcode_mr -ne 0 ]; then
390 echo -e $RED"The Message Router apps 'MR' and/or 'DMAAPMR' are not included in this test script"$ERED
391 echo -e $RED"The Message Router will not be started"$ERED
392 echo -e $RED"Both MR and DAAMPMR - or - only MR - need to be included"
396 if [ $retcode_dmaapmr -eq 0 ] && [ $retcode_mr -ne 0 ]; then
397 echo -e $RED"The Message Router apps 'MR' and/or 'DMAAPMR' are not included in this test script"$ERED
398 echo -e $RED"The Message Router will not be started"$ERED
399 echo -e $RED"Both MR and DAAMPMR - or - only MR - need to be included"
404 export TOPIC_WRITE=""
405 if [ $retcode_dmaapmr -eq 0 ]; then # Set topics for dmaap
406 export TOPIC_READ="http://$MR_DMAAP_APP_NAME:$MR_INTERNAL_PORT/events/$MR_READ_TOPIC"
407 export TOPIC_WRITE="http://$MR_DMAAP_APP_NAME:$MR_INTERNAL_PORT/events/$MR_WRITE_TOPIC/users/mr-stub?timeout=15000&limit=100"
410 export DOCKER_SIM_NWNAME
411 export ONAP_ZOOKEEPER_IMAGE
412 export MR_ZOOKEEPER_APP_NAME
413 export ONAP_KAFKA_IMAGE
414 export MR_KAFKA_APP_NAME
415 export ONAP_DMAAPMR_IMAGE
416 export MR_DMAAP_APP_NAME
417 export MR_DMAAP_LOCALHOST_PORT
418 export MR_INTERNAL_PORT
419 export MR_DMAAP_LOCALHOST_SECURE_PORT
420 export MR_INTERNAL_SECURE_PORT
422 if [ $retcode_dmaapmr -eq 0 ]; then
423 __start_container $MR_DMAAP_COMPOSE_DIR NODOCKERARGS 1 $MR_DMAAP_APP_NAME
425 __check_service_start $MR_DMAAP_APP_NAME $MR_DMAAP_PATH$MR_DMAAP_ALIVE_URL
428 __create_topic $MR_READ_TOPIC "Topic for reading policy messages"
430 __create_topic $MR_WRITE_TOPIC "Topic for writing policy messages"
432 __dmaap_pipeclean $MR_READ_TOPIC "/events/A1-POLICY-AGENT-READ" "/events/A1-POLICY-AGENT-READ/users/policy-agent?timeout=1000&limit=100"
434 __dmaap_pipeclean $MR_WRITE_TOPIC "/events/A1-POLICY-AGENT-WRITE" "/events/A1-POLICY-AGENT-WRITE/users/mr-stub?timeout=1000&limit=100"
436 echo " Current topics:"
437 curlString="$MR_DMAAP_PATH/topics"
438 result=$(__do_curl "$curlString")
439 echo $result | indent2
442 export DOCKER_SIM_NWNAME
443 export MR_STUB_APP_NAME
445 export MR_INTERNAL_PORT
446 export MR_INTERNAL_SECURE_PORT
447 export MR_STUB_LOCALHOST_PORT
448 export MR_STUB_LOCALHOST_SECURE_PORT
449 export MR_STUB_CERT_MOUNT_DIR
451 if [ $retcode_mr -eq 0 ]; then
452 __start_container $MR_STUB_COMPOSE_DIR NODOCKERARGS 1 $MR_STUB_APP_NAME
454 __check_service_start $MR_STUB_APP_NAME $MR_STUB_PATH$MR_STUB_ALIVE_URL
462 ### Generic test cases for varaible checking
464 # Tests if a variable value in the MR stub is equal to a target value and and optional timeout.
465 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
466 # equal to the target or not.
467 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
468 # before setting pass or fail depending on if the variable value becomes equal to the target
470 # (Function for test scripts)
472 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
473 __var_test "MR" $MR_STUB_PATH/counter/ $1 "=" $2 $3
476 __print_err "Wrong args to mr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
480 # Tests if a variable value in the MR stub is greater than a target value and and optional timeout.
481 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
482 # greater than the target or not.
483 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
484 # before setting pass or fail depending on if the variable value becomes greater than the target
486 # (Function for test scripts)
488 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
489 __var_test "MR" $MR_STUB_PATH/counter/ $1 ">" $2 $3
492 __print_err "Wrong args to mr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
496 # Read a variable value from MR sim and send to stdout. Arg: <variable-name>
498 echo "$(__do_curl $MR_STUB_PATH/counter/$1)"
501 # Print a variable value from the MR stub.
502 # arg: <variable-name>
503 # (Function for test scripts)
507 __print_err "need one arg, <mr-param>" $@
510 echo -e $BOLD"INFO(${BASH_LINENO[0]}): mrstub, $1 = $(__do_curl $MR_STUB_PATH/counter/$1)"$EBOLD