Fix last_reachable timestamp bug
Change-Id: I0d479c9aef59866db164790247eca2c3c6e1f0bf
diff --git a/prom.py b/prom.py
index 9a517e1..5c4668c 100644
--- a/prom.py
+++ b/prom.py
@@ -58,11 +58,9 @@
metric = elem['metric']
if 'imsi' in metric and 'mobile_ip' in metric:
imsi = metric['imsi']
- if imsi in devices:
- # log.info("{} added to list of monitored devices".format(imsi))
- devices[imsi].ip = metric['mobile_ip']
- else:
- log.error("Ignoring device as it was not reported by ROC - {}".format(metric))
+ for k in devices:
+ if devices[k].imsi == imsi:
+ devices[k].ip = metric['mobile_ip']
else:
log.error("Ignoring device as imsi or mobile-ip not found - {}".format(metric))