From a8be1f7e70ea46dfd82fa74595a43df88c2497e0 Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Wed, 16 Mar 2022 10:36:33 +0000 Subject: Add CSIT for metadataSet handling in api, pap, apex-pdp Issue-ID: POLICY-3934 Signed-off-by: zrrmmua Change-Id: Ieae62434a3477a7dc1bffccd829385df06592cec --- .../apex.policy.decisionmaker.input.tosca.json | 184 +++++++++++++++++++++ csit/pap/tests/data/create.group.request.json | 12 ++ csit/pap/tests/data/deploy.group.request.json | 10 ++ csit/pap/tests/pap-test.robot | 23 +++ 4 files changed, 229 insertions(+) create mode 100644 csit/pap/tests/data/apex.policy.decisionmaker.input.tosca.json (limited to 'csit/pap/tests') diff --git a/csit/pap/tests/data/apex.policy.decisionmaker.input.tosca.json b/csit/pap/tests/data/apex.policy.decisionmaker.input.tosca.json new file mode 100644 index 00000000..5d84c294 --- /dev/null +++ b/csit/pap/tests/data/apex.policy.decisionmaker.input.tosca.json @@ -0,0 +1,184 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "operational.apex.decisionMaker": { + "type": "onap.policies.native.Apex", + "type_version": "1.0.0", + "name": "operational.apex.decisionMaker", + "version": "1.0.0", + "metadata": { + "metadataSetName": "apexMetadata_decisionMaker", + "metadataSetVersion": "1.0.0" + }, + "properties": { + "engineServiceParameters": { + "name": "MyApexEngine", + "version": "0.0.1", + "id": 45, + "instanceCount": 4, + "deploymentPort": 12561, + "engineParameters": { + "executorParameters": { + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + }, + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters": { + "Avro": { + "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + }, + "Java": { + "parameterClassName": "org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters", + "jsonAdapters": { + "Instant": { + "adaptedClass": "java.time.Instant", + "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" + } + } + } + } + }, + "taskParameters": [ + { + "key": "ParameterKey1", + "value": "ParameterValue1" + }, + { + "taskId": "AAILookupTask:0.0.1", + "key": "SomeKeyForThisTask", + "value": "Value" + } + ] + } + }, + "eventInputParameters": { + "GuardRequestorConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters", + "parameters": { + "url": "http://111.222.333.444:5555/pdp/api/getDecision", + "httpMethod": "POST", + "restRequestTimeout": 2000, + "httpHeader": "Authorization:aaaaaaaaa== ClientAuth:bbbbbbbbb=" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventName": "GuardResponseEvent", + "eventNameFilter": "GuardResponseEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorProducer", + "requestorTimeout": 500 + }, + "DCAEConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters", + "parameters": { + "url": "http://message-router:3904/events/unauthenticated.DCAE_CL_OUTPUT/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "closedLoopControlName", + "versionAlias": "version", + "sourceAlias": "from", + "pojoField": "VirtualControlLoopEvent" + } + }, + "eventName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e" + }, + "APPCConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters", + "parameters": { + "url": "http://message-router:3904/events/APPC-LCM-WRITE/APEX/1?timeout=60000" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "versionAlias": "version", + "pojoField": "APPCLCMResponseEvent" + } + }, + "eventName": "APPCRestartVNFResponseEvent", + "eventNameFilter": "APPCRestartVNFResponseEvent" + } + }, + "eventOutputParameters": { + "logProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "/tmp/VCPEEventsOut.json" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + }, + "GuardRequestorProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTREQUESTOR", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + }, + "eventNameFilter": "GuardRequestEvent", + "requestorMode": true, + "requestorPeer": "GuardRequestorConsumer", + "requestorTimeout": 500 + }, + "APPCProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters", + "parameters": { + "url": "http://message-router:3904/events/APPC-LCM-READ" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "versionAlias": "version", + "sourceAlias": "from", + "pojoField": "APPCLCMRequestEvent" + } + }, + "eventNameFilter": "APPCRestartVNFRequestEvent" + }, + "PolicyLogProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "RESTCLIENT", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters", + "parameters": { + "url": "http://message-router:3904/events/POLICY-CL-MGT" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "versionAlias": "version", + "sourceAlias": "from", + "pojoField": "VirtualControlLoopNotification" + } + }, + "eventNameFilter": "ControlLoopLogEvent" + } + } + } + } + } + ] + } +} \ No newline at end of file diff --git a/csit/pap/tests/data/create.group.request.json b/csit/pap/tests/data/create.group.request.json index e916a94e..1e37583c 100644 --- a/csit/pap/tests/data/create.group.request.json +++ b/csit/pap/tests/data/create.group.request.json @@ -30,6 +30,18 @@ } ], "policies": [] + }, + { + "pdpType": "pdpTypeC", + "desiredInstanceCount": 1, + "properties": {}, + "supportedPolicyTypes": [ + { + "name": "onap.policies.native.Apex", + "version": "1.0.0" + } + ], + "policies": [] } ] } diff --git a/csit/pap/tests/data/deploy.group.request.json b/csit/pap/tests/data/deploy.group.request.json index 73eb213f..cfd86d1e 100644 --- a/csit/pap/tests/data/deploy.group.request.json +++ b/csit/pap/tests/data/deploy.group.request.json @@ -12,6 +12,16 @@ "version": "1.0.0" } ] + }, + { + "pdpType": "pdpTypeC", + "action": "POST", + "policies": [ + { + "name": "operational.apex.decisionMaker", + "version": "1.0.0" + } + ] } ] } diff --git a/csit/pap/tests/pap-test.robot b/csit/pap/tests/pap-test.robot index 9c020ee8..203ddd6c 100644 --- a/csit/pap/tests/pap-test.robot +++ b/csit/pap/tests/pap-test.robot @@ -18,6 +18,16 @@ LoadPolicy ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0 +LoadPolicyWithMetadataSet + [Documentation] Create a policy named 'operational.apex.decisionMaker' and version '1.0.0' using specific api + ${postjson}= Get file ${CURDIR}/data/apex.policy.decisionmaker.input.tosca.json + CreatePolicy /policy/api/v1/policytypes/onap.policies.native.Apex/versions/1.0.0/policies 200 ${postjson} operational.apex.decisionMaker 1.0.0 + +LoadNodeTemplates + [Documentation] Create node templates in database using specific api + ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json + CreateNodeTemplate /policy/api/v1/nodetemplates 200 ${postjson} 3 + Healthcheck [Documentation] Verify policy pap health check ${resp}= GetReq /policy/pap/v1/healthcheck @@ -77,11 +87,20 @@ QueryPolicyAuditAfterDeploy [Documentation] Verify policy audit record after deploy QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca DEPLOYMENT +QueryPolicyAuditWithMetadataSetAfterDeploy + [Documentation] Verify policy audit record after deploy + QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeC operational.apex.decisionMaker DEPLOYMENT + 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} +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} + QueryPdpGroupsAfterUndeploy [Documentation] Verify PdpGroups after undeploy QueryPdpGroups 2 defaultGroup ACTIVE 0 testGroup ACTIVE 0 @@ -90,6 +109,10 @@ QueryPolicyAuditAfterUnDeploy [Documentation] Verify policy audit record after undeploy QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeA onap.restart.tca UNDEPLOYMENT +QueryPolicyAuditWithMetadataSetAfterUnDeploy + [Documentation] Verify policy audit record after undeploy + QueryPolicyAudit /policy/pap/v1/policies/audit 200 testGroup pdpTypeC operational.apex.decisionMaker UNDEPLOYMENT + DeactivatePdpGroup [Documentation] Change the state of PdpGroup named 'testGroup' to PASSIVE ${auth}= PolicyAdminAuth -- cgit 1.2.3-korg