Search in sources :

Example 1 with PeDistinguisherLabelsAttributeAugmentation

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);
}
Also used : PeDistinguisherLabelAttribute(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.pe.distinguisher.labels.attribute.pe.distinguisher.labels.attribute.PeDistinguisherLabelAttribute) ByteBuf(io.netty.buffer.ByteBuf) PeDistinguisherLabelsAttributeAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.bgp.rib.route.PeDistinguisherLabelsAttributeAugmentation)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 PeDistinguisherLabelsAttributeAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.bgp.rib.route.PeDistinguisherLabelsAttributeAugmentation)1 PeDistinguisherLabelAttribute (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.pe.distinguisher.labels.attribute.pe.distinguisher.labels.attribute.PeDistinguisherLabelAttribute)1