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(${header.loopName}authorization.UserService?method=getUser()
    return: orgjava.onap.policy.clamp.loop.LoopPOST lang.String

GET /v2/loop/updateGlobalProperties/{loopName}getAllNames
    <to uri="direct:load-loop"/>org.onap.policy.clamp.loop.LoopController.getLoopNames()
    return: java.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}
    <to uri="direct:load-loop"/>
    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}
    <to uri="direct:load-loop"/>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}
    <to uri="direct:load-loop"/>
    <to uri="direct:deploy-loop"/>
    return: org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    org.onap.policy.clamp.loop.LoopPUT /v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}
    <to uri="direct:load-loop"/>
    .LoopController.updateMicroservicePolicy(${header.loopName},${exchangeProperty[MicroServicePolicyObject]})
    return: org.onap.policy.clamp.looppolicy.cds.CdsDataInstaller.updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})microservice.MicroServicePolicy

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

PUT /v2/loop/refreshOperationalPolicyJsonSchemarefreshMicroServicePolicyJsonSchema/{loopName}/{operationalPolicyNamemicroServicePolicyName}
    <to uri="direct:load-loop"/>
    org.onap.policy.clamp.loop.cdsLoopService.CdsDataInstaller.updateCdsServiceProperties($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}
    <to uri="direct:load-loop"/>
    <to uri="direct:undeploy-loop
    return: /{operationalPolicyName}
    org.onap.policy.clamp.loop.LoopPUT /v2/loop/stop/{loopName}
    <to uri="direct:load-loop"/>
    <to uri="direct:remove-all-policy-from-active-pdp-group"/>
    return: LoopService.getLoop(loopName)
    org.onap.policy.clamp.loop.LoopPUT /v2/loop/restart/{loopName}
    <to uri="direct:load-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:add-policies-fromundeploy-loop-to-pdp-group"/>
    return: org.onap.policy.clamp.loop.Loop

PUT /v2/loop/submitstop/{loopName}
    <to uri="direct:load-loop"/>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-to-pdp-objectgroup"/>
    <to uri="direct:create-policy-from-loop-object"/>
    <to uri="direct:add-policies-from-loop-to-pdp-group"/>
    return: return: org.onap.policy.clamp.loop.Loop

PUT /v2/loop/submit/{loopName}
    org.onap.policy.clamp.loop.LoopPUT /v2/loop/delete/{loopName}.LoopService.getLoop(loopName)
    <to uri="direct:load-loopremove-all-policy-from-active-pdp-group"/>
    <to uri="direct:undeploydelete-policy-from-loop-object"/>
    <to uri="direct:remove-allcreate-policy-from-activeloop-pdp-groupobject"/>
    <to uri="direct:delete-policy-from-loop-object"/>
    <to uri="direct:deletecreate-policy-from-loop-object"/>
    <to uri="direct:add-policies-from-loop-to-pdp-group"/>
    return: org.onap.policy.clamp.loop.LoopController.deleteLoop(${header.loopName})GET Loop

PUT /v2/loop/getstatusdelete/{loopName}
    org.onap.policy.clamp.loop.LoopService.getLoop(loopName)
    <to uri="direct:loadundeploy-loop"/>
    <to uri="direct:updateremove-all-policy-from-statusactive-forpdp-loopgroup"/>
    <to uri="direct:updatedelete-dcaepolicy-statusfrom-forloop-loopobject"/>
    <to uri="direct:updatedelete-policy-from-loop-stateobject"/>
    return: org.onap.policy.clamp.loop.LoopPUT /.LoopController.deleteLoop(${header.loopName})

GET /v2/loop/addOperationaPolicygetstatus/{loopName}/policyModel/{policyType}/{policyVersion}
    <to uri="direct:load-loop"/>
    org.onap.policy.clamp.loop.LoopControllerLoopService.addOperationalPolicygetLoop(${header.loopName},${header.policyType},${header.policyVersion})
    return: <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/removeOperationaPolicyaddOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}
    <to uri="direct:load-loop"/>
    <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(
    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

POST PUT /v2/loop/createremoveOperationaPolicy/{loopName}?templateName={templateName/policyModel/{policyType}/{policyVersion}/{policyName}
    org.onap.policy.clamp.loop.LoopControllerLoopService.createLoopgetLoop(${header.loopName}, ${header.templateName})
    return: )
    <to uri="direct:remove-one-policy-from-active-pdp-group"/>
    <to uri="direct:delete-policy-from-loop-object"/>
    org.onap.policy.clamp.loop.LoopGET /v2/templates
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'template','','read'LoopController.removeOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})
    return: org.onap.policy.clamp.loop.template.LoopTemplatesService.getAllLoopTemplates()
  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.template.LoopTemplateLoop

