use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class NetconfMDSalMappingTest method testEditWithCreate.
@Test
public void testEditWithCreate() throws Exception {
verifyResponse(edit("messages/mapping/editConfigs/editConfig_create.xml"), RPC_REPLY_OK);
verifyResponse(getConfigCandidate(), XmlFileLoader.xmlFileToDocument("messages/mapping/editConfig_create_n1_control.xml"));
final DocumentedException ex = assertThrows(DocumentedException.class, () -> edit("messages/mapping/editConfigs/editConfig_create.xml"));
assertEquals(ErrorSeverity.ERROR, ex.getErrorSeverity());
assertEquals(ErrorTag.DATA_EXISTS, ex.getErrorTag());
assertEquals(ErrorType.PROTOCOL, ex.getErrorType());
verifyResponse(discardChanges(), RPC_REPLY_OK);
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class NetconfMDSalMappingTest method testConfigMissing.
@Test
public void testConfigMissing() throws Exception {
final DocumentedException ex = assertThrows(DocumentedException.class, () -> edit("messages/mapping/editConfigs/editConfig_no_config.xml"));
assertEquals(ErrorSeverity.ERROR, ex.getErrorSeverity());
assertEquals(ErrorTag.MISSING_ELEMENT, ex.getErrorTag());
assertEquals(ErrorType.PROTOCOL, ex.getErrorType());
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class NetconfMDSalMappingTest method testUnlock.
@Test
public void testUnlock() throws Exception {
verifyResponse(unlockCandidate(), RPC_REPLY_OK);
DocumentedException ex = assertThrows(DocumentedException.class, NetconfMDSalMappingTest::unlock);
assertEquals(ErrorSeverity.ERROR, ex.getErrorSeverity());
assertEquals(ErrorTag.OPERATION_NOT_SUPPORTED, ex.getErrorTag());
assertEquals(ErrorType.APPLICATION, ex.getErrorType());
ex = assertThrows(DocumentedException.class, NetconfMDSalMappingTest::unlockWithoutTarget);
assertEquals(ErrorSeverity.ERROR, ex.getErrorSeverity());
assertEquals(ErrorTag.INVALID_VALUE, ex.getErrorTag());
assertEquals(ErrorType.APPLICATION, ex.getErrorType());
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class RuntimeRpcTest method testBadNamespaceInRpc.
@Test
public void testBadNamespaceInRpc() throws Exception {
final RuntimeRpc rpc = new RuntimeRpc(SESSION_ID_FOR_REPORTING, currentSchemaContext, RPC_SERVICE_VOID_INVOKER);
final Document rpcDocument = XmlFileLoader.xmlFileToDocument("messages/mapping/rpcs/rpc-bad-namespace.xml");
final DocumentedException e = assertThrows(DocumentedException.class, () -> rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT));
assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR);
assertEquals(e.getErrorTag(), ErrorTag.BAD_ELEMENT);
assertEquals(e.getErrorType(), ErrorType.APPLICATION);
}
use of org.opendaylight.netconf.api.DocumentedException in project netconf by opendaylight.
the class RuntimeRpcTest method testFailedInvocation.
@Test
public void testFailedInvocation() throws Exception {
final RuntimeRpc rpc = new RuntimeRpc(SESSION_ID_FOR_REPORTING, currentSchemaContext, RPC_SERVICE_FAILED_INVOCATION);
final Document rpcDocument = XmlFileLoader.xmlFileToDocument("messages/mapping/rpcs/rpc-nonvoid.xml");
final HandlingPriority priority = rpc.canHandle(rpcDocument);
Preconditions.checkState(priority != HandlingPriority.CANNOT_HANDLE);
final DocumentedException e = assertThrows(DocumentedException.class, () -> rpc.handle(rpcDocument, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT));
assertEquals(e.getErrorSeverity(), ErrorSeverity.ERROR);
assertEquals(e.getErrorTag(), ErrorTag.OPERATION_FAILED);
assertEquals(e.getErrorType(), ErrorType.APPLICATION);
}
Aggregations