You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 9
Next »
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 -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 -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:
{
"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:
{
"policy-id" : "operational.pnflegacy.createsubscription",
"content" : "controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20controlLoopName%3A%20ControlLoop-pnf-d0a1dfc6-94f5-4fd4-a5b5-4630b438851b%0A%20%20trigger_policy%3A%20unique-policy-id-1-pnf%0A%20%20timeout%3A%2060%0A%20%20abatement%3A%20false%0Apolicies%3A%0A%20%20-%20id%3A%20unique-policy-id-1-pnf%0A%20%20%20%20name%3A%20pnf-cds-actor%0A%20%20%20%20description%3A%0A%20%20%20%20actor%3A%20CDS%0A%20%20%20%20recipe%3A%20create-subscription%0A%20%20%20%20target%3A%0A%20%20%20%20%20%20type%3A%20PNF%0A%20%20%20%20payload%3A%0A%20%20%20%20%20%20artifact_name%3A%20pm_control%0A%20%20%20%20%20%20artifact_version%3A%201.0.0%0A%20%20%20%20retry%3A%200%0A%20%20%20%20timeout%3A%2030%0A%20%20%20%20success%3A%20final_success%0A%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20failure_guard%3A%20final_failure_guard"
}
Once the policy is created and deployed, fire the below ONSET event to unauthenticated.DCAE_CL_OUTPUT.
{
"closedLoopControlName": "ControlLoop-pnf-d0a1dfc6-94f5-4fd4-a5b5-4630b438851b",
"closedLoopAlarmStart": 1463679805324,
"closedLoopEventClient": "microservice.pmsh",
"closedLoopEventStatus": "ONSET",
"requestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a56",
"target_type": "PNF",
"target": "pnf.pnf-name",
"AAI": {
"pnf.pnf-name": "pnf300"
},
"from": "DCAE",
"version": "1.0.2",
"additionalEventParams": {
"nfName": "pnf300",
"subscriptionName": "demo-subscription",
"administrativeState": "UNLOCKED",
"fileBasedGP": "15",
"fileLocation": "test/pmx.xml"
}
}
Now, Drools-PDP sends request to CDS for create-subscription action on PNF.
commonHeader {
requestId: "c7c6a4aa-bb61-4a15-b831-ba1472dd4a56"
subRequestId: "0"
originatorId: "POLICY"
}
actionIdentifiers {
blueprintName: "pm_control"
blueprintVersion: "1.0.0"
actionName: "create-subscription"
mode: "sync"
}
payload {
fields {
key: "create-subscription-request"
value {
struct_value {
fields {
key: "resolution-key"
value {
string_value: "e6fd6fb9-5734-49e9-bf13-7b3308fb8f7a"
}
}
fields {
key: "create-subscription-properties"
value {
struct_value {
fields {
key: "pnf.pnf-name"
value {
string_value: "pnf300"
}
}
fields {
key: "pnf.pnf-name2-source"
value {
string_value: "example-pnf-name2-source-val-99275"
}
}
fields {
key: "pnf.pnf-id"
value {
string_value: "927b2580-36d9-4f13-8421-3c9d43b7a57e"
}
}
fields {
key: "pnf.equip-type"
value {
string_value: "example-equip-type-val-20348"
}
}
fields {
key: "pnf.equip-vendor"
value {
string_value: "example-equip-vendor-val-52182"
}
}
fields {
key: "pnf.equip-model"
value {
string_value: "example-equip-model-val-8370"
}
}
fields {
key: "pnf.management-option"
value {
string_value: "example-management-option-val-72881"
}
}
fields {
key: "pnf.orchestration-status"
value {
string_value: "Active"
}
}
fields {
key: "pnf.ipaddress-v4-oam"
value {
string_value: "10.2.0.142"
}
}
fields {
key: "pnf.in-maint"
value {
string_value: "false"
}
}
fields {
key: "pnf.ipaddress-v6-oam"
value {
string_value: ""
}
}
fields {
key: "pnf.resource-version"
value {
string_value: "1588678430278"
}
}
fields {
key: "nfName"
value {
string_value: "pnf300"
}
}
fields {
key: "administrativeState"
value {
string_value: "UNLOCKED"
}
}
fields {
key: "subscriptionName"
value {
string_value: "demo-subscription"
}
}
fields {
key: "fileBasedGP"
value {
string_value: "15"
}
}
fields {
key: "fileLocation"
value {
string_value: "test/pmx.xml"
}
}
fields {
key: "data"
value {
string_value: ""
}
}
}
}
}
}
}
}
}
commonHeader {
timestamp: "2020-05-06T16:43:32.437Z"
requestId: "c7c6a4aa-bb61-4a15-b831-ba1472dd4a56"
subRequestId: "0"
flag {
}
originatorId: "POLICY"
}
actionIdentifiers {
blueprintName: "pm_control"
blueprintVersion: "1.0.0"
actionName: "create-subscription"
mode: "sync"
}
status {
code: 200
message: "success"
eventType: EVENT_COMPONENT_EXECUTED
timestamp: "Wed May 06 16:43:33 GMT 2020"
}
payload {
fields {
key: "create-subscription-response"
value {
struct_value {
fields {
key: "odl-response"
value {
struct_value {
fields {
key: "status"
value {
string_value: "success"
}
}
}
}
}
}
}
}
}
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.