blob: e1d1485c0ce68734d8501975892df5141b67891a [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();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000033 // Number of packets of an unknown RADIUS type received from the accounting
34 // server
kartikey dubeye1545422019-05-22 12:53:45 +000035 private AtomicLong unknownTypeRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000036 // Number of access response packets received from the server with an invalid
37 // validator
kartikey dubeye1545422019-05-22 12:53:45 +000038 private AtomicLong invalidValidatorsRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000039 // Number of dropped packets received from the accounting server
kartikey dubeye1545422019-05-22 12:53:45 +000040 private AtomicLong droppedResponsesRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000041 // Number of malformed access response packets received from the server
kartikey dubeye1545422019-05-22 12:53:45 +000042 private AtomicLong malformedResponsesRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000043 // Number of packets received from an unknown server
kartikey dubeye1545422019-05-22 12:53:45 +000044 private AtomicLong unknownServerRx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000045 // Roundtrip packet time to the accounting server
kartikey dubeye1545422019-05-22 12:53:45 +000046 private AtomicLong requestRttMilis = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000047 // Number of access request packets retransmitted to the server
kartikey dubeye1545422019-05-22 12:53:45 +000048 private AtomicLong requestReTx = new AtomicLong();
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +000049 // Number of sessions expired
kartikey dubeye1545422019-05-22 12:53:45 +000050 private AtomicLong numberOfSessionsExpired = new AtomicLong();
Shubham Sharma1f193582019-07-11 12:12:41 +000051 //Number of EAPOL logoff messages received resulting in disconnected state
52 private AtomicLong eapolLogoffRx = new AtomicLong();
53 //Number of authenticated transitions due to successful authentication
54 private AtomicLong eapolAuthSuccessTrans = new AtomicLong();
55 //Number of transitions to held due to authentication failure
56 private AtomicLong eapolAuthFailureTrans = new AtomicLong();
57 //Number of transitions to connecting due to start request
58 private AtomicLong eapolStartReqTrans = new AtomicLong();
59 //MD5 Response Challenge
60 private AtomicLong eapolMd5RspChall = new AtomicLong();
61 //Tls Response Challenge
62 private AtomicLong eapolTlsRespChall = new AtomicLong();
63 //Number of transitions to response (received response other that NAK)
64 private AtomicLong eapolTransRespNotNak = new AtomicLong();
65 //Number of EAP request packets sent due to the authenticator choosing the EAP method
66 private AtomicLong eapPktTxauthChooseEap = new AtomicLong();
67 //Attr Identity
68 private AtomicLong eapolAttrIdentity = new AtomicLong();
69 //Number of authenticating transitions due to EAP response or identity message
70 private AtomicLong eapolResIdentityMsgTrans = new AtomicLong();
71
72 public Long getEapolResIdentityMsgTrans() {
73 return eapolResIdentityMsgTrans.get();
74 }
75
76 public Long getEapolattrIdentity() {
77 return eapolAttrIdentity.get();
78 }
79
80 public Long getEapPktTxauthChooseEap() {
81 return eapPktTxauthChooseEap.get();
82 }
83
84 public Long getEapolTransRespNotNak() {
85 return eapolTransRespNotNak.get();
86 }
87
88 public Long getEapolMd5RspChall() {
89 return eapolMd5RspChall.get();
90 }
91
92 public Long getEapolTlsRespChall() {
93 return eapolTlsRespChall.get();
94 }
95
96 public Long getEapolLogoffRx() {
97 return eapolLogoffRx.get();
98 }
99
100 public Long getEapolAuthSuccessTrans() {
101 return eapolAuthSuccessTrans.get();
102 }
103
104 public Long getEapolAuthFailureTrans() {
105 return eapolAuthFailureTrans.get();
106 }
107
108 public Long getEapolStartReqTrans() {
109 return eapolStartReqTrans.get();
110 }
kartikey dubeye1545422019-05-22 12:53:45 +0000111
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000112 private LinkedList<Long> packetRoundTripTimeList = new LinkedList<Long>();
113
114 public LinkedList<Long> getPacketRoundTripTimeList() {
115 return packetRoundTripTimeList;
116 }
117
118 public int getPacketRoundTripTimeListSize() {
119 return packetRoundTripTimeList.size();
120 }
121
122 public void clearPacketRoundTripTimeList() {
123 packetRoundTripTimeList.clear();
124 }
125
126 public void getPacketRoundTripTimeListRemoveFirst() {
127 packetRoundTripTimeList.removeFirst();
128 }
129
130 public void getPacketRoundTripTimeListAdd(long time) {
131 packetRoundTripTimeList.add(time);
132 }
133
kartikey dubeye1545422019-05-22 12:53:45 +0000134 public Long getRequestReTx() {
135 return requestReTx.get();
136 }
137
138 public void setRequestRttMilis(AtomicLong requestRttMilis) {
139 this.requestRttMilis = requestRttMilis;
140 }
141
142 public Long getUnknownServerRx() {
143 return unknownServerRx.get();
144 }
145
146 public Long getRequestRttMilis() {
147 return requestRttMilis.get();
148 }
149
150 public Long getMalformedResponsesRx() {
151 return malformedResponsesRx.get();
152 }
153
154 public Long getDroppedResponsesRx() {
155 return droppedResponsesRx.get();
156 }
157
158 public Long getInvalidValidatorsRx() {
159 return invalidValidatorsRx.get();
160 }
161
162 public Long getAcceptResponsesRx() {
163 return acceptResponsesRx.get();
164 }
165
166 public Long getRejectResponsesRx() {
167 return rejectResponsesRx.get();
168 }
169
170 public Long getChallengeResponsesRx() {
171 return challengeResponsesRx.get();
172 }
173
174 public Long getAccessRequestsTx() {
175 return accessRequestsTx.get();
176 }
177
178 public Long getPendingRequests() {
179 return pendingRequests.get();
180 }
181
182 public Long getUnknownTypeRx() {
183 return unknownTypeRx.get();
184 }
185
186 public void increaseAcceptResponsesRx() {
187 acceptResponsesRx.incrementAndGet();
188 }
189
190 public void increaseRejectResponsesRx() {
191 rejectResponsesRx.incrementAndGet();
192 }
193
194 public void increaseChallengeResponsesRx() {
195 challengeResponsesRx.incrementAndGet();
196 }
197
198 public void increaseAccessRequestsTx() {
199 accessRequestsTx.incrementAndGet();
200 }
201
202 public void increaseRequestReTx() {
203 requestReTx.incrementAndGet();
204 }
205
206 public void increaseOrDecreasePendingRequests(boolean isIncrement) {
207 if (isIncrement) {
208 pendingRequests.incrementAndGet();
209 } else {
210 pendingRequests.decrementAndGet();
211 }
212 }
213
214 public void increaseUnknownTypeRx() {
215 unknownTypeRx.incrementAndGet();
216 }
217
218 public void increaseMalformedResponsesRx() {
219 malformedResponsesRx.incrementAndGet();
220 }
221
222 public void increaseInvalidValidatorsRx() {
223 invalidValidatorsRx.incrementAndGet();
224 }
225
226 public void incrementUnknownServerRx() {
227 unknownServerRx.incrementAndGet();
228 }
229
230 public void incrementNumberOfSessionsExpired() {
231 numberOfSessionsExpired.incrementAndGet();
232 }
233
Shubham Sharma1f193582019-07-11 12:12:41 +0000234 public void incrementEapolLogoffRx() {
235 eapolLogoffRx.incrementAndGet();
236 }
237
238 public void incrementEapolAuthSuccessTrans() {
239 eapolAuthSuccessTrans.incrementAndGet();
240 }
241
242 public void incrementEapolauthFailureTrans() {
243 eapolAuthFailureTrans.incrementAndGet();
244 }
245
246 public void incrementEapolStartReqTrans() {
247 eapolStartReqTrans.incrementAndGet();
248 }
249
250 public void incrementEapolMd5RspChall() {
251 eapolMd5RspChall.incrementAndGet();
252 }
253
254 public void incrementEapolAtrrIdentity() {
255 eapolAttrIdentity.incrementAndGet();
256 }
257
258 public void incrementEapolTlsRespChall() {
259 eapolTlsRespChall.incrementAndGet();
260 }
261
kartikey dubeye1545422019-05-22 12:53:45 +0000262 public void countDroppedResponsesRx() {
263 long numberOfDroppedPackets = invalidValidatorsRx.get();
264 numberOfDroppedPackets += unknownTypeRx.get();
265 numberOfDroppedPackets += malformedResponsesRx.get();
266 numberOfDroppedPackets += numberOfSessionsExpired.get();
267 this.droppedResponsesRx = new AtomicLong(numberOfDroppedPackets);
268 }
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +0000269
270 public void resetAllCounters() {
271 clearPacketRoundTripTimeList();
272
273 accessRequestsTx.set(0);
274 acceptResponsesRx.set(0);
275 challengeResponsesRx.set(0);
276 droppedResponsesRx.set(0);
277 invalidValidatorsRx.set(0);
278 malformedResponsesRx.set(0);
279 pendingRequests.set(0);
280 rejectResponsesRx.set(0);
281 requestReTx.set(0);
282 requestRttMilis.set(0);
283 unknownServerRx.set(0);
284 unknownTypeRx.set(0);
285 }
Shubham Sharma1f193582019-07-11 12:12:41 +0000286 public void countTransRespNotNak() {
287 long eapolTransactionNotNak = eapolMd5RspChall.get();
288 eapolTransactionNotNak += eapolTlsRespChall.get();
289 this.eapolTransRespNotNak = new AtomicLong(eapolTransactionNotNak);
290 }
291
292 public void countEapolResIdentityMsgTrans() {
293 long authTransaction = eapolMd5RspChall.get();
294 authTransaction += eapolTlsRespChall.get();
295 authTransaction += eapolAttrIdentity.get();
296 this.eapolResIdentityMsgTrans = new AtomicLong(authTransaction);
297 }
298
299 public void incrementEapPktTxauthEap() {
300 eapPktTxauthChooseEap.incrementAndGet();
301 }
kartikey dubeye1545422019-05-22 12:53:45 +0000302}