aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json6
-rw-r--r--tests/dcaegen2-services-pmsh/testcases/pmsh.robot8
-rw-r--r--tests/policy/apex-pdp/apex-pdp-test.robot31
-rw-r--r--tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json260
-rw-r--r--tests/policy/apex-pdp/data/onap.policies.native.Apex.tosca.json (renamed from tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.tosca.json)9
-rw-r--r--tests/policy/apex-pdp/data/pdp_update.json2
-rw-r--r--tests/policy/drools-applications/drools-applications-test.robot2
-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.robot63
13 files changed, 111 insertions, 517 deletions
diff --git a/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json b/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json
index 6f6972f4..569e9383 100644
--- a/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json
+++ b/tests/dcaegen2-services-pmsh/testcases/assets/cbs-expectation-unlocked-config.json
@@ -82,7 +82,7 @@
"dmaap_info": {
"client_id": "1475976809466",
"client_role": "org.onap.dcae.pmPublisher",
- "topic_url": "https://mr-sim:1080/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS",
+ "topic_url": "https://mr-sim:3095/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS",
"location": "san-francisco"
},
"type": "message_router"
@@ -94,14 +94,14 @@
"dmaap_info": {
"client_id": "1575976809466",
"client_role": "org.onap.dcae.aaiSub",
- "topic_url": "https://mr-sim:1080/events/AAI_EVENT",
+ "topic_url": "https://mr-sim:3095/events/AAI_EVENT",
"location": "san-francisco"
}
},
"policy_pm_subscriber": {
"dmaap_info": {
"location": "san-francisco",
- "topic_url": "https://mr-sim:1080/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS",
+ "topic_url": "https://mr-sim:3095/events/org.onap.dmaap.mr.PM_SUBSCRIPTIONS",
"client_role": "org.onap.dcae.pmSubscriber",
"client_id": "1575876809456"
},
diff --git a/tests/dcaegen2-services-pmsh/testcases/pmsh.robot b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot
index 95b78c25..ebdae844 100644
--- a/tests/dcaegen2-services-pmsh/testcases/pmsh.robot
+++ b/tests/dcaegen2-services-pmsh/testcases/pmsh.robot
@@ -15,8 +15,8 @@ Test Teardown Delete All Sessions
*** Variables ***
${PMSH_BASE_URL} https://${PMSH_IP}:8443
-${MR_BASE_URL} http://${MR_SIM_IP_ADDRESS}:1080
-${CBS_BASE_URL} http://${CBS_SIM_IP_ADDRESS}:1080
+${MR_BASE_URL} https://${MR_SIM_IP_ADDRESS}:3095
+${CBS_BASE_URL} https://${CBS_SIM_IP_ADDRESS}:10443
${HEALTHCHECK_ENDPOINT} /healthcheck
${MR_EXPECTATION_AAI_PNF_CREATED} %{WORKSPACE}/tests/dcaegen2-services-pmsh/testcases/assets/mr-expectation-aai-pnf-created.json
@@ -27,8 +27,8 @@ ${CBS_EXPECTATION_ADMIN_STATE_UNLOCKED} %{WORKSPACE}/tests/dcaegen2-serv
${ADMIN_STATE_LOCKED_PATTERN} 'administrativeState': 'LOCKED'
${ADMIN_STATE_UNLOCKED_PATTERN} 'administrativeState': 'UNLOCKED'
-${CLI_EXEC_GET_CBS_CONFIG_FIRST} docker exec pmsh /bin/sh -c "grep -m 1 'PMSH Configuration from Configbinding Service' /var/log/ONAP/dcaegen2/services/pmsh/debug.log"
-${CLI_EXEC_GET_CBS_CONFIG_LAST} docker exec pmsh /bin/sh -c "grep 'PMSH Configuration from Configbinding Service' /var/log/ONAP/dcaegen2/services/pmsh/debug.log | tail -1"
+${CLI_EXEC_GET_CBS_CONFIG_FIRST} docker exec pmsh /bin/sh -c "grep -m 1 'PMSH config from CBS' /var/log/ONAP/dcaegen2/services/pmsh/debug.log"
+${CLI_EXEC_GET_CBS_CONFIG_LAST} docker exec pmsh /bin/sh -c "grep 'PMSH config from CBS' /var/log/ONAP/dcaegen2/services/pmsh/debug.log | tail -1"
${DB_CMD_NETWORK_FUNCTIONS_COUNT} docker exec db bash -c "psql -U pmsh -d pmsh -A -t -c 'select count(*) from network_functions;'"
${DB_CMD_NF_TO_SUB_REL_COUNT} docker exec db bash -c "psql -U pmsh -d pmsh -A -t -c 'select count(*) from nf_to_sub_rel;'"
diff --git a/tests/policy/apex-pdp/apex-pdp-test.robot b/tests/policy/apex-pdp/apex-pdp-test.robot
index 9956731d..9fdbc12e 100644
--- a/tests/policy/apex-pdp/apex-pdp-test.robot
+++ b/tests/policy/apex-pdp/apex-pdp-test.robot
@@ -18,43 +18,28 @@ Healthcheck
Should Be Equal As Strings ${resp.json()['code']} 200
ExecuteApexPolicy
- Wait Until Keyword Succeeds 2 min 5 sec CreateOperationalPolicyType
- Wait Until Keyword Succeeds 2 min 5 sec CreateNewOperationalPolicy
- Wait Until Keyword Succeeds 2 min 5 sec DeployOperationalPolicy
+ Wait Until Keyword Succeeds 2 min 5 sec CreatePolicy
+ Wait Until Keyword Succeeds 2 min 5 sec DeployPolicy
Wait Until Keyword Succeeds 4 min 10 sec RunEventOnApexEngine
*** Keywords ***
-CreateOperationalPolicyType
- [Documentation] Create Operational Policy Type
+CreatePolicy
+ [Documentation] Create a new Apex policy
${auth}= Create List healthcheck zb!XztG34
- ${postjson}= Get file ${CURDIR}/data/onap.policies.controlloop.operational.Apex.json
+ ${postjson}= Get file ${CURDIR}/data/onap.policies.native.Apex.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 data=${postjson} headers=${headers}
- Log Received response from policy2 ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- ${postjsonobject} To Json ${postjson}
- Dictionary Should Contain Key ${resp.json()} tosca_definitions_version
- Dictionary Should Contain Key ${postjsonobject} tosca_definitions_version
-
-CreateNewOperationalPolicy
- [Documentation] Create a new Operational Apex policy
- ${auth}= Create List healthcheck zb!XztG34
- ${postjson}= Get file ${CURDIR}/data/onap.policies.controlloop.operational.Apex.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.controlloop.operational.Apex/versions/1.0.0/policies data=${postjson} headers=${headers}
+ ${resp}= Post Request policy /policy/api/v1/policytypes/onap.policies.native.Apex/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
-DeployOperationalPolicy
- [Documentation] Make the PAP to initiate a PDP_UPDATE with policies
+DeployPolicy
+ [Documentation] Deploy the policy in apex-pdp engine
${auth}= Create List healthcheck zb!XztG34
${postjson}= Get file ${CURDIR}/data/pdp_update.json
Log Creating session https://${POLICY_PAP_IP}:6969
diff --git a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json b/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json
deleted file mode 100644
index ba62a171..00000000
--- a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.json
+++ /dev/null
@@ -1,260 +0,0 @@
-{
- "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
- "policy_types": {
- "onap.policies.controlloop.operational.Apex": {
- "version": "1.0.0",
- "description": "Operational Policy for Control Loops using the APEX PDP",
- "properties": {
- "engine_service": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.EngineService",
- "description": "APEX Engine Service Parameters"
- },
- "inputs": {
- "type": "map",
- "description": "Inputs for handling events coming into the APEX engine",
- "entry_schema": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.EventHandler"
- }
- },
- "outputs": {
- "type": "map",
- "description": "Outputs for handling events going out of the APEX engine",
- "entry_schema": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.EventHandler"
- }
- },
- "environment": {
- "type": "list",
- "description": "Envioronmental parameters for the APEX engine",
- "entry_schema": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.Environment"
- }
- }
- }
- }
- },
- "data_types": {
- "onap.datatypes.policies.controlloop.operational.apex.EngineService": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "name": {
- "type": "string",
- "description": "Specifies the engine name",
- "required": false,
- "default": "ApexEngineService"
- },
- "version": {
- "type": "string",
- "description": "Specifies the engine version in double dotted format",
- "required": false,
- "default": "1.0.0"
- },
- "id": {
- "type": "integer",
- "description": "Specifies the engine id",
- "required": true
- },
- "instance_count": {
- "type": "integer",
- "description": "Specifies the number of engine threads that should be run",
- "required": true
- },
- "deployment_port": {
- "type": "integer",
- "description": "Specifies the port to connect to for engine administration",
- "required": false,
- "default": 1
- },
- "policy_model_file_name": {
- "type": "string",
- "description": "The name of the file from which to read the APEX policy model",
- "required": false
- },
- "policy_type_impl": {
- "type": "string",
- "description": "The policy type implementation from which to read the APEX policy model",
- "required": false
- },
- "periodic_event_period": {
- "type": "string",
- "description": "The time interval in milliseconds for the periodic scanning event, 0 means \"don't scan\"",
- "required": false,
- "default": 0
- },
- "engine": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine",
- "description": "The parameters for all engines in the APEX engine service",
- "required": true
- }
- }
- },
- "onap.datatypes.policies.controlloop.operational.apex.EventHandler": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "name": {
- "type": "string",
- "description": "Specifies the event handler name, if not specified this is set to the key name",
- "required": false
- },
- "carrier_technology": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology",
- "description": "Specifies the carrier technology of the event handler (such as REST/Web Socket/Kafka)",
- "required": true
- },
- "event_protocol": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.EventProtocol",
- "description": "Specifies the event protocol of events for the event handler (such as Yaml/JSON/XML/POJO)",
- "required": true
- },
- "event_name": {
- "type": "string",
- "description": "Specifies the event name for events on this event handler, if not specified, the event name is read from or written to the event being received or sent",
- "required": false
- },
- "event_name_filter": {
- "type": "string",
- "description": "Specifies a filter as a regular expression, events that do not match the filter are dropped, the default is to let all events through",
- "required": false
- },
- "synchronous_mode": {
- "type": "boolean",
- "description": "Specifies the event handler is syncronous (receive event and send response)",
- "required": false,
- "default": false
- },
- "synchronous_peer": {
- "type": "string",
- "description": "The peer event handler (output for input or input for output) of this event handler in synchronous mode, this parameter is mandatory if the event handler is in synchronous mode",
- "required": false
- },
- "synchronous_timeout": {
- "type": "integer",
- "description": "The timeout in milliseconds for responses to be issued by APEX torequests, this parameter is mandatory if the event handler is in synchronous mode",
- "required": false
- },
- "requestor_mode": {
- "type": "boolean",
- "description": "Specifies the event handler is in requestor mode (send event and wait for response mode)",
- "required": false,
- "default": false
- },
- "requestor_peer": {
- "type": "string",
- "description": "The peer event handler (output for input or input for output) of this event handler in requestor mode, this parameter is mandatory if the event handler is in requestor mode",
- "required": false
- },
- "requestor_timeout": {
- "type": "integer",
- "description": "The timeout in milliseconds for wait for responses to requests, this parameter is mandatory if the event handler is in requestor mode",
- "required": false
- }
- }
- },
- "onap.datatypes.policies.controlloop.operational.apex.CarrierTechnology": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "label": {
- "type": "string",
- "description": "The label (name) of the carrier technology (such as REST, Kafka, WebSocket)",
- "required": true
- },
- "plugin_parameter_class_name": {
- "type": "string",
- "description": "The class name of the class that overrides default handling of event input or output for this carrier technology, defaults to the supplied input or output class",
- "required": false
- }
- }
- },
- "onap.datatypes.policies.controlloop.operational.apex.EventProtocol": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "label": {
- "type": "string",
- "description": "The label (name) of the event protocol (such as Yaml, JSON, XML, or POJO)",
- "required": true
- },
- "event_protocol_plugin_class": {
- "type": "string",
- "description": "The class name of the class that overrides default handling of the event protocol for this carrier technology, defaults to the supplied event protocol class",
- "required": false
- }
- }
- },
- "onap.datatypes.policies.controlloop.operational.apex.Environment": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "name": {
- "type": "string",
- "description": "The name of the environment variable",
- "required": true
- },
- "value": {
- "type": "string",
- "description": "The value of the environment variable",
- "required": true
- }
- }
- },
- "onap.datatypes.policies.controlloop.operational.apex.engineservice.Engine": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "context": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context",
- "description": "The properties for handling context in APEX engines, defaults to using Java maps for context",
- "required": false
- },
- "executors": {
- "type": "map",
- "description": "The plugins for policy executors used in engines such as javascript, MVEL, Jython",
- "required": true,
- "entry_schema": {
- "description": "The plugin class path for this policy executor",
- "type": "string"
- }
- }
- }
- },
- "onap.datatypes.policies.controlloop.operational.apex.engineservice.engine.Context": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "distributor": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin",
- "description": "The plugin to be used for distributing context between APEX PDPs at runtime",
- "required": false
- },
- "schemas": {
- "type": "map",
- "description": "The plugins for context schemas available in APEX PDPs such as Java and Avro",
- "required": false,
- "entry_schema": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin"
- }
- },
- "locking": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin",
- "description": "The plugin to be used for locking context in and between APEX PDPs at runtime",
- "required": false
- },
- "persistence": {
- "type": "onap.datatypes.policies.controlloop.operational.apex.Plugin",
- "description": "The plugin to be used for persisting context for APEX PDPs at runtime",
- "required": false
- }
- }
- },
- "onap.datatypes.policies.controlloop.operational.apex.Plugin": {
- "derived_from": "tosca.datatypes.Root",
- "properties": {
- "name": {
- "type": "string",
- "description": "The name of the executor such as Javascript, Jython or MVEL",
- "required": true
- },
- "plugin_class_name": {
- "type": "string",
- "description": "The class path of the plugin class for this executor"
- }
- }
- }
- }
-}
diff --git a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.tosca.json b/tests/policy/apex-pdp/data/onap.policies.native.Apex.tosca.json
index 179bbea2..d90ae08d 100644
--- a/tests/policy/apex-pdp/data/onap.policies.controlloop.operational.Apex.tosca.json
+++ b/tests/policy/apex-pdp/data/onap.policies.native.Apex.tosca.json
@@ -3,14 +3,11 @@
"topology_template": {
"policies": [
{
- "operational.apex.sampledomain": {
- "type": "onap.policies.controlloop.operational.Apex",
+ "onap.policies.native.apex.Sampledomain": {
+ "type": "onap.policies.native.Apex",
"type_version": "1.0.0",
"version": "1.0.0",
- "metadata": {
- "policy-id": "operational.apex.sampledomain",
- "policy-version": 1
- },
+ "name": "onap.policies.native.apex.Sampledomain",
"properties": {
"engineServiceParameters": {
"name": "MyApexEngine",
diff --git a/tests/policy/apex-pdp/data/pdp_update.json b/tests/policy/apex-pdp/data/pdp_update.json
index 5b4dfde7..51c3573d 100644
--- a/tests/policy/apex-pdp/data/pdp_update.json
+++ b/tests/policy/apex-pdp/data/pdp_update.json
@@ -7,7 +7,7 @@
"pdpType": "apex",
"action": "POST",
"policies": [{
- "name": "operational.apex.sampledomain",
+ "name": "onap.policies.native.apex.Sampledomain",
"version": "1.0.0"
}]
}
diff --git a/tests/policy/drools-applications/drools-applications-test.robot b/tests/policy/drools-applications/drools-applications-test.robot
index 2104566a..a1ca5e20 100644
--- a/tests/policy/drools-applications/drools-applications-test.robot
+++ b/tests/policy/drools-applications/drools-applications-test.robot
@@ -124,7 +124,7 @@ DeployXacmlPolicies
Log Received response from pap ${resp.text}
Should Be Equal As Strings ${resp.status_code} 200
${result}= Run Process ${SCR2}/wait_topic.sh POLICY-PDP-PAP
- ... responseTo xacml ACTIVE
+ ... responseTo xacml ACTIVE restart
Log Received status ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} onap.restart.tca
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..250e01f1 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
@@ -120,7 +151,23 @@ GetNamingDecision
${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']} SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP
+ ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP
+ 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
+
+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