Versions Compared

Key

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

...

Code Block
languageyml
titleExample Policy You Would Expect To Be Able to Create
linenumberstrue
tosca_definitions_version: tosca_simple_yaml_1_0_0
imports:
    -
      tca_policy_model_casablanca.yml
policies:
    -
      onap.vfirewall.tca_policy:
        type: policy.nodes.tca
        properties:
            domain: measurementsForVfScaling
            metricsPerEventName: 
                - 
                    eventName: Mfvs_eNodeB_RANKPIvFirewallBroadcastPackets
                    controlLoopSchemaType: VNF
                    policyScope: "resource=vFirewall;type=configurationDCAE"
                    policyName: "configuration.dcae.microservice.tca.xmlDCAE.Config_tca-hi-lo"
                    policyVersion: "v0.0.1"
                    thresholds: 
                        - 
                            closedLoopControlName: "CLControlLoop-FRWLvFirewall-LOWd0a1dfc6-TRAFFIC94f5-SIG4fd4-d925ed73-8231-4d02-9545-db4e101f88f8"
                            closedLoopEventStatus: ONSET
                            version: "1.0.2"
                            fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated"
                            thresholdValue: 4000
                            direction: LESS_OR_EQUAL
                            severity: MAJOR
                        - 
                            closedLoopControlName: "CL-FRWL-HIGH-TRAFFIC-SIG-EA36FE84-9342-5E13-A656-EC5F21309A09a5b5-4630b438850a"
                            closedLoopEventStatus: ONSET
                            version: "1.0.2"
                            fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArrayvNicUsageArray[*].receivedBroadcastPacketsAccumulatedreceivedTotalPacketsDelta"
                            thresholdValue: 20000300
                            direction: GREATERLESS_OR_EQUAL
                            severity: CRITICALMAJOR
                        - 
                            closedLoopControlName: "CLControlLoop-FRWLvFirewall-HIGHd0a1dfc6-TRAFFIC94f5-SIG4fd4-EA36FE84-9342-5E13-A656-EC5F21309A09a5b5-4630b438850a"
                            closedLoopEventStatus: ABATEDONSET
                            version: "1.0.2"
                            fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArrayvNicUsageArray[*].receivedBroadcastPacketsAccumulatedreceivedTotalPacketsDelta"
                            thresholdValue: 0700
                            direction: GREATER_OR_EQUAL
                            severity: CRITICAL

Actual Input expected by the API does not match the above YAML, but instead is JSON.

Code Block
languagebash
titleExample API Call using CURL (CLAMP uses Java API)
linenumberstrue
curl -k -v --silent -X PUT --header 'Content-Type: application/json' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -d '{

    "configBody": "{ \"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\": { \"tca_policy\": { \"domain\": \"measurementsForVfScaling\", \"metricsPerEventName\": [{ \"eventName\": \"vFirewallBroadcastPackets\", \"controlLoopSchemaType\": \"VNF\", \"policyScope\": \"DCAE\", \"policyName\": \"DCAE.Config_tca-hi-lo\", \"policyVersion\": \"v0.0.1\", \"thresholds\": [{ \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 300, \"direction\": \"LESS_OR_EQUAL\", \"severity\": \"MAJOR\", \"closedLoopEventStatus\": \"ONSET\" }, { \"closedLoopControlName\": \"ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"1.0.2\", \"fieldPath\": \"$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta\", \"thresholdValue\": 700, \"direction\": \"GREATER_OR_EQUAL\", \"severity\": \"CRITICAL\", \"closedLoopEventStatus\": \"ONSET\" } ] }] } } }",

    "policyConfigType": "MicroService",

    "policyName": "com.MicroServicevFirewall",

    "onapName": "DCAE"

}' 'https://pdp:8081/pdp/api/createPolicy'


Code Block
languagejs
titleFrom the example API call, this is the configBody JSON contents UNStringified and Pretty Printed
linenumberstrue
{
	"service": "tca_policy",
	"location": "SampleServiceLocation",
	"uuid": "test",
	"policyName": "MicroServicevFirewall", ## WHOA - THIS DOES NOT MATCH policyName in the top-level API call JSON payload
	"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": {
		"tca_policy": {
			"domain": "measurementsForVfScaling",
			"metricsPerEventName": [
				{
					"eventName": "vFirewallBroadcastPackets",
					"controlLoopSchemaType": "VNF",
					"policyScope": "DCAE",
					"policyName": "DCAE.Config_tca-hi-lo",
					"policyVersion": "v0.0.1",
					"thresholds": [
						{
							"closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
							"version": "1.0.2",
							"fieldPath": "$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta",
							"thresholdValue": 300,
							"direction": "LESS_OR_EQUAL",
							"severity": "MAJOR",
							"closedLoopEventStatus": "ONSET"
						},
						{
							"closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
							"version": "1.0.2",
							"fieldPath": "$.event.measurementsForVfScalingFields.vNicUsageArray[*].receivedTotalPacketsDelta",
							"thresholdValue": 700,
							"direction": "GREATER_OR_EQUAL",
							"severity": "CRITICAL",
							"closedLoopEventStatus": "ONSET"
						}
					]
				}
			]
		}
	}
}

...