package org.opendaylight.transportpce.renderer.provisiondevice;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;
@Override
public OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input) {
- LOG.info("Calling setup service path");
+ LOG.info("Calling setup otn-service path");
boolean success = true;
List<NodeInterface> nodeInterfaces = new ArrayList<>();
List<String> results = new ArrayList<>();
results.add("Otn Service path was set up successfully for node :" + nodeInterface.getNodeId());
}
}
+ Map<NodeInterfaceKey,NodeInterface> nodeInterfacesMap = new HashMap<>();
+ for (NodeInterface nodeInterface : nodeInterfaces) {
+ if (nodeInterface != null) {
+ nodeInterfacesMap.put(nodeInterface.key(), nodeInterface);
+ }
+ }
OtnServicePathOutputBuilder otnServicePathOutputBuilder = new OtnServicePathOutputBuilder()
.setSuccess(success)
- .setNodeInterface(nodeInterfaces)
+ .setNodeInterface(nodeInterfacesMap)
.setResult(String.join("\n", results));
return otnServicePathOutputBuilder.build();
}
public OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input) {
+ if (input == null) {
+ LOG.error("Unable to delete otn service path. input = null");
+ return new OtnServicePathOutputBuilder().setResult("Unable to delete otn service path. input = null")
+ .setSuccess(false).build();
+ }
List<Nodes> nodes = input.getNodes();
AtomicBoolean success = new AtomicBoolean(true);
ConcurrentLinkedQueue<String> results = new ConcurrentLinkedQueue<>();