...
Code Block | ||||
---|---|---|---|---|
| ||||
{ "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" } ] } ] } } } |
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:
DCAEGEN2 architecture of policy-handling by DCAE-controller
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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 '{
"pdpGroup": "default",
"policyName": "com.MicroServicevFirewall",
"policyType": "MicroService"
}' 'https://pdp:8081/pdp/api/pushPolicy'
|
DCAE Policy Handler
Code Block |
---|
POST
{"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",
"policyType": "MicroService",
"policyVersion": "1",
"matchingConditions": {
"ECOMPName": "DCAE",
"ONAPName": "DCAE",
"ConfigName": "SampleConfigName",
"service": "tca_policy",
"uuid": "test",
"Location": "SampleServiceLocation"
},
"responseAttributes": {},
"property": null
}
|
Policy Lifecycle API (DRAFT Beta version for M2)
...