16 package org.openkilda.messaging.command.flow;
18 import static com.google.common.base.MoreObjects.toStringHelper;
24 import com.fasterxml.jackson.annotation.JsonCreator;
25 import com.fasterxml.jackson.annotation.JsonInclude;
26 import com.fasterxml.jackson.annotation.JsonProperty;
27 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
28 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
30 import java.util.Objects;
37 @JsonInclude(JsonInclude.Include.NON_NULL)
49 private static final long serialVersionUID = 1L;
54 @JsonProperty(
"input_port")
55 protected Integer inputPort;
60 @JsonProperty("output_port")
61 protected Integer outputPort;
76 @JsonProperty(FLOW_ID) final String
id,
77 @JsonProperty("cookie") final Long cookie,
79 @JsonProperty("input_port") final Integer inPort,
80 @JsonProperty("output_port") final Integer outPort) {
81 super(transactionId,
id, cookie, switchId);
83 setOutputPort(outPort);
101 if (inputPort == null) {
102 throw new IllegalArgumentException(
"need to set input_port");
103 }
else if (inputPort < 0L) {
104 throw new IllegalArgumentException(
"need to set positive value for input_port");
106 this.inputPort = inputPort;
124 if (outputPort == null) {
125 throw new IllegalArgumentException(
"need to set output_port");
126 }
else if (outputPort < 0L) {
127 throw new IllegalArgumentException(
"need to set positive value for output_port");
129 this.outputPort = outputPort;
137 return toStringHelper(
this)
138 .add(TRANSACTION_ID, transactionId)
140 .add(
"cookie", cookie)
141 .add(
"switch_id", switchId)
142 .add(
"input_port", inputPort)
143 .add(
"output_port", outputPort)
152 if (
this ==
object) {
155 if (
object == null || getClass() !=
object.getClass()) {
161 && Objects.equals(getId(), that.
getId())
162 && Objects.equals(getCookie(), that.
getCookie())
163 && Objects.equals(getSwitchId(), that.
getSwitchId())
173 return Objects.hash(transactionId,
id, cookie, switchId, inputPort, outputPort);
static final String TRANSACTION_ID
void setOutputPort(final Integer outputPort)
void setInputPort(final Integer inputPort)
boolean equals(Object object)
static final String FLOW_ID