Example #1
0
 def testName(self):
     server = sftpbackupstorage.SftpBackupStorageAgent()
     server.http_server.register_sync_uri('/testcallback', self.callback)
     
     server.http_server.start_in_thread()
     time.sleep(2)
     cmd = sftpbackupstorage.ConnectCmd()
     cmd.storagePath = "/tmp"
     #url = sftpbackupstorage._build_url_for_test([sftpbackupstorage.SftpBackupStorageAgent.CONNECT_PATH])
     url = 'http://localhost:7171%s' % sftpbackupstorage.SftpBackupStorageAgent.CONNECT_PATH
     print url
     rsp = http.json_dump_post(url, cmd)
     
     cmd = sftpbackupstorage.DownloadCmd()
     cmd.accountUuid = uuidhelper.uuid()
     cmd.bits = 64
     cmd.description = "Test"
     cmd.format = sftpbackupstorage.SftpBackupStorageAgent.IMAGE_TEMPLATE
     cmd.guestOsType = "rpm"
     cmd.hypervisorType = "KVM"
     cmd.imageUuid = uuidhelper.uuid()
     cmd.name = "test"
     cmd.timeout = 60
     cmd.url = "http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-6.noarch.rpm"
     cmd.urlScheme = "http"
     url = 'http://localhost:7171%s' % sftpbackupstorage.SftpBackupStorageAgent.DOWNLOAD_IMAGE_PATH
     print url
     rsp = http.json_dump_post(url, cmd, headers={http.TASK_UUID:uuidhelper.uuid(), http.CALLBACK_URI:self.CALLBACK_URL})
     print "post back"
     time.sleep(20)
     
     server.http_server.stop()
 def testName(self):
     server = sftpbackupstorage.SftpBackupStorageAgent()
     server.http_server.start_in_thread()
     time.sleep(2)
     
     cmd = sftpbackupstorage.ConnectCmd()
     cmd.storagePath = "/tmp"
     #url = sftpbackupstorage._build_url_for_test([sftpbackupstorage.SftpBackupStorageAgent.CONNECT_PATH])
     url = 'http://localhost:7171%s' % sftpbackupstorage.SftpBackupStorageAgent.CONNECT_PATH
     print url
     rsp = http.json_dump_post(url, cmd)
     jrsp = jsonobject.loads(rsp)
     print "total: %s, used: %s" % (jrsp.totalBackupStorageSize, jrsp.usedBackupStorageSize)
     
     server.http_server.stop()
Example #3
0
    def testName(self):
        server = sftpbackupstorage.SftpBackupStorageAgent()
        server.http_server.register_sync_uri('/testcallback', self.callback)
        server.http_server.start_in_thread()
        time.sleep(2)

        cmd = sftpbackupstorage.GetSshKeyCommand()
        url = 'http://localhost:7171%s' % sftpbackupstorage.SftpBackupStorageAgent.GET_SSHKEY_PATH
        print url
        rsp = http.json_dump_post(url,
                                  cmd,
                                  headers={
                                      http.TASK_UUID: uuidhelper.uuid(),
                                      http.CALLBACK_URI: self.CALLBACK_URL
                                  })
        print "post back"
        time.sleep(5)

        server.http_server.stop()