2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.linkstate.impl.tlvs;
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.protocol.bgp.linkstate.spi.LinkstateTlvParser;
12 import org.opendaylight.protocol.util.Ipv6Util;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Ipv6InterfaceIdentifier;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.object.type.link._case.LinkDescriptors;
15 import org.opendaylight.yangtools.yang.common.QName;
17 public final class Ipv6InterfaceTlvParser implements LinkstateTlvParser<Ipv6InterfaceIdentifier>,
18 LinkstateTlvParser.LinkstateTlvSerializer<Ipv6InterfaceIdentifier> {
19 private static final int IPV6_IFACE_ADDRESS = 261;
21 public static final QName IPV6_IFACE_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv6-interface-address")
25 public void serializeTlvBody(final Ipv6InterfaceIdentifier tlv, final ByteBuf body) {
26 Ipv6Util.writeIpv6Address(tlv, body);
30 public Ipv6InterfaceIdentifier parseTlvBody(final ByteBuf value) {
31 return new Ipv6InterfaceIdentifier(Ipv6Util.addressForByteBuf(value));
35 public int getType() {
36 return IPV6_IFACE_ADDRESS;
40 public QName getTlvQName() {
41 return IPV6_IFACE_ADDRESS_QNAME;