import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.opendaylight.protocol.bgp.rib.impl.CheckUtil.checkReceivedMessages;
+import static org.opendaylight.protocol.util.CheckUtil.checkEquals;
+import static org.opendaylight.protocol.util.CheckUtil.checkReceivedMessages;
import static org.opendaylight.protocol.util.CheckUtil.waitFutureSuccess;
-import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.Uninterruptibles;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
import org.opendaylight.protocol.bgp.rib.spi.state.BGPTransportState;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParameters;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
public class AddPathAllPathsTest extends AbstractAddPathTest {
private RIBImpl ribImpl;
private Channel serverChannel;
- @FunctionalInterface
- private interface CheckEquals {
- void check();
- }
-
@Before
public void setUp() throws Exception {
super.setUp();
this.ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId("test-rib"),
AS_NUMBER, BGP_ID, null, this.ribExtension, this.serverDispatcher, this.mappingService.getCodecFactory(),
- getDomBroker(), TABLES_TYPE, pathTables, this.ribExtension.getClassLoadingStrategy(), null);
+ getDomBroker(), TABLES_TYPE, pathTables, this.ribExtension.getClassLoadingStrategy());
this.ribImpl.instantiateServiceInstance();
this.ribImpl.onGlobalContextUpdated(this.schemaContext);
checkReceivedMessages(listener6, 1);
assertEquals(UPD_NA_100, listener6.getListMsg().get(0));
causeBGPError(session6);
- //session6.close();aca send wrong message
checkEquals(()-> assertEquals(1L, peer6.getPeerState().getBGPPeerMessagesState().getNotificationMessagesSentCount()));
checkPeersPresentOnDataStore(5);
session4.close();
session5.close();
}
-
- private static void checkEquals(final CheckEquals function) throws Exception {
- AssertionError lastError = null;
- final Stopwatch sw = Stopwatch.createStarted();
- while (sw.elapsed(TimeUnit.SECONDS) <= 10) {
- try {
- function.check();
- return;
- } catch (final AssertionError e) {
- lastError = e;
- Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS);
- }
- }
- Assert.fail(lastError.getMessage());
- throw lastError;
- }
}