# ============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.
# ================================================================================
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
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}"
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']}
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
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}
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}
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}
[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
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
${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
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
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
[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}
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)
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}"
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}"
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}
#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}
#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}
#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}
#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}
#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}
#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}
#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}
[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}
[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}
[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}
[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}
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}'
[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
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}
#!/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");
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}"
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}"
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
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
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
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
- 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
#
# ===========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.
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
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
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}"
*** 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
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}
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}
*** 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}
#!/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.
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}"
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}
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}
#
# ===========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.
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
#
# ===========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.
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
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}"
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
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}"
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 ***
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
[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
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
[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
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
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
--- /dev/null
+#!/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
+
#
# ===========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.
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
#!/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.
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
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
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}"
[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
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
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}