use of org.opencord.aaa.AuthenticationService in project aaa by opencord.
the class AaaResetAllCommand method doExecute.
@Override
protected void doExecute() {
AuthenticationService authService = get(AuthenticationService.class);
List<AuthenticationRecord> authentications = newArrayList(authService.getAuthenticationRecords());
for (AuthenticationRecord auth : authentications) {
authService.removeAuthenticationStateByMac(auth.supplicantAddress());
}
}
use of org.opencord.aaa.AuthenticationService in project aaa by opencord.
the class AaaShowPerMachineCountersCommand method doExecute.
@Override
protected void doExecute() {
String sessionId = deviceId + portNumber;
AaaMachineStatisticsService aaaMachineStatsManager = get(AaaMachineStatisticsService.class);
AuthenticationService aaaManager = get(AuthenticationService.class);
AaaSupplicantMachineStats aaaSupplicantMachineStats = aaaManager.getSupplicantMachineStats(sessionId);
if (aaaSupplicantMachineStats != null) {
print("%30s %10d\n", "SessionDuration", aaaSupplicantMachineStats.getSessionDuration());
print("%30s %10d\n", "TotalOctetRecieved", aaaSupplicantMachineStats.getTotalOctetRecieved());
print("%30s %10d\n", "TotalFramesReceived", aaaSupplicantMachineStats.getTotalFramesReceived());
print("%30s %10d\n", "TotalFramesSent", aaaSupplicantMachineStats.getTotalFramesSent());
print("%30s %10d\n", "TotalOctetSent", aaaSupplicantMachineStats.getTotalOctetSent());
print("%30s %10d\n", "TotalPacketsRecieved", aaaSupplicantMachineStats.getTotalPacketsRecieved());
print("%30s %10d\n", "TotalPacketsSent", aaaSupplicantMachineStats.getTotalPacketsSent());
} else {
print("No such Device Found");
}
}
use of org.opencord.aaa.AuthenticationService in project aaa by opencord.
the class AaaShowUsersCommand method doExecute.
@Override
protected void doExecute() {
final Comparator<AuthenticationRecord> authenticationRecordComparator = (a1, a2) -> Comparators.CONNECT_POINT_COMPARATOR.compare(a1.supplicantConnectPoint(), a2.supplicantConnectPoint());
DeviceService devService = get(DeviceService.class);
SadisService sadisService = get(SadisService.class);
AuthenticationService authService = get(AuthenticationService.class);
List<AuthenticationRecord> authentications = newArrayList(authService.getAuthenticationRecords());
authentications.sort(authenticationRecordComparator);
if (strDeviceId != null && !strDeviceId.isEmpty()) {
DeviceId deviceId = DeviceId.deviceId(strDeviceId);
authentications = authentications.stream().filter(a -> a.supplicantConnectPoint().deviceId().equals(deviceId)).collect(Collectors.toList());
}
for (AuthenticationRecord auth : authentications) {
String username = UNKNOWN;
if (auth.username() != null) {
username = new String(auth.username());
}
String mac = UNKNOWN;
if (auth.supplicantAddress() != null) {
mac = auth.supplicantAddress().toString();
}
Port port = devService.getPort(auth.supplicantConnectPoint());
String nasPortId = UNKNOWN;
if (port != null) {
nasPortId = devService.getPort(auth.supplicantConnectPoint()).annotations().value(AnnotationKeys.PORT_NAME);
}
String subsId = UNKNOWN;
SubscriberAndDeviceInformation subscriber = sadisService.getSubscriberInfoService().get(nasPortId);
if (subscriber != null) {
subsId = subscriber.nasPortId();
}
print("%s: %s, last-changed=%s, mac=%s, subid=%s, username=%s", auth.supplicantConnectPoint(), auth.state(), Tools.timeAgo(auth.lastChanged()), mac, subsId, username);
}
}
Aggregations