imp: added api for getting vdu directly from vnfd
@@ -19,6 +19,7 @@ package org.openbaton.nfvo.api.catalogue;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.validation.Valid;
+import org.openbaton.catalogue.mano.descriptor.VirtualDeploymentUnit;
import org.openbaton.catalogue.mano.descriptor.VirtualNetworkFunctionDescriptor;
import org.openbaton.exceptions.EntityInUseException;
import org.openbaton.exceptions.NotFoundException;
@@ -168,4 +169,22 @@ public class RestVirtualNetworkFunctionDescriptor {
@RequestHeader(value = "project-id") String projectId) {
return vnfdManagement.update(virtualNetworkFunctionDescriptor, id, projectId);
}
+
+ @ApiOperation(
+ value = "Retrieving a Virtual Deployment Unit",
+ notes =
+ "The vnfdId in the URL belongs to the requested Virtual Network Function Descriptor and the vduId to the Virtual Deployment Unit inside the VNFD"
+ )
+ @RequestMapping(value = "{vnfdId}/vdus/{vduId}", method = RequestMethod.GET)
+ public VirtualDeploymentUnit getVDU(
+ @PathVariable("vnfdId") String vnfdId,
+ @PathVariable("vduId") String vduId,
+ @RequestHeader(value = "project-id") String projectId)
+ throws NotFoundException {
+
+ for (VirtualDeploymentUnit vdu : vnfdManagement.query(vnfdId, projectId).getVdu()) {
+ if (vdu.getId().equals(vduId)) return vdu;
+ }
+ throw new NotFoundException("No vdu with id: " + vduId + " was found.");
+ }
}
