assertArrayEquals(inputBytes.get(6), ByteArray.readAllBytes(buffer));
}
+ /*
+ * End of Rib for Ipv6 consists of empty MP_UNREACH_NLRI, with AFI 2 and SAFI 1
+ *
+ * ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff <- marker
+ * 00 1e <- length (29) - including header
+ * 02 <- message type
+ * 00 00 <- withdrawn routes length
+ * 00 07 <- total path attribute length
+ * 90 <- attribute flags
+ * 0f <- attribute type (15 - MP_UNREACH_NLRI)
+ * 00 03 <- attribute length
+ * 00 02 <- value (AFI 2: IPv6)
+ * 01 <- value (SAFI 1)
+ */
+ @Test
+ public void testEORIpv6exLength() throws Exception {
+ final byte[] body = ByteArray.cutBytes(inputBytes.get(6), MessageUtil.COMMON_HEADER_LENGTH);
+ final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(6), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
+ final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength);
+
+ final Class<? extends AddressFamily> afi = message.getPathAttributes().getAugmentation(PathAttributes2.class).getMpUnreachNlri().getAfi();
+ final Class<? extends SubsequentAddressFamily> safi = message.getPathAttributes().getAugmentation(PathAttributes2.class).getMpUnreachNlri().getSafi();
+
+ assertEquals(Ipv6AddressFamily.class, afi);
+ assertEquals(UnicastSubsequentAddressFamily.class, safi);
+
+ final ByteBuf buffer = Unpooled.buffer();
+ BGPParserTest.updateParser.serializeMessage(message, buffer);
+ assertArrayEquals(inputBytes.get(6), ByteArray.readAllBytes(buffer));
+ }
+
/*
* End of Rib for LS consists of empty MP_UNREACH_NLRI, with AFI 16388 and SAFI 71
*
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.DestinationIpv4Case;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.DestinationIpv4CaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.destination.ipv4._case.DestinationIpv4;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.destination.ipv4._case.DestinationIpv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.path.attributes.MpReachNlri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.path.attributes.MpReachNlriBuilder;
new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(
Lists.newArrayList(data.getPrefix())).build()).build()).build());
} else {
- ((DestinationIpv4) ar.getDestinationType()).getIpv4Prefixes().add(data.getPrefix());
+ ((DestinationIpv4Case) ar.getDestinationType()).getDestinationIpv4().getIpv4Prefixes().add(data.getPrefix());
}
}
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.DestinationIpv6Case;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.DestinationIpv6CaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.destination.ipv6._case.DestinationIpv6;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.destination.ipv6._case.DestinationIpv6Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.path.attributes.MpReachNlri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.path.attributes.MpReachNlriBuilder;
@Override
public void removeRoutes(final AdjRIBsTransaction trans, final Peer peer, final MpUnreachNlri nlri) {
- for (final Ipv6Prefix id : ((DestinationIpv6) nlri.getWithdrawnRoutes().getDestinationType()).getIpv6Prefixes()) {
+ for (final Ipv6Prefix id : ((DestinationIpv6Case) nlri.getWithdrawnRoutes().getDestinationType()).getDestinationIpv6().getIpv6Prefixes()) {
super.remove(trans, peer, id);
}
}
new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder().setIpv6Prefixes(
Lists.newArrayList(data.getPrefix())).build()).build()).build());
} else {
- ((DestinationIpv6) ar.getDestinationType()).getIpv6Prefixes().add(data.getPrefix());
+ ((DestinationIpv6Case) ar.getDestinationType()).getDestinationIpv6().getIpv6Prefixes().add(data.getPrefix());
}
}