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 java.nio.ByteBuffer;
14 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
15 import org.openflow.protocol.statistics.OFVendorStatistics;
19 * This Class creates the OpenFlow Vendor Extension IPv6 Flow Stats Request
20 * messages and also reads the Reply of a stats request message.
24 public class V6StatsRequest extends OFVendorStatistics {
25 private static final long serialVersionUID = 1L;
26 protected int msgsubtype;
27 protected short outPort;
28 protected short match_len;
29 protected byte tableId;
31 public static final int NICIRA_VENDOR_ID = 0x00002320; //Nicira ID
32 private static final int NXST_FLOW = 0x0; //Nicira Flow Stats Request Id
34 public V6StatsRequest() {
35 this.vendor = NICIRA_VENDOR_ID;
36 this.msgsubtype = NXST_FLOW;
41 * @param None. Being set with local variable (TBD).
43 public void setVendorId() {
44 this.vendor = NICIRA_VENDOR_ID;
50 public int getVendorId() {
55 * @param None. Being set with local variable (TBD).
57 public void setMsgtype() {
58 this.msgsubtype = NXST_FLOW;
62 * @return vendor_msgtype
64 public int getMsgtype() {
69 * @param outPort the outPort to set
71 public void setOutPort(short outPort) {
72 this.outPort = outPort;
78 public short getOutPort() {
83 * @param match_len the match_len to set
85 public void setMatchLen(short match_len) {
86 this.match_len = match_len;
90 * @return the match_len
92 public short getMatchLen() {
97 * @param tableId the tableId to set
99 public void setTableId(byte tableId) {
100 this.tableId = tableId;
104 * @return the tableId
106 public byte getTableId() {
111 public int getLength() {
112 return 20;// 4(vendor)+4(msgsubtype)+4(pad)+2(outPort)+2(match_len)+1(tableid)+3(pad)
116 public void readFrom(ByteBuffer data) {
117 this.vendor = data.getInt();
118 this.msgsubtype = data.getInt();
119 data.getInt();//pad 4 bytes
120 this.outPort = data.getShort();
121 this.match_len = data.getShort();
122 this.tableId = data.get();
123 for (int i = 0; i < 3; i++)
124 data.get();//pad byte
129 public void writeTo(ByteBuffer data) {
130 data.putInt(this.vendor);
131 data.putInt(this.msgsubtype);
132 data.putInt((int) 0x0);//pad0
133 data.putShort(this.outPort);
134 data.putShort(this.match_len);
135 data.put(this.tableId);
136 for (int i = 0; i < 3; i++)
137 data.put((byte) 0x0);//pad byte
141 public int hashCode() {
142 final int prime = 31;
143 int result = super.hashCode();
144 result = prime * result + match_len;
145 result = prime * result + msgsubtype;
146 result = prime * result + outPort;
147 result = prime * result + tableId;
152 public String toString() {
153 return "V6StatsRequest[" + ReflectionToStringBuilder.toString(this)
158 public boolean equals(Object obj) {
161 if (!super.equals(obj))
163 if (getClass() != obj.getClass())
165 V6StatsRequest other = (V6StatsRequest) obj;
166 if (match_len != other.match_len)
168 if (msgsubtype != other.msgsubtype)
170 if (outPort != other.outPort)
172 if (tableId != other.tableId)