netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / vtep / ovs-vtep
index 1db4e05..97397b0 100755 (executable)
@@ -30,6 +30,7 @@ import ovs.daemon
 import ovs.unixctl.server
 import ovs.vlog
 from six.moves import range
+import six
 
 
 VERSION = "0.99"
@@ -127,11 +128,11 @@ class Logical_Switch(object):
         ovs_ofctl("add-flow %s priority=0,action=drop" % self.short_name)
 
     def cleanup_ls(self):
-        for port_no, tun_name, remote_ip in self.tunnels.itervalues():
+        for port_no, tun_name, remote_ip in six.itervalues(self.tunnels):
             del_bfd(remote_ip)
 
     def update_flood(self):
-        flood_ports = self.ports.values()
+        flood_ports = list(self.ports.values())
 
         # Traffic flowing from one 'unknown-dst' should not be flooded to
         # port belonging to another 'unknown-dst'.
@@ -282,11 +283,11 @@ class Logical_Switch(object):
         for tunnel in old_tunnels.difference(tunnels):
             self.del_tunnel(tunnel)
 
-        for mac in remote_macs.keys():
+        for mac in six.iterkeys(remote_macs):
             if (self.remote_macs.get(mac) != remote_macs[mac]):
                 self.add_remote_mac(mac, remote_macs[mac])
 
-        for mac in self.remote_macs.keys():
+        for mac in six.iterkeys(self.remote_macs):
             if mac not in remote_macs:
                 self.del_remote_mac(mac)
 
@@ -308,7 +309,7 @@ class Logical_Switch(object):
 
         # Go through all the logical switch's interfaces that end with "-l"
         # and copy the statistics to logical_binding_stats.
-        for interface in self.ports.iterkeys():
+        for interface in six.iterkeys(self.ports):
             if not interface.endswith("-l"):
                 continue
             # Physical ports can have a '-' as part of its name.
@@ -319,7 +320,7 @@ class Logical_Switch(object):
             if not uuid:
                 continue
 
-            for (mapfrom, mapto) in stats_map.iteritems():
+            for mapfrom, mapto in six.iteritems(stats_map):
                 value = ovs_vsctl("get interface %s statistics:%s"
                                 % (interface, mapfrom)).strip('"')
                 vtep_ctl("set logical_binding_stats %s %s=%s"
@@ -435,7 +436,7 @@ def run_bfd():
                               'bfd_params:check_tnl_key': 'false'}
         bfd_params_values = {}
 
-        for key, default in bfd_params_default.iteritems():
+        for key, default in six.iteritems(bfd_params_default):
             column = vtep_ctl("--if-exists get tunnel %s %s"
                                % (tunnel, key))
             if not column:
@@ -443,7 +444,7 @@ def run_bfd():
             else:
                 bfd_params_values[key] = column
 
-        for key, value in bfd_params_values.iteritems():
+        for key, value in six.iteritems(bfd_params_values):
             new_key = key.replace('_params', '')
             ovs_vsctl("set interface %s %s=%s" % (port, new_key, value))
 
@@ -465,7 +466,7 @@ def run_bfd():
         bfd_lconf_default = {'bfd_config_local:bfd_dst_ip': '169.254.1.0',
                              'bfd_config_local:bfd_dst_mac':
                                     '00:23:20:00:00:01'}
-        for key, value in bfd_lconf_default.iteritems():
+        for key, value in six.iteritems(bfd_lconf_default):
             vtep_ctl("set tunnel %s %s=%s" % (tunnel, key, value))
 
         # bfd_config_remote options from VTEP DB should be populated to
@@ -713,7 +714,7 @@ def main():
 
         handle_physical()
 
-        for ls_name, ls in Lswitches.items():
+        for ls_name, ls in six.iteritems(Lswitches):
             ls.run()
 
         run_bfd()