sFlow packet object identifier
Change-Id: I624679b6f6bb8a2622aafdb47c09bcc7d3015ddb
diff --git a/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowMessageDecoder.java b/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowMessageDecoder.java
index 9d8c93a..0f02270 100644
--- a/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowMessageDecoder.java
+++ b/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowMessageDecoder.java
@@ -39,7 +39,7 @@
byte[] bytes = new byte[buffer.readableBytes()];
buffer.readBytes(bytes);
ctx.setAttachment(null);
- return null;
+ return SflowPacket.deserializer().deserialize(bytes, 0, bytes.length);
}
} catch (Exception e) {
log.error("sFlow message decode error ", e);
diff --git a/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowPacket.java b/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowPacket.java
index d8a1372..80c1ea4 100644
--- a/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowPacket.java
+++ b/apps/ipflow-monitor/sflow/app/src/main/java/org/onosproject/sflow/impl/SflowPacket.java
@@ -18,6 +18,8 @@
import java.util.LinkedList;
import java.util.List;
+import com.google.common.base.MoreObjects;
+import java.util.Objects;
import org.onosproject.sflow.SflowSample;
import org.onlab.packet.Deserializer;
@@ -180,6 +182,66 @@
throw new UnsupportedOperationException("Not supported yet.");
}
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 59 * hash + this.version;
+ hash = 59 * hash + this.agentIpVersion;
+ hash = 59 * hash + this.seqNumber;
+ hash = 59 * hash + this.subAgentID;
+ hash = 59 * hash + this.sysUptime;
+ hash = 59 * hash + this.numberOfSamples;
+ hash = 59 * hash + Objects.hashCode(this.agentAddress);
+ hash = 59 * hash + Objects.hashCode(this.sFlowsample);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final SflowPacket other = (SflowPacket) obj;
+ if (this.version != other.version) {
+ return false;
+ }
+ if (this.agentIpVersion != other.agentIpVersion) {
+ return false;
+ }
+ if (this.seqNumber != other.seqNumber) {
+ return false;
+ }
+ if (this.subAgentID != other.subAgentID) {
+ return false;
+ }
+ if (this.sysUptime != other.sysUptime) {
+ return false;
+ }
+ if (this.numberOfSamples != other.numberOfSamples) {
+ return false;
+ }
+ return Objects.equals(this.agentAddress, other.agentAddress);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("version", version)
+ .add("agentIpVersion", agentIpVersion)
+ .add("seqNumber", seqNumber)
+ .add("subAgentID", subAgentID)
+ .add("sysUptime", sysUptime)
+ .add("numberOfSamples", numberOfSamples)
+ .add("agentAddress", agentAddress)
+ .toString();
+ }
+
/**
* Builder for sFlow packet.
*/