Search in sources :

Example 6 with Ipv6Prefixes

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);
}
Also used : Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 7 with Ipv6Prefixes

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);
            }
        }
    }
}
Also used : AdvertizedRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutes) Preconditions(com.google.common.base.Preconditions) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.unreach.nlri.WithdrawnRoutes) DestinationIpv6Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6Case) Attributes2(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes2) Attributes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1) Ipv6Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv6.prefixes.destination.ipv6.Ipv6Prefixes)

Example 8 with Ipv6Prefixes

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);
}
Also used : Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 9 with Ipv6Prefixes

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);
}
Also used : Update(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) Notification(org.opendaylight.yangtools.yang.binding.Notification) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 10 with Ipv6Prefixes

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);
}
Also used : Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Aggregations

Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)7 Test (org.junit.Test)6 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)5 Ipv6Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes)4 ArrayList (java.util.ArrayList)3 Ipv6PrefixesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6PrefixesBuilder)3 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)3 DestinationIpv6Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.DestinationIpv6Builder)2 Preconditions (com.google.common.base.Preconditions)1 ByteBuf (io.netty.buffer.ByteBuf)1 BgpTableTypeImpl (org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 IpAddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone)1 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)1 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)1 Ipv6AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone)1 Ipv6Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv6.prefixes.destination.ipv6.Ipv6Prefixes)1 DestinationIpv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6Case)1 DestinationIpv6Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6Case)1 DestinationIpv6CaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6CaseBuilder)1