blob: 72cbfa0696ef8c8b26f541c5b40e830233808163 [file] [log] [blame]
David K. Bainbridgeeda2b052017-07-12 09:41:04 -07001/*
2 * Copyright 2017-present 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 */
16package org.opencord.sadis;
17
18import org.onlab.packet.MacAddress;
19import org.onlab.packet.VlanId;
20
21import com.fasterxml.jackson.annotation.JsonProperty;
22
23/**
24 * Represents a unit of information about a subscriber or access device.
25 */
26public class SubscriberAndDeviceInformation {
27
28 @JsonProperty(value = "id")
29 String id;
30
31 @JsonProperty(value = "sTag")
32 VlanId sTag;
33
34 @JsonProperty(value = "cTag")
35 VlanId cTag;
36
37 @JsonProperty(value = "nasPortId")
38 String nasPortId;
39
40 @JsonProperty(value = "port")
41 int port;
42
43 @JsonProperty(value = "slot")
44 int slot;
45
46 @JsonProperty(value = "hardwareIdentifier")
47 MacAddress hardwareIdentifier;
48
49 SubscriberAndDeviceInformation() {
50 }
51
52 public final String id() {
53 return this.id;
54 }
55
56 public final void setId(final String id) {
57 this.id = id;
58 }
59
60 public final VlanId sTag() {
61 return this.sTag;
62 }
63
64 public final void setSTag(final VlanId stag) {
65 this.sTag = stag;
66 }
67
68 public final VlanId cTag() {
69 return this.cTag;
70 }
71
72 public final void setCTag(final VlanId ctag) {
73 this.cTag = ctag;
74 }
75
76 public final String nasPortId() {
77 return this.nasPortId;
78 }
79
80 public final void setNasPortId(final String nasPortId) {
81 this.nasPortId = nasPortId;
82 }
83
84 public final int port() {
85 return this.port;
86 }
87
88 public final void setPort(final int port) {
89 this.port = port;
90 }
91
92 public final int slot() {
93 return this.slot;
94 }
95
96 public final void setSlot(final int slot) {
97 this.slot = slot;
98 }
99
100 public final MacAddress hardwareIdentifier() {
101 return this.hardwareIdentifier;
102 }
103
104 public final void setHardwareIdentifier(final MacAddress hardwareIdentifier) {
105 this.hardwareIdentifier = hardwareIdentifier;
106 }
107
108 /*
109 * (non-Javadoc)
110 *
111 * @see java.lang.Object#hashCode()
112 */
113 @Override
114 public int hashCode() {
115 final int prime = 31;
116 int result = 1;
117 result = prime * result + (this.cTag == null ? 0 : this.cTag.hashCode());
118 result = prime * result + (this.hardwareIdentifier == null ? 0 : this.hardwareIdentifier.hashCode());
119 result = prime * result + (this.id == null ? 0 : this.id.hashCode());
120 result = prime * result + (this.nasPortId == null ? 0 : this.nasPortId.hashCode());
121 result = prime * result + this.port;
122 result = prime * result + (this.sTag == null ? 0 : this.sTag.hashCode());
123 result = prime * result + this.slot;
124 return result;
125 }
126
127 /*
128 * (non-Javadoc)
129 *
130 * @see java.lang.Object#equals(java.lang.Object)
131 */
132 @Override
133 public boolean equals(final Object obj) {
134 if (this == obj) {
135 return true;
136 }
137 if (obj == null) {
138 return false;
139 }
140 if (this.getClass() != obj.getClass()) {
141 return false;
142 }
143 final SubscriberAndDeviceInformation other = (SubscriberAndDeviceInformation) obj;
144 if (this.cTag == null) {
145 if (other.cTag != null) {
146 return false;
147 }
148 } else if (!this.cTag.equals(other.cTag)) {
149 return false;
150 }
151 if (this.hardwareIdentifier == null) {
152 if (other.hardwareIdentifier != null) {
153 return false;
154 }
155 } else if (!this.hardwareIdentifier.equals(other.hardwareIdentifier)) {
156 return false;
157 }
158 if (this.id == null) {
159 if (other.id != null) {
160 return false;
161 }
162 } else if (!this.id.equals(other.id)) {
163 return false;
164 }
165 if (this.nasPortId == null) {
166 if (other.nasPortId != null) {
167 return false;
168 }
169 } else if (!this.nasPortId.equals(other.nasPortId)) {
170 return false;
171 }
172 if (this.port != other.port) {
173 return false;
174 }
175 if (this.sTag == null) {
176 if (other.sTag != null) {
177 return false;
178 }
179 } else if (!this.sTag.equals(other.sTag)) {
180 return false;
181 }
182 if (this.slot != other.slot) {
183 return false;
184 }
185 return true;
186 }
187
188 /*
189 * (non-Javadoc)
190 *
191 * @see java.lang.Object#toString()
192 */
193 @Override
194 public String toString() {
195 final StringBuilder buf = new StringBuilder();
196 buf.append('[');
197 buf.append("id:");
198 buf.append(this.id);
199 buf.append(",cTag:");
200 buf.append(this.cTag);
201 buf.append(",sTag:");
202 buf.append(this.sTag);
203 buf.append(",nasPortId:");
204 buf.append(this.nasPortId);
205 buf.append(",port:");
206 buf.append(this.port);
207 buf.append(",slot:");
208 buf.append(this.slot);
209 buf.append(",hardwareIdentifier:");
210 buf.append(this.hardwareIdentifier);
211 buf.append(']');
212
213 return buf.toString();
214 }
215
216}