Search in sources :

Example 1 with KnockKnockOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project controller by opendaylight.

the class CrossBrokerRpcTest method knockResult.

private Future<RpcResult<KnockKnockOutput>> knockResult(final boolean success, final String answer) {
    KnockKnockOutput output = // 
    new KnockKnockOutputBuilder().setAnswer(answer).build();
    RpcResult<KnockKnockOutput> result = RpcResultBuilder.<KnockKnockOutput>status(success).withResult(output).build();
    return Futures.immediateFuture(result);
}
Also used : KnockKnockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockOutput) KnockKnockOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockOutputBuilder)

Example 2 with KnockKnockOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project mdsal by opendaylight.

the class BindingDOMRpcIntegrationTest method knockResult.

private static ListenableFuture<RpcResult<KnockKnockOutput>> knockResult(final boolean success, final String answer) {
    KnockKnockOutput output = new KnockKnockOutputBuilder().setAnswer(answer).build();
    RpcResult<KnockKnockOutput> result = RpcResultBuilder.<KnockKnockOutput>status(success).withResult(output).build();
    return Futures.immediateFuture(result);
}
Also used : KnockKnockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutput) KnockKnockOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder)

Example 3 with KnockKnockOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project controller by opendaylight.

the class CrossBrokerRpcTest method bindingRpcInvoker_DomRoutedProviderTest.

@Test
public void bindingRpcInvoker_DomRoutedProviderTest() throws Exception {
    KnockKnockOutputBuilder builder = new KnockKnockOutputBuilder();
    builder.setAnswer("open");
    final KnockKnockOutput output = builder.build();
    provisionRegistry.registerRpcImplementation((rpc, input) -> {
        ContainerNode result = testContext.getCodec().getCodecFactory().toNormalizedNodeRpcData(output);
        return Futures.immediateCheckedFuture(new DefaultDOMRpcResult(result));
    }, DOMRpcIdentifier.create(KNOCK_KNOCK_PATH, BI_NODE_C_ID));
    OpendaylightOfMigrationTestModelService baKnockInvoker = providerRegistry.getRpcService(OpendaylightOfMigrationTestModelService.class);
    Future<RpcResult<KnockKnockOutput>> baResult = baKnockInvoker.knockKnock((knockKnock(BA_NODE_C_ID).setQuestion("Who's there?").build()));
    assertNotNull(baResult);
    assertEquals(output, baResult.get().getResult());
}
Also used : DefaultDOMRpcResult(org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult) KnockKnockOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockOutputBuilder) KnockKnockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockOutput) DOMRpcResult(org.opendaylight.controller.md.sal.dom.api.DOMRpcResult) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) DefaultDOMRpcResult(org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode) OpendaylightOfMigrationTestModelService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.OpendaylightOfMigrationTestModelService) Test(org.junit.Test)

Example 4 with KnockKnockOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder in project mdsal by opendaylight.

the class BindingDOMRpcIntegrationTest method testDOMRegistrationWithBindingInvocation.

@Test
public void testDOMRegistrationWithBindingInvocation() throws InterruptedException, ExecutionException, TimeoutException {
    KnockKnockOutput baKnockKnockOutput = new KnockKnockOutputBuilder().setAnswer("open").build();
    biRpcProviderService.registerRpcImplementation((rpc, input) -> FluentFutures.immediateFluentFuture(new DefaultDOMRpcResult(testContext.getCodec().currentSerializer().toNormalizedNodeRpcData(baKnockKnockOutput))), DOMRpcIdentifier.create(KNOCK_KNOCK_QNAME, testContext.getCodec().currentSerializer().toYangInstanceIdentifier(BA_NODE_ID)));
    final OpendaylightKnockKnockRpcService baKnockService = baRpcConsumerService.getRpcService(OpendaylightKnockKnockRpcService.class);
    Future<RpcResult<KnockKnockOutput>> baResult = baKnockService.knockKnock(knockKnock(BA_NODE_ID).setQuestion("Who's there?").build());
    assertNotNull(baResult);
    assertEquals(baKnockKnockOutput, baResult.get(5, TimeUnit.SECONDS).getResult());
}
Also used : DefaultDOMRpcResult(org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult) OpendaylightKnockKnockRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.OpendaylightKnockKnockRpcService) KnockKnockOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutput) KnockKnockOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) DefaultDOMRpcResult(org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult) DOMRpcResult(org.opendaylight.mdsal.dom.api.DOMRpcResult) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 KnockKnockOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockOutput)2 KnockKnockOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.KnockKnockOutputBuilder)2 KnockKnockOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutput)2 KnockKnockOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.KnockKnockOutputBuilder)2 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)2 DOMRpcResult (org.opendaylight.controller.md.sal.dom.api.DOMRpcResult)1 DefaultDOMRpcResult (org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult)1 DOMRpcResult (org.opendaylight.mdsal.dom.api.DOMRpcResult)1 DefaultDOMRpcResult (org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult)1 OpendaylightOfMigrationTestModelService (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.of.migration.test.model.rev150210.OpendaylightOfMigrationTestModelService)1 OpendaylightKnockKnockRpcService (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.md.sal.knock.knock.rev180723.OpendaylightKnockKnockRpcService)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1