Search in sources :

Example 1 with BGPExtensionProviderContext

use of org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext in project bgpcep by opendaylight.

the class BgpIpv4ActivatorTest method testActivator.

@Test
public void testActivator() throws Exception {
    final BgpIpv4Activator act = new BgpIpv4Activator();
    final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
    assertFalse(context.getNlriRegistry().getSerializers().iterator().hasNext());
    act.start(context);
    assertTrue(context.getNlriRegistry().getSerializers().iterator().next() instanceof VpnIpv4NlriParser);
    act.close();
}
Also used : SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) BGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext) Test(org.junit.Test)

Example 2 with BGPExtensionProviderContext

use of org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext in project bgpcep by opendaylight.

the class AbstractBGPDispatcherTest method setUp.

@Before
public void setUp() {
    if (!Epoll.isAvailable()) {
        this.boss = new NioEventLoopGroup();
        this.worker = new NioEventLoopGroup();
    }
    this.registry = new StrictBGPPeerRegistry();
    this.clientListener = new SimpleSessionListener();
    this.serverListener = new SimpleSessionListener();
    final BGPExtensionProviderContext ctx = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance();
    this.serverDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker, this.registry);
    this.clientAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
    final IpAddress clientPeerIp = new IpAddress(new Ipv4Address(this.clientAddress.getAddress().getHostAddress()));
    this.registry.addPeer(clientPeerIp, this.clientListener, createPreferences(this.clientAddress));
    this.clientDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker, this.registry);
}
Also used : BGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext) ServiceLoaderBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Before(org.junit.Before)

Example 3 with BGPExtensionProviderContext

use of org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext in project bgpcep by opendaylight.

the class SrAttributeParserTest method setUp.

@Before
public void setUp() throws Exception {
    final BGPActivator act = new BGPActivator(true, ServiceLoaderRSVPExtensionProviderContext.getSingletonInstance().getRsvpRegistry());
    final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
    act.start(context);
}
Also used : SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) BGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext) BGPActivator(org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator) Before(org.junit.Before)

Example 4 with BGPExtensionProviderContext

use of org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext in project bgpcep by opendaylight.

the class ActivatorTest method testActivator.

@Test
public void testActivator() throws Exception {
    final BGPActivator act = new BGPActivator(true, ServiceLoaderRSVPExtensionProviderContext.getSingletonInstance().getRsvpRegistry());
    final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
    assertNull(context.getAddressFamilyRegistry().classForFamily(16388));
    assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(71));
    act.start(context);
    assertEquals(LinkstateAddressFamily.class, context.getAddressFamilyRegistry().classForFamily(16388));
    assertEquals(LinkstateSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry().classForFamily(71));
    act.close();
}
Also used : SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) BGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext) BGPActivator(org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator) Test(org.junit.Test)

Example 5 with BGPExtensionProviderContext

use of org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext 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());
}
Also used : FlowspecActivator(org.opendaylight.protocol.bgp.flowspec.FlowspecActivator) BGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext) ServiceLoaderBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext) StrictBGPPeerRegistry(org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry) SimpleFlowspecExtensionProviderContext(org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) BGPActivator(org.opendaylight.protocol.bgp.parser.impl.BGPActivator) BGPDispatcherImpl(org.opendaylight.protocol.bgp.rib.impl.BGPDispatcherImpl)

Aggregations

BGPExtensionProviderContext (org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext)20 SimpleBGPExtensionProviderContext (org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext)15 Test (org.junit.Test)10 Before (org.junit.Before)7 ServiceLoaderBGPExtensionProviderContext (org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext)6 BGPActivator (org.opendaylight.protocol.bgp.parser.impl.BGPActivator)5 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)4 BmpActivator (org.opendaylight.protocol.bmp.parser.BmpActivator)4 SimpleBmpExtensionProviderContext (org.opendaylight.protocol.bmp.spi.registry.SimpleBmpExtensionProviderContext)4 ByteBuf (io.netty.buffer.ByteBuf)3 BGPActivator (org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator)3 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)3 InetSocketAddress (java.net.InetSocketAddress)2 FlowspecActivator (org.opendaylight.protocol.bgp.flowspec.FlowspecActivator)2 SimpleFlowspecExtensionProviderContext (org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext)2 BmpDispatcherImpl (org.opendaylight.protocol.bmp.impl.BmpDispatcherImpl)2 Channel (io.netty.channel.Channel)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 After (org.junit.After)1