use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib in project bgpcep by opendaylight.
the class AddPathBasePathsTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
final TablesKey tk = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(tk, BasePathSelectionModeFactory.createBestPathSelectionStrategy());
this.ribImpl = new RIBImpl(this.tableRegistry, new RibId("test-rib"), AS_NUMBER, new BgpId(RIB_ID), this.ribExtension, this.serverDispatcher, this.codecsRegistry, getDomBroker(), this.policies, TABLES_TYPE, pathTables);
this.ribImpl.instantiateServiceInstance();
final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT.toJava()));
waitFutureSuccess(channelFuture);
this.serverChannel = channelFuture.channel();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib in project bgpcep by opendaylight.
the class GracefulRestartTest method retainRoutesOnPeerRestartTest.
/**
* Test that routes from peer that has advertised the Graceful Restart Capability MUST be retained
* for all the address families that were previously received in the Graceful Restart Capability.
*
* @throws Exception on reading Rib failure
*/
@Test
public void retainRoutesOnPeerRestartTest() throws Exception {
final List<Ipv4Prefix> ipv4Prefixes = Arrays.asList(new Ipv4Prefix(PREFIX1), new Ipv4Prefix(PREFIX2));
final List<Ipv6Prefix> ipv6Prefixes = Collections.singletonList(new Ipv6Prefix(PREFIX3));
insertRoutes(ipv4Prefixes, ipv6Prefixes);
checkLocRibIpv4Routes(2);
checkLocRibIpv6Routes(1);
this.session.close();
checkIdleState(this.peer);
checkLocRibIpv4Routes(2);
checkLocRibIpv6Routes(0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib in project bgpcep by opendaylight.
the class GracefulRestartTest method verifySendEORafterRestartTest.
/**
* After graceful restart is performed from peer side we have to re-advertise routes followed by
* End-of-RIB marker.
*
* @throws Exception on reading Rib failure
*/
@Test
public void verifySendEORafterRestartTest() throws Exception {
final SimpleSessionListener listener2 = new SimpleSessionListener();
configurePeer(this.tableRegistry, PEER2, this.ribImpl, this.parameters, PeerRole.Ebgp, this.serverRegistry, afiSafiAdvertised, gracefulAfiSafiAdvertised);
final BGPSessionImpl session2 = createPeerSession(PEER2, this.parameters, listener2);
final List<Ipv4Prefix> ipv4Prefixes = Arrays.asList(new Ipv4Prefix(PREFIX1));
final List<Ipv4Prefix> ipv4Prefixes2 = Arrays.asList(new Ipv4Prefix(PREFIX2));
final List<Ipv6Prefix> ipv6Prefixes = Collections.singletonList(new Ipv6Prefix(PREFIX3));
insertRoutes(ipv4Prefixes, ipv6Prefixes);
insertRoutes(ipv4Prefixes2, PEER2, null, null, session2, BgpOrigin.Egp);
checkLocRibIpv4Routes(2);
checkLocRibIpv6Routes(1);
org.opendaylight.protocol.util.CheckUtil.checkReceivedMessages(this.listener, 3);
// verify sending of Ipv4 EOT, Ipv6 EOT and Ipv4 update with route
checkReceivedMessages(this.listener, 3);
assertTrue(this.listener.getListMsg().get(0) instanceof Update);
assertTrue(BgpPeerUtil.isEndOfRib((Update) this.listener.getListMsg().get(0)));
assertTrue(this.listener.getListMsg().get(1) instanceof Update);
assertTrue(BgpPeerUtil.isEndOfRib((Update) this.listener.getListMsg().get(1)));
assertTrue(this.listener.getListMsg().get(2) instanceof Update);
assertFalse(BgpPeerUtil.isEndOfRib((Update) this.listener.getListMsg().get(2)));
this.session.close();
checkIdleState(this.peer);
checkLocRibIpv4Routes(2);
checkLocRibIpv6Routes(0);
// verify nothing new was sent
checkReceivedMessages(this.listener, 3);
this.session = createPeerSession(PEER1, createParameter(false, true, Collections.singletonMap(TABLES_KEY, true)), this.listener);
checkUpState(listener);
checkUpState(this.peer);
org.opendaylight.protocol.util.CheckUtil.checkReceivedMessages(this.listener, 6);
// verify sending of Ipv4 update with route, Ipv4 EOT and Ipv6 EOT; order can vary based on ODTC order
final List<Notification> subList = this.listener.getListMsg().subList(3, 6);
int eotCount = 0;
int routeUpdateCount = 0;
for (Notification message : subList) {
if (BgpPeerUtil.isEndOfRib((Update) message)) {
eotCount++;
} else {
routeUpdateCount++;
}
}
assertEquals(2, eotCount);
assertEquals(1, routeUpdateCount);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib in project bgpcep by opendaylight.
the class GracefulRestartTest method waitForDeferralTimerOnLocalGracefulRestart.
/**
* Wait with route selection until deferral time is expired.
*
* @throws Exception on reading Rib failure
*/
@Test
public void waitForDeferralTimerOnLocalGracefulRestart() throws Exception {
performLocalGracefulRestart();
final List<Ipv4Prefix> ipv4prefixes = Arrays.asList(new Ipv4Prefix(PREFIX1));
final List<Ipv6Prefix> ipv6prefixes = Arrays.asList(new Ipv6Prefix(PREFIX3));
insertRoutes(ipv4prefixes, ipv6prefixes);
checkLocRibIpv4Routes(2);
checkLocRibIpv6Routes(0);
checkStateIsNotRestarting(this.peer, DEFERRAL_TIMER);
checkLocRibIpv4Routes(2);
checkLocRibIpv6Routes(1);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib in project bgpcep by opendaylight.
the class GracefulRestartTest method removeStaleRoutesAfterRestartTest.
/**
* Once the End-of-RIB marker for an address family is received from the peer, it MUST
* immediately remove any routes from the peer that are still marked as stale for that
* address family.
*
* @throws Exception on reading Rib failure
*/
@Test
public void removeStaleRoutesAfterRestartTest() throws Exception {
retainRoutesOnPeerRestartTest();
this.session = createPeerSession(PEER1, createParameter(false, true, Collections.singletonMap(TABLES_KEY, true)), this.listener);
checkUpState(this.listener);
final List<Ipv4Prefix> ipv4prefixes = Arrays.asList(new Ipv4Prefix(PREFIX1));
insertRoutes(ipv4prefixes, null);
insertRoutes(null, null);
checkLocRibIpv4Routes(1);
checkLocRibIpv6Routes(0);
}
Aggregations