Search in sources :

Example 1 with DeletePrefixInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixInput in project bgpcep by opendaylight.

the class AppPeerBenchmark method deletePrefix.

@Override
public Future<RpcResult<DeletePrefixOutput>> deletePrefix(final DeletePrefixInput input) {
    final long duration = deleteRoute(input.getPrefix(), input.getCount(), input.getBatchsize());
    final long rate = countRate(duration, input.getCount());
    final DeletePrefixOutputBuilder outputbuilder = new DeletePrefixOutputBuilder();
    outputbuilder.setResult(createResult(input.getCount(), duration, rate));
    final DeletePrefixOutput output = outputbuilder.build();
    return RpcResultBuilder.success(output).buildFuture();
}
Also used : DeletePrefixOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixOutput) DeletePrefixOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixOutputBuilder)

Example 2 with DeletePrefixInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixInput in project bgpcep by opendaylight.

the class AppPeerBenchmarkTest method testRpcs.

@Test
public void testRpcs() throws Exception {
    final AppPeerBenchmark appPeerBenchmark = new AppPeerBenchmark(getDataBroker(), this.rpcRegistry, PEER_RIB_ID);
    appPeerBenchmark.start();
    final InstanceIdentifier<Ipv4Routes> routesIID = appPeerBenchmark.getIpv4RoutesIID();
    final AddPrefixInput addPrefix = new AddPrefixInputBuilder().setBatchsize(1L).setCount(1L).setNexthop(new Ipv4Address(NH)).setPrefix(new Ipv4Prefix(PREFIX)).build();
    final RpcResult<AddPrefixOutput> addRpcResult = appPeerBenchmark.addPrefix(addPrefix).get();
    final Result addResult = addRpcResult.getResult().getResult();
    checkEquals(() -> assertEquals(1, addResult.getCount().intValue()));
    checkEquals(() -> assertEquals(1, addResult.getRate().intValue()));
    readDataConfiguration(getDataBroker(), routesIID, routes -> {
        assertNotNull(routes.getIpv4Route());
        assertEquals(1, routes.getIpv4Route().size());
        return routes;
    });
    final DeletePrefixInput deletePrefix = new DeletePrefixInputBuilder().setBatchsize(1L).setCount(1L).setPrefix(new Ipv4Prefix(PREFIX)).build();
    final RpcResult<DeletePrefixOutput> deleteRpcResult = appPeerBenchmark.deletePrefix(deletePrefix).get();
    final Result deleteResult = deleteRpcResult.getResult().getResult();
    checkEquals(() -> assertEquals(1, deleteResult.getCount().intValue()));
    checkEquals(() -> assertEquals(1, deleteResult.getRate().intValue()));
    readDataConfiguration(getDataBroker(), routesIID, routes -> {
        assertNotNull(routes.getIpv4Route());
        assertTrue(routes.getIpv4Route().isEmpty());
        return routes;
    });
    appPeerBenchmark.close();
}
Also used : AddPrefixInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.AddPrefixInput) AddPrefixInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.AddPrefixInputBuilder) AddPrefixOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.AddPrefixOutput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) Result(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.output.Result) DeletePrefixInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixInput) DeletePrefixInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixInputBuilder) DeletePrefixOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixOutput) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) Ipv4Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.Ipv4Routes) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) AbstractConcurrentDataBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest) Test(org.junit.Test)

Aggregations

DeletePrefixOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixOutput)2 Test (org.junit.Test)1 AbstractConcurrentDataBrokerTest (org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)1 Ipv4Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.Ipv4Routes)1 AddPrefixInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.AddPrefixInput)1 AddPrefixInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.AddPrefixInputBuilder)1 AddPrefixOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.AddPrefixOutput)1 DeletePrefixInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixInput)1 DeletePrefixInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixInputBuilder)1 DeletePrefixOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.DeletePrefixOutputBuilder)1 Result (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev160309.output.Result)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1