Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

Code Block
languagetext
titleDrools Tosca PolicyCurl command on CDS for verification
collapsetrue
{
curl -X   "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
    "topology_template": {
        "policies": [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"
  },
   "operational.pnf.createsubscriptioncommonHeader": {
    "originatorId": "sdnc",
           "requestId": "123456-1000",
    "typesubRequestId": "onap.policies.controlloop.operational.common.Drools",sub-123456-1000"
  },
    "payload": {
    "create-subscription-request": {
         "type_version"create-subscription-properties": {
		"nfName": "1.0.0<pnf_name>",
            "subscriptionName": "demo-subscription",
        "versionadministrativeState": "1.0.0UNLOCKED",
            "fileBasedGP": "15",
        "namefileLocation": "operational.pnf.createsubscription",test/pm.xml"
      }
    }
  }
}'


Drools Tosca Policy to test CDS interaction for PNF:

Code Block
languagetext
titleDrools Tosca Policy
collapsetrue
{
    "tosca_definitions_version": "tosca_simple_yaml_1_1_0",
    "propertiestopology_template": {
        "policies": [
            {
   "id": "ControlLoop-pnf-d0a1dfc6-94f5-4fd4-a5b5-4630b438851b",
                 "operational.pnf.createsubscription": {
                    "timeouttype": 1200"onap.policies.controlloop.operational.common.Drools",
                        "abatementtype_version": false"1.0.0",
                        "triggerversion": "unique-policy-id-1-modifyConfig1.0.0",
                        "operationsname": ["operational.pnf.createsubscription",
                            {
        "properties": {
                        "id": "unique-policy-id-1-modifyConfigControlLoop-pnf-d0a1dfc6-94f5-4fd4-a5b5-4630b438851b",
                                "descriptiontimeout": "Modify the pnf config"1200,
                                "operation"abatement": {false,
                        "trigger": "unique-policy-id-1-modifyConfig",
           "actor": "CDS",
            "operations": [
                       "operation": "create-subscription",
    {
                                "targetid": {"unique-policy-id-1-modifyConfig",
                                "description": "Modify the pnf     "targetType": "PNF"config",
                                    },"operation": {
                                    "payloadactor":{
     "CDS",
                                    "artifact_nameoperation": "pm_controlcreate-subscription",
                                        "artifact_versiontarget": "1.0.0",{
                                        "datatargetType": "PNF"
                                    },
                                    },"payload":{
                                "timeout        "artifact_name": 300"pm_control",
                                        "retriesartifact_version": "1.0.0",
                                        "successdata": "final_success",
                                 "failure": "final_failure",   }
                                "failure_timeout": "final_failure_timeout"},
                                "failure_retriestimeout": "final_failure_retries"300,
                                "failure_exceptionretries": "final_failure_exception"0,
                                "failure_guardsuccess": "final_failure_guardsuccess",
                            }
               "failure": "final_failure",
         ],
                        "controllerNamefailure_timeout": "frankfurtfinal_failure_timeout",
                    }
                }
"failure_retries": "final_failure_retries",
                  }
        ]
    }
}

Drools Legacy Policy to test CDS interaction for PNF:

Code Block
languagetext
titleDrools Tosca Policy
collapsetrue
{
  "policy-id" failure_exception": "operational.pnflegacy.createsubscriptionfinal_failure_exception",
     "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.

Code Block
languagetext
titleDrools Tosca Policy
collapsetrue
{
  "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.

                         "failure_guard": "final_failure_guard"
                            }
                        ],
                        "controllerName": "frankfurt"
                    }
                }
            }
        ]
    }
}


Drools Legacy Policy to test CDS interaction for PNF:

Code Block
languagetext
titleDrools Legacy Policy
collapsetrue
{
  "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.

Code Block
languagetext
titleONSET Event
collapsetrue
{
  "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.

Code Block
languagetext
titleCDS Request made by Policy
collapsetrue
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"
                }
              }
    
