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 | |
| 19 | import java.util.concurrent.atomic.AtomicLong; |
| 20 | |
| 21 | public class AaaStatistics { |
| 22 | //Number of access accept packets sent to the server |
| 23 | private AtomicLong acceptResponsesRx = new AtomicLong(); |
| 24 | //Number of access reject packets sent to the server |
| 25 | private AtomicLong rejectResponsesRx = new AtomicLong(); |
| 26 | //Number of access challenge packets sent to the server |
| 27 | private AtomicLong challengeResponsesRx = new AtomicLong(); |
| 28 | //Number of access request packets sent to the server |
| 29 | private AtomicLong accessRequestsTx = new AtomicLong(); |
| 30 | //Number of access request packets pending a response from the server |
| 31 | private AtomicLong pendingRequests = new AtomicLong(); |
| 32 | //Number of packets of an unknown RADIUS type received from the accounting server |
| 33 | private AtomicLong unknownTypeRx = new AtomicLong(); |
| 34 | //Number of access response packets received from the server with an invalid validator |
| 35 | private AtomicLong invalidValidatorsRx = new AtomicLong(); |
| 36 | //Number of dropped packets received from the accounting server |
| 37 | private AtomicLong droppedResponsesRx = new AtomicLong(); |
| 38 | //Number of malformed access response packets received from the server |
| 39 | private AtomicLong malformedResponsesRx = new AtomicLong(); |
| 40 | //Number of packets received from an unknown server |
| 41 | private AtomicLong unknownServerRx = new AtomicLong(); |
| 42 | //Roundtrip packet time to the accounting server |
| 43 | private AtomicLong requestRttMilis = new AtomicLong(); |
| 44 | //Number of access request packets retransmitted to the server |
| 45 | private AtomicLong requestReTx = new AtomicLong(); |
| 46 | //Number of sessions expired |
| 47 | private AtomicLong numberOfSessionsExpired = new AtomicLong(); |
| 48 | |
| 49 | public Long getRequestReTx() { |
| 50 | return requestReTx.get(); |
| 51 | } |
| 52 | |
| 53 | public void setRequestRttMilis(AtomicLong requestRttMilis) { |
| 54 | this.requestRttMilis = requestRttMilis; |
| 55 | } |
| 56 | |
| 57 | public Long getUnknownServerRx() { |
| 58 | return unknownServerRx.get(); |
| 59 | } |
| 60 | |
| 61 | public Long getRequestRttMilis() { |
| 62 | return requestRttMilis.get(); |
| 63 | } |
| 64 | |
| 65 | public Long getMalformedResponsesRx() { |
| 66 | return malformedResponsesRx.get(); |
| 67 | } |
| 68 | |
| 69 | public Long getDroppedResponsesRx() { |
| 70 | return droppedResponsesRx.get(); |
| 71 | } |
| 72 | |
| 73 | public Long getInvalidValidatorsRx() { |
| 74 | return invalidValidatorsRx.get(); |
| 75 | } |
| 76 | |
| 77 | public Long getAcceptResponsesRx() { |
| 78 | return acceptResponsesRx.get(); |
| 79 | } |
| 80 | |
| 81 | public Long getRejectResponsesRx() { |
| 82 | return rejectResponsesRx.get(); |
| 83 | } |
| 84 | |
| 85 | public Long getChallengeResponsesRx() { |
| 86 | return challengeResponsesRx.get(); |
| 87 | } |
| 88 | |
| 89 | public Long getAccessRequestsTx() { |
| 90 | return accessRequestsTx.get(); |
| 91 | } |
| 92 | |
| 93 | public Long getPendingRequests() { |
| 94 | return pendingRequests.get(); |
| 95 | } |
| 96 | |
| 97 | public Long getUnknownTypeRx() { |
| 98 | return unknownTypeRx.get(); |
| 99 | } |
| 100 | |
| 101 | public void increaseAcceptResponsesRx() { |
| 102 | acceptResponsesRx.incrementAndGet(); |
| 103 | } |
| 104 | |
| 105 | public void increaseRejectResponsesRx() { |
| 106 | rejectResponsesRx.incrementAndGet(); |
| 107 | } |
| 108 | |
| 109 | public void increaseChallengeResponsesRx() { |
| 110 | challengeResponsesRx.incrementAndGet(); |
| 111 | } |
| 112 | |
| 113 | public void increaseAccessRequestsTx() { |
| 114 | accessRequestsTx.incrementAndGet(); |
| 115 | } |
| 116 | |
| 117 | public void increaseRequestReTx() { |
| 118 | requestReTx.incrementAndGet(); |
| 119 | } |
| 120 | |
| 121 | public void increaseOrDecreasePendingRequests(boolean isIncrement) { |
| 122 | if (isIncrement) { |
| 123 | pendingRequests.incrementAndGet(); |
| 124 | } else { |
| 125 | pendingRequests.decrementAndGet(); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | public void increaseUnknownTypeRx() { |
| 130 | unknownTypeRx.incrementAndGet(); |
| 131 | } |
| 132 | |
| 133 | public void increaseMalformedResponsesRx() { |
| 134 | malformedResponsesRx.incrementAndGet(); |
| 135 | } |
| 136 | |
| 137 | public void increaseInvalidValidatorsRx() { |
| 138 | invalidValidatorsRx.incrementAndGet(); |
| 139 | } |
| 140 | |
| 141 | public void incrementUnknownServerRx() { |
| 142 | unknownServerRx.incrementAndGet(); |
| 143 | } |
| 144 | |
| 145 | public void incrementNumberOfSessionsExpired() { |
| 146 | numberOfSessionsExpired.incrementAndGet(); |
| 147 | } |
| 148 | |
| 149 | public void countDroppedResponsesRx() { |
| 150 | long numberOfDroppedPackets = invalidValidatorsRx.get(); |
| 151 | numberOfDroppedPackets += unknownTypeRx.get(); |
| 152 | numberOfDroppedPackets += malformedResponsesRx.get(); |
| 153 | numberOfDroppedPackets += numberOfSessionsExpired.get(); |
| 154 | this.droppedResponsesRx = new AtomicLong(numberOfDroppedPackets); |
| 155 | } |
| 156 | } |