# arg: <image-tag-suffix> (selects staging, snapshot, release etc)
# <image-tag-suffix> is present only for images with staging, snapshot,release tags
__MR_imagesetup() {
- __check_and_create_image_var MR "MRSTUB_IMAGE" "MRSTUB_IMAGE_BASE" "MRSTUB_IMAGE_TAG" LOCAL "$MR_STUB_DISPLAY_NAME"
+ __check_and_create_image_var MR "MRSTUB_IMAGE" "MRSTUB_IMAGE_BASE" "MRSTUB_IMAGE_TAG" LOCAL "$MR_STUB_DISPLAY_NAME" $IMAGE_TARGET_PLATFORM_IMG_TAG
}
# Create the image var used during the test
# arg: <image-tag-suffix> (selects staging, snapshot, release etc)
# <image-tag-suffix> is present only for images with staging, snapshot,release tags
__DMAAPMR_imagesetup() {
- __check_and_create_image_var DMAAPMR "ONAP_DMAAPMR_IMAGE" "ONAP_DMAAPMR_IMAGE_BASE" "ONAP_DMAAPMR_IMAGE_TAG" REMOTE_RELEASE_ONAP "DMAAP Message Router"
- __check_and_create_image_var DMAAPMR "ONAP_ZOOKEEPER_IMAGE" "ONAP_ZOOKEEPER_IMAGE_BASE" "ONAP_ZOOKEEPER_IMAGE_TAG" REMOTE_RELEASE_ONAP "ZooKeeper"
- __check_and_create_image_var DMAAPMR "ONAP_KAFKA_IMAGE" "ONAP_KAFKA_IMAGE_BASE" "ONAP_KAFKA_IMAGE_TAG" REMOTE_RELEASE_ONAP "Kafka"
+ __check_and_create_image_var DMAAPMR "ONAP_DMAAPMR_IMAGE" "ONAP_DMAAPMR_IMAGE_BASE" "ONAP_DMAAPMR_IMAGE_TAG" REMOTE_RELEASE_ONAP "DMAAP Message Router" ""
+ __check_and_create_image_var DMAAPMR "ONAP_ZOOKEEPER_IMAGE" "ONAP_ZOOKEEPER_IMAGE_BASE" "ONAP_ZOOKEEPER_IMAGE_TAG" REMOTE_RELEASE_ONAP "ZooKeeper" ""
+ __check_and_create_image_var DMAAPMR "ONAP_KAFKA_IMAGE" "ONAP_KAFKA_IMAGE_BASE" "ONAP_KAFKA_IMAGE_TAG" REMOTE_RELEASE_ONAP "Kafka" ""
}
# Pull image from remote repo or use locally built image
__MR_imagebuild() {
cd ../mrstub
echo " Building MR - $MR_STUB_DISPLAY_NAME - image: $MRSTUB_IMAGE"
- docker build --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $MRSTUB_IMAGE . &> .dockererr
+ docker build $IMAGE_TARGET_PLATFORM_CMD_PARAM --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $MRSTUB_IMAGE . &> .dockererr
if [ $? -eq 0 ]; then
echo -e $GREEN" Build Ok"$EGREEN
__retag_and_push_image MRSTUB_IMAGE
}
# Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action.
-# This function is called for prestarted apps not managed by the test script.
+# This function is called for pre-started apps not managed by the test script.
__MR_kube_scale_zero_and_wait() {
echo -e " MR replicas kept as is"
}
# Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action.
-# This function is called for prestarted apps not managed by the test script.
+# This function is called for pre-started apps not managed by the test script.
__DMAAPMR_kube_scale_zero_and_wait() {
echo -e " DMAAP replicas kept as is"
}
-# Delete all kube resouces for the app
+# Delete all kube resources for the app
# This function is called for apps managed by the test script.
__MR_kube_delete_all() {
__kube_delete_all_resources $KUBE_ONAP_NAMESPACE autotest MR
}
-# Delete all kube resouces for the app
+# Delete all kube resources for the app
# This function is called for apps managed by the test script.
__DMAAPMR_kube_delete_all() {
__kube_delete_all_resources $KUBE_ONAP_NAMESPACE autotest DMAAPMR
# Store docker logs
# This function is called for apps managed by the test script.
-# args: <log-dir> <file-prexix>
+# args: <log-dir> <file-prefix>
__MR_store_docker_logs() {
if [ $RUNMODE == "KUBE" ]; then
- kubectl logs -l "autotest=MR" -n $KUBE_ONAP_NAMESPACE --tail=-1 > $1$2_mr_stub.log 2>&1
+ kubectl $KUBECONF logs -l "autotest=MR" -n $KUBE_ONAP_NAMESPACE --tail=-1 > $1$2_mr_stub.log 2>&1
else
docker logs $MR_STUB_APP_NAME > $1$2_mr_stub.log 2>&1
fi
# Store docker logs
# This function is called for apps managed by the test script.
-# args: <log-dir> <file-prexix>
+# args: <log-dir> <file-prefix>
__DMAAPMR_store_docker_logs() {
if [ $RUNMODE == "KUBE" ]; then
- for podname in $(kubectl get pods -n $KUBE_ONAP_NAMESPACE -l "autotest=DMAAPMR" -o custom-columns=":metadata.name"); do
- kubectl logs -n $KUBE_ONAP_NAMESPACE $podname --tail=-1 > $1$2_$podname.log 2>&1
+ for podname in $(kubectl $KUBECONF get pods -n $KUBE_ONAP_NAMESPACE -l "autotest=DMAAPMR" -o custom-columns=":metadata.name"); do
+ kubectl $KUBECONF logs -n $KUBE_ONAP_NAMESPACE $podname --tail=-1 > $1$2_$podname.log 2>&1
done
else
- docker logs $MR_DMAAP_APP_NAME > $1$2mr.log 2>&1
+ docker logs $MR_DMAAP_APP_NAME > $1$2_mr.log 2>&1
docker logs $MR_KAFKA_APP_NAME > $1$2_mr_kafka.log 2>&1
docker logs $MR_ZOOKEEPER_APP_NAME > $1$2_mr_zookeeper.log 2>&1
fi
: # handle by __MR_initial_setup
}
-# Set app short-name, app name and namespace for logging runtime statistics of kubernets pods or docker containers
+# Set app short-name, app name and namespace for logging runtime statistics of kubernetes pods or docker containers
# For docker, the namespace shall be excluded
-# This function is called for apps managed by the test script as well as for prestarted apps.
+# This function is called for apps managed by the test script as well as for pre-started apps.
# args: -
-__MR_statisics_setup() {
+__MR_statistics_setup() {
if [ $RUNMODE == "KUBE" ]; then
echo "MR-STUB $MR_STUB_APP_NAME $KUBE_ONAP_NAMESPACE"
else
fi
}
-# Set app short-name, app name and namespace for logging runtime statistics of kubernets pods or docker containers
+# Set app short-name, app name and namespace for logging runtime statistics of kubernetes pods or docker containers
# For docker, the namespace shall be excluded
-# This function is called for apps managed by the test script as well as for prestarted apps.
+# This function is called for apps managed by the test script as well as for pre-started apps.
# args: -
-__DMAAPMR_statisics_setup() {
+__DMAAPMR_statistics_setup() {
if [ $RUNMODE == "KUBE" ]; then
echo "KAFKA $MR_KAFKA_APP_NAME $KUBE_ONAP_NAMESPACE MESSAGE-ROUTER $MR_DMAAP_APP_NAME $KUBE_ONAP_NAMESPACE ZOOKEEPER $MR_ZOOKEEPER_APP_NAME $KUBE_ONAP_NAMESPACE"
else
fi
}
+# Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied
+# args: -
+__MR_test_requirements() {
+ :
+}
+
+# Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied
+# args: -
+__DMAAPMR_test_requirements() {
+ :
+}
+
#######################################################
# Description of port mappings when running MR-STUB only or MR-STUB + MESSAGE-ROUTER
# args: <protocol> <internal-port> <external-port> <internal-secure-port> <external-secure-port>
__mr_set_protocoll() {
echo -e $BOLD"$MR_STUB_DISPLAY_NAME and $MR_DMAAP_DISPLAY_NAME protocol setting"$EBOLD
- echo -e " Using $BOLD http $EBOLD towards $MR_STUB_DISPLAY_NAME and $MR_DMAAP_DISPLAY_NAME"
+ echo -e " Using $BOLD $1 $EBOLD towards $MR_STUB_DISPLAY_NAME and $MR_DMAAP_DISPLAY_NAME"
## Access to Dmaap mediator
# Access via test script
MR_STUB_PATH=$MR_HTTPX"://"$MR_STUB_APP_NAME":"$INT_PORT # access from script via proxy, docker
MR_DMAAP_PATH=$MR_HTTPX"://"$MR_DMAAP_APP_NAME":"$INT_PORT # access from script via proxy, docker
- MR_DMAAP_ADAPTER_HTTP="" # Access to dmaap mr via proyx - set only if app is included
+ MR_DMAAP_ADAPTER_HTTP="" # Access to dmaap mr via proxy - set only if app is included
MR_SERVICE_PATH=$MR_STUB_PATH # access container->container, docker - access pod->svc, kube
MR_KAFKA_SERVICE_PATH=""
MR_ZOOKEEPER_SERVICE_PATH=$MR_ZOOKEEPER_APP_NAME":"$MR_ZOOKEEPER_PORT
fi
- # For directing calls from script to e.g.PMS via message rounter
+ # For directing calls from script to e.g.A1PMS via message router
# These cases shall always go though the mr-stub
MR_ADAPTER_HTTP="http://"$MR_STUB_APP_NAME":"$2
MR_ADAPTER_HTTPS="https://"$MR_STUB_APP_NAME":"$4
MR_ZOOKEEPER_SERVICE_PATH=$MR_ZOOKEEPER_APP_NAME"."$KUBE_ONAP_NAMESPACE":"$MR_ZOOKEEPER_PORT
fi
- # For directing calls from script to e.g.PMS, via message rounter
+ # For directing calls from script to e.g.A1PMS, via message router
# These calls shall always go though the mr-stub
MR_ADAPTER_HTTP="http://"$MR_STUB_APP_NAME.$KUBE_ONAP_NAMESPACE":"$3
MR_ADAPTER_HTTPS="https://"$MR_STUB_APP_NAME.$KUBE_ONAP_NAMESPACE":"$5
export MR_KAFKA_SERVICE_PATH
export MR_ZOOKEEPER_SERVICE_PATH
+
+ export MR_KAFKA_KUBE_NODE_PORT
+ export MR_KAFKA_DOCKER_LOCALHOST_PORT
}
# Export env vars for config files, docker compose and kube resources
if [ $RUNMODE == "KUBE" ]; then
- # Table of possible combinations of included mr and included/prestarted dmaap-mr
- # mr can never be prestarted
+ # Table of possible combinations of included mr and included/pre-started dmaap-mr
+ # mr can never be pre-started
# mr can be used stand alone
- # if dmaapmr is included/prestarted, then mr is needed as well as frontend
+ # if dmaapmr is included/pre-started, then mr is needed as well as frontend
# Inverted logic - 0 mean true, 1 means false
- # mr prestarted 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
+ # mr pre-started 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
# mr included 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
- # dmaap prestarted 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
+ # dmaap pre-started 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
# dmaap included 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
# ==================================================
# OK 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1
__check_service_start $MR_DMAAP_APP_NAME $MR_DMAAP_PATH$MR_DMAAP_ALIVE_URL
+ echo " Kafka TCP node port $MR_KAFKA_KUBE_NODE_PORT"
+
+
if [ $# -gt 0 ]; then
if [ $(($#%3)) -eq 0 ]; then
while [ $# -gt 0 ]; do
__check_service_start $MR_DMAAP_APP_NAME $MR_DMAAP_PATH$MR_DMAAP_ALIVE_URL
+ echo " Kafka TCP node port $MR_KAFKA_DOCKER_LOCALHOST_PORT"
+
if [ $# -gt 0 ]; then
if [ $(($#%3)) -eq 0 ]; then
while [ $# -gt 0 ]; do
fi
fi
- echo " Current topics:"
- curlString="$MR_DMAAP_PATH/topics"
- result=$(__do_curl "$curlString")
- echo $result | indent2
+ dmaap_api_print_topics
fi
__mr_export_vars
return 1
}
+# Helper function to list the current topics in DMAAP MR
+# args: -
+dmaap_api_print_topics() {
+ echo " Current topics:"
+ curlString="$MR_DMAAP_PATH/topics"
+ result=$(__do_curl "$curlString")
+ echo $result | indent2
+}
+
### Generic test cases for varaible checking
return 0
}
-# Create tet file for payload
+# Create text file for payload
# arg: <size-in-kb> <filename>
mr_api_generate_text_payload_file() {
__log_conf_start $@