• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python testagent.build_http_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zstacktestagent.testagent.build_http_path函数的典型用法代码示例。如果您正苦于以下问题:Python build_http_path函数的具体用法?Python build_http_path怎么用?Python build_http_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了build_http_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test

def test():
    #This vlan creation is not a must, if testing is under nested virt env. But it is required on physical host without enough physcial network devices and your test execution machine is not the same one as Host machine. 
    #linux.create_vlan_eth("eth0", 10, "10.0.0.200", "255.255.255.0")
    #linux.create_vlan_eth("eth0", 11, "10.0.1.200", "255.255.255.0")
    #no matter if current host is a ZStest host, we need to create 2 vlan devs for future testing connection for novlan test cases.
    linux.create_vlan_eth("eth0", 10)
    linux.create_vlan_eth("eth0", 11)

    #If test execution machine is not the same one as Host machine, deploy work is needed to separated to 2 steps(deploy_test_agent, execute_plan_without_deploy_test_agent). And it can not directly call SetupAction.run()
    test_lib.setup_plan.deploy_test_agent()
    cmd = host_plugin.CreateVlanDeviceCmd()
    
    hosts = test_lib.lib_get_all_hosts_from_plan()
    if type(hosts) != type([]):
        hosts = [hosts]
    for host in hosts:
        cmd.ethname = 'eth0'
        cmd.vlan = 10
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd)
        cmd.vlan = 11
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd)

    test_lib.setup_plan.execute_plan_without_deploy_test_agent()
    deploy_operations.deploy_initial_database(test_lib.deploy_config)
    if os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
        os.system("bash %s" % EXTRA_SUITE_SETUP_SCRIPT)

    test_util.test_pass('Suite Setup Success')
开发者ID:tianshangjun,项目名称:zstack-woodpecker,代码行数:28,代码来源:suite_setup.py


示例2: test

