use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.route.target.constrain.choice.RouteTargetConstrainDefaultCase in project bgpcep by opendaylight.
the class RouteTargetConstrainNlriHandler method serializeNlriDestinations.
public static ByteBuf serializeNlriDestinations(final List<RouteTargetConstrainDestination> destinationList) {
final ByteBuf nlri = Unpooled.buffer();
for (final RouteTargetConstrainDestination dest : destinationList) {
final RouteTargetConstrainChoice rtcChoice = dest.getRouteTargetConstrainChoice();
if (rtcChoice instanceof RouteTargetConstrainDefaultCase) {
nlri.writeByte(0);
} else {
nlri.writeByte(RT_BITS_LENGTH);
final AsNumber originAs = dest.getOriginAs();
if (originAs != null) {
ByteBufUtils.write(nlri, originAs.getValue());
}
nlri.writeBytes(ImmutableRouteTargetConstrainNlriRegistry.getInstance().serializeRouteTargetConstrain(rtcChoice));
}
}
return nlri;
}
Aggregations