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.openflow.protocol.statistics.OFVendorStatistics;
18 * This Class creates the OpenFlow Vendor Extension IPv6 Flow Stats Request
19 * messages and also reads the Reply of a stats request message.
23 public class V6StatsRequest extends OFVendorStatistics {
24 private static final long serialVersionUID = 1L;
25 protected int msgsubtype;
26 protected short outPort;
27 protected short match_len;
28 protected byte tableId;
30 public static final int NICIRA_VENDOR_ID = 0x00002320; //Nicira ID
31 private static final int NXST_FLOW = 0x0; //Nicira Flow Stats Request Id
33 public V6StatsRequest() {
34 this.vendor = NICIRA_VENDOR_ID;
35 this.msgsubtype = NXST_FLOW;
40 * @param None. Being set with local variable (TBD).
42 public void setVendorId() {
43 this.vendor = NICIRA_VENDOR_ID;
49 public int getVendorId() {
54 * @param None. Being set with local variable (TBD).
56 public void setMsgtype() {
57 this.msgsubtype = NXST_FLOW;
61 * @return vendor_msgtype
63 public int getMsgtype() {
68 * @param outPort the outPort to set
70 public void setOutPort(short outPort) {
71 this.outPort = outPort;
77 public short getOutPort() {
82 * @param match_len the match_len to set
84 public void setMatchLen(short match_len) {
85 this.match_len = match_len;
89 * @return the match_len
91 public short getMatchLen() {
96 * @param tableId the tableId to set
98 public void setTableId(byte tableId) {
99 this.tableId = tableId;
103 * @return the tableId
105 public byte getTableId() {
110 public int getLength() {
111 return 20;// 4(vendor)+4(msgsubtype)+4(pad)+2(outPort)+2(match_len)+1(tableid)+3(pad)
115 public void readFrom(ByteBuffer data) {
116 this.vendor = data.getInt();
117 this.msgsubtype = data.getInt();
118 data.getInt();//pad 4 bytes
119 this.outPort = data.getShort();
120 this.match_len = data.getShort();
121 this.tableId = data.get();
122 for (int i = 0; i < 3; i++)
123 data.get();//pad byte
128 public void writeTo(ByteBuffer data) {
129 data.putInt(this.vendor);
130 data.putInt(this.msgsubtype);
131 data.putInt((int) 0x0);//pad0
132 data.putShort(this.outPort);
133 data.putShort(this.match_len);
134 data.put(this.tableId);
135 for (int i = 0; i < 3; i++)
136 data.put((byte) 0x0);//pad byte
140 public int hashCode() {
141 final int prime = 31;
142 int result = super.hashCode();
143 result = prime * result + match_len;
144 result = prime * result + msgsubtype;
145 result = prime * result + outPort;
146 result = prime * result + tableId;
151 public String toString() {
152 return "V6StatsRequest [msgsubtype=" + msgsubtype + ", outPort="
153 + outPort + ", match_len=" + match_len + ", tableId=" + tableId
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)