- Mapping mapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint());
- if (mapping != null) {
- String otsInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtsInterface(input.getNodeId(),
- mapping);
- mapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint());
- String omsInterface = this.openRoadmInterfaceFactory.createOpenRoadmOmsInterface(input.getNodeId(),
- mapping);
- result = "Interfaces " + otsInterface + " - " + omsInterface + " successfully created on node " + input
- .getNodeId();
- success = true;
+ Mapping oldMapping = null;
+ Mapping newMapping = null;
+ oldMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint());
+ if (oldMapping != null) {
+ String otsInterface =
+ this.openRoadmInterfaceFactory.createOpenRoadmOtsInterface(input.getNodeId(), oldMapping);
+ newMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint());
+ int count = 0;
+ Boolean isSupportingOtsPresent = isSupportingOtsPresent(newMapping);
+ while (!isSupportingOtsPresent && (count < 6)) {
+ LOG.info("waiting for post interface operation on node '{}'...", input.getNodeId());
+ try {
+ Thread.sleep(10000);
+ this.portMapping.updateMapping(input.getNodeId(), oldMapping);
+ } catch (InterruptedException e) {
+ LOG.error("Failed to wait for post interface operation ");
+ }
+ newMapping = this.portMapping.getMapping(input.getNodeId(), input.getLogicalConnectionPoint());
+ isSupportingOtsPresent = isSupportingOtsPresent(newMapping);
+ count++;
+ }
+ if (count < 6) {
+ String omsInterface =
+ this.openRoadmInterfaceFactory.createOpenRoadmOmsInterface(input.getNodeId(), newMapping);
+ if (omsInterface != null) {
+ result = "Interfaces " + otsInterface + " - " + omsInterface + " successfully created on node "
+ + input.getNodeId();
+ success = true;
+ } else {
+ LOG.error("Fail to create OpenRoadmOms Interface for node '{}'", input.getNodeId());
+ result = "Fail to create OpenRoadmOms Interface for node : " + input.getNodeId();
+ }
+ } else {
+ LOG.error("Unable to get ots interface from mapping {} for node {}",
+ oldMapping.getLogicalConnectionPoint(), input.getNodeId());
+ result = String.format("Unable to get ots interface from mapping %s - %s",
+ oldMapping.getLogicalConnectionPoint(), input.getNodeId());
+ }