]> git.llucax.com Git - software/pymin.git/blobdiff - pymin/services/ip/__init__.py
qos implementation fixes
[software/pymin.git] / pymin / services / ip / __init__.py
index 9d256a294ad3020c9ff6073cba7ce53569c84456..560e2f58747af7b498231ca132c5cc72aff726f6 100644 (file)
@@ -226,9 +226,26 @@ class IpHandler(Restorable, ConfigWriter, TransactionalHandler):
                  ), shell=True)
 
 
                  ), shell=True)
 
 
+    def handle_timer(self):
+        self.refresh_devices()
+
+
+    def refresh_devices(self):
+        devices = get_network_devices()
+        #add not registered devices
+        for k,v in devices.items():
+            if k not in self.devices:
+                self.devices[k] = Device(k,v)
+        #delete dead devices
+        for k in self.devices.keys():
+            if k not in devices:
+                del self.devices[k]
+
+
+
 if __name__ == '__main__':
 
 if __name__ == '__main__':
 
-    ip = IpHandler()
+    ip = IpHanlder()
     print '----------------------'
     ip.hop.add('201.21.32.53','eth0')
     ip.hop.add('205.65.65.25','eth1')
     print '----------------------'
     ip.hop.add('201.21.32.53','eth0')
     ip.hop.add('205.65.65.25','eth1')