Adding wavelenght to port view and MHz to command

Change-Id: Iecdf46c82cd2df4fe1b46f759d32a1c49a7dd9d6
(cherry picked from commit 02e2eb4ee23b7032e4d3f56b5087d169edac2e46)
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/cli/PortWaveLengthCommand.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/cli/PortWaveLengthCommand.java
index 9f50458..568df72 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/cli/PortWaveLengthCommand.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/cli/PortWaveLengthCommand.java
@@ -32,6 +32,7 @@
 import org.onosproject.net.Device;
 import org.onosproject.net.GridType;
 import org.onosproject.net.OchSignal;
+import org.onosproject.net.Port;
 import org.onosproject.net.device.DeviceService;
 import org.onosproject.net.flow.DefaultFlowRule;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -41,8 +42,11 @@
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.flow.instructions.Instructions;
+import org.onosproject.net.optical.OchPort;
+import org.onosproject.net.optical.device.OchPortHelper;
 
 import java.util.Map;
+import java.util.Optional;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -63,6 +67,7 @@
     private static final String CH_25 = "25";
     private static final String CH_50 = "50";
     private static final String CH_100 = "100";
+    public static final long BASE_FREQUENCY = 193100000;   //Working in Mhz
 
     private static final Map<String, ChannelSpacing> CHANNEL_SPACING_MAP = ImmutableMap
             .<String, ChannelSpacing>builder()
@@ -83,18 +88,18 @@
     @Completion(OpticalConnectPointCompleter.class)
     String connectPointString = "";
 
+    @Argument(index = 2, name = "value",
+            description = "Optical Signal or wavelength. Provide wavelenght in MHz, while Och Format = "
+                    + SIGNAL_FORMAT, required = false, multiValued = false)
+    String parameter = "";
 
-    @Argument(index = 2, name = "signal",
-            description = "Optical Signal. Format = " + SIGNAL_FORMAT,
-            required = true, multiValued = false)
-    String signal = "";
 
     private OchSignal createOchSignal() throws IllegalArgumentException {
-        if (signal == null) {
+        if (parameter == null) {
             return null;
         }
         try {
-            String[] splitted = signal.split("/");
+            String[] splitted = parameter.split("/");
             checkArgument(splitted.length == 4,
                     "signal requires 4 parameters: " + SIGNAL_FORMAT);
             int slotGranularity = Integer.parseInt(splitted[0]);
@@ -111,12 +116,54 @@
              * are subclasses of RuntimeException.
              */
             String msg = String.format("Invalid signal format: %s, expected format is %s.",
-                    signal, SIGNAL_FORMAT);
+                    parameter, SIGNAL_FORMAT);
             print(msg);
             throw new IllegalArgumentException(msg, e);
         }
     }
 