def test():
    nic_name = "eth0"
    if test_lib.scenario_config != None and test_lib.scenario_file != None and os.path.exists(test_lib.scenario_file):
        nic_name = "zsn0"
    #This vlan creation is not a must, if testing is under nested virt env. But it is required on physical host without enough physcial network devices and your test execution machine is not the same one as Host machine. 
    linux.create_vlan_eth(nic_name, 10)
    linux.create_vlan_eth(nic_name, 11)

    #If test execution machine is not the same one as Host machine, deploy work is needed to separated to 2 steps(deploy_test_agent, execute_plan_without_deploy_test_agent). And it can not directly call SetupAction.run()
    test_lib.setup_plan.deploy_test_agent()
    cmd = host_plugin.CreateVlanDeviceCmd()
    cmd.ethname = nic_name
    cmd.vlan = 10
    
    cmd2 = host_plugin.CreateVlanDeviceCmd()
    cmd2.ethname = nic_name
    cmd2.vlan = 11
    testHosts = test_lib.lib_get_all_hosts_from_plan()
    if type(testHosts) != type([]):
        testHosts = [testHosts]
    for host in testHosts:
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd)
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd2)

    test_lib.setup_plan.execute_plan_without_deploy_test_agent()
    deploy_operations.deploy_initial_database(test_lib.deploy_config)
    if os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
        os.system("bash %s" % EXTRA_SUITE_SETUP_SCRIPT)
    test_util.test_pass('Suite Setup Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:29,代码来源:suite_setup.py


示例3: test

def test():
    # Clear ECS instance remained in Aliyun
    hybrid.add_datacenter_iz()
    hybrid.tear_down()
    clean_util.cleanup_all_vms_violently()
    clean_util.cleanup_none_vm_volumes_violently()
    clean_util.umount_all_primary_storages_violently()
    clean_util.cleanup_backup_storage()
    #linux.remove_vlan_eth("eth0", 10)
    #linux.remove_vlan_eth("eth0", 11)
    cmd = host_plugin.DeleteVlanDeviceCmd()
    cmd.vlan_ethname = 'eth0.10'
    
    hosts = test_lib.lib_get_all_hosts_from_plan()
    if type(hosts) != type([]):
        hosts = [hosts]
    for host in hosts:
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.DELETE_VLAN_DEVICE_PATH), cmd)

    cmd.vlan_ethname = 'eth0.11'
    for host in hosts:
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.DELETE_VLAN_DEVICE_PATH), cmd)

    test_lib.setup_plan.stop_node()
    test_lib.lib_cleanup_host_ip_dict()
    test_util.test_pass('Hybrid Teardown Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:26,代码来源:suite_teardown.py


示例4: test

def test():
    if test_lib.scenario_config != None and test_lib.scenario_file != None and not os.path.exists(test_lib.scenario_file):
        scenario_operations.deploy_scenario(test_lib.all_scenario_config, test_lib.scenario_file, test_lib.deploy_config)
        test_util.test_skip('Suite Setup Success')
    if test_lib.scenario_config != None and test_lib.scenario_destroy != None:
        scenario_operations.destroy_scenario(test_lib.all_scenario_config, test_lib.scenario_destroy)

    nic_name = "eth0"
    if test_lib.scenario_config != None and test_lib.scenario_file != None and os.path.exists(test_lib.scenario_file):
        nic_name = "zsn0"

    #This vlan creation is not a must, if testing is under nested virt env. But it is required on physical host without enough physcial network devices and your test execution machine is not the same one as Host machine. 
    #no matter if current host is a ZStest host, we need to create 2 vlan devs for future testing connection for novlan test cases.
    linux.create_vlan_eth(nic_name, 10)
    linux.create_vlan_eth(nic_name, 11)

    #If test execution machine is not the same one as Host machine, deploy work is needed to separated to 2 steps(deploy_test_agent, execute_plan_without_deploy_test_agent). And it can not directly call SetupAction.run()
    test_lib.setup_plan.deploy_test_agent()
    cmd = host_plugin.CreateVlanDeviceCmd()
    cmd.ethname = nic_name
    cmd.vlan = 10
    
    cmd2 = host_plugin.CreateVlanDeviceCmd()
    cmd2.ethname = nic_name
    cmd2.vlan = 11
    testHosts = test_lib.lib_get_all_hosts_from_plan()
    if type(testHosts) != type([]):
        testHosts = [testHosts]
    for host in testHosts:
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd)
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd2)

    test_lib.setup_plan.execute_plan_without_deploy_test_agent()
    if test_lib.scenario_config != None and test_lib.scenario_file != None and os.path.exists(test_lib.scenario_file):
        mn_ips = deploy_operations.get_nodes_from_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, test_lib.deploy_config)
        if os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
            os.system("bash %s '%s'" % (EXTRA_SUITE_SETUP_SCRIPT, mn_ips))
    elif os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
        os.system("bash %s" % (EXTRA_SUITE_SETUP_SCRIPT))

    deploy_operations.deploy_initial_database(test_lib.deploy_config, test_lib.all_scenario_config, test_lib.scenario_file)
    for host in testHosts:
        os.system("bash %s %s" % (EXTRA_HOST_SETUP_SCRIPT, host.managementIp_))

    mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
    if test_lib.ver_ge_zstack_2_0(mn_ip):
        test_lib.lib_set_allow_live_migration_local_storage('true')
    test_lib.lib_set_primary_storage_imagecache_gc_interval(1)
    test_lib.ensure_recover_script_l2_correct()

    if test_lib.lib_is_storage_network_separate():
        add_ps_network_gateway_sys_tag()

    test_util.test_pass('Suite Setup Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:54,代码来源:suite_setup.py


示例5: _wait_echo

 def _wait_echo(target_ip):
     try:
         rspstr = http.json_dump_post(testagent.build_http_path(target_ip, host_plugin.ECHO_PATH))
     except:
         print('zstack-testagent does not startup, will try again ...')
         return False
     return True
开发者ID:dennis-sun-chao,项目名称:zstack-woodpecker,代码行数:7,代码来源:setup_actions.py


示例6: check

    def check(self):
        super(zstack_kvm_volume_file_checker, self).check()
        volume = self.test_obj.volume
        volume_installPath = volume.installPath
        if not volume_installPath:
            test_util.test_logger('Check result: [installPath] is Null for [volume uuid: ] %s. Can not check volume file existence' % volume.uuid)
            return self.judge(False)

        host = test_lib.lib_get_volume_host(volume)
        if not host:
            test_util.test_logger('Check result: can not find Host, who is belonged to same Zone Uuid of [volume uuid: ] %s. Can not check volume file existence' % volume.uuid)
            return self.judge(False)

        cmd = host_plugin.HostShellCmd()
        file_exist = "file_exist"
        cmd.command = '[ -f %s ] && echo %s' % (volume_installPath, file_exist)
        rspstr = http.json_dump_post(testagent.build_http_path(host.managementIp, host_plugin.HOST_SHELL_CMD_PATH), cmd)
        rsp = jsonobject.loads(rspstr)
        output = jsonobject.dumps(rsp.stdout)
        if file_exist in output:
            test_util.test_logger('Check result: [volume file: ] %s exist on [host name:] %s .' % (volume.uuid, host.name))
            return self.judge(True)
        else:
            test_util.test_logger('Check result: [volume file: ] %s does not exist on [host name:] %s .' % (volume.uuid, host.name))
            return self.judge(False)
开发者ID:chancelq,项目名称:zstack-woodpecker,代码行数:25,代码来源:zstack_kvm_volume_checker.py


示例7: _umount_folder_violently

def _umount_folder_violently(host_ip, path):
    cmd = host_plugin.HostShellCmd()
    cmd.command = "umount %s" % path
    try:
        http.json_dump_post(testagent.build_http_path(host_ip, host_plugin.HOST_SHELL_CMD_PATH), cmd)
    except Exception as e:
        err = linux.get_exception_stacktrace()
        test_util.test_logger("Fail to umount folder: %s in Host: %s" % (path, host_ip))
        test_util.test_logger(err)

    test_util.test_logger("Umount folder: %s in Host: %s" % (path, host_ip))
开发者ID:tianshangjun,项目名称:zstack-woodpecker,代码行数:11,代码来源:clean_util.py


示例8: _rm_folder_contents_violently

def _rm_folder_contents_violently(host_ip, path):
    cmd = host_plugin.HostShellCmd()
    cmd.command = "rm -rf %s/*" % path
    try:
        http.json_dump_post(testagent.build_http_path(host_ip, host_plugin.HOST_SHELL_CMD_PATH), cmd)
    except Exception as e:
        err = linux.get_exception_stacktrace()
        test_util.test_logger("Fail to delete contents in folder: %s in Host: %s" % (path, host_ip))
        test_util.test_logger(err)

    test_util.test_logger("Successfully delete contents in folder: %s in Host: %s" % (path, host_ip))
开发者ID:tianshangjun,项目名称:zstack-woodpecker,代码行数:11,代码来源:clean_util.py


示例9: test

def test():
    if test_lib.scenario_config != None and test_lib.scenario_file != None and not os.path.exists(test_lib.scenario_file):
        scenario_operations.deploy_scenario(test_lib.all_scenario_config, test_lib.scenario_file, test_lib.deploy_config)
        test_util.test_skip('Suite Setup Success')
    if test_lib.scenario_config != None and test_lib.scenario_destroy != None:
        scenario_operations.destroy_scenario(test_lib.all_scenario_config, test_lib.scenario_destroy)

    #This vlan creation is not a must, if testing is under nested virt env. But it is required on physical host without enough physcial network devices and your test execution machine is not the same one as Host machine. 
    #no matter if current host is a ZStest host, we need to create 2 vlan devs for future testing connection for novlan test cases.
    linux.create_vlan_eth("eth0", 10)
    linux.create_vlan_eth("eth0", 11)

    #If test execution machine is not the same one as Host machine, deploy work is needed to separated to 2 steps(deploy_test_agent, execute_plan_without_deploy_test_agent). And it can not directly call SetupAction.run()
    test_lib.setup_plan.deploy_test_agent()
    cmd = host_plugin.CreateVlanDeviceCmd()
    cmd.ethname = 'eth0'
    cmd.vlan = 10
    
    cmd2 = host_plugin.CreateVlanDeviceCmd()
    cmd2.ethname = 'eth0'
    cmd2.vlan = 11
    testHosts = test_lib.lib_get_all_hosts_from_plan()
    if type(testHosts) != type([]):
        testHosts = [testHosts]
    for host in testHosts:
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd)
        http.json_dump_post(testagent.build_http_path(host.managementIp_, host_plugin.CREATE_VLAN_DEVICE_PATH), cmd2)

    test_lib.setup_plan.execute_plan_without_deploy_test_agent()
    if os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
        os.system("bash %s" % EXTRA_SUITE_SETUP_SCRIPT)

    deploy_operations.deploy_initial_database(test_lib.deploy_config, test_lib.all_scenario_config, test_lib.scenario_file)
    for host in testHosts:
        os.system("bash %s %s" % (EXTRA_HOST_SETUP_SCRIPT, host.managementIp_))

    if test_lib.lib_get_ha_selffencer_maxattempts() != None:
        test_lib.lib_set_ha_selffencer_maxattempts('60')
	test_lib.lib_set_ha_selffencer_storagechecker_timeout('60')
    test_lib.lib_set_primary_storage_imagecache_gc_interval(1)
    test_util.test_pass('Suite Setup Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:41,代码来源:suite_setup.py


示例10: check

    def check(self):
        super(zstack_kvm_volume_attach_checker, self).check()
        volume = self.test_obj.volume
        if not volume.vmInstanceUuid:
            test_util.test_logger('Check result: [volume:] %s does NOT have vmInstanceUuid. It is not attached to any vm.' % volume.uuid)
            return self.judge(False)

        if not self.test_obj.target_vm:
            test_util.test_logger('Check result: test [volume:] %s does NOT have vmInstance record in test structure. Can not do furture checking.' % volume.uuid)
            return self.judge(False)

        vm = self.test_obj.target_vm.vm

        volume_installPath = volume.installPath
        if not volume_installPath:
            test_util.test_logger('Check result: [installPath] is Null for [volume uuid: ] %s. Can not check if volume is attached to vm.' % volume.uuid)
            return self.judge(False)
        host = test_lib.lib_get_vm_host(vm)
        cmd = vm_plugin.VmStatusCmd()
        cmd.vm_uuids = [vm.uuid]
        rspstr = http.json_dump_post(testagent.build_http_path(host.managementIp, vm_plugin.VM_BLK_STATUS), cmd)
        rsp = jsonobject.loads(rspstr)
        output = jsonobject.dumps(rsp.vm_status[vm.uuid])
        if volume_installPath.startswith('iscsi'):
            volume_installPath = volume_installPath.split(';')[0].split('/iqn')[1]
            volume_installPath = 'iqn%s' % volume_installPath
            volume_installPath = volume_installPath[:-2]
        elif volume_installPath.startswith('ceph'):
            volume_installPath = volume_installPath.split('ceph://')[1]
        elif volume_installPath.startswith('fusionstor'):
            volume_installPath = volume_installPath.split('fusionstor://')[1]
        elif volume_installPath.startswith('sharedblock'):
            volume_installPath = "/dev/" + volume_installPath.split('sharedblock://')[1]
        elif volume_installPath.startswith('mini'):
            _cmd = "drbdsetup show %s | grep device | awk -F';' '{print $1}' | awk '{print $3}'" % volume.uuid
            result = test_lib.lib_execute_ssh_cmd(host.managementIp,host.username, host.password, _cmd, 180)
            volume_installPath = '/dev/drbd' + result.strip()
        elif volume_installPath.startswith('ebs'):
            ps_uuid = volume.primaryStorageUuid
            ps = test_lib.lib_get_primary_storage_by_uuid(ps_uuid)
            url = ps.url.replace('ocean/api', 'dev/name')
            vol_id = volume_installPath.split(';')[1].split('volumeId=')[-1]
            req = urllib2.Request(url, headers={'Volumeid': vol_id})
            volume_installPath = '/dev/' + urllib2.urlopen(req).read().split('"')[-2]



        if volume_installPath in output:
            test_util.test_logger('Check result: [volume:] %s [file:] %s is found in [vm:] %s on [host:] %s .' % (volume.uuid, volume_installPath, vm.uuid, host.managementIp))
            return self.judge(True)
        else:
            test_util.test_logger('Check result: [volume:] %s [file:] %s is not found in [vm:] %s on [host:] %s .' % (volume.uuid, volume_installPath, vm.uuid, host.managementIp))
            return self.judge(False)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:53,代码来源:zstack_kvm_volume_checker.py


示例11: check_file_exist

 def check_file_exist(self, volume, volume_installPath, host):
     cmd = host_plugin.HostShellCmd()
     file_exist = "file_exist"
     cmd.command = '[ -f %s ] && echo %s' % (volume_installPath, file_exist)
     rspstr = http.json_dump_post(testagent.build_http_path(host.managementIp, host_plugin.HOST_SHELL_CMD_PATH), cmd)
     rsp = jsonobject.loads(rspstr)
     output = jsonobject.dumps(rsp.stdout)
     if file_exist in output:
         test_util.test_logger('Check result: [volume:] %s [file:] %s exist on [host name:] %s .' % (volume.uuid, volume_installPath, host.managementIp))
         return self.judge(True)
     else:
         test_util.test_logger('Check result: [volume:] %s [file:] %s does not exist on [host name:] %s .' % (volume.uuid, volume_installPath, host.managementIp))
         return self.judge(False)
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:13,代码来源:zstack_kvm_volume_checker.py


示例12: print_iptables

def print_iptables(vm):
    host = test_lib.lib_find_host_by_vm(vm)
    try:
        if not host.managementIp:
            test_util.test_logger('did not find host for vm: %s ' % vm.uuid)
            return 
    except:
        test_util.test_logger('did not find host for vm: %s ' % vm.uuid)
        return 

    host_cmd = host_plugin.HostShellCmd()
    host_cmd.command = 'iptables-save'
    rspstr = http.json_dump_post(testagent.build_http_path(host.managementIp, host_plugin.HOST_SHELL_CMD_PATH), host_cmd)
    rsp = jsonobject.loads(rspstr)
    if rsp.return_code != 0:
        test_util.test_logger('can not dump iptables on host: %s; reason: %s' % (host.managementIp, rsp.stderr))
    else:
        test_util.test_logger('iptables-save result on %s: %s' % (host.managementIp, rsp.stdout))
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:18,代码来源:zstack_kvm_security_group_checker.py


示例13: check

 def check(self):
     super(zstack_kvm_vm_destroyed_checker, self).check()
     vm = self.test_obj.vm
     host = test_lib.lib_get_vm_host(vm)
     test_lib.lib_install_testagent_to_host(host)
     test_lib.lib_set_vm_host_l2_ip(vm)
     cmd = vm_plugin.VmStatusCmd()
     cmd.vm_uuids = [vm.uuid]
     test_util.test_logger('Check [vm:] %s status on host [name:] %s [uuid:] %s.' % (vm.uuid, host.name, host.uuid))
     rspstr = http.json_dump_post(testagent.build_http_path(host.managementIp, vm_plugin.VM_STATUS), cmd)
     rsp = jsonobject.loads(rspstr)
     check_result = rsp.vm_status[vm.uuid].strip()
     if check_result != vm_plugin.VmAgent.VM_STATUS_RUNNING and check_result != vm_plugin.VmAgent.VM_STATUS_STOPPED:
         test_util.test_logger('Check result: [vm:] %s is DESTROYED on [host:] %s .' % (vm.uuid, host.name))
         return self.judge(True)
     else:
         test_util.test_logger('Check result: [vm:] %s is NOT DESTROYED on [host:] %s . vm status is: %s' % (vm.uuid, host.name, check_result))
         return self.judge(False)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:18,代码来源:zstack_kvm_vm_checker.py


示例14: _destroy_vm_violently

def _destroy_vm_violently(host_ip, uuid):
    cmd = vm_plugin.DeleteVmCmd()
    cmd.vm_uuids = [uuid]
    http.json_dump_post(testagent.build_http_path(host_ip, vm_plugin.DELETE_VM_PATH), cmd)
开发者ID:tianshangjun,项目名称:zstack-woodpecker,代码行数:4,代码来源:clean_util.py


示例15: _delete_files

def _delete_files(host_ip, path):
    cmd = host_plugin.HostShellCmd()
    cmd.command = "rm -rf %s*" % path
    test_util.test_logger("Delete files: %s in Host: %s" % (path, host_ip))
    http.json_dump_post(testagent.build_http_path(host_ip, host_plugin.HOST_SHELL_CMD_PATH), cmd)
开发者ID:tianshangjun,项目名称:zstack-woodpecker,代码行数:5,代码来源:clean_util.py



注:本文中的zstacktestagent.testagent.build_http_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python account_operations.execute_action_with_session函数代码示例发布时间:2022-05-26
下一篇:
Python xmlobject.safe_list函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap