Merge "Increase default negotiation timeout for netconf server to 30s"
[controller.git] / opendaylight / md-sal / sal-netconf-connector / src / main / java / org / opendaylight / controller / sal / connect / netconf / NetconfDevice.java
index ac84acb2f177a16d3aa110f54ee4bcc692f80664..88dd0e55c596ca03e3b1c349ff2544aeeb22d18f 100644 (file)
@@ -220,8 +220,9 @@ public final class NetconfDevice implements RemoteDevice<NetconfSessionPreferenc
         messageTransformer = new NetconfMessageTransformer(result);
 
         updateTransformer(messageTransformer);
-        notificationHandler.onRemoteSchemaUp(messageTransformer);
+        // salFacade.onDeviceConnected has to be called before the notification handler is initialized
         salFacade.onDeviceConnected(result, remoteSessionCapabilities, deviceRpc);
+        notificationHandler.onRemoteSchemaUp(messageTransformer);
 
         logger.info("{}: Netconf connector initialized successfully", id);
     }
@@ -413,7 +414,9 @@ public final class NetconfDevice implements RemoteDevice<NetconfSessionPreferenc
 
             // If no more sources, fail
             if(requiredSources.isEmpty()) {
-                handleSalInitializationFailure(new IllegalStateException(id + ": No more sources for schema context"), listener);
+                final IllegalStateException cause = new IllegalStateException(id + ": No more sources for schema context");
+                handleSalInitializationFailure(cause, listener);
+                salFacade.onDeviceFailed(cause);
                 return;
             }