ONOS-4505: Bug Fixes

Change-Id: I190b4e6b950381eef8d6fba1e3ac345ea6854e40
diff --git a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
index f16aeb4..7cd7785 100644
--- a/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
+++ b/protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/Controller.java
@@ -112,10 +112,6 @@
             if (isisProcesses.size() > 0) {
                 processes = isisProcesses;
                 connectPeer();
-                //Initializing the interface map in channel handler
-                if (isisChannelHandler != null) {
-                    isisChannelHandler.initializeInterfaceMap();
-                }
             }
         } else {
             isisChannelHandler.updateInterfaceMap(isisProcesses);
@@ -154,7 +150,6 @@
         isisChannelHandler = new IsisChannelHandler(this, processes);
         ChannelPipelineFactory pfact = new IsisPipelineFactory(isisChannelHandler);
         peerBootstrap.setPipelineFactory(pfact);
-        ChannelFuture connection = peerBootstrap.connect(new InetSocketAddress(IsisConstants.SHOST, isisPort.toInt()));
     }
 
     /**
@@ -499,6 +494,7 @@
         public void run() {
             log.debug("Connect to peer {}", IsisConstants.SHOST);
             initConnection();
+            isisChannelHandler.sentConfigPacket(configPacket);
             InetSocketAddress connectToSocket = new InetSocketAddress(IsisConstants.SHOST, isisPort.toInt());
             try {
                 peerBootstrap.connect(connectToSocket).addListener(new ChannelFutureListener() {
@@ -517,13 +513,13 @@
                             }
                             scheduleConnectionRetry(connectRetryTime);
                         } else {
+                            //Send the config packet
+                            isisChannelHandler.sentConfigPacket(configPacket);
                             connectRetryCounter++;
                             log.info("Connected to remote host {}, Connect Counter {}", IsisConstants.SHOST,
                                      connectRetryCounter);
                             disconnectExecutor();
-                            isisChannelHandler.initializeInterfaceMap();
-                            //Send the config packet
-                            isisChannelHandler.sentConfigPacket(configPacket);
+
                             return;
                         }
                     }