Versions Compared

Key

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

GET /v2/loop/getAllNamesGET /v1/healthcheck
    org.onap.policy.clamp.clds.loopservice.LoopControllerCldsHealthcheckService.getLoopNamesgethealthcheck()
    return: java.lang.String[]GET /v2/loop/{loopName}org.onap.policy.clamp.clds.model.CldsHealthCheck

GET /v1/user/getUser
    org.onap.policy.clamp.loop.LoopController.getLoop(loopNameauthorization.UserService?method=getUser()
    return: orgjava.onap.policy.clamp.loop.LoopPOST lang.String

GET /v2/loop/updateGlobalProperties/{loopName}getAllNames
    org.onap.policy.clamp.loop.LoopServiceLoopController.getLoopgetLoopNames(loopName)
    orgreturn: java.onap.policy.clamp.lang.String[]

GET /v2/loop/{loopName}
    org.onap.policy.clamp.loop.LoopController.updateGlobalPropertiesJsongetLoop(${header.loopName},${header.GlobalPropertiesJson})
    return: org.onap.policy.clamp.loop.Loop

POST /v2/loop/updateOperationalPoliciesupdateGlobalProperties/{loopName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    org.onap.policy.clamp.loop.LoopController.updateOperationalPoliciesupdateGlobalPropertiesJson(${header.loopName},${header.OperationalPoliciesArrayGlobalPropertiesJson})
    return: org.onap.policy.clamp.loop.Loop

POST /v2/loop/updateMicroservicePolicyupdateOperationalPolicies/{loopName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    org.onap.policy.clamp.loop.LoopController.updateMicroservicePolicyupdateOperationalPolicies(${header.loopName},${exchangeProperty[MicroServicePolicyObject]header.OperationalPoliciesArray})
    return: org.onap.policy.clamp.policyloop.microservice.MicroServicePolicyLoopPUT

POST /v2/loop/deployupdateMicroservicePolicy/{loopName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    <to uri="direct:deploy-loop"/>org.onap.policy.clamp.loop.LoopController.updateMicroservicePolicy(${header.loopName},${exchangeProperty[MicroServicePolicyObject]})
    return: org.onap.policy.clamp.policy.loopmicroservice.LoopMicroServicePolicy

PUT /v2/loop/refreshMicroServicePolicyJsonSchemadeploy/{loopName}/{microServicePolicyName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    org.onap.policy.clamp.loop.cds.CdsDataInstaller.updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})
    <to uri="direct:deploy-loop"/>
    return: org.onap.policy.clamp.loop.LoopController.refreshMicroServicePolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.microServicePolicyName})
    return: Loop

PUT /v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}
    org.onap.policy.clamp.loop.Loop
     
PUT /v2/loop/refreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}
    org.onap.policy.clamp.loop.LoopService.getLoop.LoopService.getLoop(loopName)
    org.onap.policy.clamp.loop.cds.CdsDataInstaller.updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})
    org.onap.policy.clamp.loop.LoopController.refreshOperationalPolicyJsonRepresentationrefreshMicroServicePolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.operationalPolicyNamemicroServicePolicyName})
    return: org.onap.policy.clamp.loop.Loop
     
PUT /v2/loop/undeployrefreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    <to uri="direct:undeploy-loop
    return: org.onap.policy.clamp.loop.LoopPUT /v2/loop/stop/{loopName}cds.CdsDataInstaller.updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})
    org.onap.policy.clamp.loop.LoopServiceLoopController.getLoop(loopNamerefreshOperationalPolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.operationalPolicyName})
    <to uri="direct:remove-all-policy-from-active-pdp-group"/>
    return: org.onap.policy.return: org.onap.policy.clamp.loop.Loop

