X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Futil%2FDeviceInitializationUtils.java;h=0bdbe08a9c82e01be756b0cabec21d027f6a2863;hb=9f8a5a168696e279ae49ed79efe4590abc49b9ba;hp=9a8548c82a3e2583973be250dac783d91203d984;hpb=d9f1912971b382f39e55635d19922d9e269c103d;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtils.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtils.java index 9a8548c82a..0bdbe08a9c 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtils.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtils.java @@ -241,20 +241,26 @@ public class DeviceInitializationUtils { static void translateAndWriteReply(final MultipartType type, final DeviceContext dContext, final InstanceIdentifier nodeII, final Collection result, final ConvertorExecutor convertorExecutor) { - try { - result.stream() - .map(MultipartReply::getMultipartReplyBody) - .forEach(multipartReplyBody -> { - if (!(writeDesc(type, multipartReplyBody, dContext, nodeII) - || writeTableFeatures(type, multipartReplyBody, dContext, nodeII, convertorExecutor) - || writeMeterFeatures(type, multipartReplyBody, dContext, nodeII) - || writeGroupFeatures(type, multipartReplyBody, dContext, nodeII) - || writePortDesc(type, multipartReplyBody, dContext, nodeII))) { - throw new IllegalArgumentException("Unexpected MultipartType " + type); - } - }); - } catch (final Exception e) { - LOG.debug("translateAndWriteReply: Failed to write node {} to DS ", dContext.getDeviceInfo().getNodeId().toString(), e); + if (Objects.nonNull(result)) { + try { + result.stream() + .map(MultipartReply::getMultipartReplyBody) + .forEach(multipartReplyBody -> { + if (!(writeDesc(type, multipartReplyBody, dContext, nodeII) + || writeTableFeatures(type, multipartReplyBody, dContext, nodeII, convertorExecutor) + || writeMeterFeatures(type, multipartReplyBody, dContext, nodeII) + || writeGroupFeatures(type, multipartReplyBody, dContext, nodeII) + || writePortDesc(type, multipartReplyBody, dContext, nodeII))) { + throw new IllegalArgumentException("Unexpected MultipartType " + type); + } + }); + } catch (final Exception e) { + LOG.debug("translateAndWriteReply: Failed to write node {} to DS ", dContext.getDeviceInfo().getNodeId().toString(), e); + } + } else { + LOG.debug("translateAndWriteReply: Failed to write node {} to DS because we failed to gather device" + + "info.", + dContext.getDeviceInfo().getNodeId().toString()); } } @@ -492,6 +498,11 @@ public class DeviceInitializationUtils { final Xid xid = requestContext.getXid(); + if (Objects.isNull(xid)) { + LOG.debug("Xid is not present, so cancelling node static info gathering."); + return Futures.immediateCancelledFuture(); + } + LOG.trace("Hooking xid {} to device context - precaution.", reserved); final MultiMsgCollector multiMsgCollector = deviceContext.getMultiMsgCollector(requestContext);