]> 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 e626ab73fedf010ef30594763bc8a2990e575d4b..560e2f58747af7b498231ca132c5cc72aff726f6 100644 (file)
@@ -187,6 +187,7 @@ class IpHandler(Restorable, ConfigWriter, TransactionalHandler):
         self._config_writer_cfg_dir = config_dir
         self._config_build_templates()
         self._restore()
+        self._write_config()
         self.addr = AddressHandler(self)
         self.route = RouteHandler(self)
         self.dev = DeviceHandler(self)
@@ -225,9 +226,26 @@ class IpHandler(Restorable, ConfigWriter, TransactionalHandler):
                  ), 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__':
 
-    ip = IpHandler()
+    ip = IpHanlder()
     print '----------------------'
     ip.hop.add('201.21.32.53','eth0')
     ip.hop.add('205.65.65.25','eth1')