16 package org.openkilda.messaging.command.flow;
18 import static com.google.common.base.MoreObjects.toStringHelper;
26 import com.fasterxml.jackson.annotation.JsonCreator;
27 import com.fasterxml.jackson.annotation.JsonInclude;
28 import com.fasterxml.jackson.annotation.JsonProperty;
29 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
30 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
32 import java.util.Objects;
42 @JsonInclude(JsonInclude.Include.NON_NULL)
60 private static final long serialVersionUID = 1L;
65 @JsonProperty(
"bandwidth")
66 protected Long bandwidth;
71 @JsonProperty("input_vlan_id")
72 protected Integer inputVlanId;
77 @JsonProperty("output_vlan_type")
83 @JsonProperty("meter_id")
84 protected Long meterId;
104 @JsonProperty(FLOW_ID) final String
id,
105 @JsonProperty("cookie") final Long cookie,
107 @JsonProperty("input_port") final Integer inputPort,
108 @JsonProperty("output_port") final Integer outputPort,
109 @JsonProperty("input_vlan_id") final Integer inputVlanId,
110 @JsonProperty("transit_vlan_id") final Integer transitVlanId,
111 @JsonProperty("output_vlan_type") final
OutputVlanType outputVlanType,
112 @JsonProperty("bandwidth") final Long bandwidth,
113 @JsonProperty("meter_id") final Long meterId) {
114 super(transactionId,
id, cookie, switchId, inputPort, outputPort, transitVlanId);
115 setInputVlanId(inputVlanId);
116 setOutputVlanType(outputVlanType);
117 setBandwidth(bandwidth);
127 return outputVlanType;
136 if (outputVlanType == null) {
137 throw new IllegalArgumentException(
"need to set output_vlan_type");
139 throw new IllegalArgumentException(
"need to set valid values for input_vlan_id and output_vlan_type");
141 this.outputVlanType = outputVlanType;
160 if (bandwidth == null) {
161 throw new IllegalArgumentException(
"need to set bandwidth");
162 }
else if (bandwidth < 0L) {
163 throw new IllegalArgumentException(
"need to set non negative bandwidth");
165 this.bandwidth = bandwidth;
183 if (inputVlanId == null) {
184 this.inputVlanId = 0;
186 this.inputVlanId = inputVlanId;
188 throw new IllegalArgumentException(
"need to set valid value for input_vlan_id");
207 if (meterId == null) {
208 throw new IllegalArgumentException(
"need to set meter_id");
209 }
else if (meterId < 0L) {
210 throw new IllegalArgumentException(
"need to set non negative meter_id");
212 this.meterId = meterId;
220 return toStringHelper(
this)
221 .add(TRANSACTION_ID, transactionId)
223 .add(
"cookie", cookie)
224 .add(
"switch_id", switchId)
225 .add(
"input_port", inputPort)
226 .add(
"output_port", outputPort)
227 .add(
"input_vlan_id", inputVlanId)
228 .add(
"transit_vlan_id", transitVlanId)
229 .add(
"output_vlan_type", outputVlanType)
230 .add(
"bandwidth", bandwidth)
231 .add(
"meter_id", meterId)
240 if (
this ==
object) {
243 if (
object == null || getClass() !=
object.getClass()) {
249 && Objects.equals(getId(), that.
getId())
250 && Objects.equals(getCookie(), that.
getCookie())
251 && Objects.equals(getSwitchId(), that.
getSwitchId())
258 && Objects.equals(getMeterId(), that.
getMeterId());
266 return Objects.hash(transactionId,
id, cookie, switchId, inputPort, outputPort,
267 inputVlanId, transitVlanId, outputVlanType, bandwidth, meterId);
static boolean validateVlanRange(final Integer vlanId)
OutputVlanType getOutputVlanType()
void setMeterId(final Long meterId)
static final String TRANSACTION_ID
boolean equals(Object object)
void setBandwidth(final Long bandwidth)
void setInputVlanId(final Integer inputVlanId)
void setOutputVlanType(final OutputVlanType outputVlanType)
static final String FLOW_ID
static boolean validateInputVlanType(final Integer inputVlanId, final OutputVlanType outputVlanType)