VOL-387: Update CLI useful for debugging
Change-Id: I890dcf0b76f9e58c1bcfade75b60069db09b94f4
diff --git a/src/main/java/org/opencord/aaa/AaaShowUsersCommand.java b/src/main/java/org/opencord/aaa/AaaShowUsersCommand.java
index e2c13c3..e64a6fe 100644
--- a/src/main/java/org/opencord/aaa/AaaShowUsersCommand.java
+++ b/src/main/java/org/opencord/aaa/AaaShowUsersCommand.java
@@ -17,6 +17,11 @@
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.AnnotationKeys;
+import org.onosproject.net.device.DeviceService;
+
+import org.opencord.sadis.SubscriberAndDeviceInformation;
+import org.opencord.sadis.SubscriberAndDeviceInformationService;
/**
* Shows the users in the aaa.
@@ -33,13 +38,28 @@
"AUTHORIZED",
"UNAUTHORIZED"
};
+
+ DeviceService devService = AbstractShellCommand.get(DeviceService.class);
+ SubscriberAndDeviceInformationService subsService =
+ AbstractShellCommand.get(SubscriberAndDeviceInformationService.class);
+
for (StateMachine stateMachine : StateMachine.sessionIdMap().values()) {
String deviceId = stateMachine.supplicantConnectpoint().deviceId().toString();
String portNum = stateMachine.supplicantConnectpoint().port().toString();
String username = new String(stateMachine.username());
String mac = stateMachine.supplicantAddress().toString();
- print("UserName=%s,CurrentState=%s,DeviceId=%s,MAC=%s,PortNumber=%s",
- username, state[stateMachine.state()], deviceId, mac, portNum);
+
+ String nasPortId = devService.getPort(stateMachine.supplicantConnectpoint()).
+ annotations().value(AnnotationKeys.PORT_NAME);
+
+ String subsId = "Unknown";
+ SubscriberAndDeviceInformation subscriber = subsService.get(nasPortId);
+ if (subscriber != null) {
+ subsId = subscriber.nasPortId();
+ }
+
+ print("UserName=%s,CurrentState=%s,DeviceId=%s,MAC=%s,PortNumber=%s,SubscriberId=%s",
+ username, state[stateMachine.state()], deviceId, mac, portNum, subsId);
}
}
}
diff --git a/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index a47c6c0..728aaf0 100644
--- a/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -19,5 +19,8 @@
<command>
<action class="org.opencord.aaa.AaaShowUsersCommand"/>
</command>
+ <command>
+ <action class="org.opencord.aaa.AaaResetDeviceCommand"/>
+ </command>
</command-bundle>
</blueprint>