X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Frenderer%2Fprovisiondevice%2Ftasks%2FDeviceRenderingTask.java;h=6a30f950d7f00efc5d24eb19c638e32a57b364b5;hb=refs%2Fchanges%2F97%2F102497%2F2;hp=888e6295664fce3fc6cf31dd95ec945a1147fd7b;hpb=70443644ba70b8634539ca58e94d61ab57fc2c22;p=transportpce.git diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/tasks/DeviceRenderingTask.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/tasks/DeviceRenderingTask.java index 888e62956..6a30f950d 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/tasks/DeviceRenderingTask.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/tasks/DeviceRenderingTask.java @@ -14,8 +14,8 @@ import org.opendaylight.transportpce.renderer.ServicePathInputData; import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService; import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRenderingResult; import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev200128.ServicePathOutput; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200615.olm.renderer.input.Nodes; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.ServicePathOutput; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.optical.renderer.nodes.Nodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,15 +36,31 @@ public class DeviceRenderingTask implements Callable { @Override public DeviceRenderingResult call() throws Exception { - ServicePathOutput output = this.deviceRenderer.setupServicePath(this.servicePathInputData.getServicePathInput(), - this.direction); - if (!output.isSuccess()) { - LOG.warn("Device rendering not successfully finished."); + ServicePathOutput output; + String operation; + List olmList = null; + switch (this.servicePathInputData.getServicePathInput().getOperation()) { + case Create: + operation = "setup"; + output = this.deviceRenderer.setupServicePath(this.servicePathInputData.getServicePathInput(), + this.direction); + olmList = this.servicePathInputData.getNodeLists().getOlmNodeList(); + break; + case Delete: + operation = "delete"; + output = this.deviceRenderer.deleteServicePath(this.servicePathInputData.getServicePathInput()); + break; + default: + return DeviceRenderingResult.failed("Device rendering failed - unknown operation"); + } + if (!output.getSuccess()) { + LOG.error("Device rendering {} service path failed.", operation); return DeviceRenderingResult.failed("Operation Failed"); } - List olmList = this.servicePathInputData.getNodeLists().getOlmList(); - LOG.info("Device rendering finished successfully."); - return DeviceRenderingResult.ok(olmList, new ArrayList<>(output.nonnullNodeInterface().values())); + LOG.info("Device rendering {} service path finished successfully.", operation); + return DeviceRenderingResult.ok(olmList, new ArrayList<>(output.nonnullNodeInterface().values()), + new ArrayList<>(output.nonnullLinkTp())); + } }