+ @PostMapping(value = "/operations/GENERIC-RESOURCE-API:vf-module-topology-operation/",
+ consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
+ produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+ public ResponseEntity<?> postVfModuleOperationInformation(
+ @RequestBody final InputRequest<GenericResourceApiVfModuleOperationInformation> inputRequest,
+ final HttpServletRequest request) {
+ LOGGER.info("Request Received for VfModule : {} ...", inputRequest);
+
+ final GenericResourceApiVfModuleOperationInformation apiVfModuleperationInformation = inputRequest.getInput();
+ if (apiVfModuleperationInformation == null) {
+ LOGGER.error("Invalid input request: {}", inputRequest);
+ return ResponseEntity.badRequest().build();
+ }
+
+ final Output output = getOutput(apiVfModuleperationInformation);
+ final OutputRequest outputRequest = new OutputRequest(output);
+
+ if (output.getResponseCode().equals(HTTP_STATUS_OK)) {
+ LOGGER.info("Sucessfully executed request vnf sending response: {}", outputRequest);
+ return ResponseEntity.ok(outputRequest);
+ }
+
+ LOGGER.error("Unable to execute input request: {}, will send OutputRequest: {}", inputRequest, outputRequest);
+ return ResponseEntity.badRequest().body(outputRequest);
+
+ }
+
+ private Output getOutput(final GenericResourceApiVfModuleOperationInformation apiVfModuleOperationInformation) {
+
+ return cacheServiceProvider.putVfModuleOperationInformation(apiVfModuleOperationInformation);
+ }
+
+
+ @GetMapping(value = "/config/GENERIC-RESOURCE-API:services/service/{service-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vnf-topology/")
+ public ResponseEntity<?> getVNf(@PathVariable("service-id") String serviceId,
+ @PathVariable("vnf-id") String vnfId) {
+
+ LOGGER.info("Get vnf-topology with serviceId {} and vnfId {}",serviceId, vnfId);
+ GenericResourceApiVnfTopology genericResourceApiVnfTopology = new GenericResourceApiVnfTopology();
+
+ genericResourceApiVnfTopology = cacheServiceProvider.getGenericResourceApiVnfTopology();
+ return ResponseEntity.ok(genericResourceApiVnfTopology);
+ }
+
+ @GetMapping(value = "/config/GENERIC-RESOURCE-API:services/service/{service-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vf-modules/vf-module/{vf-module-id}/vf-module-data/vf-module-topology/", produces = {
+ MediaType.APPLICATION_JSON })
+ public ResponseEntity<?> getVFmodule(@PathVariable("service-id") String serviceId,
+ @PathVariable("vnf-id") String vnfId, @PathVariable("vf-module-id") String vfModuleId) {
+ LOGGER.info("Get vfModule-topology with serviceId {}, vnfId {} and vfModuleId {}",serviceId, vnfId,vfModuleId);
+
+ GenericResourceApiVfModuleTopology genericResourceApiVfModuleTopology = new GenericResourceApiVfModuleTopology();
+
+ genericResourceApiVfModuleTopology = cacheServiceProvider.getGenericResourceApiVfModuleTopology();
+ return ResponseEntity.ok(genericResourceApiVfModuleTopology);
+
+ }