CLAMP endpoints
GET /v1/healthcheck
org.onap.policy.clamp.clds.service.CldsHealthcheckService.gethealthcheck()
return: org.onap.policy.clamp.clds.model.CldsHealthCheck
GET /v1/user/getUser
org.onap.policy.clamp.authorization.UserService?method=getUser()
return: java.lang.String
GET /v2/loop/getAllNames
org.onap.policy.clamp.loop.LoopController.getLoopNames()
return: java.lang.String[]
GET /v2/loop/{loopName}
org.onap.policy.clamp.loop.LoopController.getLoop(loopName)
return: org.onap.policy.clamp.loop.Loop
POST /v2/loop/updateGlobalProperties/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
org.onap.policy.clamp.loop.LoopController.updateGlobalPropertiesJson(${header.loopName},${header.GlobalPropertiesJson})
return: org.onap.policy.clamp.loop.Loop
POST /v2/loop/updateOperationalPolicies/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
org.onap.policy.clamp.loop.LoopController.updateOperationalPolicies(${header.loopName},${header.OperationalPoliciesArray})
return: org.onap.policy.clamp.loop.Loop
POST /v2/loop/updateMicroservicePolicy/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
org.onap.policy.clamp.loop.LoopController.updateMicroservicePolicy(${header.loopName},${exchangeProperty[MicroServicePolicyObject]})
return: org.onap.policy.clamp.policy.microservice.MicroServicePolicy
PUT /v2/loop/deploy/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:deploy-loop"/>
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
org.onap.policy.clamp.loop.cds.CdsDataInstaller.updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})
org.onap.policy.clamp.loop.LoopController.refreshMicroServicePolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.microServicePolicyName})
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/refreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
org.onap.policy.clamp.loop.cds.CdsDataInstaller.updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})
org.onap.policy.clamp.loop.LoopController.refreshOperationalPolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.operationalPolicyName})
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/undeploy/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:undeploy-loop
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/stop/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:remove-all-policy-from-active-pdp-group"/>
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/restart/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:add-policies-from-loop-to-pdp-group"/>
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/submit/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:remove-all-policy-from-active-pdp-group"/>
<to uri="direct:delete-policy-from-loop-object"/>
<to uri="direct:create-policy-from-loop-object"/>
<to uri="direct:delete-policy-from-loop-object"/>
<to uri="direct:create-policy-from-loop-object"/>
<to uri="direct:add-policies-from-loop-to-pdp-group"/>
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/delete/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:undeploy-loop"/>
<to uri="direct:remove-all-policy-from-active-pdp-group"/>
<to uri="direct:delete-policy-from-loop-object"/>
<to uri="direct:delete-policy-from-loop-object"/>
org.onap.policy.clamp.loop.LoopController.deleteLoop(${header.loopName})
GET /v2/loop/getstatus/{loopName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:update-policy-status-for-loop"/>
<to uri="direct:update-dcae-status-for-loop"/>
<to uri="direct:update-loop-state"/>
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
org.onap.policy.clamp.loop.LoopController.addOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})
return: org.onap.policy.clamp.loop.Loop
PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}
org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
<to uri="direct:remove-one-policy-from-active-pdp-group"/>
<to uri="direct:delete-policy-from-loop-object"/>
org.onap.policy.clamp.loop.LoopController.removeOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})
return: org.onap.policy.clamp.loop.Loop
POST /v2/loop/create/{loopName}?templateName={templateName}
org.onap.policy.clamp.loop.LoopController.createLoop(${header.loopName}, ${header.templateName})
return: org.onap.policy.clamp.loop.Loop
GET /v2/templates
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'template','','read')
org.onap.policy.clamp.loop.template.LoopTemplatesService.getAllLoopTemplates()
return: org.onap.policy.clamp.loop.template.LoopTemplate
GET /v2/templates/{templateName}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'template','','read')
org.onap.policy.clamp.loop.template.LoopTemplatesService.getLoopTemplate(${header.templateName})
return: org.onap.policy.clamp.loop.template.LoopTemplate
GET /v2/templates/names
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'template','','read')
org.onap.policy.clamp.loop.template.LoopTemplatesService.getLoopTemplateNames()
return: java.lang.String[]
GET /v2/dictionary
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
org.onap.policy.clamp.tosca.DictionaryService.getAllDictionaries()"/>
return: org.onap.policy.clamp.tosca.Dictionary
GET /v2/dictionary/secondary/names
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
org.onap.policy.clamp.tosca.DictionaryService.getAllSecondaryLevelDictionaryNames()"/>
return: java.lang.String[]
GET /v2/dictionary/{dictionaryName}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
org.onap.policy.clamp.tosca.DictionaryService.getDictionary(${header.dictionaryName})"/>
return: org.onap.policy.clamp.tosca.Dictionary
PUT /v2/dictionary
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','update')
org.onap.policy.clamp.tosca.DictionaryService.saveOrUpdateDictionary(${exchangeProperty[DictionaryObject]})
return: org.onap.policy.clamp.tosca.Dictionary
PUT /v2/dictionary/{name}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','update')
org.onap.policy.clamp.tosca.DictionaryService.saveOrUpdateDictionaryElement(${header.name}, ${exchangeProperty[DictionaryObject]})
return: org.onap.policy.clamp.tosca.Dictionary
DELETE /v2/dictionary/{name}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','update')
org.onap.policy.clamp.tosca.DictionaryService.deleteDictionary(${header.name})
DELETE /v2/dictionary/{name}/elements/{shortName}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','update')
org.onap.policy.clamp.tosca.DictionaryService.deleteDictionaryElement(${header.name}, ${header.shortName})
GET /v2/policyToscaModels" return: org.onap.policy.clamp.loop.template.PolicyModel
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
org.onap.policy.clamp.loop.template.PolicyModelsService.getAllPolicyModels()
GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
org.onap.policy.clamp.loop.template.PolicyModelsService.getPolicyModelJson(${header.policyModelType},${header.policyModelVersion})
return: com.google.gson.JsonObject
GET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
org.onap.policy.clamp.loop.template.PolicyModelsService.getPolicyModelTosca(${header.policyModelType},${header.policyModelVersion})
return: java.lang.String
GET /v2/policies" return: com.google.gson.JsonObject
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','read')
<to uri="direct:get-all-policies"/>
<to uri="direct:get-all-pdp-groups"/>
org.onap.policy.clamp.policy.pdpgroup.PoliciesPdpMerger.mergePoliciesAndPdpGroupStates(${exchangeProperty[policiesListResponse]},${exchangeProperty[pdpGroupInfoResponse]})
POST /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
org.onap.policy.clamp.loop.template.PolicyModelsService.getPolicyModelTosca(${header.policyModelType},${header.policyModelVersion})
<method ref="org.onap.policy.clamp.policy.PolicyPayload" method="createPolicyPayload(${header.policyModelType}, ${header.policyModelVersion}, ${header.policyName}, ${header.policyVersion}, ${exchangeProperty[policyProperties]}, ${body})"/>
<to uri="direct:create-policy"/>
return: com.google.gson.JsonObject
DELETE /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
<to uri="direct:undeploy-one-policy-from-pap"/>
<to uri="direct:delete-policy"/>
PUT /v2/policies/pdpDeployment
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
org.onap.policy.clamp.policy.pdpgroup.PdpGroupPayload.generatePdpGroupPayloadFromList(${body})
<to uri="direct:add-multiple-policies-to-pdp-group"/>
POST /v2/policies/policytype
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
<to uri="direct:create-policy-type"/>
org.onap.policy.clamp.policy.downloader.PolicyEngineController.synchronizeAllPolicies()
GET /v2/acm/getToscaTemplate
<to uri="direct:get-service-template"/>
return: java.lang.String
POST /v2/acm/commissionToscaTemplate
<to uri="direct:commission-service-template"/>
return: java.lang.String
DELETE /v2/acm/decommissionToscaTemplate
<to uri="direct:decommission-service-template"/>
return: java.lang.String
DELETE /v2/acm/deleteToscaInstantiation
<to uri="direct:delete-tosca-instantiation"/>
return: java.lang.String
GET /v2/acm/getToscaInstantiation
<to uri="direct:get-tosca-instantiation"/>
return: java.lang.String
GET /v2/acm/getInstantiationOrderState
<to uri="direct:get-tosca-instantiation-order-state"/>
return: java.lang.String
GET /v2/acm/getJsonSchema
<to uri="direct:get-json-schema"/>
return: java.lang.String
GET /v2/acm/getElementDefinitions
<to uri="direct:get-element-definitions"/>
return: java.lang.String
GET /v2/acm/getAutomationCompositionDefinitions
<to uri="direct:get-acm-definitions"/>
return: java.lang.String
POST /v2/acm/postToscaInstanceProperties
<to uri="direct:post-tosca-instance-properties"/>
return: java.lang.String"
DELETE /v2/acm/deleteToscaInstanceProperties
<to uri="direct:delete-tosca-instance-properties"/>
return: java.lang.String
GET /v2/acm/getCommonOrInstanceProperties
<to uri="direct:get-common-or-instance-properties"/>
return: java.lang.String
POST /v2/acm/postToscaInstantiation
<to uri="direct:post-tosca-instantiation"/>
return: java.lang.String
PUT /v2/acm/putToscaInstantiationStateChange
<to uri="direct:put-tosca-instantiation"/>
return: java.lang.String
Redirection
Currently clamp is used as router to Api, Pap, Dcae, Cds and Acm runtime.
Model
Clamp uses its domain objects (JPA entities) directly in its REST endpoints. Controllers receive the body (in POST and PUT) as JsonArray.
Security
Users are store into clds/clds-users.json, it contains user, password and permissions. to handle permission clamp is using Spring Security.
Users and permissions should be decouple using roles and the application should be use Spring Security annotations.
Properties
clamp runtime: multi properties file and mapping implemented manually
clamp runtime acm: properties file is automatically mapped to a Properties bean using @ConfigurationPropertiesScan and @ConfigurationProperties. Multi properties file is already supported by SpringBoot using @PropertySource.
Logging
clamp runtime: for each end point calls a Java method to log description of the endpoint (e.g. "Create Loop" and "Successful" when finished) and to insert into MDC "X-ONAP-RequestID", "X-ONAP-InvocationID" and "X-ONAP-PartnerName"
clamp runtime acm: using RequestResponseLoggingFilter filter class we can log the url (e.g. "POST /v2/loop/create/{loopName}?templateName={templateName}" and "Successful" when finished) and insert into MDC "X-ONAP-RequestID", "X-ONAP-InvocationID" and "X-ONAP-PartnerName"
Exception Handling
clamp runtime: for each end point implements a try catch block
clamp runtime acm: implements a @RestControllerAdvice (by GlobalControllerExceptionHandler class) and Spring ErrorController (by RuntimeErrorController class).
Unit Test
Each service/component should be use Constructor-Based Dependency Injection. So we can remove @SpringBootTest annotation in unit tests increasing performance in compile time.