Search in sources :

Example 1 with GracefulRestartCapabilityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder in project bgpcep by opendaylight.

the class GracefulCapabilityHandlerTest method testUnhandledSafi.

@Test(expected = IllegalArgumentException.class)
public void testUnhandledSafi() {
    final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(), this.ctx.getSubsequentAddressFamilyRegistry());
    final GracefulRestartCapabilityBuilder capaBuilder = new GracefulRestartCapabilityBuilder();
    capaBuilder.setRestartFlags(new RestartFlags(true));
    capaBuilder.setRestartTime(50);
    final TablesBuilder tablesBuilder = new TablesBuilder();
    tablesBuilder.setAfiFlags(new AfiFlags(true));
    tablesBuilder.setAfi(Ipv4AddressFamily.class);
    tablesBuilder.setSafi(SubsequentAddressFamily.class);
    capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
    final ByteBuf buffer = Unpooled.buffer();
    handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
}
Also used : RestartFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags) CParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder) AfiFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables.AfiFlags) CParameters1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder) GracefulCapabilityHandler(org.opendaylight.protocol.bgp.parser.impl.message.open.GracefulCapabilityHandler) ByteBuf(io.netty.buffer.ByteBuf) GracefulRestartCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder) TablesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.TablesBuilder) Test(org.junit.Test)

Example 2 with GracefulRestartCapabilityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder in project bgpcep by opendaylight.

the class GracefulCapabilityHandlerTest method testUnhandledAfi.

@Test(expected = IllegalArgumentException.class)
public void testUnhandledAfi() {
    final GracefulCapabilityHandler handler = new GracefulCapabilityHandler(this.ctx.getAddressFamilyRegistry(), this.ctx.getSubsequentAddressFamilyRegistry());
    final GracefulRestartCapabilityBuilder capaBuilder = new GracefulRestartCapabilityBuilder();
    capaBuilder.setRestartFlags(new RestartFlags(true));
    capaBuilder.setRestartTime(50);
    final TablesBuilder tablesBuilder = new TablesBuilder();
    tablesBuilder.setAfiFlags(new AfiFlags(true));
    tablesBuilder.setAfi(AddressFamily.class);
    tablesBuilder.setSafi(UnicastSubsequentAddressFamily.class);
    capaBuilder.setTables(Lists.newArrayList(tablesBuilder.build()));
    final ByteBuf buffer = Unpooled.buffer();
    handler.serializeCapability(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(), buffer);
}
Also used : RestartFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags) CParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder) AfiFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables.AfiFlags) CParameters1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder) GracefulCapabilityHandler(org.opendaylight.protocol.bgp.parser.impl.message.open.GracefulCapabilityHandler) ByteBuf(io.netty.buffer.ByteBuf) GracefulRestartCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder) TablesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.TablesBuilder) Test(org.junit.Test)

Example 3 with GracefulRestartCapabilityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder in project bgpcep by opendaylight.

the class BGPSessionImplTest method setUp.

