Search in sources :

Example 1 with UnsubscribeYnlOutput

use of org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeYnlOutput in project controller by opendaylight.

the class MdsalLowLevelTestProvider method unsubscribeYnl.

@Override
public Future<RpcResult<UnsubscribeYnlOutput>> unsubscribeYnl(final UnsubscribeYnlInput input) {
    LOG.debug("Received unsubscribe-ynl, input: {}", input);
    if (!ynlRegistrations.containsKey(input.getId())) {
        final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "missing-registration", "No ynl listener with this id registered.");
        final RpcResult<UnsubscribeYnlOutput> result = RpcResultBuilder.<UnsubscribeYnlOutput>failed().withRpcError(rpcError).build();
        return Futures.immediateFuture(result);
    }
    final ListenerRegistration<YnlListener> reg = ynlRegistrations.remove(input.getId());
    final UnsubscribeYnlOutput output = reg.getInstance().getOutput();
    reg.close();
    return Futures.immediateFuture(RpcResultBuilder.<UnsubscribeYnlOutput>success().withResult(output).build());
}
Also used : RpcError(org.opendaylight.yangtools.yang.common.RpcError) YnlListener(org.opendaylight.controller.clustering.it.provider.impl.YnlListener) UnsubscribeYnlOutput(org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeYnlOutput)

Aggregations

YnlListener (org.opendaylight.controller.clustering.it.provider.impl.YnlListener)1 UnsubscribeYnlOutput (org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.UnsubscribeYnlOutput)1 RpcError (org.opendaylight.yangtools.yang.common.RpcError)1