Code Block
languagetext
titleDrools Tosca Policy
collapsetrue
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"
          valuefields {
              string_value  key: "e6fd6fb9-5734-49e9-bf13-7b3308fb8f7apnf.equip-model"
          }
       value }{
        fields {
          keystring_value: "create-subscription-properties"
example-equip-model-val-8370"
             value   {}
            struct_value  {}
              fields {
                key: "pnf.pnfmanagement-nameoption"
                value {
                  string_value: "pnf300example-management-option-val-72881"
                }
              }
              fields {
                key: "pnf.pnforchestration-name2-sourcestatus"
                value {
                  string_value: "example-pnf-name2-source-val-99275Active"
                }
              }
              fields {
                key: "pnf.pnfipaddress-v4-idoam"
                value {
                  string_value: "927b2580-36d9-4f13-8421-3c9d43b7a57e10.2.0.142"
                }
              }
              fields {
                key: "pnf.equipin-typemaint"
                value {
                  string_value: "example-equip-type-val-20348false"
                }
              }
              fields {
                key: "pnf.equipipaddress-v6-vendoroam"
                value {
                  string_value: "example-equip-vendor-val-52182"
                }
              }
              fields {
                key: "pnf.equipresource-modelversion"
                value {
                  string_value: "example-equip-model-val-83701588678430278"
                }
              }
              fields {
                key: "pnf.management-optionnfName"
                value {
                  string_value: "example-management-option-val-72881pnf300"
                }
              }
              fields {
                key: "pnf.orchestration-statusadministrativeState"
                value {
                  string_value: "ActiveUNLOCKED"
                }
              }
              fields {
                key: "pnf.ipaddress-v4-oamsubscriptionName"
                value {
                  string_value: "10.2.0.142demo-subscription"
                }
              }
              fields {
                key: "pnf.in-maintfileBasedGP"
                value {
                  string_value: "false15"
                }
              }
              fields {
                key: "pnf.ipaddress-v6-oamfileLocation"
                value {
                  string_value: "test/pmx.xml"
                }
              }
              fields {
                key: "pnf.resource-versiondata"
                value {
                  string_value: "1588678430278"
                }
              }
            }
          }
      fields  {}
      }
    }
  }
}


Code Block
languagetext
titleCDS Response
collapsetrue
commonHeader {
   keytimestamp: "nfName2020-05-06T16:43:32.437Z"
  requestId: "c7c6a4aa-bb61-4a15-b831-ba1472dd4a56"
  subRequestId: "0"
  flag {
  }
  originatorId:   value "POLICY"
}
actionIdentifiers {
  blueprintName: "pm_control"
  blueprintVersion: "1.0.0"
  actionName: "create-subscription"
  mode: "sync"
}
status {
  code: 200
  string_valuemessage: "pnf300success"
  eventType: EVENT_COMPONENT_EXECUTED
  timestamp: "Wed May 06 16:43:33       GMT 2020"
}
payload {
  fields {
    key: "create-subscription-response"
    value }{
          struct_value {
    fields {
     fields {
          key: "administrativeStateodl-response"
                value {
            struct_value  {
    string_value: "UNLOCKED"
         fields {
      }
            key: "status"
  }
              fieldsvalue {
                  keystring_value: "subscriptionNamesuccess"
                }
      value {
       }
           string_value: "demo-subscription" }
          }
        }
       }
       }
              fields {
                key: "fileBasedGP"
                value {
                  string_value: "15"
      }
  }
}

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. 

Code Block
BEFORE
root@policy-nfs:~# 
curl --location --request GET 'http://10.2.0.142:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/pnf300/yang-ext:mount/pnf-subscriptions:subscriptions' --header 'Authorization: Basic YWRtaW46YWRtaW4=' --header 'Cookie: JSESSIONID=node01t62zn06d3cessj6iezwak66h219.node0'

{
    "subscriptions": {
          }"configuration": [
            {
  }
              fields {"subscriptionName": "sub0",
                key"administrativeState": "fileLocationUNLOCKED",
                value {"fileLocation": "c://PM",
                  string_value: "test/pmx.xml""fileBasedGP": 15
            }
    }
    ]
          }
              fields }
}

root@policy-nfs:~#


AFTER
root@policy-nfs:~# 
curl --location --request GET 'http://10.2.0.142:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/pnf300/yang-ext:mount/pnf-subscriptions:subscriptions' --header 'Authorization: Basic YWRtaW46YWRtaW4=' --header 'Cookie: JSESSIONID=node01t62zn06d3cessj6iezwak66h219.node0'

{
    "subscriptions": {
           key"configuration": "data"
   [
             value {
                  string_value"subscriptionName": "sub0",
                 }
 "administrativeState": "UNLOCKED",
             }
            }"fileLocation": "c://PM",
          }
        }
   "fileBasedGP": 15
   }
    }
  }
}
Code Block
languagetext
titleDrools Tosca Policy
collapsetrue
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"
}
}
}
}
}
}
}
}
}
,
            {
                "subscriptionName": "demo-subscription",
                "administrativeState": "UNLOCKED",
                "fileLocation": "test/pmx.xml",
                "fileBasedGP": 15
            }
        ]
    }
}

root@policy-nfs:~#