Role management for the case where the controller does not hear back from
the registry-service causing the handshake to time out. Earlier we were
disconnecting the switch. With this patch, we will move to state Equal/Slave.
This behavior should be changed, once the underlying registry replies
to every mastership request (currently only replies to the controller that
wins mastership).

Also changed the timeouts:
 - role-reply not received timeout to 3 secs
 - handshake not completed timeout to 10 secs

Previously the timeouts were 10 and 60 secs respectively, which is too long
to figure out that something has gone wrong.

Change-Id: I58bf56f511992ce874407f5205c42a38cd6403ae
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java b/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
index 62938fe..c087a43 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
@@ -36,6 +36,7 @@
 public class OpenflowPipelineFactory
     implements ChannelPipelineFactory, ExternalResourceReleasable {
 
+    private static final long HANDSHAKE_TIMEOUT_SECS = 10;
     protected Controller controller;
     protected ThreadPoolExecutor pipelineExecutor;
     protected Timer timer;
@@ -61,9 +62,8 @@
         pipeline.addLast("ofmessageencoder", new OFMessageEncoder());
         pipeline.addLast("idle", idleHandler);
         pipeline.addLast("timeout", readTimeoutHandler);
-        // XXX S ONOS: was 15 increased it to fix Issue #296
         pipeline.addLast("handshaketimeout",
-                         new HandshakeTimeoutHandler(handler, timer, 60));
+                new HandshakeTimeoutHandler(handler, timer, HANDSHAKE_TIMEOUT_SECS));
         if (pipelineExecutor != null)
             pipeline.addLast("pipelineExecutor",
                              new ExecutionHandler(pipelineExecutor));