blob: 3ef348ad41b441ee712fdf886e64c45e29c736a3 [file] [log] [blame]
Matteo Scandoloaa2adde2021-09-13 12:45:32 -07001/*
2 * Copyright 2021-present Open Networking Foundation
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
17package org.opencord.olt.impl;
18
19import java.util.Objects;
20
21/**
22 * OltPortStatus is used to keep track of the flow status for a subscriber service.
23 */
24public class OltPortStatus {
25 // TODO consider adding a lastUpdated field, it may help with debugging
26 public OltFlowService.OltFlowsStatus defaultEapolStatus;
Andrea Campanella87241ae2022-03-11 11:20:24 +010027 public OltFlowService.OltFlowsStatus subscriberEapolStatus;
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070028 public OltFlowService.OltFlowsStatus subscriberFlowsStatus;
29 // NOTE we need to keep track of the DHCP status as that is installed before the other flows
30 // if macLearning is enabled (DHCP is needed to learn the MacAddress from the host)
31 public OltFlowService.OltFlowsStatus dhcpStatus;
yasin sapli0823c932022-01-26 11:26:09 +000032 public OltFlowService.OltFlowsStatus pppoeStatus;
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070033
34 public OltPortStatus(OltFlowService.OltFlowsStatus defaultEapolStatus,
Andrea Campanella87241ae2022-03-11 11:20:24 +010035 OltFlowService.OltFlowsStatus subscriberEapolStatus,
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070036 OltFlowService.OltFlowsStatus subscriberFlowsStatus,
yasin sapli0823c932022-01-26 11:26:09 +000037 OltFlowService.OltFlowsStatus dhcpStatus,
38 OltFlowService.OltFlowsStatus pppoeStatus) {
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070039 this.defaultEapolStatus = defaultEapolStatus;
Andrea Campanella87241ae2022-03-11 11:20:24 +010040 this.subscriberEapolStatus = subscriberEapolStatus;
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070041 this.subscriberFlowsStatus = subscriberFlowsStatus;
42 this.dhcpStatus = dhcpStatus;
yasin sapli0823c932022-01-26 11:26:09 +000043 this.pppoeStatus = pppoeStatus;
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070044 }
45
46 @Override
47 public boolean equals(Object o) {
48 if (this == o) {
49 return true;
50 }
51 if (o == null || getClass() != o.getClass()) {
52 return false;
53 }
54 OltPortStatus that = (OltPortStatus) o;
55 return defaultEapolStatus == that.defaultEapolStatus
Andrea Campanella87241ae2022-03-11 11:20:24 +010056 && subscriberEapolStatus == that.subscriberEapolStatus
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070057 && subscriberFlowsStatus == that.subscriberFlowsStatus
58 && dhcpStatus == that.dhcpStatus;
59 }
60
61 @Override
62 public int hashCode() {
Andrea Campanella87241ae2022-03-11 11:20:24 +010063 return Objects.hash(defaultEapolStatus, subscriberEapolStatus,
64 subscriberFlowsStatus, dhcpStatus);
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070065 }
66
67 @Override
68 public String toString() {
69 final StringBuilder sb = new StringBuilder("OltPortStatus{");
70 sb.append("defaultEapolStatus=").append(defaultEapolStatus);
Andrea Campanella87241ae2022-03-11 11:20:24 +010071 sb.append(", subscriberEapolStatus=").append(subscriberEapolStatus);
Matteo Scandoloaa2adde2021-09-13 12:45:32 -070072 sb.append(", subscriberFlowsStatus=").append(subscriberFlowsStatus);
73 sb.append(", dhcpStatus=").append(dhcpStatus);
74 sb.append('}');
75 return sb.toString();
76 }
77}