use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.bgp.rib.route.PeDistinguisherLabelsAttributeAugmentation in project bgpcep by opendaylight.
the class PEDistinguisherLabelsAttributeHandler method serializeAttribute.
@Override
public void serializeAttribute(final Attributes attribute, final ByteBuf byteAggregator) {
final PeDistinguisherLabelsAttributeAugmentation att = attribute.augmentation(PeDistinguisherLabelsAttributeAugmentation.class);
if (att == null) {
return;
}
final List<PeDistinguisherLabelAttribute> distinguishers = att.getPeDistinguisherLabelsAttribute().getPeDistinguisherLabelAttribute();
final ByteBuf buffer = Unpooled.buffer();
for (final PeDistinguisherLabelAttribute peDist : distinguishers) {
if (peDist.getPeAddress().getIpv4AddressNoZone() != null) {
buffer.writeBytes(Ipv4Util.bytesForAddress(peDist.getPeAddress().getIpv4AddressNoZone()));
} else {
buffer.writeBytes(Ipv6Util.bytesForAddress(peDist.getPeAddress().getIpv6AddressNoZone()));
}
buffer.writeBytes(MplsLabelUtil.byteBufForMplsLabel(peDist.getMplsLabel()));
}
formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, TYPE, buffer, byteAggregator);
}
Aggregations