Open Kilda Java Documentation
DiscoverPathCommandData.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.command.discovery;
17 
20 
21 import com.fasterxml.jackson.annotation.JsonCreator;
22 import com.fasterxml.jackson.annotation.JsonInclude;
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
25 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
26 
27 // FIXME(surabujin): look like it used nowhere
28 @JsonSerialize
29 @JsonInclude(JsonInclude.Include.NON_NULL)
30 @JsonPropertyOrder({
31  "command",
32  "source_switch_id",
33  "source_port_no",
34  "destination_switch_id"})
35 public class DiscoverPathCommandData extends CommandData {
39  private static final long serialVersionUID = 1L;
40 
44  @JsonProperty("source_switch_id")
45  private SwitchId srcSwitchId;
46 
50  @JsonProperty("source_port_no")
51  private int srcPortNo;
52 
56  @JsonProperty("destination_switch_id")
57  private SwitchId dstSwitchId;
58 
63  }
64 
72  @JsonCreator
73  public DiscoverPathCommandData(@JsonProperty("source_switch_id") final SwitchId srcSwitchId,
74  @JsonProperty("source_port_no") final int srcPortNo,
75  @JsonProperty("destination_switch_id") final SwitchId dstSwitchId) {
76  this.srcSwitchId = srcSwitchId;
77  this.srcPortNo = srcPortNo;
78  this.dstSwitchId = dstSwitchId;
79  }
80 
87  return srcSwitchId;
88  }
89 
95  public void setSrcSwitchId(SwitchId switchId) {
96  this.srcSwitchId = switchId;
97  }
98 
104  public int getSrcPortNo() {
105  return srcPortNo;
106  }
107 
113  public void setSrcPortNo(int portNo) {
114  this.srcPortNo = portNo;
115  }
116 
123  return dstSwitchId;
124  }
125 
131  public void setDstSwitchId(SwitchId switchId) {
132  this.dstSwitchId = switchId;
133  }
134 
138  @Override
139  public String toString() {
140  return String.format("%s-%s -> %s", srcSwitchId, srcPortNo, dstSwitchId);
141  }
142 }
DiscoverPathCommandData(@JsonProperty("source_switch_id") final SwitchId srcSwitchId, @JsonProperty("source_port_no") final int srcPortNo, @JsonProperty("destination_switch_id") final SwitchId dstSwitchId)