use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv6Case in project bgpcep by opendaylight.
the class StatefulLSPIdentifierIpv6TlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof LspIdentifiers, "LspIdentifiersTlv is mandatory.");
final LspIdentifiers lsp = (LspIdentifiers) tlv;
final ByteBuf body = Unpooled.buffer();
final Ipv6 ipv6 = ((Ipv6Case) lsp.getAddressFamily()).getIpv6();
checkArgument(ipv6.getIpv6TunnelSenderAddress() != null, "Ipv6TunnelSenderAddress is mandatory.");
Ipv6Util.writeIpv6Address(ipv6.getIpv6TunnelSenderAddress(), body);
final LspId lspId = lsp.getLspId();
checkArgument(lspId != null, "LspId is mandatory.");
body.writeShort(lspId.getValue().shortValue());
final TunnelId tunnelId = lsp.getTunnelId();
checkArgument(tunnelId != null, "TunnelId is mandatory.");
ByteBufUtils.write(body, tunnelId.getValue());
checkArgument(ipv6.getIpv6ExtendedTunnelId() != null, "Ipv6ExtendedTunnelId is mandatory.");
Ipv6Util.writeIpv6Address(ipv6.getIpv6ExtendedTunnelId(), body);
checkArgument(ipv6.getIpv6TunnelEndpointAddress() != null, "Ipv6TunnelEndpointAddress is mandatory.");
Ipv6Util.writeIpv6Address(ipv6.getIpv6TunnelEndpointAddress(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
Aggregations