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.ByteBufWriteUtil;
13 import org.opendaylight.protocol.util.Ipv4Util;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.Ipv4InterfaceIdentifier;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LinkDescriptors;
16 import org.opendaylight.yangtools.yang.common.QName;
18 public final class Ipv4NeighborTlvParser implements LinkstateTlvParser<Ipv4InterfaceIdentifier>,
19 LinkstateTlvParser.LinkstateTlvSerializer<Ipv4InterfaceIdentifier> {
21 private static final int IPV4_NEIGHBOR_ADDRESS = 260;
23 public static final QName IPV4_NEIGHBOR_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv4-neighbor-address")
27 public void serializeTlvBody(final Ipv4InterfaceIdentifier tlv, final ByteBuf body) {
28 ByteBufWriteUtil.writeIpv4Address(tlv, body);
32 public Ipv4InterfaceIdentifier parseTlvBody(final ByteBuf value) {
33 return new Ipv4InterfaceIdentifier(Ipv4Util.addressForByteBuf(value));
37 public int getType() {
38 return IPV4_NEIGHBOR_ADDRESS;
42 public QName getTlvQName() {
43 return IPV4_NEIGHBOR_ADDRESS_QNAME;