@Before
public void setUp() throws UnknownHostException {
    new EmbeddedChannel();
    MockitoAnnotations.initMocks(this);
    final List<BgpParameters> tlvs = Lists.newArrayList();
    this.classicOpen = new OpenBuilder().setMyAsNumber(AS_NUMBER.getValue().intValue()).setHoldTimer(HOLD_TIMER).setVersion(new ProtocolVersion((short) 4)).setBgpParameters(tlvs).setBgpIdentifier(BGP_ID).build();
    final List<OptionalCapabilities> capa = Lists.newArrayList();
    capa.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder().setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build()).setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build()).setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(AS_NUMBER).build()).build()).build());
    capa.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
    tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capa).build());
    final ChannelFuture f = mock(ChannelFuture.class);
    doReturn(null).when(f).addListener(Mockito.any());
    doAnswer(invocation -> {
        final Object[] args = invocation.getArguments();
        BGPSessionImplTest.this.receivedMsgs.add((Notification) args[0]);
        return f;
    }).when(this.speakerListener).writeAndFlush(Mockito.any(Notification.class));
    doReturn(this.eventLoop).when(this.speakerListener).eventLoop();
    doReturn(true).when(this.speakerListener).isActive();
    doAnswer(invocation -> {
        final Runnable command = (Runnable) invocation.getArguments()[0];
        final long delay = (long) invocation.getArguments()[1];
        final TimeUnit unit = (TimeUnit) invocation.getArguments()[2];
        GlobalEventExecutor.INSTANCE.schedule(command, delay, unit);
        return null;
    }).when(this.eventLoop).schedule(Mockito.any(Runnable.class), Mockito.any(long.class), Mockito.any(TimeUnit.class));
    doReturn("TestingChannel").when(this.speakerListener).toString();
    doReturn(true).when(this.speakerListener).isWritable();
    doReturn(new InetSocketAddress(InetAddress.getByName(BGP_ID.getValue()), 179)).when(this.speakerListener).remoteAddress();
    doReturn(new InetSocketAddress(InetAddress.getByName(LOCAL_IP), LOCAL_PORT)).when(this.speakerListener).localAddress();
    doReturn(this.pipeline).when(this.speakerListener).pipeline();
    doReturn(this.pipeline).when(this.pipeline).replace(Mockito.any(ChannelHandler.class), Mockito.any(String.class), Mockito.any(ChannelHandler.class));
    doReturn(null).when(this.pipeline).replace(Matchers.<Class<ChannelHandler>>any(), Mockito.any(String.class), Mockito.any(ChannelHandler.class));
    doReturn(this.pipeline).when(this.pipeline).addLast(Mockito.any(ChannelHandler.class));
    final ChannelFuture futureChannel = mock(ChannelFuture.class);
    doReturn(null).when(futureChannel).addListener(Mockito.any());
    doReturn(futureChannel).when(this.speakerListener).close();
    this.listener = new SimpleSessionListener();
    this.bgpSession = new BGPSessionImpl(this.listener, this.speakerListener, this.classicOpen, this.classicOpen.getHoldTimer(), null);
    this.bgpSession.setChannelExtMsgCoder(this.classicOpen);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) ChannelHandler(io.netty.channel.ChannelHandler) BgpParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters) ProtocolVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.ProtocolVersion) CParameters1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1) Notification(org.opendaylight.yangtools.yang.binding.Notification) As4BytesCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapabilityBuilder) CParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder) TimeUnit(java.util.concurrent.TimeUnit) ChannelFuture(io.netty.channel.ChannelFuture) OptionalCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilitiesBuilder) OpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.OpenBuilder) MultiprotocolCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapabilityBuilder) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) BgpParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParametersBuilder) OptionalCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities) CParameters1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder) GracefulRestartCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder) Before(org.junit.Before)

Example 4 with GracefulRestartCapabilityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder in project bgpcep by opendaylight.

the class FSMTest method setUp.

