Search in sources :

Example 1 with AttributesUnreach

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach in project bgpcep by opendaylight.

the class EvpnNlriParser method serializeAttribute.

@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
    final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
    final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.class);
    if (pathAttributes1 != null) {
        final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
        if (routes != null && routes.getDestinationType() instanceof DestinationEvpnCase) {
            final DestinationEvpnCase evpnCase = (DestinationEvpnCase) routes.getDestinationType();
            serializeNlri(evpnCase.getDestinationEvpn().getEvpnDestination(), byteAggregator);
        }
    } else if (pathAttributes2 != null) {
        final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri();
        final WithdrawnRoutes withdrawnRoutes = mpUnreachNlri.getWithdrawnRoutes();
        if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) {
            final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase evpnCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
            serializeNlri(evpnCase.getDestinationEvpn().getEvpnDestination(), byteAggregator);
        }
    }
}
Also used : AdvertizedRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutes) AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) DestinationEvpnCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationEvpnCase) MpUnreachNlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlri) AttributesUnreach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach)

Example 2 with AttributesUnreach

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach in project bgpcep by opendaylight.

the class BGPParserTest method testParseUpdateMessageWithMalformedAttributes.

/*
     * Tests withdrawn routes with malformed attribute.
     *
     * ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff <- marker
     * 00 36 <- length (54) - including header
     * 02 <- message type
     * 00 00 <- withdrawn routes length
     * 00 1b <- total path attribute length (27)
     * 40 <- attribute flags
     * 01 <- attribute type code (origin)
     * 01 <- WRONG attribute length
     * 00 <- Origin value (IGP)
     * 40 <- attribute flags
     * 03 <- attribute type code (Next Hop)
     * 04 <- attribute length
     * 0a 00 00 02 <- value (10.0.0.2)
     * 40 <- attribute flags
     * 0e <- attribute type code (MP_REACH)
     * 0d <- attribute length
     * 00 01 <- AFI (Ipv4)
     * 01 <- SAFI (Unicast)
     * 04 <- next hop length
     * ff ff ff ff <- next hop
     * 00 <- reserved
     * 18 <- length
     * 0a 00 01 <- prefix (10.0.1.0)
     * //NLRI
     * 18 <- length
     * 0a 00 02 <- prefix (10.0.2.0)
     */
@Test
public void testParseUpdateMessageWithMalformedAttributes() throws Exception {
    final PeerSpecificParserConstraintImpl constraint = new PeerSpecificParserConstraintImpl();
    constraint.addPeerConstraint(RevisedErrorHandlingSupport.class, RevisedErrorHandlingSupportImpl.forExternalPeer());
    final Update message = (Update) messageRegistry.parseMessage(Unpooled.wrappedBuffer(input.get(0)), constraint);
    assertNotNull(message);
    assertNull(message.getNlri());
    final List<WithdrawnRoutes> withdrawnRoutes = message.getWithdrawnRoutes();
    assertNotNull(withdrawnRoutes);
    assertEquals(1, withdrawnRoutes.size());
    final Attributes attributes = message.getAttributes();
    assertNotNull(attributes);
    assertNull(attributes.augmentation(AttributesReach.class));
    final AttributesUnreach AttributesUnreach = attributes.augmentation(AttributesUnreach.class);
    assertNotNull(AttributesUnreach);
    final MpUnreachNlri mpUnreachNlri = AttributesUnreach.getMpUnreachNlri();
    assertNotNull(mpUnreachNlri);
}
Also used : AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) MpUnreachNlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlri) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes) AttributesUnreach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.update.message.WithdrawnRoutes) Update(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update) PeerSpecificParserConstraintImpl(org.opendaylight.protocol.bgp.parser.spi.pojo.PeerSpecificParserConstraintImpl) Test(org.junit.Test)

Example 3 with AttributesUnreach

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach in project bgpcep by opendaylight.

the class L3vpnMcastIpv6NlriHandler method serializeAttribute.

@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
    final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
    final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.class);
    if (pathAttributes1 != null) {
        final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
        if (routes != null && routes.getDestinationType() instanceof DestinationL3vpnMcastIpv6AdvertizedCase) {
            final DestinationL3vpnMcastIpv6AdvertizedCase reach = (DestinationL3vpnMcastIpv6AdvertizedCase) routes.getDestinationType();
            L3vpnMcastNlriSerializer.serializeNlri(reach.getDestinationIpv6L3vpnMcast().getL3vpnMcastDestination(), byteAggregator);
        }
    } else if (pathAttributes2 != null) {
        final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
        if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof DestinationL3vpnMcastIpv6WithdrawnCase) {
            final DestinationL3vpnMcastIpv6WithdrawnCase reach = (DestinationL3vpnMcastIpv6WithdrawnCase) withdrawnRoutes.getDestinationType();
            L3vpnMcastNlriSerializer.serializeNlri(reach.getDestinationIpv6L3vpnMcast().getL3vpnMcastDestination(), byteAggregator);
        }
    }
}
Also used : AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) DestinationL3vpnMcastIpv6WithdrawnCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationL3vpnMcastIpv6WithdrawnCase) AdvertizedRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes) AttributesUnreach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutes) DestinationL3vpnMcastIpv6AdvertizedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationL3vpnMcastIpv6AdvertizedCase)

Example 4 with AttributesUnreach

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach in project bgpcep by opendaylight.

the class Ipv6NlriParser method serializeAttribute.

@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
    final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
    final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.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);
                Ipv6Util.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.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) {
            final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case destinationIpv6Case = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) withdrawnRoutes.getDestinationType();
            for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
                PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
                Ipv6Util.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
            }
        }
    }
}
Also used : AdvertizedRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutes) AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) 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) Ipv6Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes) AttributesUnreach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach)

Example 5 with AttributesUnreach

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach in project bgpcep by opendaylight.

the class AbstractFlowspecNlriParser method serializeAttribute.

@Override
public final void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
    final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
    final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.class);
    if (pathAttributes1 != null) {
        final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
        if (routes != null) {
            serializeMpReachNlri(routes.getDestinationType(), byteAggregator);
        }
    }
    if (pathAttributes2 != null) {
        final WithdrawnRoutes routes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
        if (routes != null) {
            serializeMpUnreachNlri(routes.getDestinationType(), byteAggregator);
        }
    }
}
Also used : AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) AdvertizedRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes) AttributesUnreach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutes)

Aggregations

AttributesUnreach (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach)19 AttributesReach (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach)16 AdvertizedRoutes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes)11 WithdrawnRoutes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutes)11 MpUnreachNlri (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlri)5 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)3 Test (org.junit.Test)2 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)2 DestinationType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType)2 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey)2 ByteBuf (io.netty.buffer.ByteBuf)1 BGPDocumentedException (org.opendaylight.protocol.bgp.parser.BGPDocumentedException)1 NlriSerializer (org.opendaylight.protocol.bgp.parser.spi.NlriSerializer)1 PeerSpecificParserConstraintImpl (org.opendaylight.protocol.bgp.parser.spi.pojo.PeerSpecificParserConstraintImpl)1 DestinationEvpnCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationEvpnCase)1 Ipv4Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.prefixes.destination.ipv4.Ipv4Prefixes)1 Ipv6Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.prefixes.destination.ipv6.Ipv6Prefixes)1 DestinationIpv4Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4Case)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 DestinationL3vpnMcastIpv4AdvertizedCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationL3vpnMcastIpv4AdvertizedCase)1