kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.opencord.aaa; |
| 18 | |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 19 | import java.util.LinkedList; |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 20 | import java.util.concurrent.atomic.AtomicLong; |
| 21 | |
| 22 | public class AaaStatistics { |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 23 | // Number of access accept packets sent to the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 24 | private AtomicLong acceptResponsesRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 25 | // Number of access reject packets sent to the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 26 | private AtomicLong rejectResponsesRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 27 | // Number of access challenge packets sent to the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 28 | private AtomicLong challengeResponsesRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 29 | // Number of access request packets sent to the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 30 | private AtomicLong accessRequestsTx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 31 | // Number of access request packets pending a response from the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 32 | private AtomicLong pendingRequests = new AtomicLong(); |
Shubham Sharma | 1e43c56 | 2019-06-19 14:18:12 +0000 | [diff] [blame^] | 33 | // Number of packets send to the server which timed out. |
| 34 | private AtomicLong timedOutPackets = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 35 | // Number of packets of an unknown RADIUS type received from the accounting |
| 36 | // server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 37 | private AtomicLong unknownTypeRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 38 | // Number of access response packets received from the server with an invalid |
| 39 | // validator |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 40 | private AtomicLong invalidValidatorsRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 41 | // Number of dropped packets received from the accounting server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 42 | private AtomicLong droppedResponsesRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 43 | // Number of malformed access response packets received from the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 44 | private AtomicLong malformedResponsesRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 45 | // Number of packets received from an unknown server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 46 | private AtomicLong unknownServerRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 47 | // Roundtrip packet time to the accounting server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 48 | private AtomicLong requestRttMilis = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 49 | // Number of access request packets retransmitted to the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 50 | private AtomicLong requestReTx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 51 | // Number of sessions expired |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 52 | private AtomicLong numberOfSessionsExpired = new AtomicLong(); |
Shubham Sharma | 1f19358 | 2019-07-11 12:12:41 +0000 | [diff] [blame] | 53 | //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 dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 113 | |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 114 | 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 dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 136 | 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 Sharma | 1f19358 | 2019-07-11 12:12:41 +0000 | [diff] [blame] | 236 | 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 dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 264 | 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 Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 271 | |
| 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 Sharma | c7fbd9f | 2019-11-25 10:04:30 +0000 | [diff] [blame] | 287 | 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 Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 295 | } |
Shubham Sharma | 1f19358 | 2019-07-11 12:12:41 +0000 | [diff] [blame] | 296 | 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 Sharma | 1e43c56 | 2019-06-19 14:18:12 +0000 | [diff] [blame^] | 312 | |
| 313 | public long getTimedOutPackets() { |
| 314 | return timedOutPackets.get(); |
| 315 | } |
| 316 | |
| 317 | public void increaseTimedOutPackets() { |
| 318 | timedOutPackets.incrementAndGet(); |
| 319 | } |
| 320 | |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 321 | } |