Merge "ROADM To ROADM Path Calculation"
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / openroadminterface / OpenRoadmInterfaceFactory.java
index 5d3b2a86eedde87c858047863aff58c1a17fc031..70abad7dc1453e4abe2109dc8704fbefca632412 100644 (file)
@@ -13,6 +13,7 @@ import org.opendaylight.transportpce.common.mapping.PortMapping;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfacesImpl;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev170228.network.nodes.Mapping;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.PowerDBm;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceKey;
@@ -40,11 +41,13 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.OTU4;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.OtuAttributes;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.otu.container.OtuBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.portmapping.rev170228.network.nodes.Mapping;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class OpenRoadmInterfaceFactory {
     private final PortMapping portMapping;
     private final OpenRoadmInterfaces openRoadmInterfaces;
+    private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterfaceFactory.class);
 
     public OpenRoadmInterfaceFactory(PortMapping portMapping, OpenRoadmInterfaces openRoadmInterfaces) {
         this.portMapping = portMapping;
@@ -87,10 +90,12 @@ public class OpenRoadmInterfaceFactory {
      * This methods creates an OCH interface on the given termination point on
      * Roadm.
      *
-     * @param waveNumber
-     *            wavelength number of the OCH interface.
+     * @param nodeId node ID
+     * @param logicalConnPoint logical Connection Point
+     * @param waveNumber wavelength number of the OCH interface
      *
      * @return Name of the interface if successful, otherwise return null.
+     * @throws OpenRoadmInterfaceException OpenRoadmInterfaceException
      */
 
     public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber)
@@ -175,8 +180,12 @@ public class OpenRoadmInterfaceFactory {
     /**
      * This methods creates an ODU interface on the given termination point.
      *
+     * @param nodeId node ID
+     * @param logicalConnPoint logical Connection Point
+     * @param supportingOtuInterface supporting OTU Interface
      *
      * @return Name of the interface if successful, otherwise return null.
+     * @throws OpenRoadmInterfaceException OpenRoadmInterfaceException
      */
 
     public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
@@ -217,6 +226,9 @@ public class OpenRoadmInterfaceFactory {
     /**
      * This methods creates an OTU interface on the given termination point.
      *
+     * @param nodeId node ID
+     * @param logicalConnPoint logical Connection Point
+     * @param supportOchInterface support OCH Interface
      *
      * @return Name of the interface if successful, otherwise return null.
      * @throws OpenRoadmInterfaceException OpenRoadmInterfaceException
@@ -285,8 +297,9 @@ public class OpenRoadmInterfaceFactory {
             if (mapping.getSupportingOts() != null) {
                 omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
             } else {
-                throw new OpenRoadmInterfaceException(String.format("Unable to get ots interface from mapping % - %",
-                    nodeId, mapping.getLogicalConnectionPoint()));
+                LOG.error("Unable to get ots interface from mapping {} - {}", nodeId,
+                        mapping.getLogicalConnectionPoint());
+                return null;
             }
             this.openRoadmInterfaces.postInterface(nodeId, omsInterfaceBldr);
             this.portMapping.updateMapping(nodeId, mapping);