ovs-vtep: Handle physical ports with '-' in its name.
authorGurucharan Shetty <gshetty@nicira.com>
Wed, 10 Sep 2014 17:32:26 +0000 (10:32 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 10 Sep 2014 17:32:26 +0000 (10:32 -0700)
As of now, if a physical port has a '-' in its name, ovs-vtep
throws a ValueError exception. This patch fixes the problem.

Reported-by: Mark Maglana <mmaglana@gmail.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
vtep/ovs-vtep

index 721063b..ea233e0 100755 (executable)
@@ -288,7 +288,9 @@ class Logical_Switch(object):
         for interface in self.ports.iterkeys():
             if not interface.endswith("-l"):
                 continue
-            vlan, pp_name, logical = interface.split("-")
+            # Physical ports can have a '-' as part of its name.
+            vlan, remainder = interface.split("-", 1)
+            pp_name, logical = remainder.rsplit("-", 1)
             uuid = vtep_ctl("get physical_port %s vlan_stats:%s"
                             % (pp_name, vlan))
             if not uuid:
@@ -308,7 +310,7 @@ class Logical_Switch(object):
 def add_binding(ps_name, binding, ls):
     vlog.info("adding binding %s" % binding)
 
-    vlan, pp_name = binding.split("-")
+    vlan, pp_name = binding.split("-", 1)
     pbinding = binding+"-p"
     lbinding = binding+"-l"