...
Code Block | ||||
---|---|---|---|---|
| ||||
# # Example CURL contents taken from Policy CSIT Tests (not the above example) # { "configBody": "{\"service\": \"policy_tosca_tca\",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\": \"RaviSampleServiceLocation\", \"uuid\": \"/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vFireWalltest\", \"policyName\": \"vFireWallMicroServicevFirewall\", \"description\": \"vFireWallMicroService vFirewall Policy\", \"configName\": \"TestConfigNameSampleConfigName\", \"templateVersion\": \"1607OpenSource.version.1\", \"version\": \"81.71.6.50\", \"priority\": \"1\", \"policyScope\": \"resource=TestResourceSampleResource,service=TestServiceSampleService,type=TestTypeSampleType,closedLoopControlName=TestClosedLoopControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"riskType\": \"testSampleRiskType\", \"riskLevel\": \"21\", \"guard\": \"False\", \"content\": { \"policyVersiontca_policy\": { \"domain\": \"v0.0.1measurementsForVfScaling\", \"threshholdsmetricsPerEventName\": [{ \"severityeventName\": \"MAJORvFirewallBroadcastPackets\", \"fieldPathcontrolLoopSchemaType\": \"$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulatedVNF\", \"thresholdValuepolicyScope\": \"4000DCAE\", \"closedLoopControlNamepolicyName\": \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8DCAE.Config_tca-hi-lo\", \"versionpolicyVersion\": \"1v0.0.21\", \"directionthresholds\": [{ \"closedLoopControlName\": \"LESS_OR_EQUALControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\"}, {\"severityversion\": \"CRITICAL1.0.2\", \"fieldPath\": \"$$$.event.measurementsForVfScalingFields.vNicPerformanceArrayvNicUsageArray[*].receivedBroadcastPacketsAccumulatedreceivedTotalPacketsDelta\", \"thresholdValue\": 300, \"20000direction\": \"LESS_OR_EQUAL\", \"closedLoopControlNameseverity\": \"CL-FRWL-HIGH-TRAFFIC-SIG-EA36FE84-9342-5E13-A656-EC5F21309A09MAJOR\", \"versionclosedLoopEventStatus\": \"1.0.2ONSET\" }, { \"directionclosedLoopControlName\": \"GREATER_OR_EQUAL\"}],\"policyNameControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a\", \"version\": \"configuration1.ae.microservice.tca.xml0.2\", \"functionalRolefieldPath\": \"ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8\"}}", "policyConfigType": "MicroService", "policyName": "${policy_name}", "ecompName": "DCAE" } $.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 | ||||
---|---|---|---|---|
Code Block | ||||
| ||||
#NOTE: This was taken from CSIT which may be using an older model of the TCA policy { "service": "policy_tosca_tca", "location": "Ravi", "uuid": "/services/cdap-tca-hi-lo/instances/dfw1/configuration/metricsPerFunctionalRole/vFireWall", "policyName": "vFireWall", "description": "vFireWall", "configName": "TestConfigName", "templateVersion": "1607", "version": "8.7.6.5", "priority": "1", "policyScope": "resource=TestResource,service=TestService,type=TestType,closedLoopControlName=TestClosedLoop", "riskType": "test", "riskLevel": "2", "guard": "False", "content": { "policyVersion": "v0.0.1", "threshholds": [{ "severity": "MAJOR", "fieldPath": "$$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", "thresholdValue": "4000", "closedLoopControlName": "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8", { "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", "direction": "LESS_OR_EQUAL" }, { "severity": "CRITICAL", "fieldPath": "$$$.event.measurementsForVfScalingFields.vNicPerformanceArrayvNicUsageArray[*].receivedBroadcastPacketsAccumulated", "thresholdValue": "20000", "closedLoopControlName": "CL-FRWL-HIGH-TRAFFIC-SIG-EA36FE84-9342-5E13-A656-EC5F21309A09receivedTotalPacketsDelta", "versionthresholdValue": "1.0.2"700, "direction": "GREATER_OR_EQUAL", }], "policyNameseverity": "configuration.ae.microservice.tca.xmlCRITICAL", "functionalRoleclosedLoopEventStatus": "ClosedLoop_F5-d925ed73-8231-4d02-9545-db4e101f88f8"ONSET" } ] } ] } } } |
Basically, the model is broken as values are spread throughout the payload for the API call. CLAMP has to hardcode this "breakage" to fit the DCAE Policy into the API call. The exact details on what DCAE Policy Handler has to do be able to retrieve the policy are way to numerous and are documented in this PDF:
...