Search in sources :

Example 1 with Ipv4Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.Ipv4Routes 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(Uint32.ONE).setCount(Uint32.ONE).setNexthop(new Ipv4AddressNoZone(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(Uint32.ONE).setCount(Uint32.ONE).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()));
    checkNotPresentConfiguration(getDataBroker(), appPeerBenchmark.getIpv4RoutesIID());
    appPeerBenchmark.close();
}
Also used : AddPrefixInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.AddPrefixInput) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) AddPrefixInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.AddPrefixInputBuilder) AddPrefixOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.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.rev200120.output.Result) DeletePrefixInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.DeletePrefixInput) DeletePrefixInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.DeletePrefixInputBuilder) DeletePrefixOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.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.rev180329.ipv4.routes.Ipv4Routes) AbstractConcurrentDataBrokerTest(org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest) Test(org.junit.Test)

Example 2 with Ipv4Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.Ipv4Routes in project bgpcep by opendaylight.

the class AbstractAddPathTest method checkLocRib.

private void checkLocRib(final int expectedRoutesOnDS) throws Exception {
    // FIXME: remove this sleep
    Thread.sleep(100);
    readDataOperational(getDataBroker(), BGP_IID, bgpRib -> {
        final Ipv4RoutesCase routes = (Ipv4RoutesCase) bgpRib.getRib().values().iterator().next().getLocRib().nonnullTables().values().iterator().next().getRoutes();
        final int size;
        if (routes != null) {
            final Ipv4Routes routesCase = routes.getIpv4Routes();
            if (routesCase != null) {
                final Map<Ipv4RouteKey, Ipv4Route> routeList = routesCase.getIpv4Route();
                size = routeList == null ? 0 : routeList.size();
            } else {
                size = 0;
            }
        } else {
            size = 0;
        }
        assertEquals(expectedRoutesOnDS, size);
        return bgpRib;
    });
}
Also used : Ipv4RouteKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.ipv4.routes.Ipv4RouteKey) Ipv4RoutesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCase) Ipv4Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.Ipv4Routes) Ipv4Route(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.ipv4.routes.Ipv4Route)

Aggregations

Ipv4Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.Ipv4Routes)2 Test (org.junit.Test)1 AbstractConcurrentDataBrokerTest (org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest)1 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)1 Ipv4RoutesCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.bgp.rib.rib.loc.rib.tables.routes.Ipv4RoutesCase)1 Ipv4Route (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.ipv4.routes.Ipv4Route)1 Ipv4RouteKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.ipv4.routes.Ipv4RouteKey)1 AddPrefixInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.AddPrefixInput)1 AddPrefixInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.AddPrefixInputBuilder)1 AddPrefixOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.AddPrefixOutput)1 DeletePrefixInput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.DeletePrefixInput)1 DeletePrefixInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.DeletePrefixInputBuilder)1 DeletePrefixOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.DeletePrefixOutput)1 Result (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp.app.peer.benchmark.rev200120.output.Result)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1