GET /v2/templates/{templateName}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'template','','read')
    org.onap.policy.clamp.loop.template.LoopTemplatesService.getLoopTemplate(${header.templateName})
getAllLoopTemplates()
    return: org.onap.policy.clamp.loop.template.LoopTemplate

GET /v2/templates/names{templateName}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'template','','read')
    org.onap.policy.clamp.loop.template.LoopTemplatesService.getLoopTemplateNames(getLoopTemplate(${header.templateName})
    return: java.lang.String[]org.onap.policy.clamp.loop.template.LoopTemplate

GET /v2/templates/dictionarynames
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'toscatemplate','','read')
    org.onap.policy.clamp.loop.toscatemplate.DictionaryServiceLoopTemplatesService.getAllDictionariesgetLoopTemplateNames()"/>
    return: orgjava.onap.policy.clamp.tosca.Dictionarylang.String[]

GET /v2/dictionary/secondary/names
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
    org.onap.policy.clamp.tosca.DictionaryService.getAllSecondaryLevelDictionaryNamesgetAllDictionaries()"/>
    return: java.lang.String[]
         
org.onap.policy.clamp.tosca.Dictionary

GET /v2/dictionary/secondary/{dictionaryName}names
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
    org.onap.policy.clamp.tosca.DictionaryService.getDictionary(${header.dictionaryName}getAllSecondaryLevelDictionaryNames()"/>
    return: orgjava.onap.policy.clamp.tosca.DictionaryPUT /lang.String[]
         
GET /v2/dictionary/{dictionaryName}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','updateread')
    org.onap.policy.clamp.tosca.DictionaryService.saveOrUpdateDictionarygetDictionary(${exchangeProperty[DictionaryObject]header.dictionaryName})"/>
    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}, saveOrUpdateDictionary(${exchangeProperty[DictionaryObject]})
    return: org.onap.policy.clamp.tosca.Dictionary

DELETE PUT /v2/dictionary/{name}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','update')
    org.onap.policy.clamp.tosca.DictionaryService.deleteDictionarysaveOrUpdateDictionaryElement(${header.name})DELETE /v2/dictionary/{name}/elements/{shortName, ${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.deleteDictionaryElementdeleteDictionary(${header.name}, ${header.shortName})GET

DELETE /v2/policyToscaModels" return: org.onap.policy.clamp.loop.template.PolicyModel/dictionary/{name}/elements/{shortName}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','readupdate')
    org.onap.policy.clamp.loop.template.PolicyModelsService.getAllPolicyModels(tosca.DictionaryService.deleteDictionaryElement(${header.name}, ${header.shortName})

GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}" return: org.onap.policy.clamp.loop.template.PolicyModel
    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.JsonObjectGET /v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}
    getAllPolicyModels()

GET /v2/policyToscaModels/{policyModelType}/{policyModelVersion}
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'tosca','','read')
    org.onap.policy.clamp.loop.template.PolicyModelsService.getPolicyModelToscagetPolicyModelJson(${header.policyModelType},${header.policyModelVersion})
    return: javacom.google.langgson.StringJsonObject

GET /v2/policies" return: com.google.gson.JsonObject/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}
    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.mergePoliciesAndPdpGroupStatesgetPolicyModelTosca(${exchangeProperty[policiesListResponse]header.policyModelType},${exchangeProperty[pdpGroupInfoResponse]header.policyModelVersion})
POST /v2/policies/{policyModelType}/{policyModelVersion}/{policyName}/{policyVersion}    return: java.lang.String