PUT /v2/loop/restartundeploy/{loopName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    <to uri="direct:add-policiesundeploy-from-loop-to-pdp-group"/>
    return: org.onap.policy.clamp.loop.Loop

PUT /v2/loop/submitstop/{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"/>return: org.onap.policy.clamp.loop.Loop

PUT /v2/loop/restart/{loopName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    <to uri="direct:deleteadd-policypolicies-from-loop-objectto-pdp-group"/>
    <to uri="direct:create-policy-from-loop-object"/>
    <to uri="direct:add-policies-from-loop-to-pdp-group"/>
    return: org.return: org.onap.policy.clamp.loop.Loop

PUT /v2/loop/deletesubmit/{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:deletecreate-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:updatedelete-policy-statusfrom-forloop-loopobject"/>
    <to uri="direct:updatecreate-dcaepolicy-statusfrom-forloop-loopobject"/>
    <to uri="direct:updateadd-policies-from-loop-to-pdp-stategroup"/>
    return: org.onap.policy.clamp.loop.Loop

PUT /v2/loop/addOperationaPolicydelete/{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.LoopPUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}
    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:remove-onedelete-policy-from-activeloop-pdp-groupobject"/>
    <to uri="direct:delete-policy-from-loop-object"/>
    org.org.onap.policy.clamp.loop.LoopController.removeOperationalPolicydeleteLoop(${header.loopName},${header.policyType},${header.policyVersion}))

GET /v2/loop/getstatus/{loopName}
    return: org.onap.policy.clamp.loop.LoopPOST /v2/loop/create/{loopName}?templateName={templateName}
    .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.LoopController.createLoop(${header.loopName}, ${header.templateName})
    return: Loop

PUT /v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}
    org.onap.policy.clamp.loop.LoopGET /v2/templates
.LoopService.getLoop(loopName)
    org.onap.policy.clamp.authorizationloop.AuthorizationControllerLoopController.authorize(*,'template','','read'addOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})
    return: org.onap.policy.clamp.loop.template.LoopTemplatesService.getAllLoopTemplates()Loop

PUT /v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}
    return: org.onap.policy.clamp.loop.template.LoopTemplateGET /v2/templates/{templateName}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.authorizationloop.AuthorizationControllerLoopController.authorize(*,'template','','read')
    org.onap.policy.clamp.loop.template.LoopTemplatesService.getLoopTemplate(removeOperationalPolicy(${header.loopName},${header.policyType},${header.templateNamepolicyVersion})
    return: org.onap.policy.clamp.loop.template.LoopTemplateLoopGET

POST /v2/templates/namesloop/create/{loopName}?templateName={templateName}
    org.onap.policy.clamp.authorizationloop.AuthorizationControllerLoopController.authorize(*,'template','','read'createLoop(${header.loopName}, ${header.templateName})
    return: org.onap.policy.clamp.loop.template.LoopTemplatesService.getLoopTemplateNames()
    return: java.lang.String[]Loop

GET /v2/dictionarytemplates
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'toscatemplate','','read')
    org.onap.policy.clamp.toscaloop.template.DictionaryServiceLoopTemplatesService.getAllDictionariesgetAllLoopTemplates()"/>
    return: org.onap.policy.clamp.loop.toscatemplate.DictionaryLoopTemplate

GET /v2/dictionary/secondary/namestemplates/{templateName}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'toscatemplate','','read')
    org.onap.policy.clamp.loop.toscatemplate.DictionaryServiceLoopTemplatesService.getAllSecondaryLevelDictionaryNames()"/>getLoopTemplate(${header.templateName})
    return: java.lang.String[]
         
org.onap.policy.clamp.loop.template.LoopTemplate

GET /v2/dictionarytemplates/{dictionaryName}names
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'toscatemplate','','read')
    org.onap.policy.clamp.loop.toscatemplate.DictionaryServiceLoopTemplatesService.getDictionary(${header.dictionaryName})"/>getLoopTemplateNames()
    return: orgjava.onap.policy.clamp.tosca.DictionaryPUT lang.String[]

GET /v2/dictionary
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','updateread')
    org.onap.policy.clamp.tosca.DictionaryService.saveOrUpdateDictionary(${exchangeProperty[DictionaryObject]})getAllDictionaries()"/>
    return: org.onap.policy.clamp.tosca.DictionaryPUT

GET /v2/dictionary/secondary/{name}names
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','updateread')
    org.onap.policy.clamp.tosca.DictionaryService.saveOrUpdateDictionaryElement(${header.name}, ${exchangeProperty[DictionaryObject]})getAllSecondaryLevelDictionaryNames()"/>
    return: orgjava.onap.policy.clamp.tosca.DictionaryDELETE lang.String[]
         
GET /v2/dictionary/{namedictionaryName}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','updateread')
    org.onap.policy.clamp.tosca.DictionaryService.deleteDictionarygetDictionary(${header.namedictionaryName})DELETE /v2/dictionary/{name}/elements/{shortName}"/>
    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.deleteDictionaryElementsaveOrUpdateDictionary(${header.name}, ${header.shortNameexchangeProperty[DictionaryObject]})
GET /v2/policyToscaModels"     return: org.onap.policy.clamp.loop.template.PolicyModeltosca.Dictionary

PUT /v2/dictionary/{name}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','readupdate')
    org.onap.policy.clamp.looptosca.template.PolicyModelsService.getAllPolicyModels()GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}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','','readupdate')
    org.onap.policy.clamp.looptosca.templateDictionaryService.PolicyModelsService.getPolicyModelJsondeleteDictionary(${header.policyModelType},${header.policyModelVersion})
    return: com.google.gson.JsonObjectGET name})

DELETE /v2/policyToscaModelsdictionary/yaml/{policyModelTypename}/elements/{policyModelVersionshortName}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','readupdate')
    org.onap.policy.clamp.looptosca.templateDictionaryService.PolicyModelsService.getPolicyModelToscadeleteDictionaryElement(${header.policyModelTypename}, ${header.policyModelVersionshortName})    return: java.lang.String

GET /v2/policiespolicyToscaModels" return: comorg.google.gson.JsonObjectonap.policy.clamp.loop.template.PolicyModel
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policiestosca','','read')
    <to uri="direct:get-all-policies"/>
    <to uri="direct:get-all-pdp-groups"/>
    org.onap.policy.clamp.policyloop.pdpgrouptemplate.PoliciesPdpMergerPolicyModelsService.mergePoliciesAndPdpGroupStates(${exchangeProperty[policiesListResponse]},${exchangeProperty[pdpGroupInfoResponse]})POST getAllPolicyModels()

