X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fopenflowj%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2Faction%2FOFActionVendor.java;fp=third-party%2Fopenflowj%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2Faction%2FOFActionVendor.java;h=430c8958fa73795a5563c52ba5706eafc9762f18;hb=42210c03b0a4c54706320ba9f55794c0abd4d201;hp=0000000000000000000000000000000000000000;hpb=7576b38152b393793b1c9ec3df0ff86685f95236;p=controller.git diff --git a/third-party/openflowj/src/main/java/org/openflow/protocol/action/OFActionVendor.java b/third-party/openflowj/src/main/java/org/openflow/protocol/action/OFActionVendor.java new file mode 100644 index 0000000000..430c8958fa --- /dev/null +++ b/third-party/openflowj/src/main/java/org/openflow/protocol/action/OFActionVendor.java @@ -0,0 +1,87 @@ +package org.openflow.protocol.action; + +import java.nio.ByteBuffer; + +/** + * + * @author David Erickson (daviderickson@cs.stanford.edu) + */ +public class OFActionVendor extends OFAction { + public static int MINIMUM_LENGTH = 8; + + protected int vendor; + + public enum ActionVendorID { + AVI_CISCO(0xC); + private int value; + private ActionVendorID(int value) { + this.value = value; + } + public int getValue() { + return this.value; + } + } + + public OFActionVendor() { + super(); + super.setType(OFActionType.VENDOR); + super.setLength((short) MINIMUM_LENGTH); + } + + /** + * @return the vendor + */ + public int getVendor() { + return vendor; + } + + /** + * @param vendor the vendor to set + */ + public void setVendor(int vendor) { + this.vendor = vendor; + } + + @Override + public void readFrom(ByteBuffer data) { + super.readFrom(data); + this.vendor = data.getInt(); + if (this.vendor == ActionVendorID.AVI_CISCO.getValue()) { + ActionVendorOutputNextHop nh = new ActionVendorOutputNextHop(); + nh.readFrom(data); + } + + } + + @Override + public void writeTo(ByteBuffer data) { + super.writeTo(data); + data.putInt(this.vendor); + } + + @Override + public int hashCode() { + final int prime = 379; + int result = super.hashCode(); + result = prime * result + vendor; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (!(obj instanceof OFActionVendor)) { + return false; + } + OFActionVendor other = (OFActionVendor) obj; + if (vendor != other.vendor) { + return false; + } + return true; + } +}