blob: 0717f9aacf5d5c97f91871a1217f9e1c9011c5bd [file] [log] [blame]
Vijaykumar Kushwahaa54ce552019-06-18 09:37:42 +00001/*
2 * Copyright 2016-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 */
16package org.opencord.aaa.impl;
17
18import org.apache.karaf.shell.commands.Command;
19import org.onosproject.cli.AbstractShellCommand;
20import org.opencord.aaa.AaaStatistics;
21import org.opencord.aaa.AuthenticationStatisticsService;
22
23/**
24 * Display current value of all aaa statistics counters.
25 */
26@Command(scope = "onos", name = "show-aaa-counters",
27description = "Display current value of all aaa statistics counters")
28public class AaaShowCountersCommand extends AbstractShellCommand {
29 @Override
30 protected void execute() {
31
32 AaaStatistics aaaStats = new AaaStatistics();
33
34 AuthenticationStatisticsService aaaStatisticsManager =
35 AbstractShellCommand.get(AuthenticationStatisticsService.class);
36 aaaStats = aaaStatisticsManager.getAaaStats();
37
38 System.out.format("%30s %10d\n", "AccessRequestsTx", aaaStats.getAccessRequestsTx());
39 System.out.format("%30s %10d\n", "ChallengeResponsesRx", aaaStats.getChallengeResponsesRx());
40 System.out.format("%30s %10d\n", "RequestReTx", aaaStats.getRequestReTx());
41 System.out.format("%30s %10d\n", "AcceptResponsesRx", aaaStats.getAcceptResponsesRx());
42 System.out.format("%30s %10d\n", "RejectResponsesRx", aaaStats.getRejectResponsesRx());
43 System.out.format("%30s %10d\n", "PendingRequests", aaaStats.getPendingRequests());
44 System.out.format("%30s %10d\n", "DroppedResponsesRx", aaaStats.getDroppedResponsesRx());
45 System.out.format("%30s %10d\n", "InvalidValidatorsRx", aaaStats.getInvalidValidatorsRx());
46 System.out.format("%30s %10d\n", "MalformedResponsesRx", aaaStats.getMalformedResponsesRx());
47 System.out.format("%30s %10d\n", "UnknownServerRx", aaaStats.getUnknownServerRx());
48 System.out.format("%30s %10d\n", "UnknownTypeRx", aaaStats.getUnknownTypeRx());
49 System.out.format("%30s %10d\n", "RequestRttMillis", aaaStats.getRequestRttMilis());
50
51 }
52}