use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes in project bgpcep by opendaylight.
the class GracefulRestartTest method waitForEORonLocalGracefulRestart.
/**
* Wait with route selection until EOT is received.
*
* @throws Exception on reading Rib failure
*/
@Test
public void waitForEORonLocalGracefulRestart() 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);
insertRoutes(null, null);
checkLocRibIpv4Routes(2);
checkLocRibIpv6Routes(1);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes in project bgpcep by opendaylight.
the class Ipv6NlriParser method serializeAttribute.
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
final Attributes pathAttributes = (Attributes) attribute;
final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv6Case) {
final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) advertizedRoutes.getDestinationType();
for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
}
}
} else if (pathAttributes2 != null) {
final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case destinationIpv6Case = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) withdrawnRoutes.getDestinationType();
for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes 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.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes 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.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes 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);
}
Aggregations