diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2022-03-16 10:36:33 +0000 |
---|---|---|
committer | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2022-03-24 22:30:38 +0000 |
commit | a8be1f7e70ea46dfd82fa74595a43df88c2497e0 (patch) | |
tree | 4c4e5adc54219f5bd252c9fe3a17edc7e0d0966e /csit/pap | |
parent | 50d506c9b792cc27fac74a439ebf2a5569b29707 (diff) |
Add CSIT for metadataSet handling in api, pap, apex-pdp
Issue-ID: POLICY-3934
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: Ieae62434a3477a7dc1bffccd829385df06592cec
Diffstat (limited to 'csit/pap')
-rw-r--r-- | csit/pap/plans/setup.sh | 3 | ||||
-rw-r--r-- | csit/pap/tests/data/apex.policy.decisionmaker.input.tosca.json | 184 | ||||
-rw-r--r-- | csit/pap/tests/data/create.group.request.json | 12 | ||||
-rw-r--r-- | csit/pap/tests/data/deploy.group.request.json | 10 | ||||
-rw-r--r-- | csit/pap/tests/pap-test.robot | 23 |
5 files changed, 232 insertions, 0 deletions
diff --git a/csit/pap/plans/setup.sh b/csit/pap/plans/setup.sh index 94a3b31b..8612d2bf 100644 --- a/csit/pap/plans/setup.sh +++ b/csit/pap/plans/setup.sh @@ -46,7 +46,10 @@ echo MARIADB IP IS "${MARIADB_IP}" DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies +NODETEMPLATES=${WORKSPACE}/models/models-examples/src/main/resources/nodetemplates + 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 DATA:${DATA}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v NODETEMPLATES:${NODETEMPLATES}" 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 |