use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes in project bgpcep by opendaylight.
the class LocRibWriter method updateNodes.
@SuppressWarnings("unchecked")
private void updateNodes(final DataObjectModification<Tables> table, final UnsignedInteger peerUuid, final WriteTransaction tx, final Map<RouteUpdateKey, RouteEntry> routes) {
final DataObjectModification<Attributes> attUpdate = table.getModifiedChildContainer(Attributes.class);
if (attUpdate != null && attUpdate.getDataAfter() != null) {
final Attributes newAttValue = attUpdate.getDataAfter();
LOG.trace("Uptodate found for {}", newAttValue);
tx.put(LogicalDatastoreType.OPERATIONAL, this.locRibTableIID.child(Attributes.class), newAttValue);
}
final DataObjectModification routesChangesContainer = table.getModifiedChildContainer(this.ribSupport.routesContainerClass());
if (routesChangesContainer == null) {
return;
}
updateRoutesEntries(routesChangesContainer.getModifiedChildren(), peerUuid, routes);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes in project bgpcep by opendaylight.
the class AbstractRIBSupport method buildReach.
/**
* Build MpReachNlri object from DOM representation.
*
* @param routes Collection of MapEntryNode DOM representation of routes
* @param hop CNextHop as it was parsed from Attributes, to be included in MpReach object
* @return MpReachNlri
*/
private MpReachNlri buildReach(final Collection<MapEntryNode> routes, final CNextHop hop) {
final MpReachNlriBuilder mb = new MpReachNlriBuilder();
mb.setAfi(this.getAfi());
mb.setSafi(this.getSafi());
mb.setCNextHop(hop);
mb.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(buildDestination(routes)).build());
return mb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes in project bgpcep by opendaylight.
the class AbstractRIBSupport method buildUnreach.
/**
* Build MpUnReachNlri object from DOM representation.
*
* @param routes Collection of MapEntryNode DOM representation of routes
* @return MpUnreachNlri
*/
private MpUnreachNlri buildUnreach(final Collection<MapEntryNode> routes) {
final MpUnreachNlriBuilder mb = new MpUnreachNlriBuilder();
mb.setAfi(this.getAfi());
mb.setSafi(this.getSafi());
mb.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(buildWithdrawnDestination(routes)).build());
return mb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes in project bgpcep by opendaylight.
the class BGPPeer method prefixesToMpReach.
/**
* Creates MPReach for the prefixes to be handled in the same way as linkstate routes.
*
* @param message Update message containing prefixes in NLRI
* @return MpReachNlri with prefixes from the nlri field
*/
private static MpReachNlri prefixesToMpReach(final Update message) {
final List<Ipv4Prefixes> prefixes = message.getNlri().stream().map(n -> new Ipv4PrefixesBuilder().setPrefix(n.getPrefix()).setPathId(n.getPathId()).build()).collect(Collectors.toList());
final MpReachNlriBuilder b = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(prefixes).build()).build()).build());
if (message.getAttributes() != null) {
b.setCNextHop(message.getAttributes().getCNextHop());
}
return b.build();
}
Aggregations