def ovs_version_str(host):
    """ Retrieve OVS version and return it as a string """

    mask_cmd = None
    ovs_ver_cmd = "ovs-vsctl get Open_vSwitch . ovs_version"
    with host.sudo():
        if not host.exists("ovs-vsctl"):
            raise Exception("Unable to find ovs-vsctl in PATH")
        mask_cmd = host.run(ovs_ver_cmd)
    if not mask_cmd or mask_cmd.failed or not mask_cmd.stdout:
        raise Exception("Failed to get OVS version with command '{cmd}'"
                        .format(cmd=ovs_ver_cmd))
    return mask_cmd.stdout.strip('"\n')