+    private OchSignal createOchSignalFromWavelength(DeviceService deviceService, ConnectPoint cp) {
+        long wavelength = Long.parseLong(parameter);
+        if (wavelength == 0L) {
+            return null;
+        }
+        Port port = deviceService.getPort(cp);
+        Optional<OchPort> ochPortOpt = OchPortHelper.asOchPort(port);
+
+        if (ochPortOpt.isPresent()) {
+            OchPort ochPort = ochPortOpt.get();
+            GridType gridType = ochPort.lambda().gridType();
+            ChannelSpacing channelSpacing = ochPort.lambda().channelSpacing();
+            int slotGranularity = ochPort.lambda().slotGranularity();
+            int multiplier = getMultplier(wavelength, gridType, channelSpacing, slotGranularity);
+            return new OchSignal(gridType, channelSpacing, multiplier, slotGranularity);
+        } else {
+            print("Connect point %s is not OChPort", cp);
+            return null;
+        }
+
+    }
+
+    private int getMultplier(long wavelength, GridType gridType, ChannelSpacing channelSpacing, int slotGranularity) {
+        long baseFreq;
+        switch (gridType) {
+            case DWDM:
+                baseFreq = BASE_FREQUENCY;
+                break;
+            case CWDM:
+            case FLEX:
+            case UNKNOWN:
+            default:
+                baseFreq = 0L;
+                break;
+        }
+        if (wavelength > baseFreq) {
+            return (int) ((wavelength - baseFreq) / (channelSpacing.frequency().asMHz()));
+        } else {
+            return (int) ((baseFreq - wavelength) / (channelSpacing.frequency().asMHz()));
+        }
+    }
+
 
     @Override
     protected void doExecute() throws Exception {
@@ -133,8 +180,19 @@
 
             // an empty traffic selector
             TrafficSelector trafficSelector = trafficSelectorBuilder.matchInPort(cp.port()).build();
-            OchSignal ochSignal = createOchSignal();
-
+            OchSignal ochSignal;
+            if (parameter.contains("/")) {
+                ochSignal = createOchSignal();
+            } else if (parameter.matches("-?\\d+(\\.\\d+)?")) {
+                ochSignal = createOchSignalFromWavelength(deviceService, cp);
+            } else {
+                print("Signal or wavelength %s are in uncorrect format");
+                return;
+            }
+            if (ochSignal == null) {
+                print("Error in creating OchSignal");
+                return;
+            }
             TrafficTreatment trafficTreatment = trafficTreatmentBuilder
                     .add(Instructions.modL0Lambda(ochSignal))
                     .add(Instructions.createOutput(deviceService.getPort(cp).number()))
diff --git a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmManager.java b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmManager.java
index 191f608..d6812ba 100644
--- a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmManager.java
+++ b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmManager.java
@@ -17,6 +17,7 @@
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Range;
+import org.onlab.util.Frequency;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
 import org.onosproject.net.ChannelSpacing;
@@ -48,7 +49,9 @@
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.flow.criteria.Criteria;
+import org.onosproject.net.flow.instructions.Instruction;
 import org.onosproject.net.flow.instructions.Instructions;
+import org.onosproject.net.flow.instructions.L0ModificationInstruction;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
 import org.osgi.service.component.annotations.Deactivate;
@@ -64,6 +67,7 @@
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.StreamSupport;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 import static org.onosproject.net.optical.OpticalAnnotations.INPUT_PORT_STATUS;
@@ -375,8 +379,8 @@
 
     @Override
     public FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
-                                 int timeout, PortNumber inPort, PortNumber outPort,
-                                 OchSignal ochSignal, Double attenuation) {
+                                   int timeout, PortNumber inPort, PortNumber outPort,
+                                   OchSignal ochSignal, Double attenuation) {
         checkNotNull(deviceId);
         checkNotNull(inPort);
         checkNotNull(outPort);
@@ -386,6 +390,39 @@
     }
 
     @Override
+    public Frequency getWavelength(DeviceId deviceId, PortNumber portNumber) {
+        checkNotNull(deviceId);
+        checkNotNull(portNumber);
+        Optional<FlowEntry> optFlow = StreamSupport
+                .stream(flowRuleService.getFlowEntries(deviceId).spliterator(), false)
+                .filter(flow -> {
+                    return flow.treatment().allInstructions().stream().filter(instr -> {
+                        if (instr.type().equals(Instruction.Type.OUTPUT)) {
+                            return ((Instructions.OutputInstruction) instr).port().equals(portNumber);
+                        } else if (instr.type().equals(Instruction.Type.L0MODIFICATION)) {
+                            return ((L0ModificationInstruction) instr).subtype()
+                                    .equals(L0ModificationInstruction.L0SubType.OCH);
+                        }
+                        return false;
+                    }).count() == 2;
+                }).findFirst();
+        if (optFlow.isPresent()) {
+            Optional<Instruction> instruction = optFlow.get().treatment().allInstructions().stream().filter(instr -> {
+                if (instr.type().equals(Instruction.Type.L0MODIFICATION)) {
+                    return ((L0ModificationInstruction) instr).subtype()
+                            .equals(L0ModificationInstruction.L0SubType.OCH);
+                }
+                return false;
+            }).findAny();
+            if (instruction.isPresent()) {
+                return ((L0ModificationInstruction.ModOchSignalInstruction) instruction.get()).lambda()
+                        .centralFrequency();
+            }
+        }
+        return null;
+    }
+
+    @Override
     public void removeConnection(DeviceId deviceId, FlowId flowId) {
         checkNotNull(deviceId);
         checkNotNull(flowId);
diff --git a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java
index 1a27fd3..3a648c4 100644
--- a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java
+++ b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmPortViewMessageHandler.java
@@ -85,6 +85,7 @@
     private static final String MIN_FREQ = "minFreq";
     private static final String MAX_FREQ = "maxFreq";
     private static final String GRID = "grid";
+    private static final String CURR_FREQ = "currFreq";
     private static final String POWER_RANGE = "powerRange";
     private static final String CURRENT_POWER = "currentPower";
     private static final String CURRENT_INPUT_POWER = "currentInputPower";
@@ -94,7 +95,7 @@
     private static final String SERVICE_STATE = "serviceState";
 
     private static final String[] COLUMN_IDS = {
-            ID, REVERSE_PORT, TYPE, NAME, ENABLED, MIN_FREQ, MAX_FREQ, GRID, POWER_RANGE,
+            ID, REVERSE_PORT, TYPE, NAME, ENABLED, MIN_FREQ, MAX_FREQ, GRID, CURR_FREQ, POWER_RANGE,
             CURRENT_POWER, CURRENT_INPUT_POWER, SERVICE_STATE, TARGET_POWER, MODULATION, HAS_TARGET_POWER
     };
 
@@ -161,6 +162,7 @@
                     .cell(MIN_FREQ, RoadmUtil.asTHz(minFreq))
                     .cell(MAX_FREQ, RoadmUtil.asTHz(maxFreq))
                     .cell(GRID, RoadmUtil.asGHz(channelSpacing))
+                    .cell(CURR_FREQ, getWavelength(deviceId, portNum))
                     .cell(POWER_RANGE, getPowerRange(deviceId, portNum))
                     .cell(CURRENT_POWER, getCurrentPower(deviceId, portNum))
                     .cell(CURRENT_INPUT_POWER, getCurrentInputPower(deviceId, portNum))
@@ -187,7 +189,7 @@
             return RoadmUtil.UNKNOWN;
         }
 
