Aihua Guo | 1ce2dd1 | 2016-08-12 23:37:44 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.tetopology.management.api.node; |
| 17 | |
| 18 | import java.util.List; |
| 19 | |
| 20 | import com.google.common.base.MoreObjects; |
| 21 | import com.google.common.base.Objects; |
| 22 | |
| 23 | /** |
| 24 | * Representation of a tunnel termination point. |
| 25 | */ |
| 26 | public class TunnelTerminationPoint { |
| 27 | //See org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te |
| 28 | //.topology.rev20160708.ietftetopology |
| 29 | //.augmentednwnode.te.DefaultTunnelTerminationPoint |
| 30 | //org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology |
| 31 | //.rev20160708.ietftetopology |
| 32 | //.augmentednwnode.te.tunnelterminationpoint.DefaultConfig |
| 33 | private byte[] tunnelTpId; |
| 34 | private List<InterfaceSwitchingCapability> switchingCapabilities; |
| 35 | private long interLayerLockId; |
| 36 | private List<TerminationCapability> terminationCapability; |
| 37 | |
| 38 | /** |
| 39 | * Create an instance of TunnelTerminationPoint. |
| 40 | * |
| 41 | * @param tunnelTpId tunnel termination point id |
| 42 | */ |
| 43 | public TunnelTerminationPoint(byte[] tunnelTpId) { |
| 44 | this.tunnelTpId = tunnelTpId; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Sets the switching capabilities. |
| 49 | * |
| 50 | * @param swcaps the switching capabilities to set |
| 51 | */ |
| 52 | public void setSwitchingCapabilities(List<InterfaceSwitchingCapability> swcaps) { |
| 53 | this.switchingCapabilities = swcaps; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Sets the interLayerLockId. |
| 58 | * |
| 59 | * @param id the interLayerLockId to set |
| 60 | */ |
| 61 | public void setInterLayerLockId(long id) { |
| 62 | this.interLayerLockId = id; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Sets the termination capability. |
| 67 | * |
| 68 | * @param terminationCapability the terminationCapability to set |
| 69 | */ |
| 70 | public void setTerminationCapabilities(List<TerminationCapability> terminationCapability) { |
| 71 | this.terminationCapability = terminationCapability; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Returns the tunnelTpId. |
| 76 | * |
| 77 | * @return tunnel termination point id |
| 78 | */ |
| 79 | public byte[] getTunnelTpId() { |
| 80 | return tunnelTpId; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Returns the switching capabilities. |
| 85 | * |
| 86 | * @return switching capabilities |
| 87 | */ |
| 88 | public List<InterfaceSwitchingCapability> getSwitchingCapabilities() { |
| 89 | return switchingCapabilities; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Returns the interLayerLockId. |
| 94 | * |
| 95 | * @return inter layer lock identifier |
| 96 | */ |
| 97 | public long getInterLayerLockId() { |
| 98 | return interLayerLockId; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Returns the termination capability list. |
| 103 | * |
| 104 | * @return termination capabilities |
| 105 | */ |
| 106 | public List<TerminationCapability> getTerminationCapabilities() { |
| 107 | return terminationCapability; |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public int hashCode() { |
| 112 | return Objects.hashCode(tunnelTpId, switchingCapabilities, interLayerLockId, terminationCapability); |
| 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public boolean equals(Object object) { |
| 117 | if (this == object) { |
| 118 | return true; |
| 119 | } |
| 120 | if (object instanceof TunnelTerminationPoint) { |
| 121 | TunnelTerminationPoint that = (TunnelTerminationPoint) object; |
| 122 | return Objects.equal(this.tunnelTpId, that.tunnelTpId) && |
| 123 | Objects.equal(this.switchingCapabilities, that.switchingCapabilities) && |
| 124 | Objects.equal(this.terminationCapability, that.terminationCapability) && |
| 125 | Objects.equal(this.interLayerLockId, that.interLayerLockId); |
| 126 | } |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | @Override |
| 131 | public String toString() { |
| 132 | return MoreObjects.toStringHelper(this) |
| 133 | .add("tunnelTpId", tunnelTpId) |
| 134 | .add("switchingCapabilities", switchingCapabilities) |
| 135 | .add("interLayerLockId", interLayerLockId) |
| 136 | .add("terminationCapability", terminationCapability) |
| 137 | .toString(); |
| 138 | } |
| 139 | |
| 140 | } |