def downloadlocally(self, filepath, options=None):
        """ Used to download a component from the iLO Repo locally

        :param filepath: Path to the file to download.
        :type filepath: string.
        """
        try:
            bs2 = risblobstore2.BlobStore2()
            risblobstore2.BlobStore2.initializecreds(options.user,
                                                     options.password)
            bs2.channel.dll.downloadComponent.argtypes = [c_char_p, c_char_p]
            bs2.channel.dll.downloadComponent.restype = c_int

            filename = filepath.rsplit('/', 1)[-1]
            if not options.outdir:
                destination = os.path.join(os.getcwd(), filename)
            else:
                destination = os.path.join(options.outdir, filename)

            if not os.path.exists(os.path.join(os.path.split(destination)[0])):
                raise InvalidFileInputError("Invalid output file location.")
            if not os.access(os.path.join(os.path.split(destination)[0]),
                             os.W_OK):
                raise InvalidFileInputError("File location is not writable.")
            if os.access(destination, os.F_OK) and not os.access(destination, \
                                                                 os.W_OK):
                raise InvalidFileInputError(
                    "Existing File cannot be overwritten.")

            ret = bs2.channel.dll.downloadComponent(ctypes.create_string_buffer(\
                                                filename.encode('utf-8')), \
                                                ctypes.create_string_buffer(\
                                                destination.encode('utf-8')))

            if ret != 0:
                sys.stdout.write("Component " + filename +
                                 " download failed\n")
                return ReturnCodes.FAILED_TO_DOWNLOAD_COMPONENT
            else:
                sys.stdout.write("Component " + filename + \
                                                    " downloaded successfully\n")

        except Exception as excep:
            raise DownloadError(str(excep))

        return ReturnCodes.SUCCESS
    def uploadlocally(self, filelist, options=None):
        """Upload component locally

        :param filelist: List of files to upload.
        :type filelist: list.
        :param options: command line options
        :type options: list.
        """
        try:
            bs2 = risblobstore2.BlobStore2()
            risblobstore2.BlobStore2.initializecreds(options.user, options.password)
            bs2.channel.dll.uploadComponent.argtypes = [c_char_p, c_char_p, c_char_p, c_uint32]
            bs2.channel.dll.uploadComponent.restype = c_int

            multiupload = False

            for item in filelist:

                ilo_upload_filename = item[0]
                componentpath = item[1]
                compsigpath = item[2]

                if not compsigpath:
                    compsigpath = self.findcompsig(componentpath)

                _, filename = os.path.split(componentpath)

                # 0x00000001  // FUM_WRITE_NAND
                # 0x00000002  // FUM_USE_NAND
                # 0x00000004  // FUM_NO_FLASH
                # 0x00000008  // FUM_FORCE
                # 0x00000010  // FUM_SIDECAR
                # 0x00000020  // FUM_APPEND

                if not compsigpath and options.update_target:
                    # Just update the firmware
                    dispatchflag = ctypes.c_uint32(0x00000000)
                elif not compsigpath and not options.update_target and \
                                                    options.update_repository:
                    # uploading a secuare flash binary image onto the NAND
                    dispatchflag = ctypes.c_uint32(0x00000001 | 0x00000004)
                else:
                    # Uploading a component with a side car file.
                    dispatchflag = ctypes.c_uint32(0x00000001 | 0x00000004 | 0x00000010)

                if multiupload:
                    # For second upload to append if the component is > 32MB in size
                    dispatchflag = ctypes.c_uint32(0x00000001 | 0x00000004 | \
                                                        0x00000010 | 0x00000020)

                sys.stdout.write("Uploading component " + filename + "\n")
                ret = bs2.channel.dll.uploadComponent(\
                  ctypes.create_string_buffer(compsigpath.encode('utf-8')),
                  ctypes.create_string_buffer(componentpath.encode('utf-8')),
                  ctypes.create_string_buffer(ilo_upload_filename), dispatchflag)

                if ret != 0:
                    sys.stdout.write("Component " + filename + " upload failed\n")

                    return ReturnCodes.FAILED_TO_UPLOAD_COMPONENT
                else:
                    sys.stdout.write("Component " + filename + " uploaded successfully\n")

                multiupload = True

        except Exception as excep:
            raise excep

        return ReturnCodes.SUCCESS