-        private Frequency minFreq = null, maxFreq = null, channelSpacing = null;
+        private Frequency minFreq = null, maxFreq = null, channelSpacing = null, currFreq = null;
 
         // Gets min frequency, max frequency, channel spacing
         private void getFrequencyLimit(DeviceId deviceId, PortNumber portNumber) {
@@ -253,6 +255,17 @@
             }
             return RoadmUtil.objectToString(modulation, RoadmUtil.UNKNOWN);
         }
+
+        // Returns modulation as a string, Unknown if modulation is expected but
+        // cannot be found
+        private String getWavelength(DeviceId deviceId, PortNumber portNumber) {
+            Frequency currentFrequency = roadmService.getWavelength(deviceId, portNumber);
+            if (currentFrequency == null) {
+                return "0";
+            } else {
+                return String.valueOf(currentFrequency.asTHz());
+            }
+        }
     }
 
 
diff --git a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmService.java b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmService.java
index 7662626..0b31e71 100644
--- a/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmService.java
+++ b/apps/roadm/app/src/main/java/org/onosproject/roadm/RoadmService.java
@@ -16,6 +16,7 @@
 package org.onosproject.roadm;
 
 import com.google.common.collect.Range;
+import org.onlab.util.Frequency;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.ModulationScheme;
@@ -29,19 +30,19 @@
 
 /**
  * ROADM service interface. Provides an interface for ROADM power configuration.
- *
+ * <p>
  * This application relies on the PowerConfig and LambdaQuery behaviours.
- *
+ * <p>
  * The device's PowerConfig implementation should be parameterized as
  * {@code PowerConfig<Object>} in order to support both Direction and OchSignal.
  * For a reference implementation of PowerConfig, please see
  * OplinkRoadmPowerConfig
- *
+ * <p>
  * In this application, a "connection" refers to the selection of a channel
  * to direct from an input to an output port. Connections are implemented
  * using FlowRules with an input port selector, optical channel selector,
  * and output port treatment (see RoadmManager#createConnection()).
- *
+ * <p>
  * This application currently only supports fixed grid channels.
  */
 public interface RoadmService {
@@ -50,7 +51,7 @@
      * Attempts to manually switch working path to the one specified by {@code index}.
      *
      * @param deviceId DeviceId of the device to configure
-     * @param index working path index to switch to
+     * @param index    working path index to switch to
      * @deprecated 1.11.0
      */
     @Deprecated
@@ -59,7 +60,7 @@
     /**
      * Retrieves protection switch specified port's service status.
      *
-     * @param deviceId DeviceId of the device to configure
+     * @param deviceId   DeviceId of the device to configure
      * @param portNumber the port
      * @return port service status
      * @deprecated 1.11.0
@@ -70,15 +71,16 @@
     /**
      * Attempts to config protection switch by specified {@code operation} and {@code index}.
      *
-     * @param deviceId DeviceId of the device to configure
-     * @param operation switch configuration, automatic, force or manual
+     * @param deviceId   DeviceId of the device to configure
+     * @param operation  switch configuration, automatic, force or manual
      * @param identifier {@link ConnectPoint} for the virtual Port representing protected path endpoint
-     * @param index working path index to switch to
+     * @param index      working path index to switch to
      */
     void configProtectionSwitch(DeviceId deviceId, String operation, ConnectPoint identifier, int index);
 
     /**
      * Retrieves protection switch endpoint states.
+     *
      * @param deviceId DeviceId of the device to configure
      * @return map groups of underlying paths
      */
@@ -87,16 +89,16 @@
     /**
      * Set target power for a port if the port has configurable target power.
      *
-     * @param deviceId DeviceId of the device to configure
+     * @param deviceId   DeviceId of the device to configure
      * @param portNumber PortNumber of the port to configure
-     * @param power value to set target power to
+     * @param power      value to set target power to
      */
     void setTargetPortPower(DeviceId deviceId, PortNumber portNumber, double power);
 
     /**
      * Returns the target power stored in storage for a port if the port has configurable target power.
      *
-     * @param deviceId DeviceId of the device to configure
+     * @param deviceId   DeviceId of the device to configure
      * @param portNumber PortNumber of the port to configure
      * @return the target power if the port has a target power, null otherwise
      */
@@ -104,7 +106,8 @@
 
     /**
      * Sync-up the target power for a port if the operator want to check the configuration.
-     * @param deviceId DeviceId of the device to configure
+     *
+     * @param deviceId   DeviceId of the device to configure
      * @param portNumber PortNumber of the port to configure
      * @return the target power if the port has a target power, null otherwise
      */
@@ -114,9 +117,9 @@
      * Sets the attenuation of a connection. This does not check that attenuation
      * is within the acceptable range.
      *
-     * @param deviceId DeviceId of the device to configure
-     * @param portNumber PortNumber of either the input or output port
-     * @param ochSignal channel to set attenuation for
+     * @param deviceId    DeviceId of the device to configure
+     * @param portNumber  PortNumber of either the input or output port
+     * @param ochSignal   channel to set attenuation for
      * @param attenuation attenuation value to set to
      */
     void setAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal, double attenuation);
