use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class Ipv4NlriParserTest method parseUnreachNlriMultiPathTest.
@Test
public void parseUnreachNlriMultiPathTest() {
final MpUnreachNlri mpUnreachNlri = new MpUnreachNlriBuilder().setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(PREFIXES).build()).build()).build()).build();
final MpUnreachNlriBuilder mpUnreachNlriBuilder = new MpUnreachNlriBuilder();
mpUnreachNlriBuilder.setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class);
this.parser.parseNlri(Unpooled.wrappedBuffer(MP_NLRI_BYTES), mpUnreachNlriBuilder, this.constraint);
mpUnreachNlriBuilder.setAfi(null).setSafi(null);
Assert.assertEquals(mpUnreachNlri, mpUnreachNlriBuilder.build());
final Ipv4NlriParser serializer = new Ipv4NlriParser();
final ByteBuf output = Unpooled.buffer(MP_NLRI_BYTES.length);
final Attributes attributes = new AttributesBuilder().addAugmentation(new AttributesUnreachBuilder().setMpUnreachNlri(mpUnreachNlri).build()).build();
serializer.serializeAttribute(attributes, output);
Assert.assertArrayEquals(MP_NLRI_BYTES, output.array());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class L3vpnMcastIpv6NlriHandler method parseNlri.
@Override
public void parseNlri(final ByteBuf nlri, final MpUnreachNlriBuilder builder, final PeerSpecificParserConstraint constraint) throws BGPParsingException {
if (!nlri.isReadable()) {
return;
}
final boolean mPathSupported = MultiPathSupportUtil.isTableTypeSupported(constraint, new BgpTableTypeImpl(builder.getAfi(), builder.getSafi()));
builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new DestinationL3vpnMcastIpv6WithdrawnCaseBuilder().setDestinationIpv6L3vpnMcast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.l3vpn.mcast.ipv6.withdrawn._case.DestinationIpv6L3vpnMcastBuilder().setL3vpnMcastDestination(L3vpnMcastNlriSerializer.extractDest(nlri, mPathSupported)).build()).build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class LinkstateAttributeParserTest method testGetNlriType.
@Test
public void testGetNlriType() throws BGPParsingException, BGPDocumentedException {
final ByteBuf b = Unpooled.buffer();
AttributesBuilder builder = new AttributesBuilder();
this.parser.parseAttribute(b, builder, null);
assertEquals(0, b.readableBytes());
builder = new AttributesBuilder();
final AttributesReachBuilder builder1 = new AttributesReachBuilder();
builder.addAugmentation(builder1.build());
this.parser.parseAttribute(b, builder, null);
assertEquals(0, b.readableBytes());
builder = new AttributesBuilder();
builder.addAugmentation(builder1.setMpReachNlri(new MpReachNlriBuilder().setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv4CaseBuilder().build()).build()).build()).build());
this.parser.parseAttribute(b, builder, null);
assertEquals(0, b.readableBytes());
builder = new AttributesBuilder();
final AttributesUnreachBuilder builder2 = new AttributesUnreachBuilder();
builder.addAugmentation(builder2.build());
this.parser.parseAttribute(b, builder, null);
assertEquals(0, b.readableBytes());
builder = new AttributesBuilder();
builder.addAugmentation(builder2.setMpUnreachNlri(new MpUnreachNlriBuilder().setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().build()).build()).build()).build());
this.parser.parseAttribute(b, builder, null);
assertEquals(0, b.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class EvpnNlriAttributesParserTest method createUnreach.
private static MpUnreachNlri createUnreach() {
final MpUnreachNlriBuilder mpReachExpected = new MpUnreachNlriBuilder();
final WithdrawnRoutes wd = new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder().setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.evpn._case.DestinationEvpnBuilder().setEvpnDestination(singletonList(new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build())).build()).build()).build();
return mpReachExpected.setWithdrawnRoutes(wd).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method parseNlri.
@Override
public final void parseNlri(@NonNull final ByteBuf nlri, @NonNull final MpUnreachNlriBuilder builder, final PeerSpecificParserConstraint constraint) throws BGPParsingException {
if (!nlri.isReadable()) {
return;
}
final PathId pathId = readPathId(nlri, builder.getAfi(), builder.getSafi(), constraint);
final Object[] nlriFields = parseNlri(nlri);
builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(createWithdrawnDestinationType(nlriFields, pathId)).build());
}
Aggregations