Search in sources :

Example 6 with NlriType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType in project bgpcep by opendaylight.

the class LinkstateAttributeParser method parseAttribute.

@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder, final RevisedErrorHandling errorHandling, final PeerSpecificParserConstraint constraint) throws BGPParsingException {
    // FIXME: BGPCEP-359: we need an updated link-state spec for RFC7606
    final CLinkstateDestination lsDestination = getNlriType(builder);
    if (lsDestination == null) {
        LOG.warn("No Linkstate NLRI found, not parsing Linkstate attribute");
        return;
    }
    final ObjectType nlriType = lsDestination.getObjectType();
    final ProtocolId protocolId = lsDestination.getProtocolId();
    builder.addAugmentation(new Attributes1Builder().setLinkStateAttribute(parseLinkState(nlriType, protocolId, buffer)).build());
}
Also used : ProtocolId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.ProtocolId) ObjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType) Attributes1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Attributes1Builder) CLinkstateDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination)

Example 7 with NlriType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType in project bgpcep by opendaylight.

the class Ipv6NlriHandler method parseIpv6ReachNlri.

static DestinationMvpnIpv6AdvertizedCase parseIpv6ReachNlri(final ByteBuf nlri, final boolean addPathSupported) {
    final List<MvpnDestination> dests = new ArrayList<>();
    while (nlri.isReadable()) {
        final MvpnDestinationBuilder builder = new MvpnDestinationBuilder();
        if (addPathSupported) {
            builder.setPathId(PathIdUtil.readPathId(nlri));
        }
        final NlriType type = NlriType.forValue(nlri.readUnsignedByte());
        final int length = nlri.readUnsignedByte();
        final ByteBuf nlriBuf = nlri.readSlice(length);
        builder.setMvpnChoice(SimpleMvpnNlriRegistry.getInstance().parseMvpn(type, nlriBuf));
        dests.add(builder.build());
    }
    return new DestinationMvpnIpv6AdvertizedCaseBuilder().setDestinationMvpn(new DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
}
Also used : MvpnDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.mvpn.destination.MvpnDestinationBuilder) MvpnDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.mvpn.destination.MvpnDestination) DestinationMvpnIpv6AdvertizedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationMvpnIpv6AdvertizedCaseBuilder) ArrayList(java.util.ArrayList) NlriType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType) ByteBuf(io.netty.buffer.ByteBuf) DestinationMvpnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv6.advertized._case.DestinationMvpnBuilder)

Example 8 with NlriType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType in project bgpcep by opendaylight.

the class Ipv6NlriHandler method parseIpv6UnreachNlri.

static DestinationMvpnIpv6WithdrawnCase parseIpv6UnreachNlri(final ByteBuf nlri, final boolean addPathSupported) {
    final List<MvpnDestination> dests = new ArrayList<>();
    while (nlri.isReadable()) {
        final MvpnDestinationBuilder builder = new MvpnDestinationBuilder();
        if (addPathSupported) {
            builder.setPathId(PathIdUtil.readPathId(nlri));
        }
        final NlriType type = NlriType.forValue(nlri.readUnsignedByte());
        final int length = nlri.readUnsignedByte();
        final ByteBuf nlriBuf = nlri.readSlice(length);
        builder.setMvpnChoice(SimpleMvpnNlriRegistry.getInstance().parseMvpn(type, nlriBuf));
        dests.add(builder.build());
    }
    return new DestinationMvpnIpv6WithdrawnCaseBuilder().setDestinationMvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn.ipv6.withdrawn._case.DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
}
Also used : MvpnDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.mvpn.destination.MvpnDestinationBuilder) ArrayList(java.util.ArrayList) DestinationMvpnIpv6WithdrawnCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationMvpnIpv6WithdrawnCaseBuilder) ByteBuf(io.netty.buffer.ByteBuf) MvpnDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.mvpn.destination.MvpnDestination) NlriType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType) DestinationMvpnBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv6.advertized._case.DestinationMvpnBuilder)

Example 9 with NlriType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType in project bgpcep by opendaylight.

the class LinkstateAttributeParser method parseAttribute.

@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) throws BGPParsingException {
    final CLinkstateDestination lsDestination = getNlriType(builder);
    if (lsDestination == null) {
        LOG.warn("No Linkstate NLRI found, not parsing Linkstate attribute");
        return;
    }
    final ObjectType nlriType = lsDestination.getObjectType();
    final ProtocolId protocolId = lsDestination.getProtocolId();
    final Attributes1 a = new Attributes1Builder().setLinkStateAttribute(parseLinkState(nlriType, protocolId, buffer)).build();
    builder.addAugmentation(Attributes1.class, a);
}
Also used : ProtocolId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.ProtocolId) ObjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.ObjectType) Attributes1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Attributes1Builder) Attributes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Attributes1) CLinkstateDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestination)

Example 10 with NlriType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType in project bgpcep by opendaylight.

the class EvpnNlriParser method parseNlri.

@Nullable
private static List<EvpnDestination> parseNlri(final ByteBuf nlri, final PeerSpecificParserConstraint constraints, final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
    if (!nlri.isReadable()) {
        return null;
    }
    final List<EvpnDestination> dests = new ArrayList<>();
    while (nlri.isReadable()) {
        final EvpnDestinationBuilder builder = new EvpnDestinationBuilder();
        if (MultiPathSupportUtil.isTableTypeSupported(constraints, new BgpTableTypeImpl(afi, safi))) {
            builder.setPathId(PathIdUtil.readPathId(nlri));
        }
        final NlriType type = NlriType.forValue(nlri.readUnsignedByte());
        final int length = nlri.readUnsignedByte();
        final ByteBuf nlriBuf = nlri.readSlice(length);
        builder.setRouteDistinguisher(parseRouteDistinguisher(nlriBuf));
        builder.setEvpnChoice(SimpleEvpnNlriRegistry.getInstance().parseEvpn(type, nlriBuf));
        dests.add(builder.build());
    }
    return dests;
}
Also used : ArrayList(java.util.ArrayList) EvpnDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.destination.EvpnDestination) EvpnDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.destination.EvpnDestinationBuilder) BgpTableTypeImpl(org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl) NlriType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.NlriType) ByteBuf(io.netty.buffer.ByteBuf) PeerSpecificParserConstraint(org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)9 ArrayList (java.util.ArrayList)6 NlriType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.NlriType)5 Test (org.junit.Test)2 NlriType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.NlriType)2 NlriType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.NlriType)2 ObjectType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType)2 MvpnDestination (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.mvpn.destination.MvpnDestination)2 MvpnDestinationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.mvpn.destination.MvpnDestinationBuilder)2 DestinationMvpnBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv4.advertized._case.DestinationMvpnBuilder)2 MvpnDestination (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.mvpn.destination.MvpnDestination)2 MvpnDestinationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.mvpn.destination.MvpnDestinationBuilder)2 DestinationMvpnBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.mvpn.ipv6.advertized._case.DestinationMvpnBuilder)2 Nullable (javax.annotation.Nullable)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 EthADRParserTest (org.opendaylight.protocol.bgp.evpn.impl.nlri.EthADRParserTest)1 NlriTypeCaseSerializer (org.opendaylight.protocol.bgp.linkstate.spi.NlriTypeCaseSerializer)1 BgpTableTypeImpl (org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)1 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)1 EvpnChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice)1