예제 #1
0
    def __run_bdx_upload_between(self, nodeA, nodeB, file_size, server_version, client_version):
        test_folder_path = "/tmp/happy_________%08d_upload_________%08d" % (int(os.getpid()), self.test_num)
        test_folder = self.__create_test_folder(test_folder_path)

        server_temp_path = self.__create_server_temp(test_folder)
        test_file = self.__create_file(test_folder, file_size)
        receive_path = self.__create_receive_folder(test_folder)

        options = WeaveBDX.option()
        options["quiet"] = False
        options["server"] = nodeA
        options["client"] = nodeB
        options["tmp"] = server_temp_path
        options["upload"] = test_file
        options["receive"] = receive_path
        options["tap"] = self.tap
        options["server_version"] = server_version
        options["client_version"] = client_version

        weave_bdx = WeaveBDX.WeaveBDX(options)
        ret = weave_bdx.run()

        value = ret.Value()
        data = ret.Data()
        copy_success = self.__file_copied(test_file, receive_path)
        self.__delete_test_folder(test_folder)

        return copy_success, data
예제 #2
0
    def __weave_bdx(self,
                    direction,
                    file_size,
                    server_version,
                    client_version,
                    num_iterations,
                    faults={},
                    test_tag=""):

        test_folder_path = "/tmp/happy_%08d_%s_%03d" % (int(
            os.getpid()), direction, self.test_num)
        test_folder = self.__create_test_folder(test_folder_path)

        server_temp_path = self.__create_server_temp(test_folder)
        test_file = self.__create_file(test_folder, file_size)
        receive_path = self.__create_receive_folder(test_folder)

        options = WeaveBDX.option()
        options["plaid"] = "auto"
        options["quiet"] = False
        options["server"] = "node01"
        options["client"] = "node02"
        options["tmp"] = server_temp_path
        options[direction] = test_file
        options["receive"] = receive_path
        options["tap"] = self.tap
        options["server_version"] = server_version
        options["client_version"] = client_version
        options["server_faults"] = faults.get('server')
        options["client_faults"] = faults.get('client')
        options["strace"] = self.strace
        options["test_tag"] = test_tag
        options["iterations"] = num_iterations

        weave_bdx = WeaveBDX.WeaveBDX(options)
        ret = weave_bdx.run()

        value = ret.Value()
        data = ret.Data()
        copy_success = self.__file_copied(test_file, receive_path)
        self.__delete_test_folder(test_folder)

        failed = self.__process_result("node01", "node02", value, data,
                                       direction, file_size, server_version,
                                       client_version, faults)

        if (len(faults) == 0):
            self.happy_seq_output_logs = {}
            self.happy_seq_output_logs['client'] = data["client_output"]
            self.happy_seq_output_logs['server'] = data["server_output"]

        self.test_num += 1

        return failed
예제 #3
0
#
#    @file
#       A Happy command line utility that tests Weave BDX among Weave nodes.
#
#       The command is executed by instantiating and running WeaveBDX class.
#

import getopt
import sys

from happy.Utils import *
import plugin.WeaveBDX as WeaveBDX

if __name__ == "__main__":
    options = WeaveBDX.option()

    try:
        opts, args = getopt.getopt(sys.argv[1:], "hqs:c:t:r:u:d:o:l:p:S:C:", [
            "help", "quiet", "server=", "client=", "tmp=", "receive=",
            "upload=", "download=", "offset=", "length=", "tap=",
            "server-version=", "client-version="
        ])

    except getopt.GetoptError as err:
        print WeaveBDX.WeaveBDX.__doc__
        print hred(str(err))
        sys.exit(hred("%s: Failed destination parse arguments." % (__file__)))

    for o, a in opts:
        if o in ("-h", "--help"):