use of org.opendaylight.yangtools.yang.common.RpcError in project openflowplugin by opendaylight.
the class HandshakeManagerImpl method postHandshake.
/**
* after handshake set features, register to session.
*
* @param proposedVersion proposed openflow version
* @param xid transaction id
*/
protected void postHandshake(final Short proposedVersion, final Long xid) {
// set version
version = proposedVersion;
LOG.debug("version set: {}", proposedVersion);
// request features
GetFeaturesInputBuilder featuresBuilder = new GetFeaturesInputBuilder();
featuresBuilder.setVersion(version).setXid(xid);
LOG.debug("sending feature request for version={} and xid={}", version, xid);
Future<RpcResult<GetFeaturesOutput>> featuresFuture = connectionAdapter.getFeatures(featuresBuilder.build());
Futures.addCallback(JdkFutureAdapters.listenInPoolThread(featuresFuture), new FutureCallback<RpcResult<GetFeaturesOutput>>() {
@Override
public void onSuccess(@Nonnull RpcResult<GetFeaturesOutput> rpcFeatures) {
LOG.trace("features are back");
if (rpcFeatures.isSuccessful()) {
GetFeaturesOutput featureOutput = rpcFeatures.getResult();
LOG.debug("obtained features: datapathId={}", featureOutput.getDatapathId());
LOG.debug("obtained features: auxiliaryId={}", featureOutput.getAuxiliaryId());
LOG.trace("handshake SETTLED: version={}, datapathId={}, auxiliaryId={}", version, featureOutput.getDatapathId(), featureOutput.getAuxiliaryId());
handshakeListener.onHandshakeSuccessful(featureOutput, proposedVersion);
} else {
// handshake failed
LOG.warn("issuing disconnect during handshake [{}]", connectionAdapter.getRemoteAddress());
for (RpcError rpcError : rpcFeatures.getErrors()) {
LOG.debug("handshake - features failure [{}]: i:{} | m:{} | s:{}", xid, rpcError.getInfo(), rpcError.getMessage(), rpcError.getSeverity(), rpcError.getCause());
}
handshakeListener.onHandshakeFailure();
}
LOG.debug("postHandshake DONE");
}
@Override
public void onFailure(Throwable throwable) {
LOG.warn("getting feature failed seriously [{}, addr:{}]: {}", xid, connectionAdapter.getRemoteAddress(), throwable.getMessage());
LOG.trace("DETAIL of sending of hello failure:", throwable);
}
}, MoreExecutors.directExecutor());
LOG.debug("future features [{}] hooked ..", xid);
}
use of org.opendaylight.yangtools.yang.common.RpcError in project openflowplugin by opendaylight.
the class OpendaylightDirectStatisticsServiceImplTest method testGetNodeConnectorStatisticsFail.
@Test
public void testGetNodeConnectorStatisticsFail() throws Exception {
RpcResult<GetNodeConnectorStatisticsOutput> result = emptyService.getNodeConnectorStatistics(getNodeConnectorStatisticsInput).get();
assertFalse(result.isSuccessful());
for (RpcError error : result.getErrors()) {
assertTrue(error.getMessage().contains(AbstractPortDirectStatisticsService.class.getSimpleName()));
}
verify(nodeConnectorDirectStatisticsService, times(0)).handleAndReply(getNodeConnectorStatisticsInput);
}
use of org.opendaylight.yangtools.yang.common.RpcError in project openflowplugin by opendaylight.
the class OpendaylightDirectStatisticsServiceImplTest method testGetQueueStatisticsFail.
@Test
public void testGetQueueStatisticsFail() throws Exception {
RpcResult<GetQueueStatisticsOutput> result = emptyService.getQueueStatistics(getQueueStatisticsInput).get();
assertFalse(result.isSuccessful());
for (RpcError error : result.getErrors()) {
assertTrue(error.getMessage().contains(AbstractQueueDirectStatisticsService.class.getSimpleName()));
}
verify(queueDirectStatisticsService, times(0)).handleAndReply(getQueueStatisticsInput);
}
use of org.opendaylight.yangtools.yang.common.RpcError in project openflowplugin by opendaylight.
the class OpendaylightDirectStatisticsServiceImplTest method testGetGroupStatisticsFail.
@Test
public void testGetGroupStatisticsFail() throws Exception {
RpcResult<GetGroupStatisticsOutput> result = emptyService.getGroupStatistics(getGroupStatisticsInput).get();
assertFalse(result.isSuccessful());
for (RpcError error : result.getErrors()) {
assertTrue(error.getMessage().contains(AbstractGroupDirectStatisticsService.class.getSimpleName()));
}
verify(groupDirectStatisticsService, times(0)).handleAndReply(getGroupStatisticsInput);
}
use of org.opendaylight.yangtools.yang.common.RpcError in project openflowplugin by opendaylight.
the class AbstractRpcListener method failedRpc.
protected final void failedRpc(final Throwable cause) {
final RpcError rpcError = buildRpcError(failureInfo, "check switch connection", cause);
result.set(RpcResultBuilder.<T>failed().withRpcError(rpcError).build());
}
Aggregations