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.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.epe.rev150622.EpeNodeDescriptors;
16 import org.opendaylight.yangtools.yang.common.QName;
18 public final class BgpRouterIdTlvParser implements LinkstateTlvParser<Ipv4Address>, LinkstateTlvParser.LinkstateTlvSerializer<Ipv4Address> {
20 private static final int BGP_ROUTER_ID = 516;
22 public static final QName BGP_ROUTER_ID_QNAME = QName.create(EpeNodeDescriptors.QNAME, "bgp-router-id").intern();
26 public void serializeTlvBody(final Ipv4Address tlv, final ByteBuf body) {
27 ByteBufWriteUtil.writeIpv4Address(tlv, body);
31 public Ipv4Address parseTlvBody(final ByteBuf value) {
32 return Ipv4Util.addressForByteBuf(value);
36 public int getType() {
41 public QName getTlvQName() {
42 return BGP_ROUTER_ID_QNAME;