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(); |
| 53 | |
| 54 | public Long getIgmpJoinReq() { |
| 55 | return igmpJoinReq.get(); |
| 56 | } |
| 57 | |
| 58 | public Long getIgmpSuccessJoinRejoinReq() { |
| 59 | return igmpSuccessJoinRejoinReq.get(); |
| 60 | } |
| 61 | |
| 62 | public Long getIgmpFailJoinReq() { |
| 63 | return igmpFailJoinReq.get(); |
| 64 | } |
| 65 | |
| 66 | public Long getIgmpLeaveReq() { |
| 67 | return igmpLeaveReq.get(); |
| 68 | } |
| 69 | |
| 70 | public Long getIgmpDisconnect() { |
| 71 | return igmpDisconnect.get(); |
| 72 | } |
| 73 | |
| 74 | public Long getIgmpv3MembershipQuery() { |
| 75 | return igmpv3MembershipQuery.get(); |
| 76 | } |
| 77 | |
| 78 | public Long getIgmpv1MemershipReport() { |
| 79 | return igmpv1MembershipReport.get(); |
| 80 | } |
| 81 | |
| 82 | public Long getIgmpv3MembershipReport() { |
| 83 | return igmpv3MembershipReport.get(); |
| 84 | } |
| 85 | |
| 86 | public Long getIgmpv2MembershipReport() { |
| 87 | return igmpv2MembershipReport.get(); |
| 88 | } |
| 89 | |
| 90 | public Long getIgmpv2LeaveGroup() { |
| 91 | return igmpv2LeaveGroup.get(); |
| 92 | } |
| 93 | |
| 94 | public Long getTotalMsgReceived() { |
| 95 | return totalMsgReceived.get(); |
| 96 | } |
| 97 | |
| 98 | public Long getIgmpMsgReceived() { |
| 99 | return igmpMsgReceived.get(); |
| 100 | } |
| 101 | |
| 102 | public Long getInvalidIgmpMsgReceived() { |
| 103 | return invalidIgmpMsgReceived.get(); |
| 104 | } |
| 105 | |
| 106 | public void increaseIgmpJoinReq() { |
| 107 | igmpJoinReq.incrementAndGet(); |
| 108 | } |
| 109 | |
| 110 | public void increaseIgmpSuccessJoinRejoinReq() { |
| 111 | igmpSuccessJoinRejoinReq.incrementAndGet(); |
| 112 | } |
| 113 | |
| 114 | public void increaseIgmpFailJoinReq() { |
| 115 | igmpFailJoinReq.incrementAndGet(); |
| 116 | } |
| 117 | |
| 118 | public void increaseIgmpLeaveReq() { |
| 119 | igmpLeaveReq.incrementAndGet(); |
| 120 | } |
| 121 | |
| 122 | public void increaseIgmpDisconnect() { |
| 123 | igmpDisconnect.incrementAndGet(); |
| 124 | } |
| 125 | |
| 126 | public void increaseIgmpv3MembershipQuery() { |
| 127 | igmpv3MembershipQuery.incrementAndGet(); |
| 128 | igmpMsgReceived.incrementAndGet(); |
| 129 | } |
| 130 | |
| 131 | public void increaseIgmpv2MembershipReport() { |
| 132 | igmpv2MembershipReport.incrementAndGet(); |
| 133 | igmpMsgReceived.incrementAndGet(); |
| 134 | } |
| 135 | |
| 136 | public void increaseIgmpv1MembershipReport() { |
| 137 | igmpv1MembershipReport.incrementAndGet(); |
| 138 | igmpMsgReceived.incrementAndGet(); |
| 139 | } |
| 140 | |
| 141 | public void increaseIgmpv3MembershipReport() { |
| 142 | igmpv3MembershipReport.incrementAndGet(); |
| 143 | igmpMsgReceived.incrementAndGet(); |
| 144 | } |
| 145 | |
| 146 | public void increaseIgmpv2LeaveGroup() { |
| 147 | igmpv2LeaveGroup.incrementAndGet(); |
| 148 | igmpMsgReceived.incrementAndGet(); |
| 149 | } |
| 150 | |
| 151 | public void increaseInvalidIgmpMsgReceived() { |
| 152 | invalidIgmpMsgReceived.incrementAndGet(); |
| 153 | } |
| 154 | |
| 155 | public void increaseTotalMsgReceived() { |
| 156 | totalMsgReceived.incrementAndGet(); |
| 157 | } |
| 158 | |
| 159 | } |