Return positive response for commit operation in netconf mdsal
northbound even if no candidate transaction is open for session.
port of:
https://git.opendaylight.org/gerrit/#/c/32938/
Change-Id: I892679d2d4ba50ecb887aefccac5b7d4ef6639f8
Signed-off-by: Tomas Cere <tcere@cisco.com>
public synchronized boolean commitTransaction() throws NetconfDocumentedException {
if (!getCandidateTransaction().isPresent()) {
public synchronized boolean commitTransaction() throws NetconfDocumentedException {
if (!getCandidateTransaction().isPresent()) {
- throw new NetconfDocumentedException(NO_TRANSACTION_FOUND_FOR_SESSION + netconfSessionIdForReporting,
- ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error);
+ //making empty commit without prior opened transaction, just return true
+ LOG.debug("Making commit without open candidate transaction for session {}", netconfSessionIdForReporting);
+ return true;
}
CheckedFuture<Void, TransactionCommitFailedException> future = candidateTransaction.submit();
}
CheckedFuture<Void, TransactionCommitFailedException> future = candidateTransaction.submit();
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws NetconfDocumentedException {
boolean commitStatus = transactionProvider.commitTransaction();
protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) throws NetconfDocumentedException {
boolean commitStatus = transactionProvider.commitTransaction();
- LOG.trace("Transaction commited succesfuly {}", commitStatus);
+ LOG.trace("Commit completed successfully {}", commitStatus);
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}
return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
}
+ @Test
+ public void testCommitWithoutOpenTransaction() throws Exception {
+ verifyResponse(commit(), RPC_REPLY_OK);
+ assertEmptyDatastore(getConfigCandidate());
+ }
+
@Test
public void testCandidateTransaction() throws Exception {
@Test
public void testCandidateTransaction() throws Exception {