Adapt renderer to manage 100GE service on Switch
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / provisiondevice / tasks / DeviceRenderingTask.java
index fe83c8a9b8be62a989609b365a2f0f2eac8190a3..a45ebe86524576a2b32b6fae4a163ff84d8c01a4 100644 (file)
@@ -36,15 +36,31 @@ public class DeviceRenderingTask implements Callable<DeviceRenderingResult> {
 
     @Override
     public DeviceRenderingResult call() throws Exception {
-        ServicePathOutput output = this.deviceRenderer.setupServicePath(this.servicePathInputData.getServicePathInput(),
-                this.direction);
+        ServicePathOutput output;
+        String operation;
+        List<Nodes> 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.warn("Device rendering not successfully finished.");
+            LOG.error("Device rendering {} service path failed.", operation);
             return DeviceRenderingResult.failed("Operation Failed");
         }
-        List<Nodes> olmList = this.servicePathInputData.getNodeLists().getOlmNodeList();
-        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()));
+
     }
 
 }