@@ -124,9 +127,9 @@
     /**
      * Returns the attenuation of a connection.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of either the input or output port
-     * @param ochSignal channel to search for
+     * @param ochSignal  channel to search for
      * @return attenuation if found, null otherwise
      */
     Double getAttenuation(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
@@ -134,7 +137,7 @@
     /**
      * Returns the current port power.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of the port
      * @return current power if found, null otherwise
      */
@@ -143,9 +146,9 @@
     /**
      * Returns the current channel power.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of either the input or output port of the connection
-     * @param ochSignal channel to search for
+     * @param ochSignal  channel to search for
      * @return channel power if found, null otherwise
      */
     Double getCurrentChannelPower(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
@@ -153,7 +156,7 @@
     /**
      * Returns the channels supported by a port.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of the port
      * @return the set of supported channels
      */
@@ -162,7 +165,7 @@
     /**
      * Set modulation for a port if the port has configurable modulation.
      *
-     * @param deviceId DeviceId of the device to configure
+     * @param deviceId   DeviceId of the device to configure
      * @param portNumber PortNumber of the port to configure
      * @param modulation value to set modulation to
      */
@@ -171,7 +174,7 @@
     /**
      * Get modulation for a port if the port has configurable modulation.
      *
-     * @param deviceId DeviceId of the device to configure
+     * @param deviceId   DeviceId of the device to configure
      * @param portNumber PortNumber of the port to configure
      * @return modulation scheme
      */
@@ -181,43 +184,52 @@
      * Creates a new internal connection on a device without attenuation. This does
      * not check that the connection is actually valid (e.g. an input port to an
      * output port).
-     *
+     * <p>
      * Connections are represented as flows with an input port, output port, and
      * channel.
      *
-     * @param deviceId DeviceId of the device to create this connection for
-     * @param priority priority of the flow
+     * @param deviceId    DeviceId of the device to create this connection for
+     * @param priority    priority of the flow
      * @param isPermanent permanence of the flow
-     * @param timeout timeout in seconds
-     * @param inPort input port
-     * @param outPort output port
-     * @param ochSignal channel to use
+     * @param timeout     timeout in seconds
+     * @param inPort      input port
+     * @param outPort     output port
+     * @param ochSignal   channel to use
      * @return FlowId of the FlowRule representing the connection
      */
     FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
-                          int timeout, PortNumber inPort, PortNumber outPort, OchSignal ochSignal);
+                            int timeout, PortNumber inPort, PortNumber outPort, OchSignal ochSignal);
 
     /**
      * Creates a new internal connection on a device with attenuation. This does
      * not check that the connection is actually valid (e.g. an input port to an
      * output port, attenuation if within the acceptable range).
-     *
+     * <p>
      * Connections are represented as flows with an input port, output port, and
      * channel. Implementation of attenuation is up to the vendor.
      *
-     * @param deviceId DeviceId of the device to create this connection for
-     * @param priority priority of the flow
+     * @param deviceId    DeviceId of the device to create this connection for
+     * @param priority    priority of the flow
      * @param isPermanent permanence of the flow
-     * @param timeout timeout in seconds
-     * @param inPort input port
-     * @param outPort output port
-     * @param ochSignal channel to use
+     * @param timeout     timeout in seconds
+     * @param inPort      input port
+     * @param outPort     output port
+     * @param ochSignal   channel to use
      * @param attenuation attenuation of the connection
      * @return FlowId of the FlowRule representing the connection
      */
     FlowId createConnection(DeviceId deviceId, int priority, boolean isPermanent,
-                          int timeout, PortNumber inPort, PortNumber outPort,
-                          OchSignal ochSignal, Double attenuation);
+                            int timeout, PortNumber inPort, PortNumber outPort,
+                            OchSignal ochSignal, Double attenuation);
+
+    /**
+     * Get wavelength for a port if the port has configurable modulation.
+     *
+     * @param deviceId   DeviceId of the device to configure
+     * @param portNumber PortNumber of the port to configure
+     * @return the frequency
+     */
+    Frequency getWavelength(DeviceId deviceId, PortNumber portNumber);
 
     /**
      * Removes an internal connection from a device by matching the FlowId and
@@ -225,14 +237,14 @@
      * from any device so FlowId should correspond with a connection flow.
      *
      * @param deviceId DeviceId of the device to remove the connection from
-     * @param flowId FlowId of the flow representing the connection to remove
+     * @param flowId   FlowId of the flow representing the connection to remove
      */
     void removeConnection(DeviceId deviceId, FlowId flowId);
 
     /**
      * Returns true if the target power for this port can be configured.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of the port to check
      * @return true if the target power for this port can be configured, false
      * otherwise
@@ -244,9 +256,9 @@
      * Returns false if the port does not have a configurable target
      * power.
      *
-     * @param deviceId DeviceId of the device to check
+     * @param deviceId   DeviceId of the device to check
      * @param portNumber PortNumber of the port to check
-     * @param power value to check
+     * @param power      value to check
      * @return true if value is within the acceptable target power range, false
      * otherwise
      */
