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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.epe.rev200120.EpeNodeDescriptors;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
17 public final class MemAsNumTlvParser implements LinkstateTlvParser<AsNumber>,
18 LinkstateTlvParser.LinkstateTlvSerializer<AsNumber> {
19 private static final int MEMBER_AS_NUMBER = 517;
21 public static final QName MEMBER_AS_NUMBER_QNAME = QName.create(EpeNodeDescriptors.QNAME, "member-asn").intern();
24 public void serializeTlvBody(final AsNumber tlv, final ByteBuf body) {
25 ByteBufUtils.write(body, tlv.getValue());
29 public AsNumber parseTlvBody(final ByteBuf value) {
30 return new AsNumber(ByteBufUtils.readUint32(value));
34 public int getType() {
35 return MEMBER_AS_NUMBER;
39 public QName getTlvQName() {
40 return MEMBER_AS_NUMBER_QNAME;