blob: babb1d98ced051f326f7d6fe5931f4aebd46b2da [file] [log] [blame]
Matteo Scandoloaa2adde2021-09-13 12:45:32 -07001/*
Joey Armstrong7f6d6d22023-01-09 17:09:50 -05002 * Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
Matteo Scandoloaa2adde2021-09-13 12:45:32 -07003 *
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
Gustavo Silva29fb20e2022-05-26 09:59:54 -030017package org.opencord.olt;
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070018
19import org.opencord.sadis.UniTagInformation;
20
21import java.util.Objects;
22
23/**
24 * SubscriberKey is used to identify the combination of a subscriber and a service.
25 */
26public class ServiceKey {
27 private AccessDevicePort port;
28 private UniTagInformation service;
29
Gustavo Silva29fb20e2022-05-26 09:59:54 -030030
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070031 public ServiceKey(AccessDevicePort port, UniTagInformation service) {
32 this.port = port;
33 this.service = service;
34 }
35
36 public AccessDevicePort getPort() {
37 return port;
38 }
39
40 public void setPort(AccessDevicePort port) {
41 this.port = port;
42 }
43
44 public UniTagInformation getService() {
45 return service;
46 }
47
48 public void setService(UniTagInformation service) {
49 this.service = service;
50 }
51
52 @Override
53 public String toString() {
54 return this.port.toString() + " - " + this.service.getServiceName();
55 }
56
57 @Override
58 public boolean equals(Object o) {
59 if (this == o) {
60 return true;
61 }
62 if (o == null || getClass() != o.getClass()) {
63 return false;
64 }
65 ServiceKey that = (ServiceKey) o;
66 boolean isPortEqual = Objects.equals(port, that.port);
67 boolean isServiceEqual = Objects.equals(service, that.service);
68
69 return isPortEqual && isServiceEqual;
70 }
71
72 @Override
73 public int hashCode() {
74 return Objects.hash(port, service);
75 }
76}