blob: db21c02a6f4f98fcc31e99c49159046be8abe4cf [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();
Shubham Sharma3c8c7022019-09-13 10:39:47 +000073 //Current number of EAPOL frames transmitted
74 private AtomicLong eapolFramesTx = new AtomicLong();
75 //Authenticator state when idle
76 private AtomicLong authStateIdle = new AtomicLong();
77 //Number of request ID EAP frames transmitted
78 private AtomicLong requestIdFramesTx = new AtomicLong();
79 //Current number of request EAP frames transmitted
80 private AtomicLong reqEapFramesTx = new AtomicLong();
81 //Number of EAPOL frames received with invalid packet type
82 private AtomicLong invalidPktType = new AtomicLong();
83 //Number of EAPOL frames received with invalid body length
84 private AtomicLong invalidBodyLength = new AtomicLong();
85 //number of valid EAPOL frames received
86 private AtomicLong validEapolFramesRx = new AtomicLong();
87 //Number of request pending response from supplicant
88 private AtomicLong pendingResSupp = new AtomicLong();
Shubham Sharma1f193582019-07-11 12:12:41 +000089
90 public Long getEapolResIdentityMsgTrans() {
91 return eapolResIdentityMsgTrans.get();
92 }
93
94 public Long getEapolattrIdentity() {
95 return eapolAttrIdentity.get();
96 }
97
98 public Long getEapPktTxauthChooseEap() {
99 return eapPktTxauthChooseEap.get();
100 }
101
102 public Long getEapolTransRespNotNak() {
103 return eapolTransRespNotNak.get();
104 }
105
106 public Long getEapolMd5RspChall() {
107 return eapolMd5RspChall.get();
108 }
109
110 public Long getEapolTlsRespChall() {
111 return eapolTlsRespChall.get();
112 }
113
114 public Long getEapolLogoffRx() {
115 return eapolLogoffRx.get();
116 }
117
118 public Long getEapolAuthSuccessTrans() {
119 return eapolAuthSuccessTrans.get();
120 }
121
122 public Long getEapolAuthFailureTrans() {
123 return eapolAuthFailureTrans.get();
124 }
125
126 public Long getEapolStartReqTrans() {
127 return eapolStartReqTrans.get();
128 }
kartikey dubeye1545422019-05-22 12:53:45 +0000129
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000130 private LinkedList<Long> packetRoundTripTimeList = new LinkedList<Long>();
131
Shubham Sharma3c8c7022019-09-13 10:39:47 +0000132 public Long getPendingResSupp() {
133 return pendingResSupp.get();
134 }
135
136 public Long getValidEapolFramesRx() {
137 return validEapolFramesRx.get();
138 }
139
140 public Long getInvalidBodyLength() {
141 return invalidBodyLength.get();
142 }
143
144 public Long getInvalidPktType() {
145 return invalidPktType.get();
146 }
147
148 public Long getRequestIdFramesTx() {
149 return requestIdFramesTx.get();
150 }
151
152 public Long getReqEapFramesTx() {
153 return reqEapFramesTx.get();
154 }
155
156 public Long getAuthStateIdle() {
157 return authStateIdle.get();
158 }
159
160 public Long getEapolFramesTx() {
161 return eapolFramesTx.get();
162 }
163
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000164 public LinkedList<Long> getPacketRoundTripTimeList() {
165 return packetRoundTripTimeList;
166 }
167
168 public int getPacketRoundTripTimeListSize() {
169 return packetRoundTripTimeList.size();
170 }
171
172 public void clearPacketRoundTripTimeList() {
173 packetRoundTripTimeList.clear();
174 }
175
176 public void getPacketRoundTripTimeListRemoveFirst() {
177 packetRoundTripTimeList.removeFirst();
178 }
179
180 public void getPacketRoundTripTimeListAdd(long time) {
181 packetRoundTripTimeList.add(time);
182 }
183
kartikey dubeye1545422019-05-22 12:53:45 +0000184 public Long getRequestReTx() {
185 return requestReTx.get();
186 }
187
188 public void setRequestRttMilis(AtomicLong requestRttMilis) {
189 this.requestRttMilis = requestRttMilis;
190 }
191
192 public Long getUnknownServerRx() {
193 return unknownServerRx.get();
194 }
195
196 public Long getRequestRttMilis() {
197 return requestRttMilis.get();
198 }
199
200 public Long getMalformedResponsesRx() {
201 return malformedResponsesRx.get();
202 }
203
204 public Long getDroppedResponsesRx() {
205 return droppedResponsesRx.get();
206 }
207
208 public Long getInvalidValidatorsRx() {
209 return invalidValidatorsRx.get();
210 }
211
212 public Long getAcceptResponsesRx() {
213 return acceptResponsesRx.get();
214 }
215
216 public Long getRejectResponsesRx() {
217 return rejectResponsesRx.get();
218 }
219
220 public Long getChallengeResponsesRx() {
221 return challengeResponsesRx.get();
222 }
223
224 public Long getAccessRequestsTx() {
225 return accessRequestsTx.get();
226 }
227
228 public Long getPendingRequests() {
229 return pendingRequests.get();
230 }
231
232 public Long getUnknownTypeRx() {
233 return unknownTypeRx.get();
234 }
235
236 public void increaseAcceptResponsesRx() {
237 acceptResponsesRx.incrementAndGet();
238 }
239
240 public void increaseRejectResponsesRx() {
241 rejectResponsesRx.incrementAndGet();
242 }
243
244 public void increaseChallengeResponsesRx() {
245 challengeResponsesRx.incrementAndGet();
246 }
247
248 public void increaseAccessRequestsTx() {
249 accessRequestsTx.incrementAndGet();
250 }
251
252 public void increaseRequestReTx() {
253 requestReTx.incrementAndGet();
254 }
255
Shubham Sharma3c8c7022019-09-13 10:39:47 +0000256 public void incrementInvalidPktType() {
257 invalidPktType.incrementAndGet();
258 }
259
kartikey dubeye1545422019-05-22 12:53:45 +0000260 public void increaseOrDecreasePendingRequests(boolean isIncrement) {
261 if (isIncrement) {
262 pendingRequests.incrementAndGet();
263 } else {
264 pendingRequests.decrementAndGet();
265 }
266 }
267
268 public void increaseUnknownTypeRx() {
269 unknownTypeRx.incrementAndGet();
270 }
271
272 public void increaseMalformedResponsesRx() {
273 malformedResponsesRx.incrementAndGet();
274 }
275
276 public void increaseInvalidValidatorsRx() {
277 invalidValidatorsRx.incrementAndGet();
278 }
279
280 public void incrementUnknownServerRx() {
281 unknownServerRx.incrementAndGet();
282 }
283
284 public void incrementNumberOfSessionsExpired() {
285 numberOfSessionsExpired.incrementAndGet();
286 }
287
Shubham Sharma1f193582019-07-11 12:12:41 +0000288 public void incrementEapolLogoffRx() {
289 eapolLogoffRx.incrementAndGet();
290 }
291
292 public void incrementEapolAuthSuccessTrans() {
293 eapolAuthSuccessTrans.incrementAndGet();
294 }
295
296 public void incrementEapolauthFailureTrans() {
297 eapolAuthFailureTrans.incrementAndGet();
298 }
299
300 public void incrementEapolStartReqTrans() {
301 eapolStartReqTrans.incrementAndGet();
302 }
303
304 public void incrementEapolMd5RspChall() {
305 eapolMd5RspChall.incrementAndGet();
306 }
307
308 public void incrementEapolAtrrIdentity() {
309 eapolAttrIdentity.incrementAndGet();
310 }
311
312 public void incrementEapolTlsRespChall() {
313 eapolTlsRespChall.incrementAndGet();
314 }
315
Shubham Sharma3c8c7022019-09-13 10:39:47 +0000316 public void incrementEapolFramesTx() {
317 eapolFramesTx.incrementAndGet();
318 }
319
320 public void incrementAuthStateIdle() {
321 authStateIdle.incrementAndGet();
322 }
323
324 public void incrementRequestIdFramesTx() {
325 requestIdFramesTx.incrementAndGet();
326 }
327
328 public void incrementInvalidBodyLength() {
329 invalidBodyLength.incrementAndGet();
330 }
331
332 public void incrementValidEapolFramesRx() {
333 validEapolFramesRx.incrementAndGet();
334 }
335
336 public void incrementPendingResSupp() {
337 pendingResSupp.incrementAndGet();
338 }
339
340 public void decrementPendingResSupp() {
341 pendingResSupp.decrementAndGet();
342 }
343
kartikey dubeye1545422019-05-22 12:53:45 +0000344 public void countDroppedResponsesRx() {
345 long numberOfDroppedPackets = invalidValidatorsRx.get();
346 numberOfDroppedPackets += unknownTypeRx.get();
347 numberOfDroppedPackets += malformedResponsesRx.get();
348 numberOfDroppedPackets += numberOfSessionsExpired.get();
349 this.droppedResponsesRx = new AtomicLong(numberOfDroppedPackets);
350 }
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000351
Shubham Sharma3c8c7022019-09-13 10:39:47 +0000352 public void countReqEapFramesTx() {
353 long noReqEapFramesTx = requestIdFramesTx.get();
354 noReqEapFramesTx += challengeResponsesRx.get();
355 this.reqEapFramesTx = new AtomicLong(noReqEapFramesTx);
356 }
357
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000358 public void resetAllCounters() {
359 clearPacketRoundTripTimeList();
360
361 accessRequestsTx.set(0);
362 acceptResponsesRx.set(0);
363 challengeResponsesRx.set(0);
364 droppedResponsesRx.set(0);
365 invalidValidatorsRx.set(0);
366 malformedResponsesRx.set(0);
367 pendingRequests.set(0);
368 rejectResponsesRx.set(0);
369 requestReTx.set(0);
370 requestRttMilis.set(0);
371 unknownServerRx.set(0);
372 unknownTypeRx.set(0);
Shubham Sharmac7fbd9f2019-11-25 10:04:30 +0000373 eapolLogoffRx.set(0);
374 eapolAuthSuccessTrans.set(0);
375 eapolAuthFailureTrans.set(0);
376 eapolStartReqTrans.set(0);
377 eapolTransRespNotNak.set(0);
378 eapPktTxauthChooseEap.set(0);
379 eapolResIdentityMsgTrans.set(0);
Shubham Sharma3c8c7022019-09-13 10:39:47 +0000380 eapolFramesTx.set(0);
381 authStateIdle.set(0);
382 requestIdFramesTx.set(0);
383 reqEapFramesTx.set(0);
384 invalidPktType.set(0);
385 invalidBodyLength.set(0);
386 validEapolFramesRx.set(0);
387 pendingResSupp.set(0);
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000388 }
Shubham Sharma1f193582019-07-11 12:12:41 +0000389 public void countTransRespNotNak() {
390 long eapolTransactionNotNak = eapolMd5RspChall.get();
391 eapolTransactionNotNak += eapolTlsRespChall.get();
392 this.eapolTransRespNotNak = new AtomicLong(eapolTransactionNotNak);
393 }
394
395 public void countEapolResIdentityMsgTrans() {
396 long authTransaction = eapolMd5RspChall.get();
397 authTransaction += eapolTlsRespChall.get();
398 authTransaction += eapolAttrIdentity.get();
399 this.eapolResIdentityMsgTrans = new AtomicLong(authTransaction);
400 }
401
402 public void incrementEapPktTxauthEap() {
403 eapPktTxauthChooseEap.incrementAndGet();
404 }
Shubham Sharma1e43c562019-06-19 14:18:12 +0000405
406 public long getTimedOutPackets() {
407 return timedOutPackets.get();
408 }
409
410 public void increaseTimedOutPackets() {
411 timedOutPackets.incrementAndGet();
412 }
413
kartikey dubeye1545422019-05-22 12:53:45 +0000414}