use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationMvpnIpv6WithdrawnCase in project bgpcep by opendaylight.
the class Ipv6NlriHandler method parseIpv6UnreachNlri.
static DestinationMvpnIpv6WithdrawnCase parseIpv6UnreachNlri(final ByteBuf nlri, final boolean addPathSupported) {
final List<MvpnDestination> dests = new ArrayList<>();
while (nlri.isReadable()) {
final MvpnDestinationBuilder builder = new MvpnDestinationBuilder();
if (addPathSupported) {
builder.setPathId(PathIdUtil.readPathId(nlri));
}
final NlriType type = NlriType.forValue(nlri.readUnsignedByte());
final int length = nlri.readUnsignedByte();
final ByteBuf nlriBuf = nlri.readSlice(length);
builder.setMvpnChoice(SimpleMvpnNlriRegistry.getInstance().parseMvpn(type, nlriBuf));
dests.add(builder.build());
}
return new DestinationMvpnIpv6WithdrawnCaseBuilder().setDestinationMvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn.ipv6.withdrawn._case.DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationMvpnIpv6WithdrawnCase in project bgpcep by opendaylight.
the class MvpnIpv6NlriHandler method serializeAttribute.
@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (routes != null && routes.getDestinationType() instanceof DestinationMvpnIpv6AdvertizedCase) {
final DestinationMvpnIpv6AdvertizedCase reach = (DestinationMvpnIpv6AdvertizedCase) routes.getDestinationType();
Ipv6NlriHandler.serializeNlri(reach.getDestinationMvpn().getMvpnDestination(), byteAggregator);
}
} else if (pathAttributes2 != null) {
final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof DestinationMvpnIpv6WithdrawnCase) {
final DestinationMvpnIpv6WithdrawnCase reach = (DestinationMvpnIpv6WithdrawnCase) withdrawnRoutes.getDestinationType();
Ipv6NlriHandler.serializeNlri(reach.getDestinationMvpn().getMvpnDestination(), byteAggregator);
}
}
}
Aggregations