Testing of PNF support in CDS Actor
Policy - CDS integration for PNF is tested using drools-pdp.
For testing purposes, a PNF simulator is used. Also a CBA blueprint file used in a PM use case is modified and uploaded to CDS, so that Drools-PDP can make the required request to CDS.
Steps happening in the flow:
Drools-PDP read the ONSET event from unauthenticated.DCAE_CL_OUTPUT DMaaP topic
Based out of the event, a request is made to CDS using the CDS Actor by Drools-PDP, where the action is "create-subscription"
CDS then does it's job, like fetching the PNF details from AAI etc and finally the new subscription is added to the PNF.
Drools-PDP receives corresponding response from CDS, the results are logged as well to POLICY-CL-MGT topic.
Setting up the environment for testing:
Setting up the PNF simulator:
git clone "https://gerrit.onap.org/r/integration
cd integration/test/mocks/pmsh-pnf-sim/docker-compose
Run the docker containers. Use the docker-compose command, or run them directly.
Populate AAI with PNF data:
Curl command to populate AAI with PNF details
curl -k -X PUT --user 'AAI:AAI' \
https://<ip>:<port>/aai/v15/network/pnfs/pnf/<pnf_name> \
-H 'Content-Type: application/json' \
-H 'X-FromAppId: dcae-curl' \
-H 'x-transactionId: 9998' \
-d '{
"pnf-name": "<pnf_name>",
"pnf-name2-source": "example-pnf-name2-source-val-99275",
"pnf-id": "927b2580-36d9-4f13-8421-3c9d43b7a57e",
"equip-type": "example-equip-type-val-20348",
"equip-vendor": "example-equip-vendor-val-52182",
"equip-model": "example-equip-model-val-8370",
"management-option": "example-management-option-val-72881",
"ipaddress-v4-oam": "<pnf-ip>",
"ipaddress-v6-oam": "",
"orchestration-status": "Active"
}'
Note: If not using ONAP SDNC, then start ODL simulator. See https://github.com/blue-onap/opendaylight for details.
Upload the CBA blueprint to CDS: pm_control.zip
This is actually a blueprint for PM use case with some modifications.
The setup can be verified by making a manual REST request on CDS.
Curl command on CDS for verification
curl -X POST 'http://<ip>:<port>/api/v1/execution-service/process' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' \
-d '{
"actionIdentifiers": {
"actionName": "create-subscription",
"blueprintName": "pm_control",
"blueprintVersion": "1.0.0",
"mode": "sync"
},
"commonHeader": {
"originatorId": "sdnc",
"requestId": "123456-1000",
"subRequestId": "sub-123456-1000"
},
"payload": {
"create-subscription-request": {
"create-subscription-properties": {
"nfName": "<pnf_name>",
"subscriptionName": "demo-subscription",
"administrativeState": "UNLOCKED",
"fileBasedGP": "15",
"fileLocation": "test/pm.xml"
}
}
}
}'
Drools Tosca Policy to test CDS interaction for PNF:
Drools Tosca Policy
{
"tosca_definitions_version": "tosca_simple_yaml_1_1_0",
"topology_template": {
"policies": [
{
"operational.pnf.createsubscription": {
"type": "onap.policies.controlloop.operational.common.Drools",
"type_version": "1.0.0",
"version": "1.0.0",
"name": "operational.pnf.createsubscription",
"properties": {
"id": "ControlLoop-pnf-d0a1dfc6-94f5-4fd4-a5b5-4630b438851b",
"timeout": 1200,
"abatement": false,
"trigger": "unique-policy-id-1-modifyConfig",
"operations": [
{
"id": "unique-policy-id-1-modifyConfig",
"description": "Modify the pnf config",
"operation": {
"actor": "CDS",
"operation": "create-subscription",
"target": {
"targetType": "PNF"
},
"payload":{
"artifact_name": "pm_control",
"artifact_version": "1.0.0",
"data": ""
}
},
"timeout": 300,
"retries": 0,
"success": "final_success",
"failure": "final_failure",
"failure_timeout": "final_failure_timeout",
"failure_retries": "final_failure_retries",
"failure_exception": "final_failure_exception",
"failure_guard": "final_failure_guard"
}
],
"controllerName": "frankfurt"
}
}
}
]
}
}
Drools Legacy Policy to test CDS interaction for PNF:
Drools Legacy Policy
Once the policy is created and deployed, fire the below ONSET event to unauthenticated.DCAE_CL_OUTPUT.
ONSET Event
Now, Drools-PDP sends request to CDS for create-subscription action on PNF.
CDS Request made by Policy
CDS Response
The results are logged by Drools-PDP to POLICY-CL-MGT topic. Also, it can be verified that the new subscription got actually created in the PNF.
Test result
The testing for PNF use case was successfully completed using the details mentioned above. The new subscription was created in the device based on the ONSET event.