From 674793d94f09873d24edd85f9eb2da2582d21673 Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Thu, 6 May 2021 19:49:17 +0200 Subject: [PATCH] Test env updates Updated test cases Updated release name to D Release Added image push policy when using custom image repo Updated http proxies to also accept https in proxy requests Issue-ID: NONRTRIC-486 Signed-off-by: BjornMagnussonXA Change-Id: I8a4a642ee50f53f7f278dd0963eb1f1b70563bbf --- test/auto-test/FTC1.sh | 2 +- test/auto-test/FTC10.sh | 2 +- test/auto-test/FTC100.sh | 4 +- test/auto-test/FTC110.sh | 2 +- test/auto-test/FTC1100.sh | 2 +- test/auto-test/FTC150.sh | 2 +- test/auto-test/FTC1800.sh | 2 +- test/auto-test/FTC2001.sh | 2 +- test/auto-test/FTC300.sh | 2 +- test/auto-test/FTC310.sh | 2 +- test/auto-test/FTC350.sh | 3 +- test/auto-test/FTC800.sh | 2 +- test/auto-test/FTC805.sh | 10 ++- test/auto-test/FTC810.sh | 2 +- test/auto-test/FTC850.sh | 2 +- test/auto-test/FTC900.sh | 2 +- ...RECIPE_DAWN.sh => FTC_HELM_RECIPE_D_RELEASE.sh} | 4 +- test/auto-test/PM_DEMO.sh | 2 +- test/auto-test/PM_EI_DEMO.sh | 2 +- test/auto-test/README.md | 10 +-- test/common/README.md | 27 +++++- test/common/api_curl.sh | 6 +- test/common/controller_api_functions.sh | 6 +- test/common/http_proxy_api_functions.sh | 88 +++++++++++++++++-- test/common/kube_proxy_api_functions.sh | 65 +++++++++++--- test/common/prodstub_api_functions.sh | 6 +- test/common/ricsimulator_api_functions.sh | 6 +- test/common/test_env-onap-guilin.sh | 20 +++-- test/common/test_env-onap-honolulu.sh | 20 +++-- test/common/test_env-onap-istanbul.sh | 20 +++-- test/common/test_env-oran-cherry.sh | 22 +++-- ...env-oran-dawn.sh => test_env-oran-d-release.sh} | 23 +++-- test/common/testcase_common.sh | 62 ++++++++++++-- test/common/testengine_config.sh | 2 +- test/http-https-proxy/README.md | 8 +- test/http-https-proxy/basic_test.sh | 8 +- test/http-https-proxy/http_proxy.js | 98 ++++++++++++---------- test/simulator-group/httpproxy/app.yaml | 6 +- test/simulator-group/httpproxy/docker-compose.yml | 5 +- test/simulator-group/httpproxy/svc.yaml | 8 ++ test/simulator-group/kubeproxy/app.yaml | 4 + test/simulator-group/kubeproxy/svc.yaml | 10 +++ 42 files changed, 435 insertions(+), 146 deletions(-) rename test/auto-test/{FTC_HELM_RECIPE_DAWN.sh => FTC_HELM_RECIPE_D_RELEASE.sh} (99%) rename test/common/{test_env-oran-dawn.sh => test_env-oran-d-release.sh} (95%) diff --git a/test/auto-test/FTC1.sh b/test/auto-test/FTC1.sh index f39ebfb0..5347f8f0 100755 --- a/test/auto-test/FTC1.sh +++ b/test/auto-test/FTC1.sh @@ -34,7 +34,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC10.sh b/test/auto-test/FTC10.sh index 2e443cb3..a3010f24 100755 --- a/test/auto-test/FTC10.sh +++ b/test/auto-test/FTC10.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC100.sh b/test/auto-test/FTC100.sh index f58ba160..a3432e1d 100755 --- a/test/auto-test/FTC100.sh +++ b/test/auto-test/FTC100.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Full agent API walkthrough using agent REST/DMAAP and with/wit DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC NGW" #App names to include in the test when running kubernetes, space separated list -KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGw" +KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGW" #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list KUBE_PRESTARTED_IMAGES="" @@ -34,7 +34,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC110.sh b/test/auto-test/FTC110.sh index c9108f81..c74ce242 100755 --- a/test/auto-test/FTC110.sh +++ b/test/auto-test/FTC110.sh @@ -34,7 +34,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh index 6c74dafe..76f03d50 100755 --- a/test/auto-test/FTC1100.sh +++ b/test/auto-test/FTC1100.sh @@ -34,7 +34,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC150.sh b/test/auto-test/FTC150.sh index 51bcbe44..a3dfbe00 100755 --- a/test/auto-test/FTC150.sh +++ b/test/auto-test/FTC150.sh @@ -28,7 +28,7 @@ KUBE_INCLUDED_IMAGES=" RICSIM SDNC KUBEPROXY" KUBE_PRESTARTED_IMAGES=" " #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh index f3d9501c..01f01788 100755 --- a/test/auto-test/FTC1800.sh +++ b/test/auto-test/FTC1800.sh @@ -34,7 +34,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC2001.sh b/test/auto-test/FTC2001.sh index c62a1359..ab48c6ea 100755 --- a/test/auto-test/FTC2001.sh +++ b/test/auto-test/FTC2001.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC300.sh b/test/auto-test/FTC300.sh index 1efdfde2..7c0208a3 100755 --- a/test/auto-test/FTC300.sh +++ b/test/auto-test/FTC300.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC310.sh b/test/auto-test/FTC310.sh index 616751bf..7865edb3 100755 --- a/test/auto-test/FTC310.sh +++ b/test/auto-test/FTC310.sh @@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Resync of RIC via changes in the consul config or pushed confi DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER" diff --git a/test/auto-test/FTC350.sh b/test/auto-test/FTC350.sh index 4390cdb3..756ea7fe 100755 --- a/test/auto-test/FTC350.sh +++ b/test/auto-test/FTC350.sh @@ -28,7 +28,7 @@ KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGW" KUBE_PRESTARTED_IMAGES="" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" @@ -41,6 +41,7 @@ SUPPORTED_RUNMODES="DOCKER KUBE" . ../common/control_panel_api_functions.sh . ../common/controller_api_functions.sh . ../common/kube_proxy_api_functions.sh +. ../common/gateway_api_functions.sh setup_testenvironment diff --git a/test/auto-test/FTC800.sh b/test/auto-test/FTC800.sh index 40c4f132..0a5cb3af 100755 --- a/test/auto-test/FTC800.sh +++ b/test/auto-test/FTC800.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC805.sh b/test/auto-test/FTC805.sh index c563bb07..3c99ed96 100755 --- a/test/auto-test/FTC805.sh +++ b/test/auto-test/FTC805.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-ISTANBUL ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-ISTANBUL ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" @@ -154,7 +154,7 @@ for __httpx in $TESTED_PROTOCOLS ; do api_equal json:policy_types 1 300 #Wait for the agent to refresh types from the simulator fi - api_put_service 201 "serv1" 600 "$CR_SERVICE_PATH/1" + api_put_service 201 "serv1" 0 "$CR_SERVICE_PATH/1" echo "Check the number of types in the agent for each ric is 1" for ((i=1; i<=$NUM_RICS; i++)) @@ -182,6 +182,8 @@ for __httpx in $TESTED_PROTOCOLS ; do sim_equal ricsim_g1_$i num_instances $NUM_POLICIES_PER_RIC done + api_get_services 200 "serv1" "serv1" 0 "$CR_SERVICE_PATH/1" + stop_policy_agent start_stopped_policy_agent @@ -217,6 +219,8 @@ for __httpx in $TESTED_PROTOCOLS ; do print_timer "Restore $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices after restart over $interface using "$__httpx + api_get_services 200 "serv1" "serv1" 0 "$CR_SERVICE_PATH/1" + start_timer "Delete $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices over $interface using "$__httpx api_delete_policy_parallel 204 $NUM_RICS $START_ID $NUM_POLICIES_PER_RIC 7 @@ -245,6 +249,8 @@ for __httpx in $TESTED_PROTOCOLS ; do sleep_wait 200 + api_get_services 200 "serv1" "serv1" 0 "$CR_SERVICE_PATH/1" + api_equal json:policies 0 for ((i=1; i<=$NUM_RICS; i++)) diff --git a/test/auto-test/FTC810.sh b/test/auto-test/FTC810.sh index 44015d69..37faaa40 100755 --- a/test/auto-test/FTC810.sh +++ b/test/auto-test/FTC810.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC850.sh b/test/auto-test/FTC850.sh index 451da3f2..b49dcc22 100755 --- a/test/auto-test/FTC850.sh +++ b/test/auto-test/FTC850.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC900.sh b/test/auto-test/FTC900.sh index 33ebd696..3cd3bd2f 100755 --- a/test/auto-test/FTC900.sh +++ b/test/auto-test/FTC900.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/FTC_HELM_RECIPE_DAWN.sh b/test/auto-test/FTC_HELM_RECIPE_D_RELEASE.sh similarity index 99% rename from test/auto-test/FTC_HELM_RECIPE_DAWN.sh rename to test/auto-test/FTC_HELM_RECIPE_D_RELEASE.sh index 7d8f0794..4343beae 100755 --- a/test/auto-test/FTC_HELM_RECIPE_DAWN.sh +++ b/test/auto-test/FTC_HELM_RECIPE_D_RELEASE.sh @@ -17,7 +17,7 @@ # ============LICENSE_END================================================= # -TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm recepie - all components - DAWN release" +TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm recepie - all components - D-RELEASE" #App names to include in the test when running docker, space separated list DOCKER_INCLUDED_IMAGES="" # Not used - KUBE only test script @@ -28,7 +28,7 @@ KUBE_INCLUDED_IMAGES=" MR CR PRODSTUB KUBEPROXY" KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ECS RC SDNC" #Supported test environment profiles -SUPPORTED_PROFILES="ORAN-DAWN" +SUPPORTED_PROFILES="ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="KUBE" diff --git a/test/auto-test/PM_DEMO.sh b/test/auto-test/PM_DEMO.sh index f9d08b5d..644c5e2e 100755 --- a/test/auto-test/PM_DEMO.sh +++ b/test/auto-test/PM_DEMO.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/PM_EI_DEMO.sh b/test/auto-test/PM_EI_DEMO.sh index 66b6454d..6f866fbe 100755 --- a/test/auto-test/PM_EI_DEMO.sh +++ b/test/auto-test/PM_EI_DEMO.sh @@ -33,7 +33,7 @@ KUBE_PRESTARTED_IMAGES="" CONDITIONALLY_IGNORED_IMAGES="NGW" #Supported test environment profiles -SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-DAWN" +SUPPORTED_PROFILES="ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE" #Supported run modes SUPPORTED_RUNMODES="DOCKER KUBE" diff --git a/test/auto-test/README.md b/test/auto-test/README.md index 8882ce7f..4926b58c 100644 --- a/test/auto-test/README.md +++ b/test/auto-test/README.md @@ -34,12 +34,12 @@ ORAN CHERRY ./PM_EI_DEMO.sh remote-remove docker release --env-file ../common/test_env-oran-cherry.sh ./PM_EI_DEMO.sh remote-remove kube release --env-file ../common/test_env-oran-cherry.sh -ORAN DAWN +ORAN D-RELEASE ========= -./PM_EI_DEMO.sh remote-remove docker --env-file ../common/test_env-oran-dawn.sh --use-release-image SDNC -./PM_EI_DEMO.sh remote-remove kube --env-file ../common/test_env-oran-dawn.sh --use-release-image SDNC -Note that dawn has not update the SDNC so cherry release is used -Note: When dawn is released, add the 'release' arg to run released images. +./PM_EI_DEMO.sh remote-remove docker --env-file ../common/test_env-oran-d-release.sh --use-release-image SDNC +./PM_EI_DEMO.sh remote-remove kube --env-file ../common/test_env-oran-d-release.sh --use-release-image SDNC +Note that D-Release has not updated the SDNC so cherry release is used +Note: When D-Release is released, add the 'release' arg to run released images. ONAP GUILIN =========== diff --git a/test/common/README.md b/test/common/README.md index 85535199..dd64c429 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -129,7 +129,7 @@ The script can be started with these arguments | arg list | |--| -| `remote|remote-remove docker|kube --env-file [release] [auto-clean] [--stop-at-error] [--ricsim-prefix ] [--use-local-image +] [--use-snapshot-image +] [--use-staging-image +] [--use-release-image +] [--image-repo [release] [auto-clean] [--stop-at-error] [--ricsim-prefix ] [--use-local-image +] [--use-snapshot-image +] [--use-staging-image +] [--use-release-image +] [--image-repo ]` | | parameter | description | |-|-| @@ -147,6 +147,7 @@ The script can be started with these arguments | `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names | | `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names | | `--image-repo` | Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo | +| `-repo-policy ` | Policy controlling which images to re-tag and push to image repo in param --image-repo. Can be set to 'local' (push on locally built images) or 'remote' (push locally built images and images from nexus repo). Default is 'local' | | `--cluster-timeout` | Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds | | `help` | Print this info along with the test script description and the list of app short names supported | @@ -1375,6 +1376,18 @@ Only response code tested - not payload # Description of functions in http_proxy_api_functions.sh # +## Function: use_http_proxy_http ## +Use http for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https. +| arg list | +|--| +| None | + +## Function: use_http_proxy_https ## +Use https for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https. +| arg list | +|--| +| None | + ## Function: start_http_proxy ## Start the http proxy container in docker or kube depending on running mode. | arg list | @@ -1383,6 +1396,18 @@ Start the http proxy container in docker or kube depending on running mode. # Description of functions in kube_proxy_api_functions.sh # +## Function: use_kube_proxy_http ## +Use http for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https. +| arg list | +|--| +| None | + +## Function: use_kube_proxy_https ## +Use https for all proxy requests. Note that this only applicable to the actual proxy request, the proxied protocol can still be http and https. +| arg list | +|--| +| None | + ## Function: start_kube_proxy ## Start the kube proxy container in kube. This proxy enabled the test env to access all services and pods in a kube cluster. No proxy is started if the function is called in docker mode. diff --git a/test/common/api_curl.sh b/test/common/api_curl.sh index 4ebac805..615ccabc 100644 --- a/test/common/api_curl.sh +++ b/test/common/api_curl.sh @@ -31,7 +31,11 @@ __do_curl_to_api() { proxyflag="" if [ $RUNMODE == "KUBE" ]; then if [ ! -z "$KUBE_PROXY_PATH" ]; then - proxyflag=" --proxy $KUBE_PROXY_PATH" + if [ $KUBE_PROXY_HTTPX == "http" ]; then + proxyflag=" --proxy $KUBE_PROXY_PATH" + else + proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH" + fi fi fi paramError=0 diff --git a/test/common/controller_api_functions.sh b/test/common/controller_api_functions.sh index 7bca91c6..3ed3933a 100644 --- a/test/common/controller_api_functions.sh +++ b/test/common/controller_api_functions.sh @@ -307,7 +307,11 @@ __do_curl_to_controller() { proxyflag="" if [ $RUNMODE == "KUBE" ]; then if [ ! -z "$KUBE_PROXY_PATH" ]; then - proxyflag=" --proxy KUBE_PROXY_PATH" + if [ $KUBE_PROXY_HTTPX == "http" ]; then + proxyflag=" --proxy $KUBE_PROXY_PATH" + else + proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH" + fi fi fi curlString="curl -skw %{http_code} $proxyflag -X POST $SDNC_API_PATH$1 -H accept:application/json -H Content-Type:application/json --data-binary @$payload" diff --git a/test/common/http_proxy_api_functions.sh b/test/common/http_proxy_api_functions.sh index 3e58a7e0..0a7718eb 100644 --- a/test/common/http_proxy_api_functions.sh +++ b/test/common/http_proxy_api_functions.sh @@ -25,7 +25,7 @@ # arg: (selects staging, snapshot, release etc) # is present only for images with staging, snapshot,release tags __HTTPPROXY_imagesetup() { - __check_and_create_image_var HTTPPROXY "HTTP_PROXY_IMAGE" "HTTP_PROXY_IMAGE_BASE" "HTTP_PROXY_IMAGE_TAG" REMOTE_PROXY "$HTTP_PROXY_DISPLAY_NAME" + __check_and_create_image_var HTTPPROXY "HTTP_PROXY_IMAGE" "HTTP_PROXY_IMAGE_BASE" "HTTP_PROXY_IMAGE_TAG" LOCAL "$HTTP_PROXY_DISPLAY_NAME" } # Pull image from remote repo or use locally built image @@ -41,7 +41,22 @@ __HTTPPROXY_imagepull() { # arg: (selects staging, snapshot, release etc) # is present only for images with staging, snapshot,release tags __HTTPPROXY_imagebuild() { - echo -e $RED"Image for app HTTPPROXY shall never be built"$ERED + cd ../$HTTP_PROXY_BUILD_DIR # Note: Reusing same impl as for kube proxy + echo " Building HTTPPROXY - $HTTP_PROXY_DISPLAY_NAME - image: $HTTP_PROXY_IMAGE" + docker build --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $HTTP_PROXY_IMAGE . &> .dockererr + if [ $? -eq 0 ]; then + echo -e $GREEN" Build Ok"$EGREEN + __retag_and_push_image HTTP_PROXY_IMAGE + if [ $? -ne 0 ]; then + exit 1 + fi + else + echo -e $RED" Build Failed"$ERED + ((RES_CONF_FAIL++)) + cat .dockererr + echo -e $RED"Exiting...."$ERED + exit 1 + fi } # Generate a string for each included image using the app display name and a docker images format string @@ -64,7 +79,7 @@ __HTTPPROXY_kube_scale_zero() { # 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. __HTTPPROXY_kube_scale_zero_and_wait() { - echo -e $RED" NGW replicas kept as is"$ERED + echo -e $RED" HTTPPROXY replicas kept as is"$ERED } # Delete all kube resouces for the app @@ -94,6 +109,30 @@ HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_WEB_EX ### Http Proxy functions ######################### +# All calls to httpproxy will be directed to the http interface +# args: - +# (Function for test scripts) +use_http_proxy_http() { + echo -e $BOLD"$HTTP_PROXY_DISPLAY_NAME protocol setting"$EBOLD + echo -e " Using $BOLD http $EBOLD" + HTTP_PROXY_HTTPX="http" + HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_EXTERNAL_PORT + + echo "" +} + +# All calls to httpproxy will be directed to the https interface +# args: - +# (Function for test scripts) +use_http_proxy_https() { + echo -e $BOLD"$HTTP_PROXY_DISPLAY_NAME protocol setting"$EBOLD + echo -e " Using $BOLD https $EBOLD" + HTTP_PROXY_HTTPX="https" + HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_EXTERNAL_SECURE_PORT + + echo "" +} + # Start the Http Proxy in the simulator group # args: - # (Function for test scripts) @@ -132,10 +171,17 @@ start_http_proxy() { if [ $retcode_i -eq 0 ]; then echo -e " Creating $HTTP_PROXY_APP_NAME deployment and service" export HTTP_PROXY_APP_NAME + export HTTP_PROXY_WEB_EXTERNAL_PORT export HTTP_PROXY_WEB_INTERNAL_PORT export HTTP_PROXY_EXTERNAL_PORT export HTTP_PROXY_INTERNAL_PORT + + export HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT + export HTTP_PROXY_WEB_INTERNAL_SECURE_PORT + export HTTP_PROXY_EXTERNAL_SECURE_PORT + export HTTP_PROXY_INTERNAL_SECURE_PORT + export KUBE_SIM_NAMESPACE export HTTP_PROXY_IMAGE @@ -156,13 +202,24 @@ start_http_proxy() { echo " Retrieving host and ports for service..." HTTP_PROXY_HOST_NAME=$(__kube_get_service_host $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE) HTTP_PROXY_WEB_EXTERNAL_PORT=$(__kube_get_service_port $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web") + HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "webs") + HTTP_PROXY_EXTERNAL_PORT=$(__kube_get_service_port $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http") + HTTP_PROXY_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $HTTP_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "https") + + if [ $HTTP_PROXY_HTTPX == "http" ]; then + HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_WEB_EXTERNAL_PORT + HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_EXTERNAL_PORT + HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_APP_NAME"."$KUBE_SIM_NAMESPACE - HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_WEB_EXTERNAL_PORT - HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_EXTERNAL_PORT - HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_APP_NAME"."$KUBE_SIM_NAMESPACE + echo " Host IP, http port: $HTTP_PROXY_HOST_NAME $HTTP_PROXY_WEB_EXTERNAL_PORT" + else + HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT + HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_EXTERNAL_SECURE_PORT + HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_APP_NAME"."$KUBE_SIM_NAMESPACE - echo " Host IP, http port: $HTTP_PROXY_HOST_NAME $HTTP_PROXY_WEB_EXTERNAL_PORT" + echo " Host IP, https port: $HTTP_PROXY_HOST_NAME $HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT" + fi __check_service_start $HTTP_PROXY_APP_NAME $HTTP_PROXY_PATH$HTTP_PROXY_ALIVE_URL @@ -176,17 +233,32 @@ start_http_proxy() { fi export HTTP_PROXY_APP_NAME + export HTTP_PROXY_EXTERNAL_PORT + export HTTP_PROXY_INTERNAL_PORT + export HTTP_PROXY_EXTERNAL_SECURE_PORT + export HTTP_PROXY_INTERNAL_SECURE_PORT export HTTP_PROXY_WEB_EXTERNAL_PORT export HTTP_PROXY_WEB_INTERNAL_PORT + export HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT + export HTTP_PROXY_WEB_INTERNAL_SECURE_PORT export DOCKER_SIM_NWNAME export HTTP_PROXY_DISPLAY_NAME __start_container $HTTP_PROXY_COMPOSE_DIR "" NODOCKERARGS 1 $HTTP_PROXY_APP_NAME + if [ $HTTP_PROXY_HTTPX == "http" ]; then + HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_EXTERNAL_PORT + else + HTTP_PROXY_PATH=$HTTP_PROXY_HTTPX"://"$HTTP_PROXY_HOST_NAME":"$HTTP_PROXY_EXTERNAL_SECURE_PORT + fi __check_service_start $HTTP_PROXY_APP_NAME $HTTP_PROXY_PATH$HTTP_PROXY_ALIVE_URL - HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_INTERNAL_PORT + if [ $HTTP_PROXY_HTTPX == "http" ]; then + HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_INTERNAL_PORT + else + HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_INTERNAL_SECURE_PORT + fi HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_APP_NAME fi diff --git a/test/common/kube_proxy_api_functions.sh b/test/common/kube_proxy_api_functions.sh index c352ff17..59b63464 100644 --- a/test/common/kube_proxy_api_functions.sh +++ b/test/common/kube_proxy_api_functions.sh @@ -98,8 +98,39 @@ __KUBEPROXY_store_docker_logs() { ####################################################### +## Access to Kube http proxy +# Direct access +KUBE_PROXY_HTTPX="http" + + +# Set http as the protocol to use for all communication to the Kube http proxy +# args: - +# (Function for test scripts) +use_kube_proxy_http() { + echo -e $BOLD"$KUBE_PROXY_DISPLAY_NAME protocol setting"$EBOLD + echo -e " Using $BOLD http $EBOLD towards Kube http proxy" + + KUBE_PROXY_HTTPX="http" + + echo -e $YELLOW" This setting cannot be changed once the kube proxy is started"$EYELLOW + echo "" +} + +# Set https as the protocol to use for all communication to the Kube http proxy +# args: - +# (Function for test scripts) +use_kube_proxy_https() { + echo -e $BOLD"$KUBE_PROXY_DISPLAY_NAME protocol setting"$EBOLD + echo -e " Using $BOLD https $EBOLD towards Kube http proxy" + + KUBE_PROXY_HTTPX="https" + + echo -e $YELLOW" This setting cannot be changed once the kube proxy is started"$EYELLOW + echo "" +} + ######################### -### Http Proxy functions +### Kube Http Proxy functions ######################### # Start the Kube Http Proxy in the simulator group @@ -140,10 +171,17 @@ start_kube_proxy() { if [ $retcode_i -eq 0 ]; then echo -e " Creating $KUBE_PROXY_APP_NAME deployment and service" export KUBE_PROXY_APP_NAME + export KUBE_PROXY_WEB_EXTERNAL_PORT export KUBE_PROXY_WEB_INTERNAL_PORT export KUBE_PROXY_EXTERNAL_PORT export KUBE_PROXY_INTERNAL_PORT + + export KUBE_PROXY_WEB_EXTERNAL_SECURE_PORT + export KUBE_PROXY_WEB_INTERNAL_SECURE_PORT + export KUBE_PROXY_EXTERNAL_SECURE_PORT + export KUBE_PROXY_INTERNAL_SECURE_PORT + export KUBE_SIM_NAMESPACE export KUBE_PROXY_IMAGE @@ -163,8 +201,6 @@ start_kube_proxy() { echo " Retrieving host and ports for service..." - CLUSTER_KUBE_PROXY="http" - #Finding host of the proxy echo " Trying to find svc hostname..." CLUSTER_KUBE_PROXY_HOST=$(__kube_cmd_with_timeout "kubectl get svc $KUBE_PROXY_APP_NAME -n $KUBE_SIM_NAMESPACE -o jsonpath={.status.loadBalancer.ingress[0].hostname}") @@ -188,28 +224,33 @@ start_kube_proxy() { echo -e $YELLOW" The test environment host/ip is: $CLUSTER_KUBE_PROXY_HOST."$EYELLOW fi fi + + PORT_KEY_PREFIX="" + if [ $KUBE_PROXY_HTTPX == "https" ]; then + PORT_KEY_PREFIX="s" #add suffix to port key name to get https ports + fi if [ -z "$CLUSTER_KUBE_PROXY_HOST" ]; then #Host/ip of proxy not found, try to use the cluster and the nodeports of the proxy CLUSTER_KUBE_PROXY_HOST=$(kubectl config view -o jsonpath={.clusters[0].cluster.server} | awk -F[/:] '{print $4}') echo -e $YELLOW" The test environment cluster ip is: $CLUSTER_KUBE_PROXY_HOST."$EYELLOW - CLUSTER_KUBE_PROXY_PORT=$(__kube_get_service_nodeport $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http") # port for proxy access - KUBE_PROXY_WEB_NODEPORT=$(__kube_get_service_nodeport $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web") # web port, only for alive test - echo " Cluster ip/host, cluster http nodeport, cluster web nodeport: $CLUSTER_KUBE_PROXY_HOST $CLUSTER_KUBE_PROXY_PORT $KUBE_PROXY_WEB_NODEPORT" + CLUSTER_KUBE_PROXY_PORT=$(__kube_get_service_nodeport $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http$PORT_KEY_PREFIX") # port for proxy access + KUBE_PROXY_WEB_NODEPORT=$(__kube_get_service_nodeport $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web$PORT_KEY_PREFIX") # web port, only for alive test + echo " Cluster ip/host, cluster http$PORT_KEY_PREFIX nodeport, cluster web$PORT_KEY_PREFIX nodeport: $CLUSTER_KUBE_PROXY_HOST $CLUSTER_KUBE_PROXY_PORT $KUBE_PROXY_WEB_NODEPORT" else #Find the service ports of the proxy - CLUSTER_KUBE_PROXY_PORT=$(__kube_get_service_port $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http") # port for proxy access - KUBE_PROXY_WEB_NODEPORT=$(__kube_get_service_port $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web") # web port, only for alive test - echo " Proxy ip/host, proxy http port, proxy web port: $CLUSTER_KUBE_PROXY_HOST $CLUSTER_KUBE_PROXY_PORT $KUBE_PROXY_WEB_NODEPORT" + CLUSTER_KUBE_PROXY_PORT=$(__kube_get_service_port $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http$PORT_KEY_PREFIX") # port for proxy access + KUBE_PROXY_WEB_NODEPORT=$(__kube_get_service_port $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web$PORT_KEY_PREFIX") # web port, only for alive test + echo " Proxy ip/host, proxy http$PORT_KEY_PREFIX port, proxy web$PORT_KEY_PREFIX port: $CLUSTER_KUBE_PROXY_HOST $CLUSTER_KUBE_PROXY_PORT $KUBE_PROXY_WEB_NODEPORT" fi - KUBE_PROXY_WEB_PATH=$CLUSTER_KUBE_PROXY"://"$CLUSTER_KUBE_PROXY_HOST":"$KUBE_PROXY_WEB_NODEPORT + KUBE_PROXY_WEB_PATH=$KUBE_PROXY_HTTPX"://"$CLUSTER_KUBE_PROXY_HOST":"$KUBE_PROXY_WEB_NODEPORT export KUBE_PROXY_PATH= # Make sure proxy is empty when checking the proxy itself __check_service_start $KUBE_PROXY_APP_NAME $KUBE_PROXY_WEB_PATH$KUBE_PROXY_ALIVE_URL # Set proxy for all subsequent calls for all services etc - export KUBE_PROXY_PATH=$CLUSTER_KUBE_PROXY"://"$CLUSTER_KUBE_PROXY_HOST":"$CLUSTER_KUBE_PROXY_PORT - + export KUBE_PROXY_PATH=$KUBE_PROXY_HTTPX"://"$CLUSTER_KUBE_PROXY_HOST":"$CLUSTER_KUBE_PROXY_PORT + export KUBE_PROXY_HTTPX else echo $YELLOW" Kube http proxy not needed in docker test. App not started" fi diff --git a/test/common/prodstub_api_functions.sh b/test/common/prodstub_api_functions.sh index 744e357c..8aae95a2 100644 --- a/test/common/prodstub_api_functions.sh +++ b/test/common/prodstub_api_functions.sh @@ -270,7 +270,11 @@ __execute_curl_to_prodstub() { proxyflag="" if [ $RUNMODE == "KUBE" ]; then if [ ! -z "$KUBE_PROXY_PATH" ]; then - proxyflag=" --proxy $KUBE_PROXY_PATH" + if [ $KUBE_PROXY_HTTPX == "http" ]; then + proxyflag=" --proxy $KUBE_PROXY_PATH" + else + proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH" + fi fi fi echo " CMD: $3 $proxyflag" >> $HTTPLOG diff --git a/test/common/ricsimulator_api_functions.sh b/test/common/ricsimulator_api_functions.sh index a8352187..0df800fd 100644 --- a/test/common/ricsimulator_api_functions.sh +++ b/test/common/ricsimulator_api_functions.sh @@ -351,7 +351,11 @@ __execute_curl_to_sim() { proxyflag="" if [ $RUNMODE == "KUBE" ]; then if [ ! -z "$KUBE_PROXY_PATH" ]; then - proxyflag=" --proxy $KUBE_PROXY_PATH" + if [ $KUBE_PROXY_HTTPX == "http" ]; then + proxyflag=" --proxy $KUBE_PROXY_PATH" + else + proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH" + fi fi fi echo " CMD: $2 $proxyflag" >> $HTTPLOG diff --git a/test/common/test_env-onap-guilin.sh b/test/common/test_env-onap-guilin.sh index 8dd205d4..59acba3a 100755 --- a/test/common/test_env-onap-guilin.sh +++ b/test/common/test_env-onap-guilin.sh @@ -114,8 +114,8 @@ CR_IMAGE_TAG_LOCAL="latest" #No remote image for CR, local image always used #Http proxy remote image and tag -HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy" -HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2" +HTTP_PROXY_IMAGE_BASE="nodejs-http-proxy" +HTTP_PROXY_IMAGE_TAG_LOCAL="latest" #No local image for http proxy, remote image always used #ONAP Zookeeper remote image and tag @@ -134,7 +134,7 @@ ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18" #No local image for ONAP DMAAP-MR, remote image always used #Kube proxy remote image and tag -KUBE_PROXY_IMAGE_BASE="nodejs-http-proxy" +KUBE_PROXY_IMAGE_BASE="nodejs-kube-proxy" KUBE_PROXY_IMAGE_TAG_LOCAL="latest" #No remote image for kube proxy, local image always used @@ -279,22 +279,30 @@ CONTROL_PANEL_HOST_MNT_DIR="./mnt" # Mounted dir, relative HTTP_PROXY_APP_NAME="httpproxy" # Name of the Http Proxy container HTTP_PROXY_DISPLAY_NAME="Http Proxy" -HTTP_PROXY_EXTERNAL_PORT=8780 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_PORT=8740 # Http Proxy container external port (host -> container) HTTP_PROXY_INTERNAL_PORT=8080 # Http Proxy container internal port (container -> container) -HTTP_PROXY_WEB_EXTERNAL_PORT=8781 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_SECURE_PORT=8742 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_INTERNAL_SECURE_PORT=8433 # Http Proxy container internal secure port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_PORT=8741 # Http Proxy container external port (host -> container) HTTP_PROXY_WEB_INTERNAL_PORT=8081 # Http Proxy container internal port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT=8743 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Http Proxy container internal secure port (container -> container HTTP_PROXY_CONFIG_PORT=0 # Port number for proxy config, will be set if proxy is started HTTP_PROXY_CONFIG_HOST_NAME="" # Proxy host, will be set if proxy is started HTTP_PROXY_ALIVE_URL="/" # Base path for alive check HTTP_PROXY_COMPOSE_DIR="httpproxy" # Dir in simulator_group for docker-compose - +HTTP_PROXY_BUILD_DIR="http-https-proxy" # Dir in simulator_group for image build - note, reuses source from kubeproxy KUBE_PROXY_APP_NAME="kubeproxy" # Name of the Kube Http Proxy container KUBE_PROXY_DISPLAY_NAME="Kube Http Proxy" KUBE_PROXY_EXTERNAL_PORT=8730 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_INTERNAL_PORT=8080 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_EXTERNAL_SECURE_PORT=8782 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_INTERNAL_SECURE_PORT=8433 # Kube Proxy container internal secure port (container -> container) KUBE_PROXY_WEB_EXTERNAL_PORT=8731 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_WEB_INTERNAL_PORT=8081 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_WEB_EXTERNAL_SECURE_PORT=8783 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Kube Proxy container internal secure port (container -> container KUBE_PROXY_PATH="" # Proxy url path, will be set if proxy is started KUBE_PROXY_ALIVE_URL="/" # Base path for alive check KUBE_PROXY_COMPOSE_DIR="kubeproxy" # Dir in simulator_group for docker-compose diff --git a/test/common/test_env-onap-honolulu.sh b/test/common/test_env-onap-honolulu.sh index 62dfab82..84076628 100755 --- a/test/common/test_env-onap-honolulu.sh +++ b/test/common/test_env-onap-honolulu.sh @@ -137,8 +137,8 @@ PROD_STUB_IMAGE_TAG_LOCAL="latest" #Http proxy remote image and tag -HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy" -HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2" +HTTP_PROXY_IMAGE_BASE="nodejs-http-proxy" +HTTP_PROXY_IMAGE_TAG_LOCAL="latest" #No local image for http proxy, remote image always used #ONAP Zookeeper remote image and tag @@ -157,7 +157,7 @@ ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18" #No local image for ONAP DMAAP-MR, remote image always used #Kube proxy remote image and tag -KUBE_PROXY_IMAGE_BASE="nodejs-http-proxy" +KUBE_PROXY_IMAGE_BASE="nodejs-kube-proxy" KUBE_PROXY_IMAGE_TAG_LOCAL="latest" #No remote image for kube proxy, local image always used @@ -344,22 +344,30 @@ CONTROL_PANEL_HOST_MNT_DIR="./mnt" # Mounted dir, relative HTTP_PROXY_APP_NAME="httpproxy" # Name of the Http Proxy container HTTP_PROXY_DISPLAY_NAME="Http Proxy" -HTTP_PROXY_EXTERNAL_PORT=8780 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_PORT=8740 # Http Proxy container external port (host -> container) HTTP_PROXY_INTERNAL_PORT=8080 # Http Proxy container internal port (container -> container) -HTTP_PROXY_WEB_EXTERNAL_PORT=8781 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_SECURE_PORT=8742 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_INTERNAL_SECURE_PORT=8433 # Http Proxy container internal secure port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_PORT=8741 # Http Proxy container external port (host -> container) HTTP_PROXY_WEB_INTERNAL_PORT=8081 # Http Proxy container internal port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT=8743 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Http Proxy container internal secure port (container -> container HTTP_PROXY_CONFIG_PORT=0 # Port number for proxy config, will be set if proxy is started HTTP_PROXY_CONFIG_HOST_NAME="" # Proxy host, will be set if proxy is started HTTP_PROXY_ALIVE_URL="/" # Base path for alive check HTTP_PROXY_COMPOSE_DIR="httpproxy" # Dir in simulator_group for docker-compose - +HTTP_PROXY_BUILD_DIR="http-https-proxy" # Dir in simulator_group for image build - note, reuses source from kubeproxy KUBE_PROXY_APP_NAME="kubeproxy" # Name of the Kube Http Proxy container KUBE_PROXY_DISPLAY_NAME="Kube Http Proxy" KUBE_PROXY_EXTERNAL_PORT=8730 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_INTERNAL_PORT=8080 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_EXTERNAL_SECURE_PORT=8782 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_INTERNAL_SECURE_PORT=8433 # Kube Proxy container internal secure port (container -> container) KUBE_PROXY_WEB_EXTERNAL_PORT=8731 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_WEB_INTERNAL_PORT=8081 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_WEB_EXTERNAL_SECURE_PORT=8783 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Kube Proxy container internal secure port (container -> container KUBE_PROXY_PATH="" # Proxy url path, will be set if proxy is started KUBE_PROXY_ALIVE_URL="/" # Base path for alive check KUBE_PROXY_COMPOSE_DIR="kubeproxy" # Dir in simulator_group for docker-compose diff --git a/test/common/test_env-onap-istanbul.sh b/test/common/test_env-onap-istanbul.sh index 423d3ef6..ea7c3e06 100644 --- a/test/common/test_env-onap-istanbul.sh +++ b/test/common/test_env-onap-istanbul.sh @@ -137,8 +137,8 @@ PROD_STUB_IMAGE_TAG_LOCAL="latest" #Http proxy remote image and tag -HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy" -HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2" +HTTP_PROXY_IMAGE_BASE="nodejs-http-proxy" +HTTP_PROXY_IMAGE_TAG_LOCAL="latest" #No local image for http proxy, remote image always used #ONAP Zookeeper remote image and tag @@ -157,7 +157,7 @@ ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18" #No local image for ONAP DMAAP-MR, remote image always used #Kube proxy remote image and tag -KUBE_PROXY_IMAGE_BASE="nodejs-http-proxy" +KUBE_PROXY_IMAGE_BASE="nodejs-kube-proxy" KUBE_PROXY_IMAGE_TAG_LOCAL="latest" #No remote image for kube proxy, local image always used @@ -344,22 +344,30 @@ CONTROL_PANEL_HOST_MNT_DIR="./mnt" # Mounted dir, relative HTTP_PROXY_APP_NAME="httpproxy" # Name of the Http Proxy container HTTP_PROXY_DISPLAY_NAME="Http Proxy" -HTTP_PROXY_EXTERNAL_PORT=8780 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_PORT=8740 # Http Proxy container external port (host -> container) HTTP_PROXY_INTERNAL_PORT=8080 # Http Proxy container internal port (container -> container) -HTTP_PROXY_WEB_EXTERNAL_PORT=8781 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_SECURE_PORT=8742 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_INTERNAL_SECURE_PORT=8433 # Http Proxy container internal secure port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_PORT=8741 # Http Proxy container external port (host -> container) HTTP_PROXY_WEB_INTERNAL_PORT=8081 # Http Proxy container internal port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT=8743 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Http Proxy container internal secure port (container -> container HTTP_PROXY_CONFIG_PORT=0 # Port number for proxy config, will be set if proxy is started HTTP_PROXY_CONFIG_HOST_NAME="" # Proxy host, will be set if proxy is started HTTP_PROXY_ALIVE_URL="/" # Base path for alive check HTTP_PROXY_COMPOSE_DIR="httpproxy" # Dir in simulator_group for docker-compose - +HTTP_PROXY_BUILD_DIR="http-https-proxy" # Dir in simulator_group for image build - note, reuses source from kubeproxy KUBE_PROXY_APP_NAME="kubeproxy" # Name of the Kube Http Proxy container KUBE_PROXY_DISPLAY_NAME="Kube Http Proxy" KUBE_PROXY_EXTERNAL_PORT=8730 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_INTERNAL_PORT=8080 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_EXTERNAL_SECURE_PORT=8782 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_INTERNAL_SECURE_PORT=8433 # Kube Proxy container internal secure port (container -> container) KUBE_PROXY_WEB_EXTERNAL_PORT=8731 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_WEB_INTERNAL_PORT=8081 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_WEB_EXTERNAL_SECURE_PORT=8783 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Kube Proxy container internal secure port (container -> container KUBE_PROXY_PATH="" # Proxy url path, will be set if proxy is started KUBE_PROXY_ALIVE_URL="/" # Base path for alive check KUBE_PROXY_COMPOSE_DIR="kubeproxy" # Dir in simulator_group for docker-compose diff --git a/test/common/test_env-oran-cherry.sh b/test/common/test_env-oran-cherry.sh index f75ff1dc..c82a5d32 100755 --- a/test/common/test_env-oran-cherry.sh +++ b/test/common/test_env-oran-cherry.sh @@ -141,9 +141,9 @@ PROD_STUB_IMAGE_TAG_LOCAL="latest" #No remote image for producer stub, local image always used #Http proxy remote image and tag -HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy" -HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2" -#No local image for Http proxy, remote image always used +HTTP_PROXY_IMAGE_BASE="nodejs-http-proxy" +HTTP_PROXY_IMAGE_TAG_LOCAL="latest" +#No local image for http proxy, remote image always used #ONAP Zookeeper remote image and tag ONAP_ZOOKEEPER_IMAGE_BASE="onap/dmaap/zookeeper" @@ -161,7 +161,7 @@ ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18" #No local image for ONAP DMAAP-MR, remote image always used #Kube proxy remote image and tag -KUBE_PROXY_IMAGE_BASE="nodejs-http-proxy" +KUBE_PROXY_IMAGE_BASE="nodejs-kube-proxy" KUBE_PROXY_IMAGE_TAG_LOCAL="latest" #No remote image for kube proxy, local image always used @@ -345,22 +345,30 @@ CONTROL_PANEL_HOST_MNT_DIR="./mnt" # Mounted dir, relative HTTP_PROXY_APP_NAME="httpproxy" # Name of the Http Proxy container HTTP_PROXY_DISPLAY_NAME="Http Proxy" -HTTP_PROXY_EXTERNAL_PORT=8780 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_PORT=8740 # Http Proxy container external port (host -> container) HTTP_PROXY_INTERNAL_PORT=8080 # Http Proxy container internal port (container -> container) -HTTP_PROXY_WEB_EXTERNAL_PORT=8781 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_SECURE_PORT=8742 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_INTERNAL_SECURE_PORT=8433 # Http Proxy container internal secure port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_PORT=8741 # Http Proxy container external port (host -> container) HTTP_PROXY_WEB_INTERNAL_PORT=8081 # Http Proxy container internal port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT=8743 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Http Proxy container internal secure port (container -> container HTTP_PROXY_CONFIG_PORT=0 # Port number for proxy config, will be set if proxy is started HTTP_PROXY_CONFIG_HOST_NAME="" # Proxy host, will be set if proxy is started HTTP_PROXY_ALIVE_URL="/" # Base path for alive check HTTP_PROXY_COMPOSE_DIR="httpproxy" # Dir in simulator_group for docker-compose - +HTTP_PROXY_BUILD_DIR="http-https-proxy" # Dir in simulator_group for image build - note, reuses source from kubeproxy KUBE_PROXY_APP_NAME="kubeproxy" # Name of the Kube Http Proxy container KUBE_PROXY_DISPLAY_NAME="Kube Http Proxy" KUBE_PROXY_EXTERNAL_PORT=8730 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_INTERNAL_PORT=8080 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_EXTERNAL_SECURE_PORT=8782 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_INTERNAL_SECURE_PORT=8433 # Kube Proxy container internal secure port (container -> container) KUBE_PROXY_WEB_EXTERNAL_PORT=8731 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_WEB_INTERNAL_PORT=8081 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_WEB_EXTERNAL_SECURE_PORT=8783 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Kube Proxy container internal secure port (container -> container KUBE_PROXY_PATH="" # Proxy url path, will be set if proxy is started KUBE_PROXY_ALIVE_URL="/" # Base path for alive check KUBE_PROXY_COMPOSE_DIR="kubeproxy" # Dir in simulator_group for docker-compose diff --git a/test/common/test_env-oran-dawn.sh b/test/common/test_env-oran-d-release.sh similarity index 95% rename from test/common/test_env-oran-dawn.sh rename to test/common/test_env-oran-d-release.sh index f83b7b03..08925a43 100755 --- a/test/common/test_env-oran-dawn.sh +++ b/test/common/test_env-oran-d-release.sh @@ -17,7 +17,7 @@ # ============LICENSE_END================================================= # #Profile for ORAN Cherry -TEST_ENV_PROFILE="ORAN-DAWN" +TEST_ENV_PROFILE="ORAN-D-RELEASE" FLAVOUR="ORAN" ######################################## @@ -95,7 +95,7 @@ SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_RELEASE_ONAP="2.1.2" #No local image for ONAP SDNC, remote release image always used # ORAN SDNC adapter kept as reference -# SDNC A1 Controller image and tags - still using cherry version, no new version for dawn +# SDNC A1 Controller image and tags - still using cherry version, no new version for D-Release #SDNC_A1_CONTROLLER_IMAGE_BASE="o-ran-sc/nonrtric-a1-controller" #SDNC_A1_CONTROLLER_IMAGE_TAG_LOCAL="2.0.1-SNAPSHOT" #SDNC_A1_CONTROLLER_IMAGE_TAG_REMOTE_SNAPSHOT="2.0.1-SNAPSHOT" @@ -160,8 +160,8 @@ PROD_STUB_IMAGE_TAG_LOCAL="latest" #No remote image for producer stub, local image always used #Http proxy remote image and tag -HTTP_PROXY_IMAGE_BASE="mitmproxy/mitmproxy" -HTTP_PROXY_IMAGE_TAG_REMOTE_PROXY="6.0.2" +HTTP_PROXY_IMAGE_BASE="nodejs-http-proxy" +HTTP_PROXY_IMAGE_TAG_LOCAL="latest" #No local image for http proxy, remote image always used #ONAP Zookeeper remote image and tag @@ -180,7 +180,7 @@ ONAP_DMAAPMR_IMAGE_TAG_REMOTE_RELEASE_ONAP="1.1.18" #No local image for ONAP DMAAP-MR, remote image always used #Kube proxy remote image and tag -KUBE_PROXY_IMAGE_BASE="nodejs-http-proxy" +KUBE_PROXY_IMAGE_BASE="nodejs-kube-proxy" KUBE_PROXY_IMAGE_TAG_LOCAL="latest" #No remote image for kube proxy, local image always used @@ -405,21 +405,30 @@ NRT_GATEWAY_ACTUATOR="/actuator/loggers/$NRT_GATEWAY_PKG_NAME" # Url for trace/d HTTP_PROXY_APP_NAME="httpproxy" # Name of the Http Proxy container HTTP_PROXY_DISPLAY_NAME="Http Proxy" -HTTP_PROXY_EXTERNAL_PORT=8780 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_PORT=8740 # Http Proxy container external port (host -> container) HTTP_PROXY_INTERNAL_PORT=8080 # Http Proxy container internal port (container -> container) -HTTP_PROXY_WEB_EXTERNAL_PORT=8781 # Http Proxy container external port (host -> container) +HTTP_PROXY_EXTERNAL_SECURE_PORT=8742 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_INTERNAL_SECURE_PORT=8433 # Http Proxy container internal secure port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_PORT=8741 # Http Proxy container external port (host -> container) HTTP_PROXY_WEB_INTERNAL_PORT=8081 # Http Proxy container internal port (container -> container) +HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT=8743 # Http Proxy container external secure port (host -> container) +HTTP_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Http Proxy container internal secure port (container -> container HTTP_PROXY_CONFIG_PORT=0 # Port number for proxy config, will be set if proxy is started HTTP_PROXY_CONFIG_HOST_NAME="" # Proxy host, will be set if proxy is started HTTP_PROXY_ALIVE_URL="/" # Base path for alive check HTTP_PROXY_COMPOSE_DIR="httpproxy" # Dir in simulator_group for docker-compose +HTTP_PROXY_BUILD_DIR="http-https-proxy" # Dir in simulator_group for image build - note, reuses source from kubeproxy KUBE_PROXY_APP_NAME="kubeproxy" # Name of the Kube Http Proxy container KUBE_PROXY_DISPLAY_NAME="Kube Http Proxy" KUBE_PROXY_EXTERNAL_PORT=8730 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_INTERNAL_PORT=8080 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_EXTERNAL_SECURE_PORT=8782 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_INTERNAL_SECURE_PORT=8433 # Kube Proxy container internal secure port (container -> container) KUBE_PROXY_WEB_EXTERNAL_PORT=8731 # Kube Http Proxy container external port (host -> container) KUBE_PROXY_WEB_INTERNAL_PORT=8081 # Kube Http Proxy container internal port (container -> container) +KUBE_PROXY_WEB_EXTERNAL_SECURE_PORT=8783 # Kube Proxy container external secure port (host -> container) +KUBE_PROXY_WEB_INTERNAL_SECURE_PORT=8434 # Kube Proxy container internal secure port (container -> container KUBE_PROXY_PATH="" # Proxy url path, will be set if proxy is started KUBE_PROXY_ALIVE_URL="/" # Base path for alive check KUBE_PROXY_COMPOSE_DIR="kubeproxy" # Dir in simulator_group for docker-compose diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh index b4ed9b4a..41135afb 100755 --- a/test/common/testcase_common.sh +++ b/test/common/testcase_common.sh @@ -27,7 +27,7 @@ __print_args() { echo "Args: remote|remote-remove docker|kube --env-file [release] [auto-clean] [--stop-at-error] " echo " [--ricsim-prefix ] [--use-local-image +] [--use-snapshot-image +]" echo " [--use-staging-image +] [--use-release-image +] [--image-repo ]" + echo " [--repo-policy local|remote] [--cluster-timeout ]" } if [ $# -eq 1 ] && [ "$1" == "help" ]; then @@ -53,6 +53,7 @@ if [ $# -eq 1 ] && [ "$1" == "help" ]; then echo "--use-staging-image - The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names" echo "--use-release-image - The script will use images from the nexus release repo for the supplied apps, space separated list of app short names" echo "--image-repo - Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo" + echo "--repo-policy - Policy controlling which images to re-tag and push if param --image-repo is set. Default is 'local'" echo "--cluster-timeout - Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds. " echo "" echo "List of app short names supported: "$APP_SHORT_NAMES @@ -303,8 +304,9 @@ TCTEST_START=$SECONDS TIMER_MEASUREMENTS=".timer_measurement.txt" echo -e "Activity \t Duration" > $TIMER_MEASUREMENTS -# If this is set, all used images will be re-tagged and pushed to this repo before any +# If this is set, some images (control by the parameter repo-polcy) will be re-tagged and pushed to this repo before any IMAGE_REPO_ADR="" +IMAGE_REPO_POLICY="local" CLUSTER_TIME_OUT=0 echo "-------------------------------------------------------------------------------------------------" @@ -525,6 +527,29 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do fi fi fi + if [ $paramerror -eq 0 ]; then + if [ "$1" == "--repo-policy" ]; then + shift; + IMAGE_REPO_POLICY=$1 + if [ -z "$1" ]; then + paramerror=1 + if [ -z "$paramerror_str" ]; then + paramerror_str="No policy found for : '--repo-policy'" + fi + else + if [ "$1" == "local" ] || [ "$1" == "remote" ]; then + echo "Option set - Image repo policy: "$1 + shift; + foundparm=0 + else + paramerror=1 + if [ -z "$paramerror_str" ]; then + paramerror_str="Repo policy shall be 'local' or 'remote'" + fi + fi + fi + fi + fi if [ $paramerror -eq 0 ]; then if [ "$1" == "--cluster-timeout" ]; then shift; @@ -735,8 +760,24 @@ __check_and_create_image_var() { echo -e "$tmp" >> $image_list_file #Export the env var export "${2}"=$image":"$tag #Note, this var may be set to the value of the target value below in __check_and_pull_image - if [ ! -z "$IMAGE_REPO_ADR" ] && [ $5 == "LOCAL" ]; then # Only push local images if repo is given + + remote_or_local_push=false + if [ ! -z "$IMAGE_REPO_ADR" ] && [[ $5 != *"PROXY"* ]]; then + if [ $5 == "LOCAL" ]; then + remote_or_local_push=true + fi + if [[ $5 == *"REMOTE"* ]]; then + if [ "$IMAGE_REPO_POLICY" == "remote" ]; then + remote_or_local_push=true + fi + fi + fi + if $remote_or_local_push; then # Only re-tag and push images according to policy, if repo is given export "${2}_SOURCE"=$image":"$tag #Var to keep the actual source image + if [[ $optional_image_repo_target == *"/"* ]]; then # Replace all / with _ for images to push to external repo + optional_image_repo_target_tmp=${optional_image_repo_target//\//_} + optional_image_repo_target=$optional_image_repo_target_tmp + fi export "${2}_TARGET"=$IMAGE_REPO_ADR"/"$optional_image_repo_target":"$tag #Create image + tag for optional image repo - pushed later if needed else export "${2}_SOURCE"="" @@ -897,6 +938,11 @@ __retag_and_push_image() { source_image="${!1}" trg_var_name=$1_"TARGET" # This var is created in func __check_and_create_image_var target_image="${!trg_var_name}" + + if [ -z $target_image ]; then + return 0 # Image with no target shall not be pushed + fi + echo -ne " Attempt to re-tag image to: ${BOLD}${target_image}${EBOLD}${SAMELINE}" tmp=$(docker image tag $source_image ${target_image} ) if [ $? -ne 0 ]; then @@ -1077,8 +1123,8 @@ setup_testenvironment() { echo -e $BOLD"Pulling configured images, if needed"$EBOLD - if [ ! -z "$IMAGE_REPO_ADR" ]; then - echo -e $YELLOW" Excluding all remote image check/pull when running with image repo: $IMAGE_REPO_ADR"$EYELLOW + if [ ! -z "$IMAGE_REPO_ADR" ] && [ $IMAGE_REPO_POLICY == "local" ]; then + echo -e $YELLOW" Excluding all remote image check/pull when running with image repo: $IMAGE_REPO_ADR and image policy $IMAGE_REPO_POLICY"$EYELLOW else for imagename in $APP_SHORT_NAMES; do __check_included_image $imagename @@ -2325,7 +2371,11 @@ __do_curl() { proxyflag="" if [ $RUNMODE == "KUBE" ]; then if [ ! -z "$KUBE_PROXY_PATH" ]; then - proxyflag=" --proxy $KUBE_PROXY_PATH" + if [ $KUBE_PROXY_HTTPX == "http" ]; then + proxyflag=" --proxy $KUBE_PROXY_PATH" + else + proxyflag=" --proxy-insecure --proxy $KUBE_PROXY_PATH" + fi fi fi curlString="curl -skw %{http_code} $proxyflag $@" diff --git a/test/common/testengine_config.sh b/test/common/testengine_config.sh index 311c2f59..e914f72a 100644 --- a/test/common/testengine_config.sh +++ b/test/common/testengine_config.sh @@ -27,7 +27,7 @@ PROJECT_IMAGES="PA ECS SDNC CP NGW RICSIM RC" AVAILABLE_IMAGES_OVERRIDE="PA ECS SDNC CP NGW RICSIM RC" # List of available apps where the image is built by the test environment -LOCAL_IMAGE_BUILD="MR CR PRODSTUB KUBEPROXY" +LOCAL_IMAGE_BUILD="MR CR PRODSTUB KUBEPROXY HTTPPROXY" #Integrate a new app into the test environment diff --git a/test/http-https-proxy/README.md b/test/http-https-proxy/README.md index 271db4de..ca58dce9 100644 --- a/test/http-https-proxy/README.md +++ b/test/http-https-proxy/README.md @@ -23,10 +23,10 @@ The dir cert contains a self-signed cert. Use the script generate_cert_and_key.s | Operation | curl example | | --------- | ------------ | -| proxy http call via http | curl --proxy localhost:8080 http://pms:1234 | -| proxy https call via http | curl --proxy localhost:8080 https://pms:5678 | -| proxy http call via https | curl --proxy-insecure localhost:8433 http://pms:1234 | -| proxy https call via https | curl --proxy-insecure localhost:8433 https://pms:5678 | +| proxy http call via http | curl --proxy http://localhost:8080 http://100.110.120.130:1234 | +| proxy https call via http | curl -k --proxy http//localhost:8080 https://100.110.120.130:5678 | +| proxy http call via https | curl --proxy-insecure --proxy https://localhost:8433 http://100.110.120.130:1234 | +| proxy https call via https | curl --proxy-insecure --proxy https://localhost:8433 https://100.110.120.130:5678 | | alive check and get stats | curl localhost:8081 | | alive check and get stats via proxy | curl --proxy localhost:8080 http://localhost:8081 | diff --git a/test/http-https-proxy/basic_test.sh b/test/http-https-proxy/basic_test.sh index 085e17f4..7ff1968f 100755 --- a/test/http-https-proxy/basic_test.sh +++ b/test/http-https-proxy/basic_test.sh @@ -32,6 +32,7 @@ if [ $? -eq 0 ]; then echo "CMD OK" else echo "CMD FAIL" + exti 1 fi echo "" @@ -43,10 +44,11 @@ if [ $? -eq 0 ]; then echo "CMD OK" else echo "CMD FAIL" + exti 1 fi echo "" -CMD="curl --proxy-insecure localhost:8433 localhost:8081" +CMD="curl --proxy-insecure --proxy https://localhost:8433 localhost:8081" echo "Running cmd: "$CMD $CMD echo "" @@ -54,10 +56,11 @@ if [ $? -eq 0 ]; then echo "CMD OK" else echo "CMD FAIL" + exti 1 fi echo "" -CMD="curl --proxy-insecure localhost:8433 -k https://localhost:8434" +CMD="curl --proxy-insecure --proxy https://localhost:8433 -k https://localhost:8434" echo "Running cmd: "$CMD $CMD echo "" @@ -65,6 +68,7 @@ if [ $? -eq 0 ]; then echo "CMD OK" else echo "CMD FAIL" + exti 1 fi echo "" diff --git a/test/http-https-proxy/http_proxy.js b/test/http-https-proxy/http_proxy.js index 714548a2..4a982856 100644 --- a/test/http-https-proxy/http_proxy.js +++ b/test/http-https-proxy/http_proxy.js @@ -105,51 +105,9 @@ function httpclientrequest(clientrequest, clientresponse) { }); } -function main() { - - // -------------------- Alive server ---------------------------------- - // Responde with '200' and statistics for any path on the alive address - const alivelistener = function (req, res) { - console.log(stats) - res.writeHead(200, { 'Content-Type': 'application/json' }); - res.write(JSON.stringify(stats)) - res.end(); - }; - - // The alive server - for healthckeck - const aliveserver = http.createServer(alivelistener); - - // The alive server - for healthckeck - const aliveserverhttps = https.createServer(httpsoptions, alivelistener); - - //Handle heatlhcheck requests - aliveserver.listen(aliveport, () => { - console.log('alive server on: '+aliveport); - console.log(' example: curl localhost: '+aliveport) - }); - - //Handle heatlhcheck requests - aliveserverhttps.listen(aliveporthttps, () => { - console.log('alive server on: '+aliveporthttps); - console.log(' example: curl -k https://localhost: '+aliveporthttps) - }); - - // -------------------- Proxy server --------------------------------- - - // The proxy server - const proxyserver = http.createServer(httpclientrequest).listen(proxyport); - console.log('http/https proxy for http proxy calls on port ' + proxyport); - console.log(' example: curl --proxy localhost:8080 http://pms:1234') - console.log(' example: curl -k --proxy localhost:8080 https://pms:5678') - - const proxyserverhttps = https.createServer(httpsoptions, httpclientrequest).listen(proxyporthttps); - console.log('http/https proxy for https proxy calls on port ' + proxyporthttps); - console.log(' example: curl --proxy-insecure localhost:8433 http://pms:1234') - console.log(' example: curl --proxy-insecure localhost:8433 https://pms:5678') - console.log(' note: proxy shall not specify https') - - // handle a http proxy request - https listener - proxyserver.addListener( +// Function to add a 'connect' message listener to a http server +function addhttpsconnect(httpserver) { + httpserver.addListener( 'connect', function (request, socketrequest, bodyhead) { @@ -205,6 +163,56 @@ function main() { ); } +function main() { + + // -------------------- Alive server ---------------------------------- + // Responde with '200' and statistics for any path on the alive address + const alivelistener = function (req, res) { + console.log(stats) + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.write(JSON.stringify(stats)) + res.end(); + }; + + // The alive server - for healthckeck + const aliveserver = http.createServer(alivelistener); + + // The alive server - for healthckeck + const aliveserverhttps = https.createServer(httpsoptions, alivelistener); + + //Handle heatlhcheck requests + aliveserver.listen(aliveport, () => { + console.log('alive server on: '+aliveport); + console.log(' example: curl localhost:'+aliveport) + }); + + //Handle heatlhcheck requests + aliveserverhttps.listen(aliveporthttps, () => { + console.log('alive server on: '+aliveporthttps); + console.log(' example: curl -k https://localhost:'+aliveporthttps) + }); + + // -------------------- Proxy server --------------------------------- + + // The proxy server + const proxyserver = http.createServer(httpclientrequest).listen(proxyport); + console.log('http/https proxy for http proxy calls on port ' + proxyport); + console.log(' example: curl --proxy http://localhost:8080 http://100.110.120.130:1234') + console.log(' example: curl -k --proxy http//localhost:8080 https://100.110.120.130:5678') + + // handle a http proxy request - https listener + addhttpsconnect(proxyserver); + + const proxyserverhttps = https.createServer(httpsoptions, httpclientrequest).listen(proxyporthttps); + console.log('http/https proxy for https proxy calls on port ' + proxyporthttps); + console.log(' example: curl --proxy-insecure --proxy https://localhost:8433 http://100.110.120.130:1234') + console.log(' example: curl --proxy-insecure --proxy https://localhost:8433 https://100.110.120.130:5678') + + // handle a https proxy request - https listener + addhttpsconnect(proxyserverhttps); + +} + //Handle ctrl c when running in interactive mode process.on('SIGINT', () => { console.info("Interrupted") diff --git a/test/simulator-group/httpproxy/app.yaml b/test/simulator-group/httpproxy/app.yaml index 266eb199..138da711 100644 --- a/test/simulator-group/httpproxy/app.yaml +++ b/test/simulator-group/httpproxy/app.yaml @@ -26,5 +26,7 @@ spec: containerPort: $HTTP_PROXY_INTERNAL_PORT - name: web containerPort: $HTTP_PROXY_WEB_INTERNAL_PORT - command: ["mitmweb"] - args: ["--web-host", "0.0.0.0", "--no-web-open-browser", "-p", "$HTTP_PROXY_INTERNAL_PORT", "--set", "ssl_insecure"] \ No newline at end of file + - name: https + containerPort: $HTTP_PROXY_INTERNAL_SECURE_PORT + - name: webs + containerPort: $HTTP_PROXY_WEB_INTERNAL_SECURE_PORT \ No newline at end of file diff --git a/test/simulator-group/httpproxy/docker-compose.yml b/test/simulator-group/httpproxy/docker-compose.yml index ff4243b7..c27ba5eb 100644 --- a/test/simulator-group/httpproxy/docker-compose.yml +++ b/test/simulator-group/httpproxy/docker-compose.yml @@ -26,10 +26,11 @@ services: - default container_name: ${HTTP_PROXY_APP_NAME} image: ${HTTP_PROXY_IMAGE} - tty: true - command: mitmweb --web-host 0.0.0.0 --no-web-open-browser --set ssl_insecure ports: + - ${HTTP_PROXY_EXTERNAL_PORT}:${HTTP_PROXY_INTERNAL_PORT} + - ${HTTP_PROXY_EXTERNAL_SECURE_PORT}:${HTTP_PROXY_INTERNAL_SECURE_PORT} - ${HTTP_PROXY_WEB_EXTERNAL_PORT}:${HTTP_PROXY_WEB_INTERNAL_PORT} + - ${HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT}:${HTTP_PROXY_WEB_INTERNAL_SECURE_PORT} labels: - "nrttest_app=HTTPPROXY" - "nrttest_dp=${HTTP_PROXY_DISPLAY_NAME}" diff --git a/test/simulator-group/httpproxy/svc.yaml b/test/simulator-group/httpproxy/svc.yaml index 1e3c0098..eb8007c5 100644 --- a/test/simulator-group/httpproxy/svc.yaml +++ b/test/simulator-group/httpproxy/svc.yaml @@ -17,5 +17,13 @@ spec: targetPort: $HTTP_PROXY_WEB_INTERNAL_PORT protocol: TCP name: web + - port: $HTTP_PROXY_EXTERNAL_SECURE_PORT + targetPort: $HTTP_PROXY_INTERNAL_SECURE_PORT + protocol: TCP + name: https + - port: $HTTP_PROXY_WEB_EXTERNAL_SECURE_PORT + targetPort: $HTTP_PROXY_WEB_INTERNAL_SECURE_PORT + protocol: TCP + name: webs selector: run: $HTTP_PROXY_APP_NAME diff --git a/test/simulator-group/kubeproxy/app.yaml b/test/simulator-group/kubeproxy/app.yaml index b9f6115c..cc2fdb32 100644 --- a/test/simulator-group/kubeproxy/app.yaml +++ b/test/simulator-group/kubeproxy/app.yaml @@ -26,3 +26,7 @@ spec: containerPort: $KUBE_PROXY_INTERNAL_PORT - name: web containerPort: $KUBE_PROXY_WEB_INTERNAL_PORT + - name: https + containerPort: $KUBE_PROXY_INTERNAL_SECURE_PORT + - name: webs + containerPort: $KUBE_PROXY_WEB_INTERNAL_SECURE_PORT \ No newline at end of file diff --git a/test/simulator-group/kubeproxy/svc.yaml b/test/simulator-group/kubeproxy/svc.yaml index 51cf7450..c92c069c 100644 --- a/test/simulator-group/kubeproxy/svc.yaml +++ b/test/simulator-group/kubeproxy/svc.yaml @@ -19,5 +19,15 @@ spec: protocol: TCP name: web nodePort: + - port: $KUBE_PROXY_EXTERNAL_SECURE_PORT + targetPort: $KUBE_PROXY_INTERNAL_SECURE_PORT + protocol: TCP + name: https + nodePort: + - port: $KUBE_PROXY_WEB_EXTERNAL_SECURE_PORT + targetPort: $KUBE_PROXY_WEB_INTERNAL_SECURE_PORT + protocol: TCP + name: webs + nodePort: selector: run: $KUBE_PROXY_APP_NAME -- 2.16.6