Open Kilda Java Documentation
SwitchMessage.java
Go to the documentation of this file.
1 package org.openkilda.simulator.messages;
2 
3 import static com.google.common.base.MoreObjects.toStringHelper;
4 
6 
7 import com.fasterxml.jackson.annotation.JsonInclude;
8 import com.fasterxml.jackson.annotation.JsonProperty;
9 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
10 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
11 
12 import java.io.Serializable;
13 import java.util.List;
14 
15 @JsonSerialize
16 @JsonInclude(JsonInclude.Include.NON_NULL)
17 @JsonPropertyOrder(value = {
18  "dpid",
19  "num_of_ports",
20  "links"})
21 
22 public class SwitchMessage implements Serializable {
23  @JsonProperty("dpid")
24  private SwitchId dpid;
25 
26  @JsonProperty("num_of_ports")
27  private int numOfPorts;
28 
29  @JsonProperty("links")
30  private List<LinkMessage> links;
31 
32  public SwitchMessage(@JsonProperty("dpid") SwitchId dpid,
33  @JsonProperty("num_of_ports") int numOfPorts,
34  @JsonProperty("links") List<LinkMessage> links) {
35  this.dpid = dpid;
36  this.numOfPorts = numOfPorts;
37  this.links = links;
38  }
39 
40  @Override
41  public String toString() {
42  return toStringHelper(this)
43  .add("dpid", dpid)
44  .add("num_of_ports", numOfPorts)
45  .toString();
46  }
47 
48  public SwitchId getDpid() {
49  return dpid;
50  }
51 
52  public int getNumOfPorts() {
53  return numOfPorts;
54  }
55 
56  public List<LinkMessage> getLinks() {
57  return links;
58  }
59 }
value
Definition: nodes.py:62
SwitchMessage(@JsonProperty("dpid") SwitchId dpid, @JsonProperty("num_of_ports") int numOfPorts, @JsonProperty("links") List< LinkMessage > links)