@Before
public void setUp() throws UnknownHostException {
    MockitoAnnotations.initMocks(this);
    final List<BgpParameters> tlvs = Lists.newArrayList();
    final List<OptionalCapabilities> capas = Lists.newArrayList();
    capas.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder().setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build()).build()).build()).build());
    capas.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder().setAfi(this.linkstatett.getAfi()).setSafi(this.linkstatett.getSafi()).build()).build()).build()).build());
    capas.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(30L)).build()).build()).build());
    capas.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
    capas.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build()).build()).build());
    tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capas).build());
    final BGPSessionPreferences prefs = new BGPSessionPreferences(new AsNumber(30L), (short) 3, new BgpId("1.1.1.1"), new AsNumber(30L), tlvs);
    final ChannelFuture f = mock(ChannelFuture.class);
    doReturn(null).when(f).addListener(any(GenericFutureListener.class));
    final InetAddress peerAddress = InetAddress.getByName("1.1.1.2");
    doAnswer(invocation -> {
        final Object[] args = invocation.getArguments();
        FSMTest.this.receivedMsgs.add((Notification) args[0]);
        return f;
    }).when(this.speakerListener).writeAndFlush(any(Notification.class));
    doReturn(this.eventLoop).when(this.speakerListener).eventLoop();
    doReturn(null).when(this.eventLoop).schedule(any(Runnable.class), any(long.class), any(TimeUnit.class));
    doReturn("TestingChannel").when(this.speakerListener).toString();
    doReturn(new InetSocketAddress(peerAddress, 179)).when(this.speakerListener).remoteAddress();
    doReturn(new InetSocketAddress(peerAddress, 179)).when(this.speakerListener).localAddress();
    doReturn(this.pipeline).when(this.speakerListener).pipeline();
    doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class), any(String.class), any(ChannelHandler.class));
    doReturn(null).when(this.pipeline).replace(Matchers.<Class<ChannelHandler>>any(), any(String.class), any(ChannelHandler.class));
    doReturn(this.pipeline).when(this.pipeline).addLast(any(ChannelHandler.class));
    doReturn(mock(ChannelFuture.class)).when(this.speakerListener).close();
    final BGPPeerRegistry peerRegistry = new StrictBGPPeerRegistry();
    peerRegistry.addPeer(new IpAddress(new Ipv4Address(peerAddress.getHostAddress())), new SimpleSessionListener(), prefs);
    this.clientSession = new BGPClientSessionNegotiator(new DefaultPromise<>(GlobalEventExecutor.INSTANCE), this.speakerListener, peerRegistry);
    this.classicOpen = new OpenBuilder().setMyAsNumber(30).setHoldTimer(3).setVersion(new ProtocolVersion((short) 4)).setBgpParameters(tlvs).setBgpIdentifier(new Ipv4Address("1.1.1.2")).build();
}
Also used : InetSocketAddress(java.net.InetSocketAddress) ChannelHandler(io.netty.channel.ChannelHandler) BgpParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters) ProtocolVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.ProtocolVersion) Notification(org.opendaylight.yangtools.yang.binding.Notification) As4BytesCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapabilityBuilder) CParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder) BGPSessionPreferences(org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences) TimeUnit(java.util.concurrent.TimeUnit) GenericFutureListener(io.netty.util.concurrent.GenericFutureListener) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) ChannelFuture(io.netty.channel.ChannelFuture) OptionalCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilitiesBuilder) MultiprotocolCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapabilityBuilder) OpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.OpenBuilder) BGPPeerRegistry(org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry) BgpParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParametersBuilder) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) OptionalCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities) CParameters1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId) DefaultPromise(io.netty.util.concurrent.DefaultPromise) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) GracefulRestartCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder) InetAddress(java.net.InetAddress) Before(org.junit.Before)

Example 5 with GracefulRestartCapabilityBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder in project bgpcep by opendaylight.

the class SynchronizationAndExceptionTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    new EmbeddedChannel();
    final List<BgpParameters> tlvs = Lists.newArrayList();
    this.classicOpen = new OpenBuilder().setMyAsNumber(AS_NUMBER.getValue().intValue()).setHoldTimer(HOLD_TIMER).setVersion(new ProtocolVersion((short) 4)).setBgpParameters(tlvs).setBgpIdentifier(BGP_ID).build();
    final List<OptionalCapabilities> capa = Lists.newArrayList();
    capa.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder().setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build()).setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build()).setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(AS_NUMBER).build()).build()).build());
    capa.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
    tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capa).build());
    doReturn(null).when(mock(ChannelFuture.class)).addListener(any());
    doReturn(this.eventLoop).when(this.speakerListener).eventLoop();
    doReturn(true).when(this.speakerListener).isActive();
    doAnswer(invocation -> {
        final Runnable command = (Runnable) invocation.getArguments()[0];
        final long delay = (long) invocation.getArguments()[1];
        final TimeUnit unit = (TimeUnit) invocation.getArguments()[2];
        GlobalEventExecutor.INSTANCE.schedule(command, delay, unit);
        return null;
    }).when(this.eventLoop).schedule(any(Runnable.class), any(long.class), any(TimeUnit.class));
    doReturn("TestingChannel").when(this.speakerListener).toString();
    doReturn(true).when(this.speakerListener).isWritable();
    doReturn(new InetSocketAddress(InetAddress.getByName(BGP_ID.getValue()), 179)).when(this.speakerListener).remoteAddress();
    doReturn(new InetSocketAddress(InetAddress.getByName(LOCAL_IP), LOCAL_PORT)).when(this.speakerListener).localAddress();
    doReturn(this.pipeline).when(this.speakerListener).pipeline();
    doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class), any(String.class), any(ChannelHandler.class));
    doReturn(null).when(this.pipeline).replace(Matchers.<Class<ChannelHandler>>any(), any(String.class), any(ChannelHandler.class));
    doReturn(this.pipeline).when(this.pipeline).addLast(any(ChannelHandler.class));
    final ChannelFuture futureChannel = mock(ChannelFuture.class);
    doReturn(null).when(futureChannel).addListener(any());
    doReturn(futureChannel).when(this.speakerListener).close();
    doReturn(futureChannel).when(this.speakerListener).writeAndFlush(any(Notify.class));
    doReturn(this.domChain).when(this.domBroker).createTransactionChain(any());
    doReturn(this.tx).when(this.domChain).newWriteOnlyTransaction();
    final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
    final ListenerRegistration<?> listener = mock(ListenerRegistration.class);
    doReturn(listener).when(dOMDataTreeChangeService).registerDataTreeChangeListener(any(), any());
    doNothing().when(listener).close();
    doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService)).when(this.domBroker).getSupportedExtensions();
    doNothing().when(this.tx).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
    doNothing().when(this.tx).put(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
    doNothing().when(this.tx).delete(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class));
    final CheckedFuture<?, ?> future = mock(CheckedFuture.class);
    doAnswer(invocation -> {
        final Runnable callback = (Runnable) invocation.getArguments()[0];
        callback.run();
        return null;
    }).when(future).addListener(any(Runnable.class), any(Executor.class));
    doReturn(future).when(this.tx).submit();
    doReturn(mock(Optional.class)).when(future).checkedGet();
}
Also used : Notify(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Notify) InetSocketAddress(java.net.InetSocketAddress) ChannelHandler(io.netty.channel.ChannelHandler) BgpParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters) ProtocolVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.ProtocolVersion) CParameters1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1) As4BytesCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapabilityBuilder) CParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder) GlobalEventExecutor(io.netty.util.concurrent.GlobalEventExecutor) Executor(java.util.concurrent.Executor) TimeUnit(java.util.concurrent.TimeUnit) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) ChannelFuture(io.netty.channel.ChannelFuture) OptionalCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilitiesBuilder) OpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.OpenBuilder) MultiprotocolCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapabilityBuilder) Optional(com.google.common.base.Optional) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) BgpParametersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParametersBuilder) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) OptionalCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities) DOMDataTreeChangeService(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService) CParameters1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) GracefulRestartCapabilityBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder) Before(org.junit.Before)

Aggregations

CParametersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.CParametersBuilder)11 CParameters1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1Builder)11 GracefulRestartCapabilityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapabilityBuilder)11 Test (org.junit.Test)7 RestartFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.GracefulRestartCapability.RestartFlags)7 TablesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.TablesBuilder)7 ByteBuf (io.netty.buffer.ByteBuf)6 AfiFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.graceful.restart.capability.Tables.AfiFlags)6 GracefulCapabilityHandler (org.opendaylight.protocol.bgp.parser.impl.message.open.GracefulCapabilityHandler)5 As4BytesCapabilityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapabilityBuilder)5 CParameters1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.CParameters1)5 OpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.OpenBuilder)4 ProtocolVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.ProtocolVersion)4 BgpParameters (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters)4 BgpParametersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParametersBuilder)4 OptionalCapabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities)4 OptionalCapabilitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilitiesBuilder)4 MultiprotocolCapabilityBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapabilityBuilder)4 ChannelFuture (io.netty.channel.ChannelFuture)3 ChannelHandler (io.netty.channel.ChannelHandler)3