Idle OF channel handling

- Added handler for idle OF channel
- Workaround for device not responding to meter feature request (ONOS-5834)

Change-Id: I72435c65fa427c3f7668a0042b9425eb726cd54e
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
index eedfaf2..11cff69 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OFChannelHandler.java
@@ -619,6 +619,15 @@
                     throws IOException {
                 h.pendingPortStatusMsg.add(m);
             }
+
+            @Override
+            void processIdle(OFChannelHandler h) throws IOException {
+                log.info("{} did not respond to MeterFeaturesRequest, " +
+                         "moving on without it.",
+                         h.getSwitchInfoString());
+                h.sendHandshakeDescriptionStatsRequest();
+                h.setState(WAIT_DESCRIPTION_STAT_REPLY);
+            }
         },
 
 
@@ -719,6 +728,11 @@
                 h.dispatchMessage(m);
             }
 
+            @Override
+            void processIdle(OFChannelHandler h) throws IOException {
+                log.info("{} idle", h.getSwitchInfoString());
+            }
+
         };
 
         private final boolean handshakeComplete;
@@ -1098,6 +1112,11 @@
             unhandledMessageReceived(h, m);
         }
 
+        void processIdle(OFChannelHandler h) throws IOException {
+            // disconnect channel which did no complete handshake
+            log.error("{} idle in state {}, disconnecting", h.getSwitchInfoString(), this);
+            h.channel.disconnect();
+        }
     }
 
 
@@ -1215,6 +1234,7 @@
         e.getChannel().write(Collections.singletonList(m));
         // XXX S some problems here -- echo request has no transaction id, and
         // echo reply is not correlated to the echo request.
+        state.processIdle(this);
     }
 
     @Override