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(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 33 | // Number of packets of an unknown RADIUS type received from the accounting |
| 34 | // server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 35 | private AtomicLong unknownTypeRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 36 | // Number of access response packets received from the server with an invalid |
| 37 | // validator |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 38 | private AtomicLong invalidValidatorsRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 39 | // Number of dropped packets received from the accounting server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 40 | private AtomicLong droppedResponsesRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 41 | // Number of malformed access response packets received from the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 42 | private AtomicLong malformedResponsesRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 43 | // Number of packets received from an unknown server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 44 | private AtomicLong unknownServerRx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 45 | // Roundtrip packet time to the accounting server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 46 | private AtomicLong requestRttMilis = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 47 | // Number of access request packets retransmitted to the server |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 48 | private AtomicLong requestReTx = new AtomicLong(); |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 49 | // Number of sessions expired |
kartikey dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 50 | private AtomicLong numberOfSessionsExpired = new AtomicLong(); |
Shubham Sharma | 1f19358 | 2019-07-11 12:12:41 +0000 | [diff] [blame^] | 51 | //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 dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 111 | |
Vijaykumar Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 112 | 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 dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 134 | 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 Sharma | 1f19358 | 2019-07-11 12:12:41 +0000 | [diff] [blame^] | 234 | 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 dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 262 | 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 Kushwaha | a54ce55 | 2019-06-18 09:37:42 +0000 | [diff] [blame] | 269 | |
| 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 Sharma | 1f19358 | 2019-07-11 12:12:41 +0000 | [diff] [blame^] | 286 | 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 dubey | e154542 | 2019-05-22 12:53:45 +0000 | [diff] [blame] | 302 | } |