* 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 {
}
}
- /**
- * 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
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;
}
}
}
- /**
- * 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
*/
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);
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;
}
return null;
}
-}
+}
\ No newline at end of file