use of org.opendaylight.protocol.bgp.parser.impl.BGPActivator in project bgpcep by opendaylight.
the class AbstractAddPathTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
this.ribActivator = new RIBActivator();
this.ribExtension = new SimpleRIBExtensionProviderContext();
this.ribActivator.startRIBExtensionProvider(this.ribExtension);
this.bgpActivator = new BGPActivator();
this.inetActivator = new org.opendaylight.protocol.bgp.inet.BGPActivator();
this.context = new SimpleBGPExtensionProviderContext();
this.bgpActivator.start(this.context);
this.inetActivator.start(this.context);
this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpParameters.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MultiprotocolCapability.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(DestinationIpv4Case.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(AdvertizedRoutes.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpRib.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(Attributes1.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MpReachNlri.class));
this.mappingService.onGlobalContextUpdated(moduleInfoBackedContext.tryToCreateSchemaContext().get());
this.schemaContext = moduleInfoBackedContext.getSchemaContext();
if (!Epoll.isAvailable()) {
this.worker = new NioEventLoopGroup();
this.boss = new NioEventLoopGroup();
}
this.serverRegistry = new StrictBGPPeerRegistry();
this.serverDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss, this.worker, this.serverRegistry);
doReturn(Mockito.mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider).registerClusterSingletonService(any(ClusterSingletonService.class));
this.codecsRegistry = CodecsRegistryImpl.create(this.mappingService.getCodecFactory(), this.ribExtension.getClassLoadingStrategy());
}
use of org.opendaylight.protocol.bgp.parser.impl.BGPActivator 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());
}
use of org.opendaylight.protocol.bgp.parser.impl.BGPActivator in project bgpcep by opendaylight.
the class BmpMock method initiateMock.
private static BmpMockDispatcher initiateMock(final BmpMockArguments arguments) {
final BGPExtensionProviderContext bgpCtx = new SimpleBGPExtensionProviderContext();
final BGPActivator bgpActivator = new BGPActivator();
bgpActivator.start(bgpCtx);
final BmpExtensionProviderContext ctx = new SimpleBmpExtensionProviderContext();
final BmpExtensionProviderActivator bmpActivator = new BmpActivator(bgpCtx);
bmpActivator.start(ctx);
return new BmpMockDispatcher(ctx.getBmpMessageRegistry(), new BmpMockSessionFactory(arguments));
}
use of org.opendaylight.protocol.bgp.parser.impl.BGPActivator in project bgpcep by opendaylight.
the class AbstractBmpMessageTest method setUp.
@Before
public final void setUp() {
this.bgpActivator = new BGPActivator();
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
this.bgpActivator.start(context);
final SimpleBmpExtensionProviderContext ctx = new SimpleBmpExtensionProviderContext();
this.bmpActivator = new BmpActivator(context);
this.bmpActivator.start(ctx);
this.messageRegistry = ctx.getBmpMessageRegistry();
}
use of org.opendaylight.protocol.bgp.parser.impl.BGPActivator in project bgpcep by opendaylight.
the class BmpMonitorImplTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
doAnswer(invocationOnMock -> {
BmpMonitorImplTest.this.singletonService = (ClusterSingletonService) invocationOnMock.getArguments()[0];
this.singletonService.instantiateServiceInstance();
return BmpMonitorImplTest.this.singletonServiceRegistration;
}).when(this.clusterSSProv).registerClusterSingletonService(any(ClusterSingletonService.class));
doAnswer(invocationOnMock -> BmpMonitorImplTest.this.singletonService.closeServiceInstance()).when(this.singletonServiceRegistration).close();
doAnswer(invocationOnMock -> {
this.singletonService2 = (ClusterSingletonService) invocationOnMock.getArguments()[0];
this.singletonService2.instantiateServiceInstance();
return BmpMonitorImplTest.this.singletonServiceRegistration2;
}).when(this.clusterSSProv2).registerClusterSingletonService(any(ClusterSingletonService.class));
doAnswer(invocationOnMock -> BmpMonitorImplTest.this.singletonService2.closeServiceInstance()).when(this.singletonServiceRegistration2).close();
this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(InitiationMessage.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(CParameters1.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpParameters.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MultiprotocolCapability.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(DestinationIpv4Case.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(AdvertizedRoutes.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(SentOpen.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(ReceivedOpen.class));
this.mappingService.onGlobalContextUpdated(moduleInfoBackedContext.tryToCreateSchemaContext().get());
this.ribActivator = new RIBActivator();
this.ribExtension = new SimpleRIBExtensionProviderContext();
this.ribActivator.startRIBExtensionProvider(this.ribExtension);
this.bgpActivator = new BGPActivator();
final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
this.bgpActivator.start(context);
final SimpleBmpExtensionProviderContext ctx = new SimpleBmpExtensionProviderContext();
this.bmpActivator = new BmpActivator(context);
this.bmpActivator.start(ctx);
this.msgRegistry = ctx.getBmpMessageRegistry();
this.dispatcher = new BmpDispatcherImpl(new NioEventLoopGroup(), new NioEventLoopGroup(), ctx.getBmpMessageRegistry(), new DefaultBmpSessionFactory());
final InetSocketAddress inetAddress = new InetSocketAddress(InetAddresses.forString(MONITOR_LOCAL_ADDRESS), MONITOR_LOCAL_PORT);
final DOMDataWriteTransaction wTx = getDomBroker().newWriteOnlyTransaction();
final ContainerNode parentNode = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(BmpMonitor.QNAME)).addChild(ImmutableNodes.mapNodeBuilder(Monitor.QNAME).build()).build();
wTx.merge(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.of(BmpMonitor.QNAME), parentNode);
wTx.submit();
final BmpDeployerDependencies bmpDependecies = new BmpDeployerDependencies(getDataBroker(), getDomBroker(), this.ribExtension, this.mappingService.getCodecFactory(), getSchemaContext(), this.clusterSSProv);
this.bmpApp = new BmpMonitoringStationImpl(bmpDependecies, this.dispatcher, MONITOR_ID, inetAddress, null);
readDataOperational(getDataBroker(), BMP_II, monitor -> {
assertEquals(1, monitor.getMonitor().size());
final Monitor bmpMonitor = monitor.getMonitor().get(0);
assertEquals(MONITOR_ID, bmpMonitor.getMonitorId());
assertEquals(0, bmpMonitor.getRouter().size());
assertEquals(MONITOR_ID, bmpMonitor.getMonitorId());
assertEquals(0, bmpMonitor.getRouter().size());
return monitor;
});
}
Aggregations