/** * This operation is used to remove a Network Service Record * * @param id : the id of Network Service Record */ @ApiOperation( value = "Remove a Network Service Record", notes = "Removes the Network Service Record that has the id specified in the URL") @RequestMapping(value = "{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void delete( @PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId) throws InterruptedException, ExecutionException, NotFoundException, BadFormatException, WrongStatusException { networkServiceRecordManagement.delete(id, projectId); }
@ApiOperation( value = "Remove all VNFC Instances from all VDUs", notes = "Deletes all VNFC Instances from all VDUS in a VNFR") @RequestMapping( value = "{id}/vnfrecords/{idVnf}/vdunits/vnfcinstances", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteVNFCInstance( @PathVariable("id") String id, @PathVariable("idVnf") String idVnf, @RequestHeader(value = "project-id") String projectId) throws NotFoundException, BadFormatException, WrongStatusException, InterruptedException, ExecutionException, VimException, PluginException { networkServiceRecordManagement.deleteVNFCInstance(id, idVnf, projectId); }
@ApiOperation( value = "Remove a VNF Dependency from a NSR", notes = "Removes a VNF Dependency based on a VNFR it concerns") @RequestMapping(value = "{idNsr}/vnfdependencies/{idVnfd}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteVNFDependency( @PathVariable("idNsr") String idNsr, @PathVariable("idVnfd") String idVnfd, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { networkServiceRecordManagement.deleteVNFDependency(idNsr, idVnfd, projectId); }
@ApiOperation( value = "Update a Virtual Network Function Record in a NSR", notes = "Specify the ids of the parent NSR and of the VNFR which will be updated") @RequestMapping(value = "{idNsr}/vnfrecords/{idVnfr}/update", method = RequestMethod.POST) @ResponseStatus(HttpStatus.ACCEPTED) public void updateVnfr( @PathVariable("idNsr") String idNsr, @PathVariable("idVnfr") String idVnfr, @RequestHeader(value = "project-id") String projectId) throws NotFoundException, BadFormatException, ExecutionException, InterruptedException { NetworkServiceRecord nsr = networkServiceRecordManagement.query(idNsr, projectId); VirtualNetworkFunctionRecord vnfRecord = networkServiceRecordManagement.getVirtualNetworkFunctionRecord(idNsr, idVnfr, projectId); nsr.getVnfr().add(vnfRecord); log.info("Executing UPDATE for VNFR: " + vnfRecord.getName()); networkServiceRecordManagement.updateVnfr(idNsr, idVnfr, projectId); }
@ApiOperation( value = "Add a VNF Dependency to a NSR", notes = "Adds a new VNF Dependency to the specified NSR") @RequestMapping( value = "{id}/vnfdependencies/", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public VNFRecordDependency postVNFDependency( @RequestBody @Valid VNFRecordDependency vnfDependency, @PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { NetworkServiceRecord nsr = networkServiceRecordManagement.query(id, projectId); nsr.getVnf_dependency().add(vnfDependency); networkServiceRecordManagement.update(nsr, id, projectId); return vnfDependency; }
@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); }
/** * This operation returns the Network Service Descriptor (NSD) selected by id * * @param id : the id of Network Service Descriptor * @return NetworkServiceRecord: the Network Service Descriptor selected */ @ApiOperation( value = "Retrieving a Network Service Record", notes = "The id in the URL belongs to the NSR that should be retrieved") @RequestMapping(value = "{id}", method = RequestMethod.GET) public NetworkServiceRecord findById( @PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { return networkServiceRecordManagement.query(id, projectId); }
@ApiOperation( value = "Restarts a VNFR in an NSR", notes = "Restarts a VNFR, rebuilding to a different image if specified") @RequestMapping( value = "{idNsr}/vnfrecords/{idVnfr}/restart", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public void restartVNFR( @RequestBody @Valid JsonObject body, @PathVariable("idNsr") String nsrId, @PathVariable("idVnfr") String vnfrId, @RequestHeader(value = "project-id") String projectId) throws NotFoundException, InterruptedException, BadRequestException, AlreadyExistingException, VimException, ExecutionException, PluginException, IOException, BadFormatException { log.debug("Received request for restarting a VNFR"); if (!body.has("imageName") || !body.getAsJsonPrimitive("imageName").isString()) throw new BadRequestException( "The passed JSON is not correct. It should include a string field named: imageName"); String imageName = body.getAsJsonPrimitive("imageName").getAsString(); // check if nsr exists NetworkServiceRecord nsr = networkServiceRecordManagement.query(nsrId, projectId); networkServiceRecordManagement.restartVnfr(nsr, vnfrId, imageName, projectId); }
networkServiceRecordManagement.getVirtualNetworkFunctionRecord(idNsr, idVnfr, projectId); networkServiceRecordManagement.executeScript(idNsr, idVnfr, projectId, script);
+ "\nand\n" + vimInstanceNames); networkServiceRecordManagement.addVNFCInstance( id, idVnf, idVdu, component, "standby", projectId, vimInstanceNames);
/** * Returns the VirtualNetworkFunctionRecord with idVnf into NSR with idNsr * * @param idNsr of NSR * @param idVnf of VirtualNetworkFunctionRecord * @return VirtualNetworkFunctionRecord selected by idVnf * @throws NotFoundException */ @ApiOperation( value = "Return a single Virtual Network Function Record of a NSR ", notes = "The id of NSR and the id of the VNFR are specified in the URL") @RequestMapping( value = "{idNsr}/vnfrecords/{idVnf}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) public VirtualNetworkFunctionRecord getVirtualNetworkFunctionRecord( @PathVariable("idNsr") String idNsr, @PathVariable("idVnf") String idVnf, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { return networkServiceRecordManagement.getVirtualNetworkFunctionRecord(idNsr, idVnf, projectId); }
/** * Removes the VirtualNetworkFunctionRecord with idVnf into NSR with idNsr * * @param idNsr id of the NSR * @param idVnf id of the VNF * @throws NotFoundException */ @ApiOperation( value = "Remove a single Virtual Network Function Record of a NSR", notes = "The id of NSR and the id of the VNFR are specified in the URL") @RequestMapping(value = "{idNsr}/vnfrecords/{idVnf}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void deleteVNFRecord( @PathVariable("idNsr") String idNsr, @PathVariable("idVnf") String idVnf, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { networkServiceRecordManagement.deleteVNFRecord(idNsr, idVnf, projectId); }
return networkServiceRecordManagement.onboard( id, projectId, keys, vduVimInstances, configurations, monitoringIp);
@ApiOperation(value = "", notes = "", hidden = true) @RequestMapping( value = "{id}/vnfrecords/{idVnf}/vdunits/{idVdu}/vnfcinstances/{idVNFCI}/actions", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public void postAction( @RequestBody @Valid NFVMessage nfvMessage, @PathVariable("id") String id, @PathVariable("idVnf") String idVnf, @PathVariable("idVdu") String idVdu, @PathVariable("idVNFCI") String idVNFCI, @RequestHeader(value = "project-id") String projectId) throws NotFoundException, BadFormatException, ExecutionException, InterruptedException { log.debug("Received: " + nfvMessage); networkServiceRecordManagement.executeAction(nfvMessage, id, idVnf, idVdu, idVNFCI, projectId); }
@ApiOperation( value = "Add a Virtual Network Function Record", notes = "Add a new VNFR to an already existing NSR") @RequestMapping( value = "{id}/vnfrecords/", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) public VirtualNetworkFunctionRecord postVNFR( @RequestBody @Valid VirtualNetworkFunctionRecord vnfRecord, @PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { NetworkServiceRecord nsr = networkServiceRecordManagement.query(id, projectId); nsr.getVnfr().add(vnfRecord); networkServiceRecordManagement.update(nsr, id, projectId); return vnfRecord; }
/** * Returns the list of PhysicalNetworkFunctionRecord into a NSD with id * * @param id : The id of NSD * @return List<PhysicalNetworkFunctionRecord>: The List of PhysicalNetworkFunctionRecord into NSD */ @ApiOperation(value = "", notes = "", hidden = true) @RequestMapping( value = "{id}/pnfrecords", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) public Set<PhysicalNetworkFunctionRecord> getPhysicalNetworkFunctionRecord( @PathVariable("id") String id, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { NetworkServiceRecord nsr = networkServiceRecordManagement.query(id, projectId); return nsr.getPnfr(); }
@ApiOperation( value = "Add a VNFC instance to a random VDU of a VNFR", notes = "Adds a VNFC instance by only specifying the VNFR and the NSR") @RequestMapping( value = "{id}/vnfrecords/{idVnf}/vdunits/vnfcinstances", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.CREATED) @SuppressWarnings("unchecked") public void postVNFCInstance( @RequestBody @Valid JsonObject body, @PathVariable("id") String id, @PathVariable("idVnf") String idVnf, @RequestHeader(value = "project-id") String projectId) throws NotFoundException, BadFormatException, WrongStatusException, BadRequestException { if (!body.has("vnfComponent")) throw new BadRequestException( "The passed request body is not correct. It should include a field named: vnfComponent"); VNFComponent component = retrieveVNFComponentFromRequest(body); List<String> vimInstanceNames = retrieveVimInstanceNamesFromRequest(body); log.trace("Received: " + component + "\nand\n" + vimInstanceNames); networkServiceRecordManagement.addVNFCInstance( id, idVnf, component, projectId, vimInstanceNames); }
@ApiOperation( value = "Returns the history of the VNFRs of an NSR", notes = "Returns the history of the specified VNFR") @RequestMapping( value = "{id}/vnfrecords/{id_vnf}/history", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public LinkedHashSet<HistoryLifecycleEvent> getHistory( @PathVariable("id") String id, @PathVariable("id_vnf") String id_vnf, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { return (LinkedHashSet<HistoryLifecycleEvent>) networkServiceRecordManagement .getVirtualNetworkFunctionRecord(id, id_vnf, projectId) .getLifecycle_event_history(); }
/** * Removes multiple Virtual Network Function Records from the NSR repository * * @param ids: the id list of Virtual Network Function Records * @throws NotFoundException * @throws InterruptedException * @throws ExecutionException * @throws WrongStatusException * @throws VimException */ @ApiOperation( value = "Removing multiple Virtual Network Function Records", notes = "The list of ids in the Request Body specify the Virtual Network Function Records that will be deleted") @RequestMapping( value = "{idNsr}/vnfrecords/multipledelete", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.NO_CONTENT) public void vnfrMultipleDelete( @RequestBody @Valid List<String> ids, @PathVariable("idNsr") String idNsr, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { log.trace("NSR ID: " + idNsr + " Project ID: " + projectId + " VNFR IDs: " + ids); for (String idVnfr : ids) { networkServiceRecordManagement.deleteVNFRecord(idNsr, idVnfr, projectId); } }
return networkServiceRecordManagement.onboard( networkServiceDescriptor, projectId,