Basic ping test
Change-Id: Ib61ebd3963db46118a0d8f5c4cea0e002f48aa9a
diff --git a/device.py b/device.py
new file mode 100644
index 0000000..767180e
--- /dev/null
+++ b/device.py
@@ -0,0 +1,41 @@
+"""
+SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+SPDX-License-Identifier: LicenseRef-ONF-Member-1.01
+"""
+
+import logging as log
+from datetime import datetime
+
+
+class Device(object):
+
+ def __init__(self, imsi_id, imsi, ip=None):
+ # log.debug("creating device, imsi_id={}, imsi={}, ip={}".format(imsi_id, imsi, ip))
+ self.imsi_id = imsi_id
+ self.imsi = imsi
+ self.ip = ip
+ self.reachable = False
+ self.last_reachable = datetime.min
+
+ @classmethod
+ def get_reachable(cls, devices):
+ reachable = {}
+ for _, device in devices.items():
+ if device.reachable is True:
+ reachable[device.imsi_id] = {'ip':device.ip, 'imsi':device.imsi, 'last_reachable':'{:%Y-%m-%d %H:%M:%S}'.format(device.last_reachable)}
+ last_reachable = datetime(1, 1, 1, 0, 0)
+
+ return reachable
+
+ @classmethod
+ def get_unreachable(cls, devices):
+ unreachable = {}
+ for _, device in devices.items():
+ if device.reachable is False:
+ unreachable[device.imsi_id] = {'ip':device.ip, 'imsi':device.imsi, 'last_reachable':'{:%Y-%m-%d %H:%M:%S}'.format(device.last_reachable)}
+
+ return unreachable
+
+
+
+