@@ -258,9 +270,9 @@
      * attenuation. The attenuation range is determined by either the input
      * or output port of the connection.
      *
-     * @param deviceId DeviceId of the device to check
+     * @param deviceId   DeviceId of the device to check
      * @param portNumber PortNumber of either the input or output port of the connection
-     * @param att value to check
+     * @param att        value to check
      * @return true if value is within the acceptable attenuation range, false
      * otherwise
      */
@@ -269,7 +281,7 @@
     /**
      * Returns true if the port is an input port.
      *
-     * @param deviceId DeviceId of the device to check
+     * @param deviceId   DeviceId of the device to check
      * @param portNumber PortNumber of the port to check
      * @return true if the port is an input port, false otherwise
      */
@@ -278,7 +290,7 @@
     /**
      * Returns true if the port is an output port.
      *
-     * @param deviceId DeviceId of the device to check
+     * @param deviceId   DeviceId of the device to check
      * @param portNumber PortNumber of the port to check
      * @return true if the port is an output port, false otherwise
      */
@@ -288,9 +300,9 @@
      * Returns true if the channel is supported by the port. The port can be either
      * an input or output port.
      *
-     * @param deviceId DeviceId of the device to check
+     * @param deviceId   DeviceId of the device to check
      * @param portNumber PortNumber of the port to check
