Open Kilda Java Documentation
SimpleIsl.java
Go to the documentation of this file.
1 /* Copyright 2018 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.pce.model;
17 
19 
20 import lombok.EqualsAndHashCode;
21 import lombok.Getter;
22 import lombok.Setter;
23 import lombok.ToString;
24 
30 @Getter
31 @Setter
32 @ToString
33 @EqualsAndHashCode(exclude = {"cost", "latency"})
34 public class SimpleIsl {
36  private static final int DEFAULT_COST = 700;
37 
38  private SwitchId srcDpid;
39  private SwitchId dstDpid;
40  private int srcPort;
41  private int dstPort;
42  private int cost;
43  private int latency;
44 
45 
46  public SimpleIsl(SwitchId srcDpid, SwitchId dstDpid, int srcPort, int dstPort, int cost, int latency) {
47  this.srcDpid = srcDpid;
48  this.dstDpid = dstDpid;
49  this.srcPort = srcPort;
50  this.dstPort = dstPort;
51  this.cost = (cost == 0) ? DEFAULT_COST : cost;
52  this.latency = latency;
53  }
54 
60  public boolean identical(Object o) {
61  if (this.equals(o)) {
62  SimpleIsl simpleIsl = (SimpleIsl) o;
63  return cost == simpleIsl.cost && latency == simpleIsl.latency;
64  }
65  return false;
66  }
67 
68 }
SimpleIsl(SwitchId srcDpid, SwitchId dstDpid, int srcPort, int dstPort, int cost, int latency)
Definition: SimpleIsl.java:46