Search in sources :

Example 1 with RouteTargetConstrainChoice

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.RouteTargetConstrainChoice 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;
}
Also used : RouteTargetConstrainDefaultCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.route.target.constrain.choice.RouteTargetConstrainDefaultCase) ByteBuf(io.netty.buffer.ByteBuf) RouteTargetConstrainDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.destination.RouteTargetConstrainDestination) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) RouteTargetConstrainChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.RouteTargetConstrainChoice)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 RouteTargetConstrainChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.RouteTargetConstrainChoice)1 RouteTargetConstrainDestination (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.destination.RouteTargetConstrainDestination)1 RouteTargetConstrainDefaultCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.route.target.constrain.choice.RouteTargetConstrainDefaultCase)1