import java.util.concurrent.TimeoutException;
import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
+import org.opendaylight.openflowplugin.ConnectionException;
+import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
+import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
+import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeListener;
+import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
} catch (Exception ex) {
errorHandler.handleException(ex, null);
connectionAdapter.disconnect();
+ handshakeListener.onHandshakeFailure();
LOG.trace("ret - shake fail: {}", ex.getMessage());
}
}
RpcUtil.smokeRpc(helloResult);
LOG.debug("FIRST HELLO sent.");
} catch (Exception e) {
- LOG.debug("FIRST HELLO sending failed.");
- throw e;
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("FIRST HELLO sent.", e);
+ }
+ handshakeListener.onHandshakeFailure();
+ throw new ConnectionException("FIRST HELLO sending failed because of connection issue.");
}
}
/**
* after handshake set features, register to session
* @param proposedVersion
- * @param xId
+ * @param xid
* @throws Exception
*/
protected void postHandshake(Short proposedVersion, Long xid) throws Exception {
// handshake failed
LOG.warn("issuing disconnect during handshake, reason: future expired", e);
connectionAdapter.disconnect();
+ handshakeListener.onHandshakeFailure();
throw e;
} catch (Exception e) {
// handshake failed
LOG.warn("issuing disconnect during handshake, reason - RPC: {}", e.getMessage(), e);
connectionAdapter.disconnect();
+ handshakeListener.onHandshakeFailure();
throw e;
}