use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.PmsiTunnel in project bgpcep by opendaylight.
the class PMSITunnelAttributeHandler method serializeAttribute.
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
final PmsiTunnelAugmentation pmsiTunnelAugmentation = ((Attributes) attribute).getAugmentation(PmsiTunnelAugmentation.class);
if (pmsiTunnelAugmentation == null) {
return;
}
final PmsiTunnel pmsiTunnelAttribute = pmsiTunnelAugmentation.getPmsiTunnel();
final TunnelIdentifier tunnel = pmsiTunnelAttribute.getTunnelIdentifier();
final ByteBuf tunnelBuffer = Unpooled.buffer();
final int tunnelType = this.tunnelIdentifierHandler.serialize(tunnel, tunnelBuffer);
final ByteBuf body = Unpooled.buffer();
serializeFlag(pmsiTunnelAttribute, body);
body.writeByte(tunnelType);
serializeMpls(pmsiTunnelAttribute.getMplsLabel(), body);
body.writeBytes(tunnelBuffer);
AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, getType(), body, byteAggregator);
}
Aggregations