diff options
-rwxr-xr-x | csit/apex-pdp/plans/setup.sh | 10 | ||||
-rw-r--r-- | csit/apex-pdp/tests/apex-pdp-test.robot | 14 | ||||
-rwxr-xr-x | csit/api/plans/setup.sh | 4 | ||||
-rw-r--r-- | csit/api/tests/api-test.robot | 9 | ||||
-rwxr-xr-x | csit/clamp/plans/setup.sh | 32 | ||||
-rw-r--r-- | csit/clamp/tests/policy-clamp-test.robot | 32 | ||||
-rw-r--r-- | csit/common-library.robot | 40 | ||||
-rwxr-xr-x | csit/distribution/plans/setup.sh | 8 | ||||
-rw-r--r-- | csit/distribution/tests/distribution-test.robot | 10 | ||||
-rw-r--r-- | csit/docker-compose-all.yml | 3 | ||||
-rwxr-xr-x | csit/drools-applications/plans/setup.sh | 12 | ||||
-rw-r--r-- | csit/drools-applications/tests/drools-applications-test.robot | 36 | ||||
-rwxr-xr-x | csit/drools-pdp/plans/setup.sh | 10 | ||||
-rw-r--r-- | csit/drools-pdp/tests/drools-pdp-test.robot | 8 | ||||
-rwxr-xr-x | csit/make_topic.sh | 4 | ||||
-rwxr-xr-x | csit/onset.sh | 4 | ||||
-rwxr-xr-x | csit/pap/plans/setup.sh | 6 | ||||
-rw-r--r-- | csit/pap/tests/pap-test.robot | 18 | ||||
-rwxr-xr-x | csit/wait_for_rest.sh | 77 | ||||
-rwxr-xr-x | csit/wait_topic.sh | 4 | ||||
-rwxr-xr-x | csit/xacml-pdp/plans/setup.sh | 10 | ||||
-rw-r--r-- | csit/xacml-pdp/tests/xacml-pdp-test.robot | 8 |
22 files changed, 242 insertions, 117 deletions
diff --git a/csit/apex-pdp/plans/setup.sh b/csit/apex-pdp/plans/setup.sh index f38b9e45..9241041a 100755 --- a/csit/apex-pdp/plans/setup.sh +++ b/csit/apex-pdp/plans/setup.sh @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. # -# Modifications Copyright (c) 2019-2022 Nordix Foundation. +# Modifications Copyright (c) 2019-2023 Nordix Foundation. # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. # Modifications Copyright (C) 2021 Bell Canada. All rights reserved. # ================================================================================ @@ -35,9 +35,12 @@ docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d apex-pdp grafana unset http_proxy https_proxy POLICY_API_IP=$(get-instance-ip.sh policy-api) +POLICY_API_PORT=30440 POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) +POLICY_PAP_PORT=30442 MARIADB_IP=$(get-instance-ip.sh mariadb) APEX_IP=$(get-instance-ip.sh policy-apex-pdp) +APEX_PORT=30237 SIM_IP=$(get-instance-ip.sh simulator) export SIM_IP @@ -48,11 +51,14 @@ echo APEX IP IS "${APEX_IP}" echo DMAAP_IP IS "${SIM_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${APEX_IP}" 6969 +"${SCRIPTS}"/wait_for_rest.sh localhost "${APEX_PORT}" ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCRIPTS:${SCRIPTS}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_IP:${APEX_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_PORT:${APEX_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_PORT:${POLICY_API_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_PORT:${POLICY_PAP_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DMAAP_IP:${SIM_IP}" diff --git a/csit/apex-pdp/tests/apex-pdp-test.robot b/csit/apex-pdp/tests/apex-pdp-test.robot index 77393270..3de53a96 100644 --- a/csit/apex-pdp/tests/apex-pdp-test.robot +++ b/csit/apex-pdp/tests/apex-pdp-test.robot @@ -12,7 +12,7 @@ Resource ${CURDIR}/../../common-library.robot Healthcheck [Documentation] Runs Apex PDP Health check ${hcauth}= HealthCheckAuth - ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth} + ${resp}= PerformGetRequest ${APEX_PORT} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth} Should Be Equal As Strings ${resp.json()['code']} 200 Set Suite Variable ${pdpName} ${resp.json()['name']} @@ -62,7 +62,7 @@ ExecuteApexTestPnfPolicyWithMetadataSet Metrics [Documentation] Verify policy-apex-pdp is exporting prometheus metrics ${auth}= HealthCheckAuth - ${resp}= PerformGetRequest ${APEX_IP} /metrics 200 null ${auth} + ${resp}= PerformGetRequest ${APEX_PORT} /metrics 200 null ${auth} Should Contain ${resp.text} pdpa_policy_deployments_total{operation="deploy",status="TOTAL",} 4.0 Should Contain ${resp.text} pdpa_policy_deployments_total{operation="deploy",status="SUCCESS",} 4.0 Should Contain ${resp.text} pdpa_policy_executions_total{status="SUCCESS",} 3.0 @@ -88,11 +88,11 @@ DeployPolicy set to dictionary ${postjson['groups'][0]['deploymentSubgroups'][0]['policies'][0]} name=${policyName} ${postjson}= evaluate json.dumps(${postjson}) json ${policyadmin}= PolicyAdminAuth - PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${policyadmin} + PerformPostRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${policyadmin} RunEventOnApexEngine [Documentation] Send event to verify policy execution - Create Session apexSession http://${APEX_IP}:23324 max_retries=1 + Create Session apexSession http://localhost:23324 max_retries=1 ${data}= Get Binary File ${CURDIR}${/}data${/}event.json &{headers}= Create Dictionary Content-Type=application/json Accept=application/json ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} @@ -100,7 +100,7 @@ RunEventOnApexEngine TriggerAndVerifyTestPnfPolicy [Documentation] Send TestPnf policy trigger event to DMaaP and read notifications to verify policy execution - Create Session apexSession http://${DMAAP_IP}:3904 max_retries=1 + Create Session apexSession http://localhost:30227 max_retries=1 ${data}= Get Binary File ${CURDIR}/data/VesEventForPnfPolicy.json &{headers}= Create Dictionary Content-Type=application/json Accept=application/json ${resp}= POST On Session apexSession /events/unauthenticated.DCAE_CL_OUTPUT data=${data} headers=${headers} @@ -111,7 +111,7 @@ TriggerAndVerifyTestPnfPolicy TriggerAndVerifyTestVnfPolicy [Documentation] Send TestVnf policy trigger event to DMaaP and read notifications to verify policy execution - Create Session apexSession http://${DMAAP_IP}:3904 max_retries=1 + Create Session apexSession http://localhost:30227 max_retries=1 ${data}= Get Binary File ${CURDIR}/data/VesEventForVnfPolicy.json &{headers}= Create Dictionary Content-Type=application/json Accept=application/json ${resp}= POST On Session apexSession /events/unauthenticated.DCAE_POLICY_EXAMPLE_OUTPUT data=${data} headers=${headers} @@ -133,7 +133,7 @@ VerifyPdpStatistics [Documentation] Verify pdp statistics after policy execution [Arguments] ${deployCount} ${deploySuccessCount} ${executedCount} ${executedSuccessCount} ${policyadmin}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/statistics/defaultGroup/apex/${pdpName} 200 null ${policyadmin} + ${resp}= PerformGetRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/statistics/defaultGroup/apex/${pdpName} 200 null ${policyadmin} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As Strings ${resp.json()['defaultGroup']['apex'][0]['pdpInstanceId']} ${pdpName} Should Be Equal As Strings ${resp.json()['defaultGroup']['apex'][0]['pdpGroupName']} defaultGroup diff --git a/csit/api/plans/setup.sh b/csit/api/plans/setup.sh index 874eb954..31d16836 100755 --- a/csit/api/plans/setup.sh +++ b/csit/api/plans/setup.sh @@ -51,15 +51,17 @@ sleep 10 unset http_proxy https_proxy POLICY_API_IP=$(get-instance-ip.sh policy-api) +POLICY_API_PORT=30440 MARIADB_IP=$(get-instance-ip.sh mariadb) echo API IP IS "${POLICY_API_IP}" echo MARIADB IP IS "${MARIADB_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${POLICY_API_IP}" 6969 +"${SCRIPTS}"/wait_for_rest.sh localhost "$POLICY_API_PORT" ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_PORT:${POLICY_API_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v NODETEMPLATES:${NODETEMPLATES}"
\ No newline at end of file diff --git a/csit/api/tests/api-test.robot b/csit/api/tests/api-test.robot index c6927326..33848795 100644 --- a/csit/api/tests/api-test.robot +++ b/csit/api/tests/api-test.robot @@ -54,7 +54,6 @@ CreateNewMonitoringPolicyV2 ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json CreatePolicy /policy/api/v1/policies 200 ${postjson} onap.restart.tca 2.0.0 - CreateNodeTemplates [Documentation] Create node templates in database using specific api ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json @@ -114,7 +113,7 @@ DeleteSpecificPolicyTypeV3 Metrics [Documentation] Verify policy-api is exporting prometheus metrics ${auth}= PolicyAdminAuth - ${resp}= GetMetrics ${POLICY_API_IP} ${auth} /policy/api/v1/ + ${resp}= GetMetrics ${POLICY_API_PORT} ${auth} /policy/api/v1/ Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/statistics",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/policytypes",} 1.0 @@ -138,13 +137,13 @@ Metrics GetReq [Arguments] ${url} ${auth}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth} + ${resp}= PerformGetRequest ${POLICY_API_PORT} ${url} 200 null ${auth} [return] ${resp} DeleteReq [Arguments] ${url} ${expectedstatus} ${auth}= PolicyAdminAuth - ${resp}= PerformDeleteRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${auth} + ${resp}= PerformDeleteRequest ${POLICY_API_PORT} ${url} ${expectedstatus} ${auth} [return] ${resp} CreatePolicyType @@ -152,7 +151,7 @@ CreatePolicyType [Documentation] Create the specific policy type ${postjson}= Get file ${CURDIR}/data/${jsonfile} ${auth}= PolicyAdminAuth - ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${auth} + ${resp}= PerformPostRequest ${POLICY_API_PORT} ${url} ${expectedstatus} ${postjson} null ${auth} Run Keyword If ${expectedstatus}==200 List Should Contain Value ${resp.json()['policy_types']} ${policytypename} Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['policy_types']['${policytypename}']['version']} ${policytypeversion} diff --git a/csit/clamp/plans/setup.sh b/csit/clamp/plans/setup.sh index 02770a86..b750b023 100755 --- a/csit/clamp/plans/setup.sh +++ b/csit/clamp/plans/setup.sh @@ -33,6 +33,7 @@ sleep 10 unset http_proxy https_proxy POLICY_RUNTIME_ACM_IP=$(get-instance-ip.sh policy-clamp-runtime-acm) +POLICY_RUNTIME_ACM_PORT=30258 MARIADB_IP=$(get-instance-ip.sh mariadb) DMAAP_IP=$(get-instance-ip.sh simulator) @@ -41,22 +42,30 @@ echo DMAAP_IP IS "${DMAAP_IP}" echo POLICY RUNTIME ACM IP IS "${POLICY_RUNTIME_ACM_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${POLICY_RUNTIME_ACM_IP}" 6969 +"${SCRIPTS}"/wait_for_rest.sh localhost "${POLICY_RUNTIME_ACM_PORT}" -# Bringup ACM participant containers -docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-k8s-ppnt -docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-http-ppnt -docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-pf-ppnt -docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-a1pms-ppnt +# TODO: This disables the participant during ACM refactoring, will be reenabled when ACM +# TODO: tests are re-enabled -sleep 10 +# Bring up ACM participant containers +#docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-k8s-ppnt +#docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-http-ppnt +#docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-pf-ppnt +#docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d policy-clamp-ac-a1pms-ppnt + +#sleep 10 unset http_proxy https_proxy POLICY_PARTICIPANT_IP=$(get-instance-ip.sh policy-clamp-ac-pf-ppnt) +POLICY_PARTICIPANT_PORT=30218 POLICY_API_IP=$(get-instance-ip.sh policy-api) +POLICY_API_PORT=30440 K8S_PARTICIPANT_IP=$(get-instance-ip.sh policy-clamp-ac-k8s-ppnt) +K8S_PARTICIPANT_PORT=30295 HTTP_PARTICIPANT_IP=$(get-instance-ip.sh policy-clamp-ac-http-ppnt) +HTTP_PARTICIPANT_PORT=30290 A1PMS_PARTICIPANT_IP=$(get-instance-ip.sh policy-clamp-ac-a1pms-ppnt) +A1PMS_PARTICIPANT_PORT=30296 echo POLICY PARTICIPANT IP IS "${POLICY_PARTICIPANT_IP}" echo API IP IS "${POLICY_API_IP}" @@ -65,13 +74,18 @@ echo HTTP PARTICIPANT IP IS "${HTTP_PARTICIPANT_IP}" echo A1PMS PARTICIPANT IP IS "${A1PMS_PARTICIPANT_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${POLICY_PARTICIPANT_IP}" 6969 +#"${SCRIPTS}"/wait_for_rest.sh localhost "${POLICY_PARTICIPANT_PORT}" ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_RUNTIME_ACM_IP:${POLICY_RUNTIME_ACM_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_RUNTIME_ACM_PORT:${POLICY_RUNTIME_ACM_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PARTICIPANT_IP:${POLICY_PARTICIPANT_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PARTICIPANT_PORT:${POLICY_PARTICIPANT_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v K8S_PARTICIPANT_IP:${K8S_PARTICIPANT_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v K8S_PARTICIPANT_PORT:${K8S_PARTICIPANT_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v HTTP_PARTICIPANT_IP:${HTTP_PARTICIPANT_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v HTTP_PARTICIPANT_PORT:${HTTP_PARTICIPANT_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v A1PMS_PARTICIPANT_IP:${A1PMS_PARTICIPANT_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v A1PMS_PARTICIPANT_PORT:${A1PMS_PARTICIPANT_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" - +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_PORT:${POLICY_API_PORT}" diff --git a/csit/clamp/tests/policy-clamp-test.robot b/csit/clamp/tests/policy-clamp-test.robot index 9fefbc0a..2c31b9a3 100644 --- a/csit/clamp/tests/policy-clamp-test.robot +++ b/csit/clamp/tests/policy-clamp-test.robot @@ -10,8 +10,8 @@ Library yaml Healthcheck [Documentation] Healthcheck on Clamp Acm ${auth}= Create List runtimeUser zb!XztG34 - Log Creating session http://${POLICY_RUNTIME_ACM_IP}:6969 - ${session}= Create Session ACM http://${POLICY_RUNTIME_ACM_IP}:6969 auth=${auth} + Log Creating session http://localhost:${POLICY_RUNTIME_ACM_PORT} + ${session}= Create Session ACM http://localhost:${POLICY_RUNTIME_ACM_PORT} auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= GET On Session ACM /onap/policy/clamp/acm/health headers=${headers} Log Received response from ACM healthcheck {resp.text} @@ -20,9 +20,9 @@ Healthcheck #CommissionAutomationCompositionV1 # [Documentation] Commission automation composition. # ${auth}= Create List runtimeUser zb!XztG34 -# Log Creating session http://${POLICY_RUNTIME_ACM_IP}:6969 +# Log Creating session http://localhost:${POLICY_RUNTIME_ACM_PORT} # ${postyaml}= Get file ${CURDIR}/data/functional-pmsh-usecase.yaml -# ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP}:6969 auth=${auth} +# ${session}= Create Session policy http://localhost:${POLICY_RUNTIME_ACM_PORT} auth=${auth} # ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml # ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions data=${postyaml} headers=${headers} # Log Received response from runtime acm ${resp.text} @@ -33,10 +33,10 @@ Healthcheck #InstantiateAutomationCompositionV1 # [Documentation] Instantiate automation composition. # ${auth}= Create List runtimeUser zb!XztG34 -# Log Creating session http://${POLICY_RUNTIME_ACM_IP}:6969 +# Log Creating session http://localhost:${POLICY_RUNTIME_ACM_PORT} # ${postjson}= Get file ${CURDIR}/data/AutomationComposition.json # ${updatedpostjson}= Replace String ${postjson} COMPOSITIONIDPLACEHOLDER ${compositionId} -# ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP}:6969 auth=${auth} +# ${session}= Create Session policy http://localhost:${POLICY_RUNTIME_ACM_PORT} auth=${auth} # ${headers}= Create Dictionary Accept=application/json Content-Type=application/json # ${resp}= POST On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances data=${updatedpostjson} headers=${headers} # Log Received response from runtime acm ${resp.text} @@ -47,9 +47,9 @@ Healthcheck #PassivateAutomationComposition # [Documentation] Passivate automation composition. # ${auth}= Create List runtimeUser zb!XztG34 -# Log Creating session http://${POLICY_RUNTIME_ACM_IP}:6969 +# Log Creating session http://localhost:${POLICY_RUNTIME_ACM_PORT} # ${postjson}= Get file ${CURDIR}/data/PassiveCommand.json -# ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP}:6969 auth=${auth} +# ${session}= Create Session policy http://localhost:${POLICY_RUNTIME_ACM_PORT} auth=${auth} # ${headers}= Create Dictionary Accept=application/json Content-Type=application/json # ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} # Log Received response from runtime acm ${resp.text} @@ -58,8 +58,8 @@ Healthcheck #QueryPolicies # [Documentation] Runs Policy Participant Query New Policies # ${auth}= Create List policyadmin zb!XztG34 -# Log Creating session http://${POLICY_API_IP}:6969 -# ${session}= Create Session policy http://${POLICY_API_IP}:6969 auth=${auth} +# Log Creating session http://localhost:${POLICY_API_PORT} +# ${session}= Create Session policy http://localhost:${POLICY_API_PORT} auth=${auth} # ${headers}= Create Dictionary Accept=application/json Content-Type=application/json # ${resp}= GET On Session policy /policy/api/v1/policies headers=${headers} # Log Received response from policy-api {resp.text} @@ -68,8 +68,8 @@ Healthcheck #QueryPolicyTypes # [Documentation] Runs Policy Participant Query New Policy Types # ${auth}= Create List policyadmin zb!XztG34 -# Log Creating session http://${POLICY_API_IP}:6969 -# ${session}= Create Session policy http://${POLICY_API_IP}:6969 auth=${auth} +# Log Creating session http://localhost:${POLICY_API_PORT}}:6969 +# ${session}= Create Session policy http://localhost:${POLICY_API_PORT} auth=${auth} # ${headers}= Create Dictionary Accept=application/json Content-Type=application/json # ${resp}= GET On Session policy /policy/api/v1/policytypes headers=${headers} # Log Received response from policy-api ${resp.text} @@ -78,9 +78,9 @@ Healthcheck #StateChangeRunningAutomationComposition # [Documentation] AutomationComposition State Change to RUNNING. # ${auth}= Create List runtimeUser zb!XztG34 -# Log Creating session http://${POLICY_RUNTIME_ACM_IP}:6969 +# Log Creating session http://localhost:${POLICY_RUNTIME_ACM_PORT} # ${postjson}= Get file ${CURDIR}/data/RunningCommand.json -# ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP}:6969 auth=${auth} +# ${session}= Create Session policy http://localhost:${POLICY_RUNTIME_ACM_PORT} auth=${auth} # ${headers}= Create Dictionary Accept=application/json Content-Type=application/json # ${resp}= PUT On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} data=${postjson} headers=${headers} expected_status=400 # Log Received response from runtime acm ${resp.text} @@ -88,8 +88,8 @@ Healthcheck #QueryInstantiatedACs # [Documentation] Get Instantiated AutomationCompositions # ${auth}= Create List runtimeUser zb!XztG34 -# Log Creating session http://${POLICY_RUNTIME_ACM_IP}:6969 -# ${session}= Create Session policy http://${POLICY_RUNTIME_ACM_IP}:6969 auth=${auth} +# Log Creating session http://localhost:${POLICY_RUNTIME_ACM_PORT} +# ${session}= Create Session policy http://localhost:${POLICY_RUNTIME_ACM_PORT} auth=${auth} # ${headers}= Create Dictionary Accept=application/json Content-Type=application/json # ${resp}= GET On Session policy /onap/policy/clamp/acm/v2/compositions/${compositionId}/instances/${instanceId} headers=${headers} # Log Received response from runtime acm ${resp.text} diff --git a/csit/common-library.robot b/csit/common-library.robot index c19f78cd..e8a9640c 100644 --- a/csit/common-library.robot +++ b/csit/common-library.robot @@ -15,36 +15,36 @@ HealthCheckAuth [return] ${healthcheck} PerformPostRequest - [Arguments] ${hostname} ${url} ${expectedstatus} ${postjson} ${params} ${auth} - Log Creating session http://${hostname}:6969 - ${session}= Create Session policy http://${hostname}:6969 auth=${auth} + [Arguments] ${port} ${url} ${expectedstatus} ${postjson} ${params} ${auth} + Log Creating session http://localhost:${port} + ${session}= Create Session policy http://localhost:${port} auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= POST On Session policy ${url} data=${postjson} params=${params} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} [return] ${resp} PerformPutRequest - [Arguments] ${hostname} ${url} ${expectedstatus} ${params} ${auth} - Log Creating session http://${hostname}:6969 - ${session}= Create Session policy http://${hostname}:6969 auth=${auth} + [Arguments] ${port} ${url} ${expectedstatus} ${params} ${auth} + Log Creating session http://localhost:${port} + ${session}= Create Session policy http://localhost:${port} auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= PUT On Session policy ${url} params=${params} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} [return] ${resp} PerformGetRequest - [Arguments] ${hostname} ${url} ${expectedstatus} ${params} ${auth} - Log Creating session http://${hostname}:6969 - ${session}= Create Session policy http://${hostname}:6969 auth=${auth} + [Arguments] ${port} ${url} ${expectedstatus} ${params} ${auth} + Log Creating session http://localhost:${port} + ${session}= Create Session policy http://localhost:${port} auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= GET On Session policy ${url} params=${params} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} [return] ${resp} PerformDeleteRequest - [Arguments] ${hostname} ${url} ${expectedstatus} ${auth} - Log Creating session http://${hostname}:6969 - ${session}= Create Session policy http://${hostname}:6969 auth=${auth} + [Arguments] ${port} ${url} ${expectedstatus} ${auth} + Log Creating session http://localhost:${port} + ${session}= Create Session policy http://localhost:${port} auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} @@ -53,7 +53,7 @@ CreatePolicy [Arguments] ${url} ${expectedstatus} ${postjson} ${policyname} ${policyversion} [Documentation] Create the specific policy ${policyadmin}= PolicyAdminAuth - ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${policyadmin} + ${resp}= PerformPostRequest ${POLICY_API_PORT} ${url} ${expectedstatus} ${postjson} null ${policyadmin} Run Keyword If ${expectedstatus}==200 Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} @@ -61,7 +61,7 @@ CreateNodeTemplate [Arguments] ${url} ${expectedstatus} ${postjson} ${nodeTemplateListLength} [Documentation] Create the node templates ${policyadmin}= PolicyAdminAuth - ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} \ ${policyadmin} + ${resp}= PerformPostRequest ${POLICY_API_PORT} ${url} ${expectedstatus} ${postjson} \ ${policyadmin} Run Keyword If ${expectedstatus}==200 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} @@ -69,7 +69,7 @@ QueryPdpGroups [Documentation] Verify pdp group query - supports upto 2 groups [Arguments] ${groupsLength} ${group1Name} ${group1State} ${policiesLengthInGroup1} ${group2Name} ${group2State} ${policiesLengthInGroup2} ${policyadmin}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps 200 null ${policyadmin} + ${resp}= PerformGetRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps 200 null ${policyadmin} Length Should Be ${resp.json()['groups']} ${groupsLength} Should Be Equal As Strings ${resp.json()['groups'][0]['name']} ${group1Name} Should Be Equal As Strings ${resp.json()['groups'][0]['pdpGroupState']} ${group1State} @@ -81,7 +81,7 @@ QueryPdpGroups QueryPolicyAudit [Arguments] ${url} ${expectedstatus} ${pdpGroup} ${pdpType} ${policyName} ${expectedAction} ${policyadmin}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} ${expectedstatus} recordCount=2 ${policyadmin} + ${resp}= PerformGetRequest ${POLICY_PAP_PORT} ${url} ${expectedstatus} recordCount=2 ${policyadmin} Log Received response from queryPolicyAudit ${resp.text} FOR ${responseEntry} IN @{resp.json()} Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}' @@ -97,7 +97,7 @@ QueryPolicyStatus [Documentation] Verify policy deployment status [Arguments] ${policyName} ${pdpGroup} ${pdpType} ${pdpName} ${policyTypeName} ${policyadmin}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/policies/status 200 null ${policyadmin} + ${resp}= PerformGetRequest ${POLICY_PAP_PORT} /policy/pap/v1/policies/status 200 null ${policyadmin} FOR ${responseEntry} IN @{resp.json()} Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}' END @@ -113,9 +113,9 @@ QueryPolicyStatus Should Be Equal As Strings ${responseEntry['state']} SUCCESS GetMetrics - [Arguments] ${hostname} ${auth} ${context_path} - Log Creating session http://${hostname}:6969 - ${session}= Create Session policy http://${hostname}:6969 auth=${auth} + [Arguments] ${port} ${auth} ${context_path} + Log Creating session http://localhost:${port} + ${session}= Create Session policy http://localhost:${port} auth=${auth} ${resp}= GET On Session policy ${context_path}metrics expected_status=200 Log Received response from policy ${resp.text} [return] ${resp} diff --git a/csit/distribution/plans/setup.sh b/csit/distribution/plans/setup.sh index b7495007..8efb935d 100755 --- a/csit/distribution/plans/setup.sh +++ b/csit/distribution/plans/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2018 Ericsson. All rights reserved. -# Modifications Copyright (c) 2019-2022 Nordix Foundation. +# Modifications Copyright (c) 2019-2023 Nordix Foundation. # Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,8 +45,10 @@ POLICY_API_IP=$(get-instance-ip.sh policy-api) POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) MARIADB_IP=$(get-instance-ip.sh mariadb) APEX_IP=$(get-instance-ip.sh policy-apex-pdp) +APEX_PORT=30237 DMAAP_IP=$(get-instance-ip.sh simulator) POLICY_DISTRIBUTION_IP=$(get-instance-ip.sh policy-distribution) +POLICY_DISTRIBUTION_PORT=30238 echo PAP IP IS "${POLICY_PAP_IP}" echo MARIADB IP IS "${MARIADB_IP}" @@ -56,9 +58,11 @@ echo DMAAP_IP IS "${DMAAP_IP}" echo POLICY_DISTRIBUTION_IP IS "${POLICY_DISTRIBUTION_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${POLICY_DISTRIBUTION_IP}" 6969 +"${SCRIPTS}"/wait_for_rest.sh localhost "${POLICY_DISTRIBUTION_PORT}" ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_IP:${APEX_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v APEX_PORT:${APEX_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCRIPT_DIR:${SCRIPT_DIR}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_DISTRIBUTION_IP:${POLICY_DISTRIBUTION_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_DISTRIBUTION_PORT:${POLICY_DISTRIBUTION_PORT}" diff --git a/csit/distribution/tests/distribution-test.robot b/csit/distribution/tests/distribution-test.robot index c283f668..8cfc3fac 100644 --- a/csit/distribution/tests/distribution-test.robot +++ b/csit/distribution/tests/distribution-test.robot @@ -10,19 +10,19 @@ Resource ${CURDIR}/../../common-library.robot Healthcheck [Documentation] Verify policy distribution health check ${hcauth}= HealthCheckAuth - ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /healthcheck 200 null ${hcauth} + ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /healthcheck 200 null ${hcauth} Should Be Equal As Strings ${resp.json()['code']} 200 Statistics [Documentation] Verify policy distribution statistics ${hcauth}= HealthCheckAuth - ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /statistics 200 null ${hcauth} + ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /statistics 200 null ${hcauth} Should Be Equal As Strings ${resp.json()['code']} 200 Metrics [Documentation] Verify policy-distribution is exporting prometheus metrics ${hcauth}= HealthCheckAuth - ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /metrics 200 null ${hcauth} + ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /metrics 200 null ${hcauth} Should Contain ${resp.text} total_distribution_received_count_total 0.0 Should Contain ${resp.text} distribution_success_count_total 0.0 Should Contain ${resp.text} distribution_failure_count_total 0.0 @@ -36,7 +36,7 @@ InvokeDistributionAndRunEventOnEngine MetricsAfterExecution [Documentation] Verify policy-distribution is exporting prometheus metrics after execution ${hcauth}= HealthCheckAuth - ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /metrics 200 null ${hcauth} + ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_PORT} /metrics 200 null ${hcauth} Should Contain ${resp.text} total_distribution_received_count_total 1.0 Should Contain ${resp.text} distribution_success_count_total 1.0 Should Contain ${resp.text} distribution_failure_count_total 0.0 @@ -50,7 +50,7 @@ InvokeDistributionUsingFile And RunEventOnApexEngine Copy File ${SCRIPT_DIR}/csar/csar_temp.csar ${SCRIPT_DIR}/csar/temp.csar Move File ${SCRIPT_DIR}/csar/temp.csar ${SCRIPT_DIR}/temp/sample_csar_with_apex_policy.csar Sleep 20 seconds "Waiting for the Policy Distribution to call Policy API and PAP" - Create Session apexSession http://${APEX_IP}:23324 max_retries=1 + Create Session apexSession http://localhost:23324 max_retries=1 ${data}= Get Binary File ${CURDIR}${/}data${/}event.json &{headers}= Create Dictionary Content-Type=application/json Accept=application/json ${resp}= PUT On Session apexSession /apex/FirstConsumer/EventIn data=${data} headers=${headers} expected_status=200 diff --git a/csit/docker-compose-all.yml b/csit/docker-compose-all.yml index 38a5de51..2116e547 100644 --- a/csit/docker-compose-all.yml +++ b/csit/docker-compose-all.yml @@ -200,6 +200,7 @@ services: hostname: policy-apex-pdp ports: - 30237:6969 + - 23324:23324 volumes: - ./config/apex-pdp/OnapPfConfig.json:/opt/app/policy/apex-pdp/etc/onappf/config/OnapPfConfig.json:ro - ./config/apex-pdp/logback.xml:/opt/app/policy/apex-pdp/etc/logback.xml:ro @@ -220,6 +221,8 @@ services: - pap - apex-pdp hostname: policy-distribution + ports: + - 30238:6969 volumes: - ./config/distribution/defaultConfig.json:/opt/app/policy/distribution/etc/defaultConfig.json:ro - ./distribution/config/temp/:/opt/app/policy/distribution/etc/temp/:ro diff --git a/csit/drools-applications/plans/setup.sh b/csit/drools-applications/plans/setup.sh index 6ca073bc..5f680b44 100755 --- a/csit/drools-applications/plans/setup.sh +++ b/csit/drools-applications/plans/setup.sh @@ -2,7 +2,7 @@ # # ===========LICENSE_START==================================================== # Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright 2021-2022 Nordix Foundation. +# Modifications Copyright 2021-2023 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,9 +33,13 @@ docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d drools-apps unset http_proxy https_proxy DROOLS_IP=$(get-instance-ip.sh drools-apps) +DROOLS_PORT=30221 API_IP=$(get-instance-ip.sh policy-api) +API_PORT=30440 PAP_IP=$(get-instance-ip.sh policy-pap) +PAP_PORT=30442 XACML_IP=$(get-instance-ip.sh policy-xacml-pdp) +XACML_PORT=30441 SIM_IP=$(get-instance-ip.sh simulator) export SIM_IP @@ -46,7 +50,7 @@ echo XACML IP IS "${XACML_IP}" echo SIMULATORS IP IS "${SIM_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${DROOLS_IP}" 6969 +"${SCRIPTS}"/wait_for_rest.sh localhost 30219 # give enough time for the controllers to come up sleep 15 @@ -59,7 +63,11 @@ ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCRIPTS}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA2:${DATA2}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_IP:${DROOLS_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_PORT:${DROOLS_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v API_IP:${API_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v API_PORT:${API_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v PAP_IP:${PAP_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v PAP_PORT:${PAP_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_IP:${XACML_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_PORT:${XACML_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SIM_IP:${SIM_IP}" diff --git a/csit/drools-applications/tests/drools-applications-test.robot b/csit/drools-applications/tests/drools-applications-test.robot index c06631b9..02dc0f32 100644 --- a/csit/drools-applications/tests/drools-applications-test.robot +++ b/csit/drools-applications/tests/drools-applications-test.robot @@ -9,17 +9,17 @@ Library json *** Test Cases *** Alive [Documentation] Runs Policy PDP Alive Check - ${resp}= PeformGetRequest /policy/pdp/engine ${DROOLS_IP} 9696 200 + ${resp}= PeformGetRequest /policy/pdp/engine 30219 200 Should Be Equal As Strings ${resp.json()['alive']} True Metrics [Documentation] Verify drools-apps is exporting metrics - ${resp}= PeformGetRequest /metrics ${DROOLS_IP} 9696 200 + ${resp}= PeformGetRequest /metrics 30219 200 Should Contain ${resp.text} jvm_threads_current Healthcheck [Documentation] Runs Policy PDP-D Health check - ${resp}= PeformGetRequest /healthcheck ${DROOLS_IP} 6969 200 + ${resp}= PeformGetRequest /healthcheck ${DROOLS_PORT} 200 Should Be Equal As Strings ${resp.json()['healthy']} True Controller @@ -35,31 +35,31 @@ MakeTopics CreateVcpeXacmlPolicy [Documentation] Create VCPE Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${API_IP} 6969 vCPE.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + PerformPostRequest /policy/api/v1/policies null ${API_PORT} vCPE.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 CreateVcpeDroolsPolicy [Documentation] Create VCPE Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${API_IP} 6969 vCPE.policy.operational.input.tosca.yaml ${DATA} yaml 200 + PerformPostRequest /policy/api/v1/policies null ${API_PORT} vCPE.policy.operational.input.tosca.yaml ${DATA} yaml 200 CreateVdnsXacmlPolicy [Documentation] Create VDNS Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${API_IP} 6969 vDNS.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + PerformPostRequest /policy/api/v1/policies null ${API_PORT} vDNS.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 CreateVdnsDroolsPolicy [Documentation] Create VDNS Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${API_IP} 6969 vDNS.policy.operational.input.tosca.json ${DATA} json 200 + PerformPostRequest /policy/api/v1/policies null ${API_PORT} vDNS.policy.operational.input.tosca.json ${DATA} json 200 CreateVfwXacmlPolicy [Documentation] Create VFW Policy for Xacml - PerformPostRequest /policy/api/v1/policies null ${API_IP} 6969 vFirewall.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 + PerformPostRequest /policy/api/v1/policies null ${API_PORT} vFirewall.policy.monitoring.input.tosca.yaml ${DATA} yaml 200 CreateVfwDroolsPolicy [Documentation] Create VFW Policy for Drools - PerformPostRequest /policy/api/v1/policies null ${API_IP} 6969 vFirewall.policy.operational.input.tosca.json ${DATA} json 200 + PerformPostRequest /policy/api/v1/policies null ${API_PORT} vFirewall.policy.operational.input.tosca.json ${DATA} json 200 DeployXacmlPolicies [Documentation] Deploys the Policies to Xacml - PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${PAP_IP} 6969 deploy.xacml.policies.json ${DATA2} json 202 + PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${PAP_PORT} deploy.xacml.policies.json ${DATA2} json 202 ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-PDP-PAP ... responseTo xacml ACTIVE restart Log Received status ${result.stdout} @@ -70,7 +70,7 @@ DeployXacmlPolicies DeployDroolsPolicies [Documentation] Deploys the Policies to Drools - PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${PAP_IP} 6969 deploy.drools.policies.json ${DATA2} json 202 + PerformPostRequest /policy/pap/v1/pdps/deployments/batch null ${PAP_PORT} deploy.drools.policies.json ${DATA2} json 202 ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-PDP-PAP ... responseTo drools ACTIVE Log Received status ${result.stdout} @@ -207,25 +207,25 @@ VfwExecute *** Keywords *** VerifyController - ${resp}= PeformGetRequest /policy/pdp/engine/controllers/usecases/drools/facts ${DROOLS_IP} 9696 200 + ${resp}= PeformGetRequest /policy/pdp/engine/controllers/usecases/drools/facts 30219 200 Should Be Equal As Strings ${resp.json()['usecases']} 1 PeformGetRequest - [Arguments] ${url} ${hostname} ${port} ${expectedstatus} + [Arguments] ${url} ${port} ${expectedstatus} ${auth}= Create List demo@people.osaaf.org demo123456! - Log Creating session http://${hostname}:${port} - ${session}= Create Session policy http://${hostname}:${port} auth=${auth} + Log Creating session http://localhost:${port} + ${session}= Create Session policy http://localhost:${port} auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= GET On Session policy ${url} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} [return] ${resp} PerformPostRequest - [Arguments] ${url} ${params} ${hostname} ${port} ${jsonfile} ${filepath} ${contenttype} ${expectedstatus} + [Arguments] ${url} ${params} ${port} ${jsonfile} ${filepath} ${contenttype} ${expectedstatus} ${auth}= Create List policyadmin zb!XztG34 ${postjson}= Get file ${filepath}/${jsonfile} - Log Creating session http://${hostname}:${port} - ${session}= Create Session policy http://${hostname}:${port} auth=${auth} + Log Creating session http://localhost:${port} + ${session}= Create Session policy http://localhost:${port} auth=${auth} ${headers}= Create Dictionary Accept=application/${contenttype} Content-Type=application/${contenttype} ${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus} Log Received response from policy ${resp.text} diff --git a/csit/drools-pdp/plans/setup.sh b/csit/drools-pdp/plans/setup.sh index 987c453c..f08126ec 100755 --- a/csit/drools-pdp/plans/setup.sh +++ b/csit/drools-pdp/plans/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright 2017-2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright 2021-2022 Nordix Foundation. +# Modifications Copyright 2021-2023 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,16 +30,18 @@ source "${SCRIPTS}"/get-versions.sh docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d drools POLICY_DROOLS_IP=$(get-instance-ip.sh drools) +POLICY_DROOLS_PORT=30217 MARIADB_IP=$(get-instance-ip.sh mariadb) echo DROOLS IP IS "${POLICY_DROOLS_IP}" echo MARIADB IP IS "${MARIADB_IP}" -# wait for the app to start up - looking for telemetry service on port 9696 -"${SCRIPTS}"/wait_for_port.sh "${POLICY_DROOLS_IP}" 9696 +# wait for the app to start up - looking for telemetry service on port 30216 forwarded from 9696 +"${SCRIPTS}"/wait_for_rest.sh localhost 30216 # give enough time for the controllers to come up sleep 15 ROBOT_VARIABLES="" -ROBOT_VARIABLES="${ROBOT_VARIABLES}-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_DROOLS_PORT:${POLICY_DROOLS_PORT}" diff --git a/csit/drools-pdp/tests/drools-pdp-test.robot b/csit/drools-pdp/tests/drools-pdp-test.robot index 3d95b6a1..b895857f 100644 --- a/csit/drools-pdp/tests/drools-pdp-test.robot +++ b/csit/drools-pdp/tests/drools-pdp-test.robot @@ -8,8 +8,8 @@ Library json Alive [Documentation] Runs Policy PDP Alive Check ${auth}= Create List demo@people.osaaf.org demo123456! - Log Creating session http://${POLICY_DROOLS_IP}:9696 - ${session}= Create Session policy http://${POLICY_DROOLS_IP}:9696 auth=${auth} + Log Creating session http://localhost:30216 + ${session}= Create Session policy http://localhost:30216 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= GET On Session policy /policy/pdp/engine headers=${headers} expected_status=200 Log Received response from policy ${resp.text} @@ -18,8 +18,8 @@ Alive Metrics [Documentation] Verify drools-pdp is exporting metrics ${auth}= Create List demo@people.osaaf.org demo123456! - Log Creating session http://${POLICY_DROOLS_IP}:9696 - ${session}= Create Session policy http://${POLICY_DROOLS_IP}:9696 auth=${auth} + Log Creating session http://localhost:30216 + ${session}= Create Session policy http://localhost:30216 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= GET On Session policy /metrics headers=${headers} expected_status=200 Log Received response from policy ${resp.text} diff --git a/csit/make_topic.sh b/csit/make_topic.sh index 05d11f3c..f50753ce 100755 --- a/csit/make_topic.sh +++ b/csit/make_topic.sh @@ -2,7 +2,7 @@ # # ===========LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright (C) 2022 Nordix Foundation. +# Modifications Copyright (C) 2022-2023 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,5 +30,5 @@ fi topic="${1}" -curl -s -k "http://${SIM_IP}:3904/events/${topic}/script/1?limit=1&timeout=0" +curl -s -k "http://localhost:30227/events/${topic}/script/1?limit=1&timeout=0" echo diff --git a/csit/onset.sh b/csit/onset.sh index 251b5b51..6b9d900e 100755 --- a/csit/onset.sh +++ b/csit/onset.sh @@ -2,7 +2,7 @@ # # ===========LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright (C) 2022 Nordix Foundation. +# Modifications Copyright (C) 2022-2023 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,5 +29,5 @@ then fi curl -k -H "Content-type: application/json" --data-binary @$1 \ - http://${SIM_IP}:3904/events/unauthenticated.DCAE_CL_OUTPUT + http://localhost:30227/events/unauthenticated.DCAE_CL_OUTPUT echo diff --git a/csit/pap/plans/setup.sh b/csit/pap/plans/setup.sh index 4f48d124..b656ef5a 100755 --- a/csit/pap/plans/setup.sh +++ b/csit/pap/plans/setup.sh @@ -38,7 +38,9 @@ sleep 10 unset http_proxy https_proxy POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) +POLICY_PAP_PORT=30442 POLICY_API_IP=$(get-instance-ip.sh policy-api) +POLICY_API_PORT=30440 MARIADB_IP=$(get-instance-ip.sh mariadb) echo PAP IP IS "${POLICY_PAP_IP}" @@ -46,7 +48,7 @@ echo API IP IS "${POLICY_API_IP}" echo MARIADB IP IS "${MARIADB_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${POLICY_PAP_IP}" 6969 +"${SCRIPTS}"/wait_for_rest.sh localhost "${POLICY_PAP_PORT}" DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies @@ -55,5 +57,7 @@ NODETEMPLATES=${WORKSPACE}/models/models-examples/src/main/resources/nodetemplat ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_PORT:${POLICY_PAP_PORT}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_PORT:${POLICY_API_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v NODETEMPLATES:${NODETEMPLATES}" diff --git a/csit/pap/tests/pap-test.robot b/csit/pap/tests/pap-test.robot index e79f6ede..c417a83f 100644 --- a/csit/pap/tests/pap-test.robot +++ b/csit/pap/tests/pap-test.robot @@ -9,7 +9,7 @@ Resource ${CURDIR}/../../common-library.robot GetReq [Arguments] ${url} ${auth}= PolicyAdminAuth - ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} 200 null ${auth} + ${resp}= PerformGetRequest ${POLICY_PAP_PORT} ${url} 200 null ${auth} [return] ${resp} *** Test Cases *** @@ -41,7 +41,7 @@ Consolidated Healthcheck Metrics [Documentation] Verify policy pap is exporting prometheus metrics ${auth}= PolicyAdminAuth - ${resp}= GetMetrics ${POLICY_PAP_IP} ${auth} /policy/pap/v1/ + ${resp}= GetMetrics ${POLICY_PAP_PORT} ${auth} /policy/pap/v1/ Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/healthcheck",} 1.0 Should Contain ${resp.text} http_server_requests_seconds_count{exception="None",method="GET",outcome="SUCCESS",status="200",uri="/components/healthcheck",} 1.0 Should Contain ${resp.text} spring_data_repository_invocations_seconds_count{exception="None",method="save",repository="PdpGroupRepository",state="SUCCESS",} 1.0 @@ -57,7 +57,7 @@ AddPdpGroup [Documentation] Add a new PdpGroup named 'testGroup' in the policy database ${postjson}= Get file ${CURDIR}/data/create.group.request.json ${auth}= PolicyAdminAuth - PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/batch 200 ${postjson} null ${auth} + PerformPostRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/groups/batch 200 ${postjson} null ${auth} QueryPdpGroupsBeforeActivation [Documentation] Verify PdpGroups before activation @@ -66,7 +66,7 @@ QueryPdpGroupsBeforeActivation ActivatePdpGroup [Documentation] Change the state of PdpGroup named 'testGroup' to ACTIVE ${auth}= PolicyAdminAuth - PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=ACTIVE ${auth} + PerformPutRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/groups/testGroup 200 state=ACTIVE ${auth} QueryPdpGroupsAfterActivation [Documentation] Verify PdpGroups after activation @@ -76,7 +76,7 @@ DeployPdpGroups [Documentation] Deploy policies in PdpGroups ${postjson}= Get file ${CURDIR}/data/deploy.group.request.json ${auth}= PolicyAdminAuth - PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${auth} + PerformPostRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${auth} QueryPdpGroupsAfterDeploy [Documentation] Verify PdpGroups after undeploy @@ -93,12 +93,12 @@ QueryPolicyAuditWithMetadataSetAfterDeploy UndeployPolicy [Documentation] Undeploy a policy named 'onap.restart.tca' from PdpGroups ${auth}= PolicyAdminAuth - PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${auth} + PerformDeleteRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${auth} UndeployPolicyWithMetadataSet [Documentation] Undeploy a policy named 'operational.apex.decisionMaker' from PdpGroups ${auth}= PolicyAdminAuth - PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/operational.apex.decisionMaker 202 ${auth} + PerformDeleteRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/policies/operational.apex.decisionMaker 202 ${auth} QueryPdpGroupsAfterUndeploy [Documentation] Verify PdpGroups after undeploy @@ -116,12 +116,12 @@ QueryPolicyAuditWithMetadataSetAfterUnDeploy DeactivatePdpGroup [Documentation] Change the state of PdpGroup named 'testGroup' to PASSIVE ${auth}= PolicyAdminAuth - PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=PASSIVE ${auth} + PerformPutRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/groups/testGroup 200 state=PASSIVE ${auth} DeletePdpGroups [Documentation] Delete the PdpGroup named 'testGroup' from policy database ${auth}= PolicyAdminAuth - PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 ${auth} + PerformDeleteRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/groups/testGroup 200 ${auth} QueryPdpGroupsAfterDelete [Documentation] Verify PdpGroups after delete diff --git a/csit/wait_for_rest.sh b/csit/wait_for_rest.sh new file mode 100755 index 00000000..bf47ccf1 --- /dev/null +++ b/csit/wait_for_rest.sh @@ -0,0 +1,77 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 2023 Nordix Foundation. +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== +usage() { + echo args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ... >&2 + exit 1 +} +tmout=300 +cmd= +while getopts c:t: opt +do + case "$opt" in + c) + cmd="$OPTARG" + ;; + t) + tmout="$OPTARG" + ;; + *) + usage + ;; + esac +done +nargs=$((OPTIND-1)) +shift "$nargs" +even_args=$(($#%2)) +if [ $# -lt 2 ] || [ "$even_args" -ne 0 ] +then + usage +fi +while [ $# -ge 2 ] +do + export host="$1" + export port="$2" + shift + shift + echo "Waiting for REST to come up on $host port $port..." + while [ "$tmout" -gt 0 ] + do + if command -v docker > /dev/null 2>&1 + then + docker ps + fi + curl "http://$host:$port" > /dev/null 2>&1 + rc=$? + if [ $rc -eq 0 ] + then + break + else + tmout=$((tmout-1)) + sleep 1 + fi + done + if [ $rc -ne 0 ] + then + echo "$host port $port REST cannot be detected" + exit $rc + fi +done +$cmd +exit 0 + diff --git a/csit/wait_topic.sh b/csit/wait_topic.sh index a6d997d0..c72b728f 100755 --- a/csit/wait_topic.sh +++ b/csit/wait_topic.sh @@ -2,7 +2,7 @@ # # ===========LICENSE_START==================================================== # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright (C) 2022 Nordix Foundation. +# Modifications Copyright (C) 2022-2023 Nordix Foundation. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ matched=no while [ ${matched} = "no" ] do - msg=`curl -s -k "http://${SIM_IP}:3904/events/${topic}/script/1?limit=1"` + msg=`curl -s -k "http://localhost:30227/events/${topic}/script/1?limit=1"` if [ $? -ne 0 -o "${msg}" = "[]" ] then echo not found >&2 diff --git a/csit/xacml-pdp/plans/setup.sh b/csit/xacml-pdp/plans/setup.sh index 705c8202..646605ff 100755 --- a/csit/xacml-pdp/plans/setup.sh +++ b/csit/xacml-pdp/plans/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # ============LICENSE_START======================================================= # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright 2021-2022 Nordix Foundation. +# Modifications Copyright 2021-2023 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,10 +33,13 @@ docker-compose -f "${SCRIPTS}"/docker-compose-all.yml up -d xacml-pdp unset http_proxy https_proxy POLICY_API_IP=$(get-instance-ip.sh policy-api) +POLICY_API_PORT=30440 MARIADB_IP=$(get-instance-ip.sh mariadb) POLICY_PDPX_IP=$(get-instance-ip.sh policy-xacml-pdp) +POLICY_PDPX_PORT=30441 SIM_IP=$(get-instance-ip.sh simulator) POLICY_PAP_IP=$(get-instance-ip.sh policy-pap) +POLICY_PAP_PORT=30442 export SIM_IP @@ -47,7 +50,7 @@ echo MARIADB IP IS "${MARIADB_IP}" echo SIM_IP IS "${SIM_IP}" # wait for the app to start up -"${SCRIPTS}"/wait_for_port.sh "${POLICY_PDPX_IP}" 6969 +"${SCRIPTS}"/wait_for_rest.sh localhost "${POLICY_PDPX_PORT}" DATA2=${WORKSPACE}/models/models-examples/src/main/resources/policies @@ -55,5 +58,8 @@ ROBOT_VARIABLES="" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR_DMAAP:${SCRIPTS}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA2:${DATA2}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PDPX_IP:${POLICY_PDPX_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PDPX_PORT:${POLICY_PDPX_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_PORT:${POLICY_API_PORT}" ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_IP:${POLICY_PAP_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PAP_PORT:${POLICY_PAP_PORT}" diff --git a/csit/xacml-pdp/tests/xacml-pdp-test.robot b/csit/xacml-pdp/tests/xacml-pdp-test.robot index 9b3df140..e29200ac 100644 --- a/csit/xacml-pdp/tests/xacml-pdp-test.robot +++ b/csit/xacml-pdp/tests/xacml-pdp-test.robot @@ -64,7 +64,7 @@ DeployPolicies [Documentation] Runs Policy PAP to deploy a policy ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json ${policyadmin}= PolicyAdminAuth - PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies 202 ${postjson} null ${policyadmin} + PerformPostRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/policies 202 ${postjson} null ${policyadmin} ${result}= Run Process ${SCR_DMAAP}/wait_topic.sh POLICY-PDP-PAP ... responseTo xacml ACTIVE onap.restart.tca Should Be Equal As Integers ${result.rc} 0 @@ -129,7 +129,7 @@ GetStatisticsAfterDecision UndeployMonitorPolicy [Documentation] Runs Policy PAP to undeploy a policy ${policyadmin}= PolicyAdminAuth - PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${policyadmin} + PerformDeleteRequest ${POLICY_PAP_PORT} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${policyadmin} GetStatisticsAfterUndeploy [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed @@ -140,11 +140,11 @@ GetStatisticsAfterUndeploy PdpxGetReq [Arguments] ${url} ${hcauth}= HealthCheckAuth - ${resp}= PerformGetRequest ${POLICY_PDPX_IP} ${url} 200 null ${hcauth} + ${resp}= PerformGetRequest ${POLICY_PDPX_PORT} ${url} 200 null ${hcauth} [return] ${resp} DecisionPostReq [Arguments] ${postjson} ${abbr} ${hcauth}= HealthCheckAuth - ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} ${abbr} ${hcauth} + ${resp}= PerformPostRequest ${POLICY_PDPX_PORT} /policy/pdpx/v1/decision 200 ${postjson} ${abbr} ${hcauth} [return] ${resp} |