Added routes to OMF nodes
[nepi.git] / src / nepi / testbeds / planetlab / interfaces.py
index 60295e2..f4df82f 100644 (file)
@@ -221,13 +221,13 @@ class TunIface(object):
             if pointopoint:
                 prefix = 32
                 
-            dest, destprefix, nexthop, metric = route
+            dest, destprefix, nexthop, metric, device = route
             
-            myNet = ipaddr.IPNetwork("%s/%d" % (addr, prefix))
-            gwIp = ipaddr.IPNetwork(nexthop)
+            myNet = ipaddr.IPv4Network("%s/%d" % (addr, prefix))
+            gwIp = ipaddr.IPv4Network(nexthop)
             
             if pointopoint:
-                peerIp = ipaddr.IPNetwork(pointopoint)
+                peerIp = ipaddr.IPv4Network(pointopoint)
                 
                 if gwIp == peerIp:
                     return True
@@ -578,6 +578,28 @@ class ClassQueueFilter(TunFilter):
         # Attributes
         self.module = "classqueue.py"
 
+class LoggingClassQueueFilter(ClassQueueFilter):
+    _TRACEMAP = ClassQueueFilter._TRACEMAP.copy()
+    _TRACEMAP.update({
+        # tracename : (remotename, localname)
+        'queue_stats_f'   : ('queue_stats_f', 'queue_stats_f'),
+        'queue_stats_b'   : ('queue_stats_b', 'queue_stats_b'),
+    })
+    
+    def __init__(self, api=None):
+        super(LoggingClassQueueFilter, self).__init__(api)
+        # Attributes
+        self.module = "loggingclassqueue.py classqueue.py"
+        
+    def _args_get(self):
+        # Inject outpath
+        args = dict(filter(lambda x:len(x)>1, map(lambda x:x.split('=',1),(self._args or "").split(','))))
+        args["outpath"] = "queue_stats"
+        return ",".join(map("=".join, args.iteritems()))
+    def _args_set(self, value):
+        self._args = value
+    args = property(_args_get, _args_set)
+
 class ToSQueueFilter(TunFilter):
     def __init__(self, api=None):
         super(ToSQueueFilter, self).__init__(api)