use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4Route in project bgpcep by opendaylight.
the class AppPeerBenchmark method processRoutes.
private long processRoutes(final Ipv4Prefix ipv4Prefix, final long count, final long batch, final Attributes attributes) {
WriteTransaction wt = this.txChain.newWriteOnlyTransaction();
String address = getAdddressFromPrefix(ipv4Prefix);
final Stopwatch stopwatch = Stopwatch.createStarted();
for (int i = 1; i <= count; i++) {
final Ipv4RouteKey routeKey = new Ipv4RouteKey(NON_PATH_ID, createPrefix(address));
final KeyedInstanceIdentifier<Ipv4Route, Ipv4RouteKey> routeIId = this.routesIId.child(Ipv4Route.class, routeKey);
if (attributes != null) {
final Ipv4RouteBuilder ipv4RouteBuilder = new Ipv4RouteBuilder();
ipv4RouteBuilder.setPrefix(routeKey.getPrefix());
ipv4RouteBuilder.setKey(routeKey);
ipv4RouteBuilder.setAttributes(attributes);
final Ipv4Route ipv4Route = ipv4RouteBuilder.build();
wt.put(LogicalDatastoreType.CONFIGURATION, routeIId, ipv4Route);
} else {
wt.delete(LogicalDatastoreType.CONFIGURATION, routeIId);
}
if (i % batch == 0) {
wt.submit();
wt = this.txChain.newWriteOnlyTransaction();
}
address = increasePrefix(address);
}
wt.submit();
return stopwatch.stop().elapsed(TimeUnit.MILLISECONDS);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4Route in project bgpcep by opendaylight.
the class IPv4RIBSupportTest method testPutRoutes.
@Test
public void testPutRoutes() {
RIB_SUPPORT.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
final Ipv4Route route = (Ipv4Route) this.insertedRoutes.get(0).getValue();
assertEquals(ROUTE, route);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4Route in project bgpcep by opendaylight.
the class AbstractAddPathTest method checkLocRib.
private void checkLocRib(final int expectedRoutesOnDS) throws Exception {
Thread.sleep(100);
readDataOperational(getDataBroker(), BGP_IID, bgpRib -> {
final Ipv4RoutesCase routes = (Ipv4RoutesCase) bgpRib.getRib().get(0).getLocRib().getTables().get(0).getRoutes();
final List<Ipv4Route> routeList = routes.getIpv4Routes().getIpv4Route();
Assert.assertEquals(expectedRoutesOnDS, routeList.size());
return bgpRib;
});
}
Aggregations