553a9bd264a7d42955adcc5920615c7863d201d5
[ccsdk/sli.git] /
1 package org.onap.ccsdk.sli.core.slipluginutils.slitopologyutils.topology;
2
3 import java.util.Objects;
4
5 public class OtnLink implements Link{
6
7     private final Type type = Type.OTN;
8     private final PInterface src;
9     private final PInterface dst;
10
11
12     private final String linkName;
13
14     public OtnLink(String linkName, PInterface src, PInterface dst){
15         this.linkName = linkName;
16         this.src = src;
17         this.dst = dst;
18     }
19
20     public PInterface src() {
21         return src;
22     }
23
24     public PInterface dst() {
25         return dst;
26     }
27
28     public String linkName() {
29         return linkName;
30     }
31
32     public boolean isInnerDomain(){
33         if (src != null && dst != null){
34             if (src.pInterfaceName() != null && dst.pInterfaceName() != null){
35                 if (src.pInterfaceName().getNetworkId() != null
36                     && dst.pInterfaceName().getNetworkId() != null) {
37                     return src.pInterfaceName().getNetworkId().equals(dst.pInterfaceName().getNetworkId());
38                 }
39             }
40         }
41         return false;
42     }
43
44     @Override
45     public boolean equals(Object o){
46         if (this == o) {
47             return true;
48         }
49         if (o instanceof OtnLink){
50             final OtnLink other = (OtnLink) o;
51             return  Objects.equals(this.linkName, other.linkName);
52         }
53         return false;
54     }
55
56     @Override
57     public int hashCode(){
58         return Objects.hash(linkName, type, src, dst);
59     }
60 }