@ApiOperation( value = "Upgrade a Virtual Network Function Record in a NSR", notes = "Specify the ids of the parent NSR and of the VNFR which will be upgraded") @RequestMapping( value = "{idNsr}/vnfrecords/{idVnfr}/upgrade", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public void upgradeVnfr( @PathVariable("idNsr") String idNsr, @PathVariable("idVnfr") String idVnfr, @RequestHeader(value = "project-id") String projectId, @RequestBody @Valid JsonObject body) throws NotFoundException, BadFormatException, BadRequestException, ExecutionException, InterruptedException, IOException, VimException, PluginException { NetworkServiceRecord nsr = networkServiceRecordManagement.query(idNsr, projectId); VirtualNetworkFunctionRecord vnfRecord = networkServiceRecordManagement.getVirtualNetworkFunctionRecord(idNsr, idVnfr, projectId); nsr.getVnfr().add(vnfRecord); String upgradeRequestEntityKey = "vnfdId"; if (!body.has(upgradeRequestEntityKey) || !body.getAsJsonPrimitive(upgradeRequestEntityKey).isString()) throw new BadRequestException( "The passed JSON is not correct. It should include a string field named: " + upgradeRequestEntityKey); // String vnfPackageId = body.getAsJsonPrimitive("vnfPackageId").getAsString(); String upgradeVnfdId = body.getAsJsonPrimitive(upgradeRequestEntityKey).getAsString(); log.info("Executing UPGRADE for VNFR: " + vnfRecord.getName()); networkServiceRecordManagement.upgradeVnfr(idNsr, idVnfr, projectId, upgradeVnfdId); }