use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.destination.RouteTargetConstrainDestinationBuilder in project bgpcep by opendaylight.
the class RouteTargetConstrainNlriHandler method parseNlriDestinations.
private static List<RouteTargetConstrainDestination> parseNlriDestinations(final ByteBuf nlri, final boolean addPathSupported) {
final List<RouteTargetConstrainDestination> dests = new ArrayList<>();
while (nlri.isReadable()) {
final RouteTargetConstrainDestinationBuilder builder = new RouteTargetConstrainDestinationBuilder();
if (addPathSupported) {
builder.setPathId(PathIdUtil.readPathId(nlri));
}
final int length = nlri.readUnsignedByte() / 8;
final ByteBuf nlriBuf = nlri.readSlice(length);
Integer type = null;
if (length != 0) {
builder.setOriginAs(new AsNumber(ByteBufUtils.readUint32(nlriBuf)));
type = (int) nlriBuf.readUnsignedByte();
// Skip Subtype
nlriBuf.skipBytes(1);
}
builder.setRouteTargetConstrainChoice(ImmutableRouteTargetConstrainNlriRegistry.getInstance().parseRouteTargetConstrain(type, nlriBuf));
dests.add(builder.build());
}
return dests;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.destination.RouteTargetConstrainDestinationBuilder in project bgpcep by opendaylight.
the class RouteTargetConstrainRIBSupport method extractDestination.
private RouteTargetConstrainDestination extractDestination(final DataContainerNode rtDest) {
final RouteTargetConstrainDestinationBuilder builder = new RouteTargetConstrainDestinationBuilder().setPathId(PathIdUtil.buildPathId(rtDest, routePathIdNid())).setRouteTargetConstrainChoice(extractRouteTargetChoice(rtDest));
final Optional<Object> originAs = NormalizedNodes.findNode(rtDest, this.originAsNid).map(NormalizedNode::body);
originAs.ifPresent(o -> builder.setOriginAs(new AsNumber((Uint32) o)));
return builder.build();
}
Aggregations