X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-persister-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fpersist%2Fimpl%2FConfigPusher.java;h=ed5a3a97a4c67809e75857ba77409eb695e00535;hb=f776809962df87deeaa533ba995cc6fceba64d0e;hp=6dba9ac64e22e1e5d5f528aa6b8c830aa78d9f17;hpb=e467b27c2487308a0e4b12f3565b6e1077e103e2;p=controller.git diff --git a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java index 6dba9ac64e..ed5a3a97a4 100644 --- a/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java +++ b/opendaylight/netconf/config-persister-impl/src/main/java/org/opendaylight/controller/netconf/persist/impl/ConfigPusher.java @@ -110,6 +110,10 @@ public class ConfigPusher { } private static class NotEnoughCapabilitiesException extends Exception { + private NotEnoughCapabilitiesException(String message, Throwable cause) { + super(message, cause); + } + private NotEnoughCapabilitiesException(String message) { super(message); } @@ -123,13 +127,18 @@ public class ConfigPusher { * @return service if capabilities are present, otherwise absent value */ private NetconfOperationService getOperationService(Set expectedCapabilities, String idForReporting) throws NotEnoughCapabilitiesException { - NetconfOperationService serviceCandidate = configNetconfConnector.createService(idForReporting); + NetconfOperationService serviceCandidate; + try { + serviceCandidate = configNetconfConnector.createService(idForReporting); + } catch(RuntimeException e) { + throw new NotEnoughCapabilitiesException("Netconf service not stable for " + idForReporting, e); + } Set notFoundDiff = computeNotFoundCapabilities(expectedCapabilities, serviceCandidate); if (notFoundDiff.isEmpty()) { return serviceCandidate; } else { serviceCandidate.close(); - logger.debug("Netconf server did not provide required capabilities for {} " + + logger.trace("Netconf server did not provide required capabilities for {} " + "Expected but not found: {}, all expected {}, current {}", idForReporting, notFoundDiff, expectedCapabilities, serviceCandidate.getCapabilities() ); @@ -226,15 +235,13 @@ public class ConfigPusher { try { response = operation.handle(request.getDocument(), NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT); } catch (NetconfDocumentedException | RuntimeException e) { + if (e instanceof NetconfDocumentedException && e.getCause() instanceof ConflictingVersionException) { + throw (ConflictingVersionException) e.getCause(); + } throw new IllegalStateException("Failed to send " + operationNameForReporting + " for configuration " + configIdForReporting, e); } - try { - return NetconfUtil.checkIsMessageOk(response); - } catch (ConflictingVersionException e) { - logger.trace("conflicting version detected: {} while committing {}", e.toString(), configIdForReporting); - throw e; - } + return NetconfUtil.checkIsMessageOk(response); } // load editConfig.xml template, populate /rpc/edit-config/config with parameter