3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension;
12 import org.apache.commons.lang3.builder.EqualsBuilder;
13 import org.apache.commons.lang3.builder.HashCodeBuilder;
14 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
15 import org.openflow.protocol.statistics.OFVendorStatistics;
16 import java.nio.ByteBuffer;
20 * This Class creates the OpenFlow Vendor Extension IPv6 Flow Stats Request
21 * messages and also reads the Reply of a stats request message.
25 public class V6StatsRequest extends OFVendorStatistics {
26 private static final long serialVersionUID = 1L;
27 protected int msgsubtype;
28 protected short outPort;
29 protected short match_len;
30 protected byte tableId;
32 public static final int NICIRA_VENDOR_ID = 0x00002320; //Nicira ID
33 private static final int NXST_FLOW = 0x0; //Nicira Flow Stats Request Id
35 public V6StatsRequest() {
36 this.vendor = NICIRA_VENDOR_ID;
37 this.msgsubtype = NXST_FLOW;
42 * @param None. Being set with local variable (TBD).
44 public void setVendorId() {
45 this.vendor = NICIRA_VENDOR_ID;
51 public int getVendorId() {
56 * @param None. Being set with local variable (TBD).
58 public void setMsgtype() {
59 this.msgsubtype = NXST_FLOW;
63 * @return vendor_msgtype
65 public int getMsgtype() {
70 * @param outPort the outPort to set
72 public void setOutPort(short outPort) {
73 this.outPort = outPort;
79 public short getOutPort() {
84 * @param match_len the match_len to set
86 public void setMatchLen(short match_len) {
87 this.match_len = match_len;
91 * @return the match_len
93 public short getMatchLen() {
98 * @param tableId the tableId to set
100 public void setTableId(byte tableId) {
101 this.tableId = tableId;
105 * @return the tableId
107 public byte getTableId() {
112 public int getLength() {
113 return 20;// 4(vendor)+4(msgsubtype)+4(pad)+2(outPort)+2(match_len)+1(tableid)+3(pad)
117 public void readFrom(ByteBuffer data) {
118 this.vendor = data.getInt();
119 this.msgsubtype = data.getInt();
120 data.getInt();//pad 4 bytes
121 this.outPort = data.getShort();
122 this.match_len = data.getShort();
123 this.tableId = data.get();
124 for (int i = 0; i < 3; i++)
125 data.get();//pad byte
130 public void writeTo(ByteBuffer data) {
131 data.putInt(this.vendor);
132 data.putInt(this.msgsubtype);
133 data.putInt((int) 0x0);//pad0
134 data.putShort(this.outPort);
135 data.putShort(this.match_len);
136 data.put(this.tableId);
137 for (int i = 0; i < 3; i++)
138 data.put((byte) 0x0);//pad byte
142 public int hashCode() {
143 return HashCodeBuilder.reflectionHashCode(this);
147 public String toString() {
148 return "V6StatsRequest[" + ReflectionToStringBuilder.toString(this)
153 public boolean equals(Object obj) {
154 return EqualsBuilder.reflectionEquals(this, obj);