On Mon, Sep 8, 2014 at 9:08 PM, Mark Maglana <mmagl...@gmail.com> wrote:
> Modify patch port name separators to use "--" instead of "-" so that
> ovs-vtep plays nice with external tools such as Mininet which uses
> dashes in port names. Without this change, ovs-vtep will throw a
> ValueError exception and die soon after one of the physical ports
> created by Mininet is attached to a logical switch.
>
> Signed-off-by: Mark Maglana <mmagl...@gmail.com>
I see that there is a bug. With your patch, would we still hit the bug
if the port name has a "--" in it?

> ---
>  vtep/ovs-vtep | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep
> index 721063b..bcd8b06 100755
> --- a/vtep/ovs-vtep
> +++ b/vtep/ovs-vtep
> @@ -286,9 +286,9 @@ 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():
> -            if not interface.endswith("-l"):
> +            if not interface.endswith("--l"):
>                  continue
> -            vlan, pp_name, logical = interface.split("-")
> +            vlan, pp_name, logical = interface.split("--")
>              uuid = vtep_ctl("get physical_port %s vlan_stats:%s"
>                              % (pp_name, vlan))
>              if not uuid:
> @@ -308,9 +308,9 @@ class Logical_Switch(object):
>  def add_binding(ps_name, binding, ls):
>      vlog.info("adding binding %s" % binding)
>
> -    vlan, pp_name = binding.split("-")
> -    pbinding = binding+"-p"
> -    lbinding = binding+"-l"
> +    vlan, pp_name = binding.split("--")
> +    pbinding = binding+"--p"
> +    lbinding = binding+"--l"
>
>      # Create a patch port that connects the VLAN+port to the lswitch.
>      # Do them as two separate calls so if one side already exists, the
> @@ -349,9 +349,9 @@ def add_binding(ps_name, binding, ls):
>  def del_binding(ps_name, binding, ls):
>      vlog.info("removing binding %s" % binding)
>
> -    vlan, pp_name = binding.split("-")
> -    pbinding = binding+"-p"
> -    lbinding = binding+"-l"
> +    vlan, pp_name = binding.split("--")
> +    pbinding = binding+"--p"
> +    lbinding = binding+"--l"
>
>      port_no = ovs_vsctl("get Interface %s ofport" % pp_name)
>      patch_no = ovs_vsctl("get Interface %s ofport" % pbinding)
> @@ -400,7 +400,7 @@ def handle_physical(ps_name):
>              if ls_name not in Lswitches:
>                  Lswitches[ls_name] = Logical_Switch(ls_name)
>
> -            binding = "%s-%s" % (vlan, pp_name)
> +            binding = "%s--%s" % (vlan, pp_name)
>              ls = Lswitches[ls_name]
>              new_bindings.add(binding)
>
> --
> 2.0.3
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to