aboutsummaryrefslogtreecommitdiffstats
path: root/tests/policy/xacml-pdp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/policy/xacml-pdp')
-rw-r--r--tests/policy/xacml-pdp/data/onap.policies.monitoring.cdap.tca.hi.lo.app.json210
-rw-r--r--tests/policy/xacml-pdp/data/onap.policy.guard.decision.request.json16
-rw-r--r--tests/policy/xacml-pdp/data/onap.policy.optimization.decision.request.json15
-rw-r--r--tests/policy/xacml-pdp/data/vCPE.policy.input.tosca.deploy.json5
-rw-r--r--tests/policy/xacml-pdp/data/vCPE.policy.monitoring.input.tosca.deploy.json1
-rw-r--r--tests/policy/xacml-pdp/xacml-pdp-test.robot61
6 files changed, 90 insertions, 218 deletions
diff --git a/tests/policy/xacml-pdp/data/onap.policies.monitoring.cdap.tca.hi.lo.app.json b/tests/policy/xacml-pdp/data/onap.policies.monitoring.cdap.tca.hi.lo.app.json
deleted file mode 100644
index 06574735..00000000
--- a/tests/policy/xacml-pdp/data/onap.policies.monitoring.cdap.tca.hi.lo.app.json
+++ /dev/null
@@ -1,210 +0,0 @@
-{
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "policy_types": {
- "onap.policies.Monitoring": {
- "derived_from": "tosca.policies.Root",
- "description": "a base policy type for all policies that governs monitoring provisioning"
- },
- "onap.policies.monitoring.cdap.tca.hi.lo.app": {
- "derived_from": "onap.policies.Monitoring",
- "version": "1.0.0",
- "properties": {
- "tca_policy": {
- "type": "onap.datatypes.monitoring.tca_policy",
- "description": "TCA Policy JSON"
- }
- }
- }
- },
- "data_types": {
- "onap.datatypes.monitoring.metricsPerEventName": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "controlLoopSchemaType": {
- "type": "string",
- "required": true,
- "description": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM",
- "constraints": [
- {
- "valid_values": [
- "VM",
- "VNF"
- ]
- }
- ]
- },
- "eventName": {
- "type": "string",
- "required": true,
- "description": "Event name to which thresholds need to be applied"
- },
- "policyName": {
- "type": "string",
- "required": true,
- "description": "TCA Policy Scope Name"
- },
- "policyScope": {
- "type": "string",
- "required": true,
- "description": "TCA Policy Scope"
- },
- "policyVersion": {
- "type": "string",
- "required": true,
- "description": "TCA Policy Scope Version"
- },
- "thresholds": {
- "type": "list",
- "required": true,
- "description": "Thresholds associated with eventName",
- "entry_schema": {
- "type": "onap.datatypes.monitoring.thresholds"
- }
- }
- }
- },
- "onap.datatypes.monitoring.tca_policy": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "domain": {
- "type": "string",
- "required": true,
- "description": "Domain name to which TCA needs to be applied",
- "default": "measurementsForVfScaling",
- "constraints": [
- {
- "equal": "measurementsForVfScaling"
- }
- ]
- },
- "metricsPerEventName": {
- "type": "list",
- "required": true,
- "description": "Contains eventName and threshold details that need to be applied to given eventName",
- "entry_schema": {
- "type": "onap.datatypes.monitoring.metricsPerEventName"
- }
- }
- }
- },
- "onap.datatypes.monitoring.thresholds": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "closedLoopControlName": {
- "type": "string",
- "required": true,
- "description": "Closed Loop Control Name associated with the threshold"
- },
- "closedLoopEventStatus": {
- "type": "string",
- "required": true,
- "description": "Closed Loop Event Status of the threshold",
- "constraints": [
- {
- "valid_values": [
- "ONSET",
- "ABATED"
- ]
- }
- ]
- },
- "direction": {
- "type": "string",
- "required": true,
- "description": "Direction of the threshold",
- "constraints": [
- {
- "valid_values": [
- "LESS",
- "LESS_OR_EQUAL",
- "GREATER",
- "GREATER_OR_EQUAL",
- "EQUAL"
- ]
- }
- ]
- },
- "fieldPath": {
- "type": "string",
- "required": true,
- "description": "Json field Path as per CEF message which needs to be analyzed for TCA",
- "constraints": [
- {
- "valid_values": [
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait",
- "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage",
- "$.event.measurementsForVfScalingFields.meanRequestLatency",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree",
- "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed",
- "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
- ]
- }
- ]
- },
- "severity": {
- "type": "string",
- "required": true,
- "description": "Threshold Event Severity",
- "constraints": [
- {
- "valid_values": [
- "CRITICAL",
- "MAJOR",
- "MINOR",
- "WARNING",
- "NORMAL"
- ]
- }
- ]
- },
- "thresholdValue": {
- "type": "integer",
- "required": true,
- "description": "Threshold value for the field Path inside CEF message"
- },
- "version": {
- "type": "string",
- "required": true,
- "description": "Version number associated with the threshold"
- }
- }
- }
- }
-}
diff --git a/tests/policy/xacml-pdp/data/onap.policy.guard.decision.request.json b/tests/policy/xacml-pdp/data/onap.policy.guard.decision.request.json
new file mode 100644
index 00000000..ee90feaa
--- /dev/null
+++ b/tests/policy/xacml-pdp/data/onap.policy.guard.decision.request.json
@@ -0,0 +1,16 @@
+{
+ "ONAPName": "Guard",
+ "ONAPComponent": "Guard-component",
+ "ONAPInstance": "Guard-component-instance",
+ "requestId": "unique-request-guard-1",
+ "action": "guard",
+ "resource": {
+ "guard": {
+ "actor": "APPC",
+ "operation": "ModifyConfig",
+ "target": "f17face5-69cb-4c88-9e0b-7426db7edddd",
+ "requestId": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
+ "clname": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a"
+ }
+ }
+}
diff --git a/tests/policy/xacml-pdp/data/onap.policy.optimization.decision.request.json b/tests/policy/xacml-pdp/data/onap.policy.optimization.decision.request.json
new file mode 100644
index 00000000..d997099c
--- /dev/null
+++ b/tests/policy/xacml-pdp/data/onap.policy.optimization.decision.request.json
@@ -0,0 +1,15 @@
+{
+ "ONAPName": "OOF",
+ "ONAPComponent": "OOF-component",
+ "ONAPInstance": "OOF-component-instance",
+ "context" : {
+ "subscriberName": []
+ },
+ "action": "optimize",
+ "resource": {
+ "scope": [],
+ "services": [],
+ "resources": [],
+ "geography": []
+ }
+}
diff --git a/tests/policy/xacml-pdp/data/vCPE.policy.input.tosca.deploy.json b/tests/policy/xacml-pdp/data/vCPE.policy.input.tosca.deploy.json
new file mode 100644
index 00000000..7ace047b
--- /dev/null
+++ b/tests/policy/xacml-pdp/data/vCPE.policy.input.tosca.deploy.json
@@ -0,0 +1,5 @@
+{"policies":[
+ {"policy-id":"onap.restart.tca"},
+ {"policy-id":"OSDF_CASABLANCA.Affinity_Default"}
+ ]
+}
diff --git a/tests/policy/xacml-pdp/data/vCPE.policy.monitoring.input.tosca.deploy.json b/tests/policy/xacml-pdp/data/vCPE.policy.monitoring.input.tosca.deploy.json
deleted file mode 100644
index c0d157cf..00000000
--- a/tests/policy/xacml-pdp/data/vCPE.policy.monitoring.input.tosca.deploy.json
+++ /dev/null
@@ -1 +0,0 @@
-{"policies":[{"policy-id":"onap.restart.tca"}]} \ No newline at end of file
diff --git a/tests/policy/xacml-pdp/xacml-pdp-test.robot b/tests/policy/xacml-pdp/xacml-pdp-test.robot
index 5144f966..931c77b5 100644
--- a/tests/policy/xacml-pdp/xacml-pdp-test.robot
+++ b/tests/policy/xacml-pdp/xacml-pdp-test.robot
@@ -28,18 +28,21 @@ Statistics
Should Be Equal As Strings ${resp.json()['code']} 200
ExecuteXacmlPolicy
- Wait Until Keyword Succeeds 0 min 15 sec CreateNewMonitorPolicy
- Wait Until Keyword Succeeds 0 min 15 sec DeployMonitorPolicy
+ Wait Until Keyword Succeeds 0 min 15 sec CreateMonitorPolicy
+ Wait Until Keyword Succeeds 0 min 15 sec CreateOptimizationPolicy
+ Wait Until Keyword Succeeds 0 min 15 sec GetDefaultDecision
+ Wait Until Keyword Succeeds 0 min 15 sec DeployPolicies
Wait Until Keyword Succeeds 0 min 15 sec GetAbbreviatedDecisionResult
Wait Until Keyword Succeeds 0 min 15 sec GetMonitoringDecision
Wait Until Keyword Succeeds 0 min 15 sec GetNamingDecision
+ Wait Until Keyword Succeeds 0 min 15 sec GetOptimizationDecision
*** Keywords ***
-CreateNewMonitorPolicy
- [Documentation] Create a new Monitoring policy
+CreateMonitorPolicy
+ [Documentation] Create a Monitoring policy
${auth}= Create List healthcheck zb!XztG34
- ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.json
+ ${postjson}= Get file ${DATA2}/vCPE.policy.monitoring.input.tosca.json
Log Creating session https://${POLICY_API_IP}:6969
${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
@@ -50,10 +53,24 @@ CreateNewMonitorPolicy
Dictionary Should Contain Key ${resp.json()} tosca_definitions_version
Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version
-DeployMonitorPolicy
+CreateOptimizationPolicy
+ [Documentation] Create an Optimization policy
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${DATA2}/vCPE.policies.optimization.input.tosca.json
+ Log Creating session https://${POLICY_API_IP}:6969
+ ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies data=${postjson} headers=${headers}
+ Log Received response from policy4 ${resp.text}
+ ${postjsonobject} To Json ${postjson}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Dictionary Should Contain Key ${resp.json()} tosca_definitions_version
+ Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version
+
+DeployPolicies
[Documentation] Runs Policy PAP to deploy a policy
${auth}= Create List healthcheck zb!XztG34
- ${postjson}= Get file ${CURDIR}/data/vCPE.policy.monitoring.input.tosca.deploy.json
+ ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json
Log Creating session https://${POLICY_PAP_IP}:6969
${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
@@ -74,6 +91,20 @@ GetStatisticsAfterDeployed
Should Be Equal As Strings ${resp.json()['code']} 200
Should Be Equal As Strings ${resp.json()['totalPoliciesCount'] 1
+GetDefaultDecision
+ [Documentation] Get Default Decision with no policies in Xacml PDP
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json
+ Log Creating session https://${POLICY_PDPX_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${params}= Create Dictionary abbrev=true
+ ${resp}= Post Request policy /policy/pdpx/v1/decision params=${params} data=${postjson} headers=${headers}
+ Log Received response from policy ${resp.text}
+ ${status}= Get From Dictionary ${resp.json()} status
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${status} Permit
+
GetAbbreviatedDecisionResult
[Documentation] Get Decision with abbreviated results from Policy Xacml PDP
${auth}= Create List healthcheck zb!XztG34
@@ -127,6 +158,22 @@ GetNamingDecision
Dictionary Should Contain Key ${policy} properties
Dictionary Should Contain Key ${policy} name
+GetOptimizationDecision
+ [Documentation] Get Decision from Optimization Policy Xacml PDP
+ ${auth}= Create List healthcheck zb!XztG34
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json
+ Log Creating session https://${POLICY_PDPX_IP}:6969
+ ${session}= Create Session policy https://${POLICY_PDPX_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Post Request policy /policy/pdpx/v1/decision data=${postjson} headers=${headers}
+ Log Received response from policy ${resp.text}
+ ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default
+ Should Be Equal As Strings ${resp.status_code} 200
+ Dictionary Should Contain Key ${policy} type
+ Dictionary Should Contain Key ${policy} type_version
+ Dictionary Should Contain Key ${policy} properties
+ Dictionary Should Contain Key ${policy} name
+
GetStatisticsAfterDecision
[Documentation] Runs Policy Xacml PDP Statistics after Decision request
${auth}= Create List healthcheck zb!XztG34