Update testtool version in tests folder
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / provisiondevice / CrossConnect.java
index 94404c1336bc1f63035afb203e1ccccc9e988f1e..993a6a7622d92afbd09c244f0368fe137ddae5b7 100644 (file)
@@ -64,16 +64,11 @@ public class CrossConnect {
      * This method return the RoadmConnection subtree for a given connection
      * number.
      *
-     * @param connectionNumber
-     *            Name of the cross connect.
-     *
      * @return Roadm connection subtree from the device.
      */
-    public RoadmConnections getCrossConnect(String connectionNumber) {
-        if (connectionNumber == null && this.connectionNumber != null) {
-            connectionNumber = this.connectionNumber;
-        }
-        if (deviceDb != null) {
+    public RoadmConnections getCrossConnect() {
+
+        if (deviceDb != null && connectionNumber != null) {
             ReadOnlyTransaction rtx = deviceDb.newReadOnlyTransaction();
             Optional<RoadmConnections> roadmConnectionsObject;
             try {
@@ -131,21 +126,7 @@ public class CrossConnect {
         }
     }
 
-    /**
-     * This method does a delete(edit-config) on roadm connection subtree for a
-     * given connection number.
-     *
-     * @param connectionNumber
-     *            Name of the cross connect.
-     * @return true/false based on status of operation.
-     */
 
-    public boolean deleteCrossConnect(String connectionNumber) {
-        if (connectionNumber == null && this.connectionNumber != null) {
-            connectionNumber = this.connectionNumber;
-        }
-        return deleteCrossConnect();
-    }
 
     /**
      * This method does a delete(edit-config) on roadm connection subtree for a
@@ -157,7 +138,7 @@ public class CrossConnect {
     public boolean deleteCrossConnect() {
 
         //Check if cross connect exists before delete
-        if (getCrossConnect(connectionNumber) == null) {
+        if (getCrossConnect() == null) {
             LOG.info("Cross connect does not exist, halting delete");
             return false;
         }
@@ -180,25 +161,7 @@ public class CrossConnect {
         }
     }
 
-    /**
-     * This method does an edit-config on roadm connection subtree for a given
-     * connection number in order to set power level for use by the optical
-     * power control.
-     *
-     * @param mode
-     *            Optical control modelcan be off, power or gainLoss.
-     * @param value
-     *            Power value in DBm.
-     * @param connectionNumber
-     *            Name of the cross connect.
-     * @return true/false based on status of operation.
-     */
-    public boolean setPowerLevel(OpticalControlMode mode, PowerDBm value, String connectionNumber) {
-        if (connectionNumber == null && this.connectionNumber != null) {
-            connectionNumber = this.connectionNumber;
-        }
-        return setPowerLevel(mode, value);
-    }
+
 
     /**
      * This method does an edit-config on roadm connection subtree for a given
@@ -213,7 +176,7 @@ public class CrossConnect {
      */
     public boolean setPowerLevel(OpticalControlMode mode, PowerDBm value) {
 
-        RoadmConnections rdmConn = getCrossConnect(connectionNumber);
+        RoadmConnections rdmConn = getCrossConnect();
         if (rdmConn != null) {
             RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder(rdmConn);
             rdmConnBldr.setOpticalControlMode(mode);
@@ -226,7 +189,7 @@ public class CrossConnect {
                 try {
                     submit.checkedGet();
                     LOG.info("Roadm connection power level successfully set ");
-                    return false;
+                    return true;
                 } catch (TransactionCommitFailedException ex) {
                     LOG.info("Failed to post {} ", rdmConnBldr.build(), ex);
                     return false;
@@ -289,4 +252,4 @@ public class CrossConnect {
         }
         return null;
     }
-}
+}
\ No newline at end of file