use of org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry in project bgpcep by opendaylight.
the class BGPPeerBuilder method createPeer.
static void createPeer(final BGPDispatcher dispatcher, final Arguments arguments, final InetSocketAddress localAddress, final BGPSessionListener sessionListener, final BgpParameters bgpParameters) {
final AsNumber as = arguments.getAs();
final BGPSessionPreferences proposal = new BGPSessionPreferences(as, arguments.getHoldTimer(), new BgpId(localAddress.getAddress().getHostAddress()), as, Collections.singletonList(bgpParameters), Optional.empty());
final BGPPeerRegistry strictBGPPeerRegistry = dispatcher.getBGPPeerRegistry();
if (arguments.getInitiateConnection()) {
for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
addFutureListener(localAddress, ((BGPDispatcherImpl) dispatcher).createClient(localAddress, remoteAddress, RETRY_TIMER, true));
}
} else {
for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
}
addFutureListener(localAddress, dispatcher.createServer(localAddress));
}
LOG.debug("{} {}", sessionListener, proposal);
}
use of org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry in project bgpcep by opendaylight.
the class BGPTestTool method initializeActivator.
private static BGPDispatcher initializeActivator() {
final BGPActivator activator = new BGPActivator();
final BGPExtensionProviderContext ctx = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance();
activator.start(ctx);
final org.opendaylight.protocol.bgp.inet.BGPActivator inetActivator = new org.opendaylight.protocol.bgp.inet.BGPActivator();
inetActivator.start(ctx);
final org.opendaylight.protocol.bgp.evpn.impl.BGPActivator evpnActivator = new org.opendaylight.protocol.bgp.evpn.impl.BGPActivator();
evpnActivator.start(ctx);
final SimpleFlowspecExtensionProviderContext fsContext = new SimpleFlowspecExtensionProviderContext();
final FlowspecActivator flowspecActivator = new FlowspecActivator(fsContext);
final org.opendaylight.protocol.bgp.flowspec.BGPActivator flowspecBGPActivator = new org.opendaylight.protocol.bgp.flowspec.BGPActivator(flowspecActivator);
flowspecBGPActivator.start(ctx);
final org.opendaylight.protocol.bgp.labeled.unicast.BGPActivator labeledActivator = new org.opendaylight.protocol.bgp.labeled.unicast.BGPActivator();
labeledActivator.start(ctx);
final org.opendaylight.protocol.bgp.l3vpn.ipv4.BgpIpv4Activator bgpIpv4Activator = new org.opendaylight.protocol.bgp.l3vpn.ipv4.BgpIpv4Activator();
bgpIpv4Activator.start(ctx);
final org.opendaylight.protocol.bgp.l3vpn.ipv6.BgpIpv6Activator bgpIpv6Activator = new org.opendaylight.protocol.bgp.l3vpn.ipv6.BgpIpv6Activator();
bgpIpv6Activator.start(ctx);
return new BGPDispatcherImpl(ctx.getMessageRegistry(), new NioEventLoopGroup(), new NioEventLoopGroup(), new StrictBGPPeerRegistry());
}
Aggregations