Versions Compared

Key

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

...

DCAE Policy Handler

Code Block
languagejs
https://pdp:8081/pdp/api/getConfig POST
Content-Type: application/json

{"configAttributes": {}, "unique": false, "ecompName": "DCAE", "configName": ".*", "policyName": ".*vFirewall*"}


#
# Returns
#


{
  "policyConfigMessage": "Config Retrieved! ",
  "policyConfigStatus": "CONFIG_RETRIEVED",
  "type": "JSON",
  "config": "{\"service\":\"tca_policy\",\"location\":\"SampleServiceLocation\",\"uuid\":\"test\",\"policyName\":\"MicroServicevFirewall\",\"description\":\"MicroService vFirewall Policy\",\"configName\":\"SampleConfigName\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"1.1.0\",\"priority\":\"1\",\"policyScope\":\"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\",\"guard\":\"False\",\"content\":{\"policyVersion\":\"v0.0.1\",\"threshholds\":[{\"severity\":\"MAJOR\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":\"300\",\"closedLoopEventStatus\":\"ONSET\",\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"direction\":\"LESS_OR_EQUAL\"},{\"severity\":\"CRITICAL\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\",\"thresholdValue\":\"700\",\"closedLoopEventStatus\":\"ONSET\",\"closedLoopControlName\":\"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\",\"version\":\"1.0.2\",\"direction\":\"GREATER_OR_EQUAL\"}],\"policyName\":\"DCAE.Config_tca-hi-lo\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"eventName\":\"vFirewallBroadcastPackets\"}}",
  "policyName": "com.Config_MS_CSIT_kf0zc9b9olvs2gm_vFirewall.1.xml", ### Where did this come from?? Why isn't this com.MicroServicevFirewall??
  "policyType": "MicroService",
  "policyVersion": "1",
  "matchingConditions": {
    "ECOMPName": "DCAE",
    "ONAPName": "DCAE",
    "ConfigName": "SampleConfigName",
    "service": "tca_policy",
    "uuid": "test",
    "Location": "SampleServiceLocation"
  },
  "responseAttributes": {},
  "property": null
}


#
# The contents of the config UNESCAPED and PRETTY PRINTED
#
# MISSING under content:
#		"tca_policy": {
#			"domain": "measurementsForVfScaling",
#			"metricsPerEventName": [
#
#
{
  "service": "tca_policy",
  "location": "SampleServiceLocation",
  "uuid": "test",
  "policyName": "MicroServicevFirewall",
  "description": "MicroService vFirewall Policy",
  "configName": "SampleConfigName",
  "templateVersion": "OpenSource.version.1",
  "version": "1.1.0",
  "priority": "1",
  "policyScope": "resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
  "riskType": "SampleRiskType",
  "riskLevel": "1",
  "guard": "False",
  "content": {
    "policyVersion": "v0.0.1",
    "threshholds": [
      {
        "severity": "MAJOR",
        "fieldPath": "$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta",
        "thresholdValue": "300",
        "closedLoopEventStatus": "ONSET",
        "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
        "version": "1.0.2",
        "direction": "LESS_OR_EQUAL"
      },
      {
        "severity": "CRITICAL",
        "fieldPath": "$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta",
        "thresholdValue": "700",
        "closedLoopEventStatus": "ONSET",
        "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
        "version": "1.0.2",
        "direction": "GREATER_OR_EQUAL"
      }
    ],
    "policyName": "DCAE.Config_tca-hi-lo",
    "controlLoopSchemaType": "VNF",
    "policyScope": "DCAE",
    "eventName": "vFirewallBroadcastPackets"
  }
}

...

Code Block
languageyml
titleExpected Policy to be Created by CLAMP
linenumberstrue
tosca_definitions_version: tosca_simple_yaml_1_0_0
imports:
    -
      tca_policy_model_dublin.yml
policies:
    -
      onap.vfirewall.tca:
        type: onap.policy.monitoring.cdap.tca.hi.lo.app
        properties:
            domain: measurementsForVfScaling
            metricsPerEventName: 
            - 
                eventName: vLoadBalancer
                controlLoopSchemaType: VNF
                policyScope: "resource=vLoadBalancer;type=configuration"
                policyName: "onap.vfirewall.tca" # Do we need a name? The unique node name should be enough?
                policyVersion: "v0.0.1" # This field should be removed as Policy Create/Update API will return the version
                thresholds: 
                - 
                    closedLoopControlName: "CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A"
                    closedLoopEventStatus: ONSET
                    version: "1.0.2"
                    fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
                    thresholdValue: 500
                    direction: LESS_OR_EQUAL
                    severity: MAJOR
                - 
                    closedLoopControlName: "CL-LBAL-LOW-TRAFFIC-SIG-0C5920A6-B564-8035-C878-0E814352BC2B"
                    closedLoopEventStatus: ONSET
                    version: "1.0.2"
                    fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
                    thresholdValue: 5000
                    direction: GREATER_OR_EQUAL
                    severity: CRITICAL


Equivalency Table: Casablanca and Dublin APIs

(Comments pasted from API page)

In an equivalency table, this would be the same as the legacy - createPolicy and updatePolicy.   Probably worth to mention for the benefit of other teams.   The result would support the JSON format, so clients should expect little or no change.

This URL for POST should create a resource that we need to identify

POST
https://{url}:{port}/api/v1/policytypes/
{policy type id}/versions/{version}/policies/

One proposal is to use the closedLoopControlName field:

CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A

and the version in this case:

1.0.2.

The GET for this specific one would be then

GET
https://{url}:{port}/api/v1/policytypes/
{policy type id}/versions/{version}/policies/CL-LBAL-LOW-TRAFFIC-SIG-FB480F95-A453-6F24-B767-FD703241AB1A/versions/1.0.2

They can name the policies however they want. If they want to use Closed Loop Control Name go ahead. The problem with the TCA model is they shove all that detail inside the model and use arrays of Control Loops. But its up to them on how they want their model to look.