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}/{operationalPolicyName}
    <to uri="direct:load-loop"/>microServicePolicyName}
    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-loop"remove-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-statusfrom-active-forpdp-loopgroup"/>
    <to uri="direct:updatedelete-dcaepolicy-statusfrom-forloop-loopobject"/>
    <to uri="direct:updatedelete-loop-statepolicy-from-loop-object"/>
    return: org.onap.policy.clamp.loop.LoopPUT .LoopController.deleteLoop(${header.loopName})

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

...

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.