Skip to content

Commit

Permalink
Priv - CheckSkf improve log and fix missing session test
Browse files Browse the repository at this point in the history
  • Loading branch information
disk91 committed Feb 28, 2024
1 parent e7976d6 commit 7da1d9c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/main/java/eu/heliumiot/console/service/NovaService.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ public void verifySKFsForAGivenAddr(int addr, boolean clear) {
htss = heliumTenantSetupRepository.findAllByTemplate(false, PageRequest.of(_i,50));
for ( HeliumTenantSetup hts : htss ) {
if ( hts.getRouteId() != null && !hts.isTemplate() ) {
log.info("["+_i+"-"+_j+"/"+cTemplate+"] Exploring tenant "+hts.getTenantUUID()+ " route "+hts.getRouteId());
Tenant t = tenantRepository.findOneTenantById(UUID.fromString(hts.getTenantUUID()));
String tName = "Unknown";
if ( t != null ) tName = t.getName();

log.info("["+_i+"-"+_j+"/"+cTemplate+"] Exploring tenant "+tName+" ("+hts.getTenantUUID()+") route "+hts.getRouteId());
// get all skfs for tha current route and the devAddr
List<skf_v1> skfs = grpcListSessionsByDevaddr(addr,hts.getRouteId());
HashMap<String,skf_v1> inRouteSkfs = new HashMap<>();
Expand All @@ -204,7 +208,7 @@ public void verifySKFsForAGivenAddr(int addr, boolean clear) {
DeviceSession s = redisDeviceRepository.getDeviceDetails(hd.getDeviceEui());
if ( s == null ) continue;
String devaddr = HexaConverters.byteToHexString(s.getDevAddr().toByteArray());
log.info(">"+devaddr+"<>"+sAddr+"<");
//log.debug(">"+devaddr+"<>"+sAddr+"<");
if ( devaddr.compareToIgnoreCase(sAddr) == 0 ) {
// we found a device
String ntwSEncKey = HexaConverters.byteToHexString(s.getNwkSEncKey().toByteArray()).toLowerCase();
Expand All @@ -219,14 +223,14 @@ public void verifySKFsForAGivenAddr(int addr, boolean clear) {
// some error case
log.info(">> Valid session exists for dead device: "+hd.getDeviceEui()+" addr: "+sAddr+" nwks: "+ntwSEncKey);
}
}
} else {
// this device does not have a session registered, normal when inactive
if ( hd.getState() == HeliumDevice.DeviceState.INSERTED
|| hd.getState() == HeliumDevice.DeviceState.ACTIVE
|| hd.getState() == HeliumDevice.DeviceState.INACTIVE
){
log.info(">> Missing session for device: " + hd.getDeviceEui() + " addr: " + sAddr);
} else {
// this device does not have a session registered, normal when inactive
if ( hd.getState() == HeliumDevice.DeviceState.INSERTED
|| hd.getState() == HeliumDevice.DeviceState.ACTIVE
|| hd.getState() == HeliumDevice.DeviceState.INACTIVE
){
log.info(">> Missing session for device: " + hd.getDeviceEui() + " addr: " + sAddr);
}
}
}
}
Expand Down

0 comments on commit 7da1d9c

Please sign in to comment.