GET /v2/policies" return: com.google.gson.JsonObject
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','updateread')
    org.onap.policy.clamp.loop.template.PolicyModelsService.getPolicyModelTosca(${header.policyModelType},${header.policyModelVersion})
    <method ref="<to uri="direct:get-all-policies"/>
    <to uri="direct:get-all-pdp-groups"/>
    org.onap.policy.clamp.policy.PolicyPayload" method="createPolicyPayload.pdpgroup.PoliciesPdpMerger.mergePoliciesAndPdpGroupStates(${header.policyModelTypeexchangeProperty[policiesListResponse]},${header.policyModelVersion}, ${header.policyName}, ${header.policyVersion}, ${exchangeProperty[policyProperties]}, ${body})"/>
    <to uri="direct:create-policy"/>
    return: com.google.gson.JsonObjectDELETE /exchangeProperty[pdpGroupInfoResponse]})

POST /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.org.onap.policy.clamp.loop.authorizationtemplate.AuthorizationControllerPolicyModelsService.authorize(*,'policies','','update'getPolicyModelTosca(${header.policyModelType},${header.policyModelVersion})
    <method ref="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.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:createundeploy-one-policy-type-from-pap"/>
    <to uri="direct:delete-policy"/>

PUT /v2/policies/pdpDeployment
    org.onap.policy.clamp.policyauthorization.downloaderAuthorizationController.PolicyEngineController.synchronizeAllPolicies()GET /v2/acm/getToscaTemplateauthorize(*,'policies','','update')
    org.onap.policy.clamp.policy.pdpgroup.PdpGroupPayload.generatePdpGroupPayloadFromList(${body})
    <to uri="direct:get-service-templateadd-multiple-policies-to-pdp-group"/>

    return: java.lang.StringPOST /v2/acm/commissionToscaTemplatePOST /v2/policies/policytype
    org.onap.policy.clamp.authorization.AuthorizationController.authorize(*,'policies','','update')
    <to uri="direct:commissioncreate-servicepolicy-templatetype"/>
    return: java.lang.StringDELETE /v2/acm/decommissionToscaTemplateorg.onap.policy.clamp.policy.downloader.PolicyEngineController.synchronizeAllPolicies()

GET /v2/acm/getToscaTemplate
    <to uri="direct:decommissionget-service-template"/>
    return: java.lang.String

DELETE POST /v2/acm/deleteToscaInstantiationcommissionToscaTemplate
    <to uri="direct:deletecommission-toscaservice-instantiationtemplate"/>
    return: java.lang.String

GET DELETE /v2/acm/getToscaInstantiationdecommissionToscaTemplate
    <to uri="direct:getdecommission-toscaservice-instantiationtemplate"/>
    return: java.lang.String

GET DELETE /v2/acm/getInstantiationOrderStatedeleteToscaInstantiation
    <to uri="direct:getdelete-tosca-instantiation-order-state"/>
    return: java.lang.String

GET /v2/acm/getJsonSchemagetToscaInstantiation
    <to uri="direct:get-jsontosca-schemainstantiation"/>
    return: java.lang.String

GET /v2/acm/getElementDefinitionsgetInstantiationOrderState
    <to uri="direct:get-tosca-elementinstantiation-order-definitionsstate"/>
    return: java.lang.String

GET /v2/acm/getAutomationCompositionDefinitionsgetJsonSchema
    <to uri="direct:get-acmjson-definitionsschema"/>
    return: java.lang.String

POST GET /v2/acm/postToscaInstancePropertiesgetElementDefinitions
    <to uri="direct:postget-toscaelement-instance-propertiesdefinitions"/>
    return: java.lang.String"DELETE

GET /v2/acm/deleteToscaInstancePropertiesgetAutomationCompositionDefinitions
    <to uri="direct:deleteget-toscaacm-instance-propertiesdefinitions"/>
    return: java.lang.StringGET

POST /v2/acm/getCommonOrInstancePropertiespostToscaInstanceProperties
    <to uri="direct:getpost-common-ortosca-instance-properties"/>
    return: java.lang.String"

POST DELETE /v2/acm/postToscaInstantiationdeleteToscaInstanceProperties
    <to uri="direct:postdelete-tosca-instantiationinstance-properties"/>    
    return: java.lang.StringPUT

GET /v2/acm/putToscaInstantiationStateChangegetCommonOrInstanceProperties
    <to uri="direct:putget-tosca-instantiationcommon-or-instance-properties"/>
    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 or direct call.

Logging

...

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.