* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bmp.parser.tlv;
import com.google.common.base.Preconditions;
import org.opendaylight.protocol.bmp.spi.parser.BmpTlvSerializer;
import org.opendaylight.protocol.bmp.spi.parser.TlvUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev150512.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev150512.stat.tlvs.InvalidatedClusterListLoopTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev150512.stat.tlvs.InvalidatedClusterListLoopTlvBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.tlvs.InvalidatedClusterListLoopTlv;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.tlvs.InvalidatedClusterListLoopTlvBuilder;
+import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
public class StatType003TlvHandler implements BmpTlvParser, BmpTlvSerializer {
-
public static final int TYPE = 3;
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf output) {
- Preconditions.checkArgument(tlv instanceof InvalidatedClusterListLoopTlv, "InvalidatedClusterListLoopTlv is mandatory.");
+ Preconditions.checkArgument(tlv instanceof InvalidatedClusterListLoopTlv,
+ "InvalidatedClusterListLoopTlv is mandatory.");
TlvUtil.formatTlvCounter32(TYPE, ((InvalidatedClusterListLoopTlv) tlv).getCount(), output);
}
if (buffer == null) {
return null;
}
- return new InvalidatedClusterListLoopTlvBuilder().setCount(new Counter32(buffer.readUnsignedInt())).build();
+ return new InvalidatedClusterListLoopTlvBuilder()
+ .setCount(new Counter32(ByteBufUtils.readUint32(buffer)))
+ .build();
}
-
}