GET /v2/policiespolicyToscaModels/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policiestosca','','updateread')
    org.onap.policy.clamp.loop.template.PolicyModelsService.getPolicyModelToscagetPolicyModelJson(${header.policyModelType},${header.policyModelVersion})
    <method ref="org.onap.policy.clamp.policy.PolicyPayload" method="createPolicyPayload(${header.policyModelType}, ${header.policyModelVersion}, ${header.policyNamereturn: 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.policyVersion}, ${exchangeProperty[policyProperties]}, ${body})"/>policyModelVersion})
    <to uri="direct:create-policy"/>
    return: java.lang.String

GET /v2/policies" return: com.google.gson.JsonObject
DELETE /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}
    org.onap.policy.clamp.authorization.    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','updateread')
    <to uri="direct:undeployget-one-policy-from-papall-policies"/>
    <to uri="direct:delete-policyget-all-pdp-groups"/>
PUT /v2/policies/pdpDeployment
    org.onap.policy.clamp.policy.authorizationpdpgroup.AuthorizationControllerPoliciesPdpMerger.authorize(*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.policyloop.pdpgrouptemplate.PdpGroupPayloadPolicyModelsService.generatePdpGroupPayloadFromListgetPolicyModelTosca(${bodyheader.policyModelType},${header.policyModelVersion})
    <to uri="direct:add-multiple-policies-to-pdp-group"/>POST /v2/policies/policytype
    <method ref="org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')policy.PolicyPayload" method="createPolicyPayload(${header.policyModelType}, ${header.policyModelVersion}, ${header.policyName}, ${header.policyVersion}, ${exchangeProperty[policyProperties]}, ${body})"/>
    <to uri="direct:create-policy-type"/>
    orgreturn: com.onapgoogle.policy.clamp.policy.downloader.PolicyEngineController.synchronizeAllPolicies()GET /v2/acm/getToscaTemplategson.JsonObject

DELETE /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
    <to uri="direct:get-service-templateundeploy-one-policy-from-pap"/>
    return: java.lang.StringPOST /v2/acm/commissionToscaTemplate
    <to <to uri="direct:commissiondelete-service-templatepolicy"/>    return: java.lang.StringDELETE

PUT /v2/acmpolicies/decommissionToscaTemplatepdpDeployment
    <to uri="direct:decommission-service-template"/>
    return: java.lang.StringDELETE /v2/acm/deleteToscaInstantiationorg.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
    org.onap.policy.clamp.policy.pdpgroup.PdpGroupPayload.generatePdpGroupPayloadFromList(${body})
    <to uri="direct:deleteadd-multiple-tosca-instantiationpolicies-to-pdp-group"/>

POST /v2/policies/policytype
    return: java.lang.StringGET /v2/acm/getToscaInstantiation
org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
    <to uri="direct:getcreate-toscapolicy-instantiationtype"/>
    return: java.lang.Stringorg.onap.policy.clamp.policy.downloader.PolicyEngineController.synchronizeAllPolicies()

GET /v2/acm/getInstantiationOrderStategetToscaTemplate
    <to uri="direct:get-tosca-instantiation-order-stateservice-template"/>
    return: java.lang.String

GET POST /v2/acm/getJsonSchemacommissionToscaTemplate
    <to uri="direct:getcommission-jsonservice-schematemplate"/>
    return: java.lang.String

GET DELETE /v2/acm/getElementDefinitionsdecommissionToscaTemplate
    <to uri="direct:getdecommission-elementservice-definitionstemplate"/>
    return: java.lang.StringGET

DELETE /v2/acm/getAutomationCompositionDefinitionsdeleteToscaInstantiation
    <to uri="direct:getdelete-acmtosca-definitionsinstantiation"/>
    return: java.lang.String

POST GET /v2/acm/postToscaInstancePropertiesgetToscaInstantiation
    <to uri="direct:postget-tosca-instance-propertiesinstantiation"/>
    return: java.lang.String"DELETE

GET /v2/acm/deleteToscaInstancePropertiesgetInstantiationOrderState
    <to uri="direct:deleteget-tosca-instantiation-instanceorder-propertiesstate"/>
    return: java.lang.String

GET /v2/acm/getCommonOrInstancePropertiesgetJsonSchema
    <to uri="direct:get-common-or-instance-propertiesjson-schema"/>
    return: java.lang.String

POST GET /v2/acm/postToscaInstantiationgetElementDefinitions
    <to uri="direct:postget-toscaelement-instantiationdefinitions"/>    
    return: java.lang.String

PUT GET /v2/acm/putToscaInstantiationStateChangegetAutomationCompositionDefinitions
    <to uri="direct:putget-toscaacm-instantiationdefinitions"/>
    return: java.lang.String

Redirection

Clamp is also used as router, several end points are just redirection to Api and Pap and could be removed. Policy-guy could use an external router/gateway or direct call. Anyway clamp is still need to call Api and Pap.

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.

Logging

...

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.