On Tue, Jun 16, 2015 at 6:20 AM, Daniele Di Proietto <diproiet...@vmware.com> wrote: > With this commit, the VTEP emulator detects the datapath_type of the > bridge used as a "physical" switch, and creates subsequent bridges > with the same type. This allows ovs-vtep to work with the userspace > datapath. > > Signed-off-by: Daniele Di Proietto <diproiet...@vmware.com> > --- > v1 - v2: > Applied Guru's suggestions > * Fixed unspecified datapath_type > * Use more pythonic check for empty string > --- > vtep/ovs-vtep | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep > index 60dbb95..6e8d0db 100755 > --- a/vtep/ovs-vtep > +++ b/vtep/ovs-vtep > @@ -40,6 +40,7 @@ vlog = ovs.vlog.Vlog("ovs-vtep") > exiting = False > > ps_name = "" > +ps_type = "" > Tunnel_Ip = "" > Lswitches = {} > Bindings = {} > @@ -103,7 +104,12 @@ class Logical_Switch(object): > self.tunnel_key = 0 > vlog.warn("invalid tunnel key for %s, using 0" % self.name) > > - ovs_vsctl("--may-exist add-br %s" % self.short_name) > + if ps_type: > + ovs_vsctl("--may-exist add-br %s -- set Bridge %s > datapath_type=%s" > + % (self.short_name, self.short_name, ps_type)) > + else: > + ovs_vsctl("--may-exist add-br %s" % self.short_name) > + > ovs_vsctl("br-set-external-id %s vtep_logical_switch true" > % self.short_name) > ovs_vsctl("br-set-external-id %s logical_switch_name %s" > @@ -595,6 +601,11 @@ def setup(): > if (ps_name not in br_list): > ovs.util.ovs_fatal(0, "couldn't find OVS bridge %s" % ps_name, vlog) > > + global ps_type > + ps_type = ovs_vsctl("get Bridge %s datapath_type" % ps_name) > + if ps_type == "\"\"": > + ps_type = "" Else where in the code, this is handled by calling strip(). e.g: port_type = ovs_vsctl("get Interface %s type" % port).strip('"') It sort of looks cleaner to me and provides a little more consistency. Otherwise, I am happy with the change.
> + > call_prog("vtep-ctl", ["set", "physical_switch", ps_name, > 'description="OVS VTEP Emulator"']) > > @@ -636,7 +647,11 @@ def setup(): > > ovs_vsctl("del-br %s" % br) > > - ovs_vsctl("add-br %s" % bfd_bridge) > + if ps_type: > + ovs_vsctl("add-br %s -- set Bridge %s datapath_type=%s" > + % (bfd_bridge, bfd_bridge, ps_type)) > + else: > + ovs_vsctl("add-br %s" % bfd_bridge) > > > def main(): > -- > 2.1.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev