blob: f9b22b887339b4c501a4b7af0fc41e96ca0e50d0 [file] [log] [blame]
Daniele Moro94660a02019-12-02 12:02:07 -08001/*
Joey Armstronga68e7852024-01-28 13:27:02 -05002 * Copyright 2019-2024 Open Networking Foundation (ONF) and the ONF Contributors
Daniele Moro94660a02019-12-02 12:02:07 -08003 *
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.bng;
18
19import com.google.common.base.MoreObjects;
20import org.onlab.packet.IpAddress;
21import org.onlab.packet.MacAddress;
22import org.onlab.packet.VlanId;
23import org.onosproject.net.ConnectPoint;
24
25/**
26 * Subject for a PPPoE attachment level events.
27 */
28public final class PppoeEventSubject {
29
30 private final ConnectPoint oltConnectPoint;
31 private final IpAddress ipAddress;
32 private final MacAddress macAddress;
33 private final String onuSerialNumber;
34 private final short sessionId;
35 private final VlanId sTag;
36 private final VlanId cTag;
37
38 /**
39 * Creates a PPPoE attachment event subject.
40 *
41 * @param oltConnectPoint The connect point of the OLT (UNI port)
42 * @param ipAddress The IP Address that has been assigned
43 * @param macAddress The MAC address of the attachment
44 * @param onuSerialNumber The serial number of the ONU
45 * @param sessionId The PPPoE session ID
46 * @param sTag The VLAN S-Tag
47 * @param cTag The VLan C-Tag
48 */
49 public PppoeEventSubject(ConnectPoint oltConnectPoint,
50 IpAddress ipAddress,
51 MacAddress macAddress,
52 String onuSerialNumber,
53 short sessionId,
54 VlanId sTag,
55 VlanId cTag) {
56 this.oltConnectPoint = oltConnectPoint;
57 this.ipAddress = ipAddress;
58 this.macAddress = macAddress;
59 this.onuSerialNumber = onuSerialNumber;
60 this.sessionId = sessionId;
61 this.sTag = sTag;
62 this.cTag = cTag;
63 }
64
65 /**
66 * Returns the connect point of the OLT (UNI port).
67 *
68 * @return The connect point
69 */
70 public ConnectPoint getOltConnectPoint() {
71 return this.oltConnectPoint;
72 }
73
74
75 /**
76 * Returns the assigned IP address (if any).
77 *
78 * @return The IP address
79 */
80 public IpAddress getIpAddress() {
81 return this.ipAddress;
82 }
83
84 /**
85 * Returns the MAC address.
86 *
87 * @return The MAC address
88 */
89 public MacAddress getMacAddress() {
90 return this.macAddress;
91 }
92
93 /**
94 * Returns the ONU serial number.
95 *
96 * @return The ONU serial number
97 */
98 public String getOnuSerialNumber() {
99 return onuSerialNumber;
100 }
101
102 /**
103 * Returns the session ID.
104 *
105 * @return The session ID.
106 */
107 public short getSessionId() {
108 return this.sessionId;
109 }
110
111 /**
112 * Returns the VLAN S-Tag.
113 *
114 * @return The VLAN S-Tag.
115 */
116 public VlanId getsTag() {
117 return sTag;
118 }
119
120 /**
121 * Returns the VLAN C-Tag.
122 *
123 * @return The VLAN C-Tag.
124 */
125 public VlanId getcTag() {
126 return cTag;
127 }
128
129 @Override
130 public String toString() {
131 return MoreObjects.toStringHelper(this)
132 .add("oltConnectPoint", oltConnectPoint)
133 .add("ipAddress", ipAddress)
134 .add("macAddress", macAddress)
135 .add("onuSerialNumber", onuSerialNumber)
136 .add("sessionId", sessionId)
137 .add("STag", sTag)
138 .add("CTag", cTag)
139 .toString();
140 }
141}