Shubham Sharma | 47f2caf | 2020-02-18 12:13:40 +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 | package org.opencord.igmpproxy; |
| 17 | |
| 18 | import java.util.concurrent.atomic.AtomicLong; |
| 19 | |
| 20 | /** |
| 21 | * |
| 22 | * Records metrics for IgmpProxy application. |
| 23 | * |
| 24 | */ |
| 25 | public class IgmpStatistics { |
| 26 | |
| 27 | //Total number of join requests |
| 28 | private AtomicLong igmpJoinReq = new AtomicLong(); |
| 29 | //Total number of successful join and rejoin requests |
| 30 | private AtomicLong igmpSuccessJoinRejoinReq = new AtomicLong(); |
| 31 | //Total number of failed join requests |
| 32 | private AtomicLong igmpFailJoinReq = new AtomicLong(); |
| 33 | //Total number of leaves requests |
| 34 | private AtomicLong igmpLeaveReq = new AtomicLong(); |
| 35 | // Total number of disconnects |
| 36 | private AtomicLong igmpDisconnect = new AtomicLong(); |
| 37 | //Count of Total number of IGMPV3_MEMBERSHIP_QUERY |
| 38 | private AtomicLong igmpv3MembershipQuery = new AtomicLong(); |
| 39 | //Count of IGMPV1_MEMBERSHIP_REPORT |
| 40 | private AtomicLong igmpv1MembershipReport = new AtomicLong(); |
| 41 | //Count of IGMPV3_MEMBERSHIP_REPORT |
| 42 | private AtomicLong igmpv3MembershipReport = new AtomicLong(); |
| 43 | //Count of IGMPV2_MEMBERSHIP_REPORT |
| 44 | private AtomicLong igmpv2MembershipReport = new AtomicLong(); |
| 45 | //Count of TYPE_IGMPV2_LEAVE_GROUP |
| 46 | private AtomicLong igmpv2LeaveGroup = new AtomicLong(); |
| 47 | //Total number of messages received. |
| 48 | private AtomicLong totalMsgReceived = new AtomicLong(); |
| 49 | //Total number of IGMP messages received |
| 50 | private AtomicLong igmpMsgReceived = new AtomicLong(); |
| 51 | //Total number of invalid IGMP messages received |
| 52 | private AtomicLong invalidIgmpMsgReceived = new AtomicLong(); |
Sonal Kasliwal | f11c067 | 2020-03-18 11:11:50 +0000 | [diff] [blame] | 53 | //Counter for unknown igmp type |
| 54 | private AtomicLong unknownIgmpTypePacketsRxCounter = new AtomicLong(); |
| 55 | // Counter for igmp report with wrong mode. |
| 56 | private AtomicLong reportsRxWithWrongModeCounter = new AtomicLong(); |
| 57 | // Counter for failed join due to insufficient permission access |
| 58 | private AtomicLong failJoinReqInsuffPermissionAccessCounter = new AtomicLong(); |
| 59 | // Counter for invalid group ip address i.e not a valid multicast address. |
| 60 | private AtomicLong failJoinReqUnknownMulticastIpCounter = new AtomicLong(); |
| 61 | // Counter for unconfigured group |
| 62 | private AtomicLong unconfiguredGroupCounter = new AtomicLong(); |
| 63 | // Counter for valid igmp packet |
| 64 | private AtomicLong validIgmpPacketCounter = new AtomicLong(); |
| 65 | // Counter for current number of igmp channel joins |
| 66 | private AtomicLong igmpChannelJoinCounter = new AtomicLong(); |
| 67 | // Counter for current group number |
| 68 | private AtomicLong currentGrpNumCounter = new AtomicLong(); |
| 69 | // Counter for igmp Checksum |
| 70 | private AtomicLong igmpValidChecksumCounter = new AtomicLong(); |
| 71 | // Counter for Invalid Igmp Length |
| 72 | private AtomicLong invalidIgmpLength = new AtomicLong(); |
| 73 | //Total number of general IGMP membership query messages received |
| 74 | private AtomicLong igmpGeneralMembershipQuery = new AtomicLong(); |
| 75 | //Total number of group specific IGMP membership query messages received |
| 76 | private AtomicLong igmpGrpSpecificMembershipQuery = new AtomicLong(); |
| 77 | //Total number of group and source specific IGMP membership query messages received |
| 78 | private AtomicLong igmpGrpAndSrcSpecificMembershipQuery = new AtomicLong(); |
Shubham Sharma | 47f2caf | 2020-02-18 12:13:40 +0000 | [diff] [blame] | 79 | |
| 80 | public Long getIgmpJoinReq() { |
| 81 | return igmpJoinReq.get(); |
| 82 | } |
| 83 | |
| 84 | public Long getIgmpSuccessJoinRejoinReq() { |
| 85 | return igmpSuccessJoinRejoinReq.get(); |
| 86 | } |
| 87 | |
| 88 | public Long getIgmpFailJoinReq() { |
| 89 | return igmpFailJoinReq.get(); |
| 90 | } |
| 91 | |
| 92 | public Long getIgmpLeaveReq() { |
| 93 | return igmpLeaveReq.get(); |
| 94 | } |
| 95 | |
| 96 | public Long getIgmpDisconnect() { |
| 97 | return igmpDisconnect.get(); |
| 98 | } |
| 99 | |
| 100 | public Long getIgmpv3MembershipQuery() { |
| 101 | return igmpv3MembershipQuery.get(); |
| 102 | } |
| 103 | |
| 104 | public Long getIgmpv1MemershipReport() { |
| 105 | return igmpv1MembershipReport.get(); |
| 106 | } |
| 107 | |
| 108 | public Long getIgmpv3MembershipReport() { |
| 109 | return igmpv3MembershipReport.get(); |
| 110 | } |
| 111 | |
| 112 | public Long getIgmpv2MembershipReport() { |
| 113 | return igmpv2MembershipReport.get(); |
| 114 | } |
| 115 | |
| 116 | public Long getIgmpv2LeaveGroup() { |
| 117 | return igmpv2LeaveGroup.get(); |
| 118 | } |
| 119 | |
| 120 | public Long getTotalMsgReceived() { |
| 121 | return totalMsgReceived.get(); |
| 122 | } |
| 123 | |
| 124 | public Long getIgmpMsgReceived() { |
| 125 | return igmpMsgReceived.get(); |
| 126 | } |
| 127 | |
| 128 | public Long getInvalidIgmpMsgReceived() { |
| 129 | return invalidIgmpMsgReceived.get(); |
| 130 | } |
| 131 | |
| 132 | public void increaseIgmpJoinReq() { |
| 133 | igmpJoinReq.incrementAndGet(); |
| 134 | } |
| 135 | |
| 136 | public void increaseIgmpSuccessJoinRejoinReq() { |
| 137 | igmpSuccessJoinRejoinReq.incrementAndGet(); |
| 138 | } |
| 139 | |
| 140 | public void increaseIgmpFailJoinReq() { |
| 141 | igmpFailJoinReq.incrementAndGet(); |
| 142 | } |
| 143 | |
| 144 | public void increaseIgmpLeaveReq() { |
| 145 | igmpLeaveReq.incrementAndGet(); |
| 146 | } |
| 147 | |
| 148 | public void increaseIgmpDisconnect() { |
| 149 | igmpDisconnect.incrementAndGet(); |
| 150 | } |
| 151 | |
| 152 | public void increaseIgmpv3MembershipQuery() { |
| 153 | igmpv3MembershipQuery.incrementAndGet(); |
| 154 | igmpMsgReceived.incrementAndGet(); |
| 155 | } |
| 156 | |
| 157 | public void increaseIgmpv2MembershipReport() { |
| 158 | igmpv2MembershipReport.incrementAndGet(); |
| 159 | igmpMsgReceived.incrementAndGet(); |
| 160 | } |
| 161 | |
| 162 | public void increaseIgmpv1MembershipReport() { |
| 163 | igmpv1MembershipReport.incrementAndGet(); |
| 164 | igmpMsgReceived.incrementAndGet(); |
| 165 | } |
| 166 | |
| 167 | public void increaseIgmpv3MembershipReport() { |
| 168 | igmpv3MembershipReport.incrementAndGet(); |
| 169 | igmpMsgReceived.incrementAndGet(); |
| 170 | } |
| 171 | |
| 172 | public void increaseIgmpv2LeaveGroup() { |
| 173 | igmpv2LeaveGroup.incrementAndGet(); |
| 174 | igmpMsgReceived.incrementAndGet(); |
| 175 | } |
| 176 | |
| 177 | public void increaseInvalidIgmpMsgReceived() { |
| 178 | invalidIgmpMsgReceived.incrementAndGet(); |
| 179 | } |
| 180 | |
| 181 | public void increaseTotalMsgReceived() { |
| 182 | totalMsgReceived.incrementAndGet(); |
| 183 | } |
| 184 | |
Sonal Kasliwal | f11c067 | 2020-03-18 11:11:50 +0000 | [diff] [blame] | 185 | public Long getValidIgmpPacketCounter() { |
| 186 | return validIgmpPacketCounter.get(); |
| 187 | } |
| 188 | |
| 189 | public void increaseValidIgmpPacketCounter() { |
| 190 | validIgmpPacketCounter.incrementAndGet(); |
| 191 | } |
| 192 | |
| 193 | public Long getCurrentGrpNumCounter() { |
| 194 | return currentGrpNumCounter.get(); |
| 195 | } |
| 196 | |
| 197 | public void increaseCurrentGrpNumCounter() { |
| 198 | currentGrpNumCounter.incrementAndGet(); |
| 199 | } |
| 200 | |
| 201 | public Long getIgmpChannelJoinCounter() { |
| 202 | return igmpChannelJoinCounter.get(); |
| 203 | } |
| 204 | public Long getIgmpValidChecksumCounter() { |
| 205 | return igmpValidChecksumCounter.get(); |
| 206 | } |
| 207 | |
| 208 | public void increaseIgmpChannelJoinCounter() { |
| 209 | igmpChannelJoinCounter.incrementAndGet(); |
| 210 | } |
| 211 | |
| 212 | public void increaseIgmpValidChecksumCounter() { |
| 213 | igmpValidChecksumCounter.incrementAndGet(); |
| 214 | } |
| 215 | |
| 216 | public Long getUnconfiguredGroupCounter() { |
| 217 | return unconfiguredGroupCounter.get(); |
| 218 | } |
| 219 | |
| 220 | public void increaseUnconfiguredGroupCounter() { |
| 221 | unconfiguredGroupCounter.incrementAndGet(); |
| 222 | } |
| 223 | |
| 224 | public Long getFailJoinReqUnknownMulticastIpCounter() { |
| 225 | return failJoinReqUnknownMulticastIpCounter.get(); |
| 226 | } |
| 227 | |
| 228 | public void increaseFailJoinReqUnknownMulticastIpCounter() { |
| 229 | failJoinReqUnknownMulticastIpCounter.incrementAndGet(); |
| 230 | } |
| 231 | |
| 232 | public Long getFailJoinReqInsuffPermissionAccessCounter() { |
| 233 | return failJoinReqInsuffPermissionAccessCounter.get(); |
| 234 | } |
| 235 | |
| 236 | public void increaseFailJoinReqInsuffPermissionAccessCounter() { |
| 237 | failJoinReqInsuffPermissionAccessCounter.incrementAndGet(); |
| 238 | } |
| 239 | |
| 240 | public Long getReportsRxWithWrongModeCounter() { |
| 241 | return reportsRxWithWrongModeCounter.get(); |
| 242 | } |
| 243 | |
| 244 | public Long getUnknownIgmpTypePacketsRxCounter() { |
| 245 | return unknownIgmpTypePacketsRxCounter.get(); |
| 246 | } |
| 247 | |
| 248 | public void increaseUnknownIgmpTypePacketsRxCounter() { |
| 249 | unknownIgmpTypePacketsRxCounter.incrementAndGet(); |
| 250 | } |
| 251 | |
| 252 | public void increaseReportsRxWithWrongModeCounter() { |
| 253 | reportsRxWithWrongModeCounter.incrementAndGet(); |
| 254 | } |
| 255 | |
| 256 | public Long getInvalidIgmpLength() { |
| 257 | return invalidIgmpLength.get(); |
| 258 | } |
| 259 | |
| 260 | public void increaseInvalidIgmpLength() { |
| 261 | invalidIgmpLength.incrementAndGet(); |
| 262 | } |
| 263 | |
| 264 | public Long getIgmpGeneralMembershipQuery() { |
| 265 | return igmpGeneralMembershipQuery.get(); |
| 266 | } |
| 267 | |
| 268 | public Long getIgmpGrpSpecificMembershipQuery() { |
| 269 | return igmpGrpSpecificMembershipQuery.get(); |
| 270 | } |
| 271 | |
| 272 | public Long getIgmpGrpAndSrcSpecificMembershipQuery() { |
| 273 | return igmpGrpAndSrcSpecificMembershipQuery.get(); |
| 274 | } |
| 275 | |
| 276 | public void increaseIgmpGeneralMembershipQuery() { |
| 277 | igmpGeneralMembershipQuery.incrementAndGet(); |
| 278 | } |
| 279 | |
| 280 | public void increaseIgmpGrpSpecificMembershipQuery() { |
| 281 | igmpGrpSpecificMembershipQuery.incrementAndGet(); |
| 282 | } |
| 283 | |
| 284 | public void increaseIgmpGrpAndSrcSpecificMembershipQuery() { |
| 285 | igmpGrpAndSrcSpecificMembershipQuery.incrementAndGet(); |
| 286 | } |
| 287 | |
Shubham Sharma | 47f2caf | 2020-02-18 12:13:40 +0000 | [diff] [blame] | 288 | } |