@ApiOperation( value = "Gets a single VNF from the NSD", notes = "Returns the VNFD with the id specified in the URL and that is part of the specified NSD") @RequestMapping( value = "{idNsd}/vnfdescriptors/{idVfnd}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) public VirtualNetworkFunctionDescriptor getVirtualNetworkFunctionDescriptor( @PathVariable("idNsd") String idNsd, @PathVariable("idVfnd") String idVfnd, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { return networkServiceDescriptorManagement.getVirtualNetworkFunctionDescriptor( idNsd, idVfnd, projectId); }
@Test @SuppressWarnings({"unsafe", "unchecked"}) public void VNFDNotFoundException() throws NotFoundException { exception.expect(NotFoundException.class); when(nsdManagement.getVirtualNetworkFunctionDescriptor(anyString(), anyString(), anyString())) .thenThrow(NotFoundException.class); restNetworkService.getVirtualNetworkFunctionDescriptor( networkServiceDescriptor.getId(), "-1", "pi"); }
@Test public void getVNFD() throws NotFoundException { VirtualNetworkFunctionDescriptor vnfd = networkServiceDescriptor.getVnfd().iterator().next(); when(nsdManagement.getVirtualNetworkFunctionDescriptor(anyString(), anyString(), anyString())) .thenReturn(vnfd); assertEquals( vnfd, restNetworkService.getVirtualNetworkFunctionDescriptor( networkServiceDescriptor.getId(), vnfd.getId(), "peojectid")); }