blob: e345a68c0993cdf1bb367074a95817a0c4c8e182 [file] [log] [blame]
kartikey dubeye1545422019-05-22 12:53:45 +00001/*
2 * Copyright 2018-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.aaa;
18
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000019import java.util.LinkedList;
kartikey dubeye1545422019-05-22 12:53:45 +000020import java.util.concurrent.atomic.AtomicLong;
21
22public class AaaStatistics {
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000023 // Number of access accept packets sent to the server
kartikey dubeye1545422019-05-22 12:53:45 +000024 private AtomicLong acceptResponsesRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000025 // Number of access reject packets sent to the server
kartikey dubeye1545422019-05-22 12:53:45 +000026 private AtomicLong rejectResponsesRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000027 // Number of access challenge packets sent to the server
kartikey dubeye1545422019-05-22 12:53:45 +000028 private AtomicLong challengeResponsesRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000029 // Number of access request packets sent to the server
kartikey dubeye1545422019-05-22 12:53:45 +000030 private AtomicLong accessRequestsTx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000031 // Number of access request packets pending a response from the server
kartikey dubeye1545422019-05-22 12:53:45 +000032 private AtomicLong pendingRequests = new AtomicLong();
Shubham Sharma1e43c562019-06-19 14:18:12 +000033 // Number of packets send to the server which timed out.
34 private AtomicLong timedOutPackets = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000035 // Number of packets of an unknown RADIUS type received from the accounting
36 // server
kartikey dubeye1545422019-05-22 12:53:45 +000037 private AtomicLong unknownTypeRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000038 // Number of access response packets received from the server with an invalid
39 // validator
kartikey dubeye1545422019-05-22 12:53:45 +000040 private AtomicLong invalidValidatorsRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000041 // Number of dropped packets received from the accounting server
kartikey dubeye1545422019-05-22 12:53:45 +000042 private AtomicLong droppedResponsesRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000043 // Number of malformed access response packets received from the server
kartikey dubeye1545422019-05-22 12:53:45 +000044 private AtomicLong malformedResponsesRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000045 // Number of packets received from an unknown server
kartikey dubeye1545422019-05-22 12:53:45 +000046 private AtomicLong unknownServerRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000047 // Roundtrip packet time to the accounting server
kartikey dubeye1545422019-05-22 12:53:45 +000048 private AtomicLong requestRttMilis = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000049 // Number of access request packets retransmitted to the server
kartikey dubeye1545422019-05-22 12:53:45 +000050 private AtomicLong requestReTx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000051 // Number of sessions expired
kartikey dubeye1545422019-05-22 12:53:45 +000052 private AtomicLong numberOfSessionsExpired = new AtomicLong();
Shubham Sharma1f193582019-07-11 12:12:41 +000053 //Number of EAPOL logoff messages received resulting in disconnected state
54 private AtomicLong eapolLogoffRx = new AtomicLong();
55 //Number of authenticated transitions due to successful authentication
56 private AtomicLong eapolAuthSuccessTrans = new AtomicLong();
57 //Number of transitions to held due to authentication failure
58 private AtomicLong eapolAuthFailureTrans = new AtomicLong();
59 //Number of transitions to connecting due to start request
60 private AtomicLong eapolStartReqTrans = new AtomicLong();
61 //MD5 Response Challenge
62 private AtomicLong eapolMd5RspChall = new AtomicLong();
63 //Tls Response Challenge
64 private AtomicLong eapolTlsRespChall = new AtomicLong();
65 //Number of transitions to response (received response other that NAK)
66 private AtomicLong eapolTransRespNotNak = new AtomicLong();
67 //Number of EAP request packets sent due to the authenticator choosing the EAP method
68 private AtomicLong eapPktTxauthChooseEap = new AtomicLong();
69 //Attr Identity
70 private AtomicLong eapolAttrIdentity = new AtomicLong();
71 //Number of authenticating transitions due to EAP response or identity message
72 private AtomicLong eapolResIdentityMsgTrans = new AtomicLong();
73
74 public Long getEapolResIdentityMsgTrans() {
75 return eapolResIdentityMsgTrans.get();
76 }
77
78 public Long getEapolattrIdentity() {
79 return eapolAttrIdentity.get();
80 }
81
82 public Long getEapPktTxauthChooseEap() {
83 return eapPktTxauthChooseEap.get();
84 }
85
86 public Long getEapolTransRespNotNak() {
87 return eapolTransRespNotNak.get();
88 }
89
90 public Long getEapolMd5RspChall() {
91 return eapolMd5RspChall.get();
92 }
93
94 public Long getEapolTlsRespChall() {
95 return eapolTlsRespChall.get();
96 }
97
98 public Long getEapolLogoffRx() {
99 return eapolLogoffRx.get();
100 }
101
102 public Long getEapolAuthSuccessTrans() {
103 return eapolAuthSuccessTrans.get();
104 }
105
106 public Long getEapolAuthFailureTrans() {
107 return eapolAuthFailureTrans.get();
108 }
109
110 public Long getEapolStartReqTrans() {
111 return eapolStartReqTrans.get();
112 }
kartikey dubeye1545422019-05-22 12:53:45 +0000113
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000114 private LinkedList<Long> packetRoundTripTimeList = new LinkedList<Long>();
115
116 public LinkedList<Long> getPacketRoundTripTimeList() {
117 return packetRoundTripTimeList;
118 }
119
120 public int getPacketRoundTripTimeListSize() {
121 return packetRoundTripTimeList.size();
122 }
123
124 public void clearPacketRoundTripTimeList() {
125 packetRoundTripTimeList.clear();
126 }
127
128 public void getPacketRoundTripTimeListRemoveFirst() {
129 packetRoundTripTimeList.removeFirst();
130 }
131
132 public void getPacketRoundTripTimeListAdd(long time) {
133 packetRoundTripTimeList.add(time);
134 }
135
kartikey dubeye1545422019-05-22 12:53:45 +0000136 public Long getRequestReTx() {
137 return requestReTx.get();
138 }
139
140 public void setRequestRttMilis(AtomicLong requestRttMilis) {
141 this.requestRttMilis = requestRttMilis;
142 }
143
144 public Long getUnknownServerRx() {
145 return unknownServerRx.get();
146 }
147
148 public Long getRequestRttMilis() {
149 return requestRttMilis.get();
150 }
151
152 public Long getMalformedResponsesRx() {
153 return malformedResponsesRx.get();
154 }
155
156 public Long getDroppedResponsesRx() {
157 return droppedResponsesRx.get();
158 }
159
160 public Long getInvalidValidatorsRx() {
161 return invalidValidatorsRx.get();
162 }
163
164 public Long getAcceptResponsesRx() {
165 return acceptResponsesRx.get();
166 }
167
168 public Long getRejectResponsesRx() {
169 return rejectResponsesRx.get();
170 }
171
172 public Long getChallengeResponsesRx() {
173 return challengeResponsesRx.get();
174 }
175
176 public Long getAccessRequestsTx() {
177 return accessRequestsTx.get();
178 }
179
180 public Long getPendingRequests() {
181 return pendingRequests.get();
182 }
183
184 public Long getUnknownTypeRx() {
185 return unknownTypeRx.get();
186 }
187
188 public void increaseAcceptResponsesRx() {
189 acceptResponsesRx.incrementAndGet();
190 }
191
192 public void increaseRejectResponsesRx() {
193 rejectResponsesRx.incrementAndGet();
194 }
195
196 public void increaseChallengeResponsesRx() {
197 challengeResponsesRx.incrementAndGet();
198 }
199
200 public void increaseAccessRequestsTx() {
201 accessRequestsTx.incrementAndGet();
202 }
203
204 public void increaseRequestReTx() {
205 requestReTx.incrementAndGet();
206 }
207
208 public void increaseOrDecreasePendingRequests(boolean isIncrement) {
209 if (isIncrement) {
210 pendingRequests.incrementAndGet();
211 } else {
212 pendingRequests.decrementAndGet();
213 }
214 }
215
216 public void increaseUnknownTypeRx() {
217 unknownTypeRx.incrementAndGet();
218 }
219
220 public void increaseMalformedResponsesRx() {
221 malformedResponsesRx.incrementAndGet();
222 }
223
224 public void increaseInvalidValidatorsRx() {
225 invalidValidatorsRx.incrementAndGet();
226 }
227
228 public void incrementUnknownServerRx() {
229 unknownServerRx.incrementAndGet();
230 }
231
232 public void incrementNumberOfSessionsExpired() {
233 numberOfSessionsExpired.incrementAndGet();
234 }
235
Shubham Sharma1f193582019-07-11 12:12:41 +0000236 public void incrementEapolLogoffRx() {
237 eapolLogoffRx.incrementAndGet();
238 }
239
240 public void incrementEapolAuthSuccessTrans() {
241 eapolAuthSuccessTrans.incrementAndGet();
242 }
243
244 public void incrementEapolauthFailureTrans() {
245 eapolAuthFailureTrans.incrementAndGet();
246 }
247
248 public void incrementEapolStartReqTrans() {
249 eapolStartReqTrans.incrementAndGet();
250 }
251
252 public void incrementEapolMd5RspChall() {
253 eapolMd5RspChall.incrementAndGet();
254 }
255
256 public void incrementEapolAtrrIdentity() {
257 eapolAttrIdentity.incrementAndGet();
258 }
259
260 public void incrementEapolTlsRespChall() {
261 eapolTlsRespChall.incrementAndGet();
262 }
263
kartikey dubeye1545422019-05-22 12:53:45 +0000264 public void countDroppedResponsesRx() {
265 long numberOfDroppedPackets = invalidValidatorsRx.get();
266 numberOfDroppedPackets += unknownTypeRx.get();
267 numberOfDroppedPackets += malformedResponsesRx.get();
268 numberOfDroppedPackets += numberOfSessionsExpired.get();
269 this.droppedResponsesRx = new AtomicLong(numberOfDroppedPackets);
270 }
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000271
272 public void resetAllCounters() {
273 clearPacketRoundTripTimeList();
274
275 accessRequestsTx.set(0);
276 acceptResponsesRx.set(0);
277 challengeResponsesRx.set(0);
278 droppedResponsesRx.set(0);
279 invalidValidatorsRx.set(0);
280 malformedResponsesRx.set(0);
281 pendingRequests.set(0);
282 rejectResponsesRx.set(0);
283 requestReTx.set(0);
284 requestRttMilis.set(0);
285 unknownServerRx.set(0);
286 unknownTypeRx.set(0);
Shubham Sharmac7fbd9f2019-11-25 10:04:30 +0000287 eapolLogoffRx.set(0);
288 eapolAuthSuccessTrans.set(0);
289 eapolAuthFailureTrans.set(0);
290 eapolStartReqTrans.set(0);
291 eapolTransRespNotNak.set(0);
292 eapPktTxauthChooseEap.set(0);
293 eapolResIdentityMsgTrans.set(0);
294
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000295 }
Shubham Sharma1f193582019-07-11 12:12:41 +0000296 public void countTransRespNotNak() {
297 long eapolTransactionNotNak = eapolMd5RspChall.get();
298 eapolTransactionNotNak += eapolTlsRespChall.get();
299 this.eapolTransRespNotNak = new AtomicLong(eapolTransactionNotNak);
300 }
301
302 public void countEapolResIdentityMsgTrans() {
303 long authTransaction = eapolMd5RspChall.get();
304 authTransaction += eapolTlsRespChall.get();
305 authTransaction += eapolAttrIdentity.get();
306 this.eapolResIdentityMsgTrans = new AtomicLong(authTransaction);
307 }
308
309 public void incrementEapPktTxauthEap() {
310 eapPktTxauthChooseEap.incrementAndGet();
311 }
Shubham Sharma1e43c562019-06-19 14:18:12 +0000312
313 public long getTimedOutPackets() {
314 return timedOutPackets.get();
315 }
316
317 public void increaseTimedOutPackets() {
318 timedOutPackets.incrementAndGet();
319 }
320
kartikey dubeye1545422019-05-22 12:53:45 +0000321}