blob: c2c496e7c1645421626fca34ae2b91d8716152d0 [file] [log] [blame]
Qianqian Hubf15a5a2016-02-16 15:18:05 +08001/*
2 * Copyright 2016 Open Networking Laboratory
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.onosproject.aaa;
17
18import org.apache.karaf.shell.commands.Command;
19import org.onosproject.cli.AbstractShellCommand;
20
21/**
22 * Shows the users in the aaa.
23 */
24@Command(scope = "onos", name = "aaa-users",
25 description = "Shows the aaa users")
26public class AaaShowUsersCommand extends AbstractShellCommand {
27 @Override
28 protected void execute() {
29 String[] state = {
30 "IDLE",
31 "STARTED",
32 "PENDING",
33 "AUTHORIZED",
34 "UNAUTHORIZED"
35 };
36 for (StateMachine stateMachine : StateMachine.sessionIdMap().values()) {
37 String deviceId = stateMachine.supplicantConnectpoint().deviceId().toString();
38 String portNum = stateMachine.supplicantConnectpoint().port().toString();
39 String username = new String(stateMachine.username());
40 print("UserName=%s,CurrentState=%s,DeviceId=%s,PortNumber=%s",
41 username, state[stateMachine.state()], deviceId, portNum);
42 }
43 }
44}