Open Kilda Java Documentation
FlowInstall.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.messaging.model.rule;
17 
19 
20 import com.fasterxml.jackson.annotation.JsonProperty;
21 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
22 import com.google.common.base.MoreObjects;
23 
24 import java.io.Serializable;
25 import java.util.Objects;
26 
30 @JsonSerialize
31 public class FlowInstall extends FlowDelete implements Serializable {
35  private static final long serialVersionUID = 1L;
36 
40  @JsonProperty(RuleConstants.OUTPUT_PORT)
41  private int outputPort;
42 
46  @JsonProperty(RuleConstants.OUTPUT_VLAN)
47  private int outputVlan;
48 
52  @JsonProperty(RuleConstants.OUTPUT_VLAN_TYPE)
53  private OutputVlanType outputVlanType;
54 
58  @JsonProperty(RuleConstants.METER_ID)
59  private int meterId;
60 
64  @JsonProperty(RuleConstants.PRIORITY)
65  private int priority;
66 
70  public FlowInstall() {
71  }
72 
87  public FlowInstall(@JsonProperty(RuleConstants.FLOW_ID) String flowId,
88  @JsonProperty(RuleConstants.COOKIE) int cookie,
89  @JsonProperty(RuleConstants.SWITCH_ID) String switchId,
90  @JsonProperty(RuleConstants.MATCH_PORT) int matchPort,
91  @JsonProperty(RuleConstants.MATCH_VLAN) int matchVlan,
92  @JsonProperty(RuleConstants.OUTPUT_PORT) int outputPort,
93  @JsonProperty(RuleConstants.OUTPUT_VLAN) int outputVlan,
94  @JsonProperty(RuleConstants.OUTPUT_VLAN_TYPE) OutputVlanType outputVlanType,
95  @JsonProperty(RuleConstants.METER_ID) int meterId,
96  @JsonProperty(RuleConstants.PRIORITY) int priority) {
98  this.outputPort = outputPort;
99  this.outputVlan = outputVlan;
100  this.outputVlanType = outputVlanType;
101  this.meterId = meterId;
102  this.priority = priority;
103  }
104 
110  public int getOutputPort() {
111  return outputPort;
112  }
113 
119  public void setOutputPort(int outputPort) {
120  this.outputPort = outputPort;
121  }
122 
128  public int getOutputVlan() {
129  return outputVlan;
130  }
131 
137  public void setOutputVlan(int outputVlan) {
138  this.outputVlan = outputVlan;
139  }
140 
147  return outputVlanType;
148  }
149 
155  public void setOutputVlanType(OutputVlanType outputVlanType) {
156  this.outputVlanType = outputVlanType;
157  }
158 
164  public int getMeterId() {
165  return meterId;
166  }
167 
173  public void setMeterId(int meterId) {
174  this.meterId = meterId;
175  }
176 
182  public int getPriority() {
183  return priority;
184  }
185 
191  public void setPriority(int priority) {
192  this.priority = priority;
193  }
194 
198  @Override
199  public boolean equals(Object object) {
200  if (this == object) {
201  return true;
202  }
203 
204  if (object == null || getClass() != object.getClass()) {
205  return false;
206  }
207 
208  FlowInstall that = (FlowInstall) object;
209  return Objects.equals(getFlowId(), that.getFlowId())
210  && getCookie() == that.getCookie()
211  && Objects.equals(getSwitchId(), that.getSwitchId())
212  && getMatchPort() == that.getMatchPort()
213  && getMatchVlan() == that.getMatchVlan()
214  && getOutputPort() == that.getOutputPort()
215  && getOutputVlan() == that.getOutputVlan()
216  && getOutputVlanType() == that.getOutputVlanType()
217  && getMeterId() == that.getMeterId()
218  && getPriority() == that.getPriority();
219  }
220 
224  @Override
225  public int hashCode() {
226  return Objects.hash(getFlowId(), getCookie(), getSwitchId(), getMatchPort(), getMatchVlan(),
228  }
229 
233  @Override
234  public String toString() {
235  return MoreObjects.toStringHelper(this)
241  .add(RuleConstants.OUTPUT_PORT, outputPort)
242  .add(RuleConstants.OUTPUT_VLAN, outputVlan)
243  .add(RuleConstants.OUTPUT_VLAN_TYPE, outputVlanType)
244  .add(RuleConstants.METER_ID, meterId)
245  .add(RuleConstants.PRIORITY, priority)
246  .toString();
247  }
248 }
FlowInstall(@JsonProperty(RuleConstants.FLOW_ID) String flowId, @JsonProperty(RuleConstants.COOKIE) int cookie, @JsonProperty(RuleConstants.SWITCH_ID) String switchId, @JsonProperty(RuleConstants.MATCH_PORT) int matchPort, @JsonProperty(RuleConstants.MATCH_VLAN) int matchVlan, @JsonProperty(RuleConstants.OUTPUT_PORT) int outputPort, @JsonProperty(RuleConstants.OUTPUT_VLAN) int outputVlan, @JsonProperty(RuleConstants.OUTPUT_VLAN_TYPE) OutputVlanType outputVlanType, @JsonProperty(RuleConstants.METER_ID) int meterId, @JsonProperty(RuleConstants.PRIORITY) int priority)
void setOutputVlanType(OutputVlanType outputVlanType)