-     * @param ochSignal channel to check
+     * @param ochSignal  channel to check
      * @return true if the channel is supported by the port, false otherwise
      */
     boolean validChannel(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
@@ -299,7 +311,7 @@
      * Returns true if the channel is not being used by a connection on the
      * device.
      *
-     * @param deviceId DeviceId of the device to check
+     * @param deviceId  DeviceId of the device to check
      * @param ochSignal channel to check
      * @return true if the channel is not in use, false otherwise
      */
@@ -311,8 +323,8 @@
      * respectively, valid input and output ports.
      *
      * @param deviceId DeviceId of the device to check
-     * @param inPort input port of the connection
-     * @param outPort output port of the connection
+     * @param inPort   input port of the connection
+     * @param outPort  output port of the connection
      * @return true if the connection is valid, false otherwise
      */
     boolean validConnection(DeviceId deviceId, PortNumber inPort, PortNumber outPort);
@@ -320,7 +332,7 @@
     /**
      * Returns the acceptable target port power range for a port.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of the port
      * @return range if found, null otherwise
      */
@@ -329,9 +341,9 @@
     /**
      * Returns the acceptable attenuation range for a connection.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of either the input or output port
-     * @param ochSignal channel to check
+     * @param ochSignal  channel to check
      * @return range if found, null otherwise
      */
     Range<Double> attenuationRange(DeviceId deviceId, PortNumber portNumber, OchSignal ochSignal);
@@ -339,7 +351,7 @@
     /**
      * Returns the expected input power range for an input port.
      *
-     * @param deviceId DeviceId of the device
+     * @param deviceId   DeviceId of the device
      * @param portNumber PortNumber of an input port
      * @return range if found, null otherwise
      */
diff --git a/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html b/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html
index 1e16d57..26420ca 100644
--- a/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html
+++ b/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.html
@@ -70,6 +70,7 @@
                     <td colId="minFreq">MIN FREQ (THz)</td>
                     <td colId="maxFreq">MAX FREQ (THz)</td>
                     <td colId="grid">GRID (GHz)</td>
+                    <td colId="currentFreq">CURRENT FREQ (THz)</td>
                     <td colId="modulation">MODULATION</td>
                     <td colId="powerRange">POWER RANGE (dBm)</td>
                     <td colId="currentPower">CURRENT POWER (dBm)</td>
@@ -96,6 +97,7 @@
                     <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH'?port.minFreq:""}}</td>
                     <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH'?port.maxFreq:""}}</td>
                     <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH'?port.grid:""}}</td>
+                    <td [ngClass]="(isDelta() ? 'delta' : '')">{{port.type=='OCH'?port.currFreq:""}}</td>
                     <td [ngClass]="(isDelta() ? 'delta' : '')">
                         <form [formGroup]="modulationForm" (ngSubmit)="submitModulation(devId, port.id)" *ngIf="port.type=='OCH'">
                             <select [(ngModel)]="port.modulation" formControlName="newModulation">
diff --git a/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.ts b/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.ts
index 4a0d36e..56bd85c 100644
--- a/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.ts
+++ b/apps/roadm/web/roadm-gui/projects/roadm-gui-lib/src/lib/port/port.component.ts
@@ -44,6 +44,7 @@
     minFreq: string;
     maxFreq: string;
     grid: string;
+    currFreq: string;
     powerRange: string;
     currentPower: string;
     targetPower: string;
diff --git a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniModulationOpenConfig.java b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniModulationOpenConfig.java
index c85e43e..d848379 100644
--- a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniModulationOpenConfig.java
+++ b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniModulationOpenConfig.java
@@ -17,6 +17,7 @@
  */
 package org.onosproject.drivers.odtn;
 
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.XMLConfiguration;
 import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine;
@@ -36,6 +37,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.StringWriter;
 import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
@@ -84,7 +86,6 @@
 
 
     private NetconfSession getNetconfSession(DeviceId deviceId) {
-        log.info("Inside getNetconfSession () method for device : {}", deviceId);
         NetconfController controller = handler().get(NetconfController.class);
         NetconfDevice ncdev = controller.getDevicesMap().get(deviceId);
         if (ncdev == null) {
@@ -116,10 +117,30 @@
 
     private XMLConfiguration executeRpc(NetconfSession session, String message) {
         try {
+            if (log.isDebugEnabled()) {
+                try {
+                    StringWriter stringWriter = new StringWriter();
+                    XMLConfiguration xconf = (XMLConfiguration) XmlConfigParser.loadXmlString(message);
+                    xconf.setExpressionEngine(new XPathExpressionEngine());
+                    xconf.save(stringWriter);
+                    log.debug("Request {}", stringWriter.toString());
+                } catch (ConfigurationException e) {
+                    log.error("XML Config Exception ", e);
+                }
+            }
             CompletableFuture<String> fut = session.rpc(message);
             String rpcReply = fut.get();
             XMLConfiguration xconf = (XMLConfiguration) XmlConfigParser.loadXmlString(rpcReply);
             xconf.setExpressionEngine(new XPathExpressionEngine());
+            if (log.isDebugEnabled()) {
+                try {
+                    StringWriter stringWriter = new StringWriter();
+                    xconf.save(stringWriter);
+                    log.debug("Response {}", stringWriter.toString());
+                } catch (ConfigurationException e) {
+                    log.error("XML Config Exception ", e);
+                }
+            }
             return xconf;
         } catch (NetconfException ne) {
             log.error("Exception on Netconf protocol: {}.", ne);
@@ -178,7 +199,6 @@
         }
 
         state.cassini = this;
-        log.info("Setting the state with clsName :{} ", clsName);
     }
 
     /*
diff --git a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniTerminalDevicePowerConfig.java b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniTerminalDevicePowerConfig.java
index 24251e6..f0f5d3a 100644
--- a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniTerminalDevicePowerConfig.java
+++ b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/CassiniTerminalDevicePowerConfig.java
@@ -94,12 +94,33 @@
      * @param message Netconf message in XML format
      * @return XMLConfiguration object
      */
+
     private XMLConfiguration executeRpc(NetconfSession session, String message) {
         try {
+            if (log.isDebugEnabled()) {
+                try {
+                    StringWriter stringWriter = new StringWriter();
+                    XMLConfiguration xconf = (XMLConfiguration) XmlConfigParser.loadXmlString(message);
+                    xconf.setExpressionEngine(new XPathExpressionEngine());
+                    xconf.save(stringWriter);
+                    log.debug("Request {}", stringWriter.toString());
+                } catch (ConfigurationException e) {
+                    log.error("XML Config Exception ", e);
+                }
+            }
             CompletableFuture<String> fut = session.rpc(message);
             String rpcReply = fut.get();
             XMLConfiguration xconf = (XMLConfiguration) XmlConfigParser.loadXmlString(rpcReply);
             xconf.setExpressionEngine(new XPathExpressionEngine());
+            if (log.isDebugEnabled()) {
+                try {
+                    StringWriter stringWriter = new StringWriter();
+                    xconf.save(stringWriter);
+                    log.debug("Response {}", stringWriter.toString());
+                } catch (ConfigurationException e) {
+                    log.error("XML Config Exception ", e);
+                }
+            }
             return xconf;
         } catch (NetconfException ne) {
             log.error("Exception on Netconf protocol: {}.", ne);
@@ -380,15 +401,7 @@
                     .append(underState)
                     .append("</state></optical-channel></component></components></filter></get>")
                     .append(RPC_CLOSE_TAG);
-            log.info("Getting Optical Channel State {}", rpcReq.toString());
-            StringWriter stringWriter = new StringWriter();
             XMLConfiguration xconf = pc.executeRpc(session, rpcReq.toString());
-            try {
-                xconf.save(stringWriter);
-            } catch (ConfigurationException e) {
-                log.error("XML Config Exception ", e);
-            }
-            log.info("Optical Channel State {}", stringWriter.toString());
             return xconf;
         }