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')
示例#2
0
    def create_vlan_bridge(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        rsp = CreateVlanBridgeResponse()
        vlanInterfName = '%s.%s' % (cmd.physicalInterfaceName, cmd.vlan)

        if linux.is_bridge(cmd.bridgeName):
            logger.debug('%s is a bridge device, no need to create bridge' % cmd.bridgeName)
            try:
                self._ifup_device_if_down('%s.%s' % (cmd.physicalInterfaceName, cmd.vlan))
            except DeviceNotExistedError:
                linux.create_vlan_eth(cmd.physicalInterfaceName, cmd.vlan)
            self._configure_bridge(cmd.disableIptables)
            self._configure_bridge_mtu(cmd.bridgeName, vlanInterfName, cmd.mtu)
            self._configure_bridge_learning(cmd.bridgeName, vlanInterfName)
            linux.set_bridge_alias_using_phy_nic_name(cmd.bridgeName, cmd.physicalInterfaceName)
            linux.set_device_uuid_alias('%s.%s' % (cmd.physicalInterfaceName, cmd.vlan), cmd.l2NetworkUuid)
            self._ifup_device_if_down(cmd.bridgeName)
            return jsonobject.dumps(rsp)
        
        try:
            linux.create_vlan_bridge(cmd.bridgeName, cmd.physicalInterfaceName, cmd.vlan)
            self._configure_bridge(cmd.disableIptables)
            self._configure_bridge_mtu(cmd.bridgeName, vlanInterfName, cmd.mtu)
            self._configure_bridge_learning(cmd.bridgeName, vlanInterfName)
            linux.set_bridge_alias_using_phy_nic_name(cmd.bridgeName, cmd.physicalInterfaceName)
            linux.set_device_uuid_alias('%s.%s' % (cmd.physicalInterfaceName, cmd.vlan), cmd.l2NetworkUuid)
            logger.debug('successfully realize vlan bridge[name:%s, vlan:%s] from device[%s]' % (cmd.bridgeName, cmd.vlan, cmd.physicalInterfaceName))
        except Exception as e:
            logger.warning(traceback.format_exc())
            rsp.error = 'unable to create vlan bridge[name:%s, vlan:%s] from device[%s], because %s' % (cmd.bridgeName, cmd.vlan, cmd.physicalInterfaceName, str(e))
            rsp.success = False
            
        return jsonobject.dumps(rsp)
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.
    #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()
    deploy_operations.deploy_initial_database(test_lib.deploy_config)
    test_util.test_pass('Suite Setup Success')
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')
示例#5
0
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)

    delete_policy = test_lib.lib_set_delete_policy('vm', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('volume', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('image', 'Direct')
    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')
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')
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')
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"
        linux.create_vlan_eth(nic_name, 1010)
        linux.create_vlan_eth(nic_name, 1011)
    #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(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()
    
    hosts = test_lib.lib_get_all_hosts_from_plan()
    if type(hosts) != type([]):
        hosts = [hosts]
    #for host in hosts:
    #    cmd.ethname = nic_name
    #    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()
    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 hosts:
        os.system("bash %s %s" % (EXTRA_HOST_SETUP_SCRIPT, host.managementIp_))

    delete_policy = test_lib.lib_set_delete_policy('vm', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('volume', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('image', 'Direct')
#    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')
def test():
    if test_lib.scenario_config == None or test_lib.scenario_file ==None:
        test_util.test_fail('Suite Setup Fail without scenario')

    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)

    config_json = os.environ.get('configJson')
    ha_deploy_tool = os.environ.get('zstackHaInstaller')
    mn_img = os.environ.get('mnImage')
    test_stub.deploy_ha_env(test_lib.all_scenario_config, test_lib.scenario_file, test_lib.deploy_config,config_json, ha_deploy_tool, mn_img)

    node_operations.wait_for_management_server_start(300)
    ssh.scp_file("/home/license-10host-10days-hp.txt", "/home/license-10host-10days-hp.txt", os.environ.get('zstackHaVip'), 'root', 'password')
    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_lib.lib_set_reserved_memory('8G')
    test_util.test_pass('Suite Setup Success')
示例#10
0
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')
示例#11
0
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' %s" %
                      (EXTRA_SUITE_SETUP_SCRIPT, mn_ips, 'disaster-recovery'))
    elif os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
        os.system("bash %s '' '%s'" %
                  (EXTRA_SUITE_SETUP_SCRIPT, 'disaster-recovery'))

    mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
    if test_lib.scenario_config != None and test_lib.scenario_file != None and not os.path.exists(
            test_lib.scenario_file):
        host_ips = scenario_operations.dump_scenario_file_ips(
            test_lib.scenario_file)
    else:
        host_ips = testHosts
    #for host in host_ips:
    #    if host.managementIp_ != mn_ip:
    #        cmd = "echo 'export LANG=\"zh_CN.GB18030\"' >> /etc/profile && sudo ls /root && source /etc/profile"
    #        os.system('sshpass -p password ssh root@%s "%s"' %(host.managementIp_,cmd))

    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()

    if test_lib.scenario_config != None and test_lib.scenario_file != None and os.path.exists(
            test_lib.scenario_file):
        scenario_operations.replace_env_params_if_scenario()
    else:
        pass

    test_util.test_pass('Suite Setup Success')
 def testName(self):
     linux.create_vlan_eth('eth0', 11, '10.1.1.1', '255.255.255.0')
     linux.create_vlan_eth('eth0', 100, '10.3.3.3', '255.255.255.0')
 def testName(self):
     linux.create_vlan_eth('eth0', 11, '10.1.1.1', '255.255.255.0')
     linux.create_vlan_eth('eth0', 100, '10.3.3.3', '255.255.255.0')
示例#14
0
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"
        linux.create_vlan_eth(nic_name, 1010)
        linux.create_vlan_eth(nic_name, 1011)
    #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(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()
    
    hosts = test_lib.lib_get_all_hosts_from_plan()
    if type(hosts) != type([]):
        hosts = [hosts]
    for host in hosts:
        cmd.ethname = nic_name
        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()
    conf_ops.change_global_config("applianceVm", "agent.deployOnStart", 'true')
    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 hosts:
        os.system("bash %s %s" % (EXTRA_HOST_SETUP_SCRIPT, host.managementIp_))
    
    test_util.test_dsc("create vpc vrouter")
    vr = test_stub.create_vpc_vrouter()
    test_util.test_dsc("Try to create one vm in random L3 not attached")
    with test_lib.expected_failure("create one vm in random L3 not attached", Exception):
        test_stub.create_vm_with_random_offering(vm_name='vpc_vm1', l3_name=random.choice(test_stub.L3_SYSTEM_NAME_LIST))
    test_util.test_dsc("attach vpc l3 to vpc vrouter")
    test_stub.attach_l3_to_vpc_vr(vr, test_stub.L3_SYSTEM_NAME_LIST)

    test_util.test_dsc("create cloud router")
    vm1 = test_stub.create_vlan_vm(os.environ.get('l3NoVlanNetworkName2'))
    test_obj_dict.add_vm(vm1)
    vm1.clean()

    test_util.test_dsc("create load balance")
    l3_public_name = os.environ.get('l3PublicNetworkName')
    l3_net_uuid = test_lib.lib_get_l3_by_name(l3_public_name).uuid

    vip = test_stub.create_vip('vip_for_lb_test', l3_net_uuid)
    test_obj_dict.add_vip(vip)

    lb = zstack_lb_header.ZstackTestLoadBalancer()
    lb.create('autoscaling lb test', vip.get_vip().uuid)
    test_obj_dict.add_load_balancer(lb)

    lb_creation_option = test_lib.lib_create_lb_listener_option('check vm http healthy','tcp',22,80)
    lbl = lb.create_listener(lb_creation_option)


    delete_policy = test_lib.lib_set_delete_policy('vm', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('volume', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('image', 'Direct')
#    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')
示例#15
0
 def create_vlan_device(self, req):
     cmd = jsonobject.loads(req[http.REQUEST_BODY])
     linux.create_vlan_eth(cmd.ethname, cmd.vlan, cmd.ip_, cmd.netmask_)
     rsp = testagent.AgentResponse()
     logger.debug('create vlan device: %s' % cmd.vlan)
     return jsonobject.dumps(rsp)
示例#16
0
def test():
    if test_lib.scenario_config == None or test_lib.scenario_file == None:
        test_util.test_fail('Suite Setup Fail without scenario')

    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)


    if test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-nfs.xml"], \
                                       ["scenario-config-storage-separate-nfs.xml"]):
        config_json = os.environ.get('configJsonSepStor')

    elif test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-nonmon-ceph.xml"], \
                                       ["scenario-config-storage-separate-ceph.xml"]):
        config_json = os.environ.get('configJsonNonMon')

    elif test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-flat-dhcp-nfs-sep-pub-man.xml"], \
                                         ["scenario-config-nfs-sep-man.xml", \
                                          "scenario-config-nfs-sep-pub.xml"]):
        config_json = os.environ.get('configJsonSepPub')

    elif test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-ceph-3-nets-sep.xml"], \
                                         ["scenario-config-ceph-sep-man.xml", \
                                          "scenario-config-ceph-sep-pub.xml", \
                                          "scenario-config-ceph-3-nets-sep.xml"]):
        config_json = os.environ.get('configJsonSepPub')

    elif test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-fusionstor-3-nets-sep.xml"], \
                                         ["scenario-config-fusionstor-3-nets-sep.xml"]):
        config_json = os.environ.get('configJson3Net')

    elif test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-flat-dhcp-nfs-mul-net-pubs.xml"], \
                                         ["scenario-config-nfs-sep-man.xml", \
                                          "scenario-config-nfs-sep-pub.xml"]):
        config_json = os.environ.get('configJsonAllOne')

    else:
        config_json = os.environ.get('configJson')

    ha_deploy_tool = os.environ.get('zstackHaInstaller')
    mn_img = os.environ.get('mnImage')
    test_stub.deploy_ha_env(test_lib.all_scenario_config,
                            test_lib.scenario_file, test_lib.deploy_config,
                            config_json, ha_deploy_tool, mn_img)

    #if os.path.basename(os.environ.get('WOODPECKER_SCENARIO_CONFIG_FILE')).strip() == "scenario-config-vpc-ceph-3-sites.xml":
    #    test_util.test_logger("@@@DEBUG->IS VPC CEPH@@@")
    #    old_mn_ip = os.environ['zstackHaVip']
    #    test_stub.auto_set_mn_ip(test_lib.scenario_file)
    #    cmd = 'sed -i "s/%s/%s/g" %s' %(old_mn_ip, os.environ['zstackHaVip'], EXTRA_SUITE_SETUP_SCRIPT)
    #    os.system(cmd)

    #node_operations.wait_for_management_server_start(600)
    test_stub.wrapper_of_wait_for_management_server_start(
        600, EXTRA_SUITE_SETUP_SCRIPT)
    test_util.test_logger("@@@DEBUG->suite_setup@@@ os\.environ\[\'ZSTACK_BUILT_IN_HTTP_SERVER_IP\'\]=%s; os\.environ\[\'zstackHaVip\'\]=%s"	\
                          %(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], os.environ['zstackHaVip']) )
    ssh.scp_file("/home/license-10host-10days-hp.txt",
                 "/home/license-10host-10days-hp.txt",
                 os.environ.get('zstackHaVip'), 'root', 'password')
    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_lib.lib_set_reserved_memory('8G')

    if test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-flat-dhcp-nfs-sep-pub-man.xml"], ["scenario-config-nfs-sep-pub.xml"]) or \
       test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-ceph-3-nets-sep.xml"], ["scenario-config-ceph-sep-pub.xml"]) or \
       test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-fusionstor-3-nets-sep.xml"], ["scenario-config-fusionstor-3-nets-sep.xml"]):
        add_ps_network_gateway_sys_tag()

    test_util.test_pass('Suite Setup Success')
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"
    public_l2_vlan = int(os.getenv('l2PublicVlan'))
    #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(nic_name, 10)
    linux.create_vlan_eth(nic_name, 11)
    linux.create_vlan_eth(nic_name, public_l2_vlan)

    #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 = nic_name
        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)
        cmd.vlan = public_l2_vlan
        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()
    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)

    delete_policy = test_lib.lib_set_delete_policy('vm', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('volume', 'Direct')
    delete_policy = test_lib.lib_set_delete_policy('image', 'Direct')
    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)

    bss = res_ops.query_resource(res_ops.BACKUP_STORAGE)
    bs = bss[0]
    test_util.test_pass('Suite Setup Success')
示例#18
0
def test():
    if test_lib.scenario_config == None or test_lib.scenario_file ==None:
        test_util.test_fail('Suite Setup Fail without scenario')

    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_stub.deploy_2ha(test_lib.all_scenario_config, test_lib.scenario_file)
    mn_ip1 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 0).ip_
    mn_ip2 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 1).ip_

    host_ip1 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 2).ip_
    test_stub.recover_vlan_in_host(host_ip1, test_lib.all_scenario_config, test_lib.deploy_config)

    test_stub.wrapper_of_wait_for_management_server_start(600, EXTRA_SUITE_SETUP_SCRIPT)
    test_util.test_logger("@@@DEBUG->suite_setup@@@ os\.environ\[\'ZSTACK_BUILT_IN_HTTP_SERVER_IP\'\]=%s; os\.environ\[\'zstackHaVip\'\]=%s"	\
                          %(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], os.environ['zstackHaVip']) )
    ssh.scp_file("/home/license-10host-10days-hp.txt", "/home/license-10host-10days-hp.txt", mn_ip1, 'root', 'password')
    ssh.scp_file("/home/license-10host-10days-hp.txt", "/home/license-10host-10days-hp.txt", mn_ip2, 'root', 'password')
    if os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
        os.system("bash %s %s" % (EXTRA_SUITE_SETUP_SCRIPT, mn_ip1))
        os.system("bash %s %s" % (EXTRA_SUITE_SETUP_SCRIPT, mn_ip2))

    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_))

    test_lib.lib_set_primary_storage_imagecache_gc_interval(1)
    #test_lib.lib_set_reserved_memory('1G')
    

    test_util.test_pass('Suite Setup Success')
示例#19
0
def test():
    if test_lib.scenario_config == None or test_lib.scenario_file ==None:
        test_util.test_fail('Suite Setup Fail without scenario')

    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_stub.deploy_2ha(test_lib.all_scenario_config, test_lib.scenario_file, test_lib.deploy_config)
    mn_ip1 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 0).ip_
    mn_ip2 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 1).ip_

    if not xmlobject.has_element(test_lib.deploy_config, 'backupStorages.miniBackupStorage'):
        host_ip1 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 2).ip_
        test_stub.recover_vlan_in_host(host_ip1, test_lib.all_scenario_config, test_lib.deploy_config)

    test_stub.wrapper_of_wait_for_management_server_start(600, EXTRA_SUITE_SETUP_SCRIPT)
    test_util.test_logger("@@@DEBUG->suite_setup@@@ os\.environ\[\'ZSTACK_BUILT_IN_HTTP_SERVER_IP\'\]=%s; os\.environ\[\'zstackHaVip\'\]=%s"	\
                          %(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], os.environ['zstackHaVip']) )
    ssh.scp_file("/home/license-10host-10days-hp.txt", "/home/license-10host-10days-hp.txt", mn_ip1, 'root', 'password')
    ssh.scp_file("/home/license-10host-10days-hp.txt", "/home/license-10host-10days-hp.txt", mn_ip2, 'root', 'password')
    if os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
        os.system("bash %s %s" % (EXTRA_SUITE_SETUP_SCRIPT, mn_ip1))
        os.system("bash %s %s" % (EXTRA_SUITE_SETUP_SCRIPT, mn_ip2))

    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_))

    test_lib.lib_set_primary_storage_imagecache_gc_interval(1)
    #test_lib.lib_set_reserved_memory('1G')

    if test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-local-ps.xml"], ["scenario-config-upgrade-3.1.1.xml"]):
        cmd = r"sed -i '$a\172.20.198.8 rsync.repo.zstack.io' /etc/hosts"
        ssh.execute(cmd, mn_ip1, "root", "password", False, 22)
        ssh.execute(cmd, mn_ip2, "root", "password", False, 22)

    test_util.test_pass('Suite Setup Success')
示例#20
0
def test():
    if os.environ.get('ZSTACK_SIMULATOR') == "yes":
        os.system('pkill -f ./test_rest_server.py')
        process = subprocess.Popen("./test_rest_server.py", cwd=os.environ.get('woodpecker_root_path')+'/dailytest/', universal_newlines=True, preexec_fn=os.setsid)
        test_lib.setup_plan.execute_plan_without_deploy_test_agent()
        deploy_operations.deploy_simulator_database(test_lib.deploy_config, test_lib.all_scenario_config, test_lib.scenario_file)
        deploy_operations.deploy_initial_database(test_lib.deploy_config, test_lib.all_scenario_config, test_lib.scenario_file)
    
        agent_url = CP_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                src_path = entity_body_json["srcPath"].split('/')[3].split('@')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+src_path).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = CREATE_SNAPSHOT_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                volume_uuid = entity_body_json["volumeUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+volume_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = UPLOAD_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                src_path = entity_body_json["srcPath"].split('/')[3].split('@')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+src_path).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = NFS_CREATE_TEMPLATE_FROM_VOLUME_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                src_path = entity_body_json["rootVolumePath"].split('vol-')[1].split('/')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+src_path).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = SMP_CREATE_TEMPLATE_FROM_VOLUME_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                src_path = entity_body_json["volumePath"].split('vol-')[1].split('/')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+src_path).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = NFS_COMMIT_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = SMP_COMMIT_BITS_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        
        agent_url = NFS_UPLOAD_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = SMP_UPLOAD_BITS_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = LOCAL_CREATE_TEMPLATE_FROM_VOLUME
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                volume_uuid = entity_body_json["volumePath"].split('vol-')[1].split('/')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+volume_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = LOCAL_COMMIT_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        
        agent_url = LOCAL_UPLOAD_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = KVM_TAKE_VOLUME_SNAPSHOT_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                volume_uuid = entity_body_json["volumeUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+volume_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = LOCAL_UPLOAD_BIT_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                src_path = entity_body_json["primaryStorageInstallPath"].split('image-')[1].split('/')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+src_path).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = NFS_UPLOAD_TO_SFTP_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                src_path = entity_body_json["primaryStorageInstallPath"].split('image-')[1].split('/')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+src_path).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = SMP_UPLOAD_BITS_TO_SFTP_BACKUPSTORAGE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                src_path = entity_body_json["primaryStorageInstallPath"].split('image-')[1].split('/')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+src_path).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = SBLK_CREATE_TEMPLATE_FROM_VOLUME_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                volume_uuid = entity_body_json["volumePath"].split('/')[3]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+volume_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = SBLK_COMMIT_BITS_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        
        agent_url = SBLK_UPLOAD_BITS_TO_IMAGESTORE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = CEPH_DOWNLOAD_IMAGE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = IMAGESTORE_IMPORT
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageuuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = SFTP_DOWNLOAD_IMAGE_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                image_uuid = entity_body_json["imageUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+image_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = KVM_MIGRATE_VM_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                vm_uuid = entity_body_json["vmUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+vm_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = GET_MD5_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                volume_uuid = entity_body_json["volumeUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+volume_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = CHECK_MD5_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                volume_uuid = entity_body_json["volumeUuid"]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+volume_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        
        agent_url = COPY_TO_REMOTE_BITS_PATH
        script = '''
        { entity -> 
        	slurper = new groovy.json.JsonSlurper();
        	entity_body_json = slurper.parseText(entity.body);
                volume_uuid = entity_body_json["paths"][0].split('vol-')[1].split('/')[0]
        	def get = new URL("http://127.0.0.1:8888/test/api/v1.0/store/"+volume_uuid).openConnection(); 
        	get.setRequestMethod("GET");
        	def getRC = get.getResponseCode();
        	if (!getRC.equals(200)) {
        		return;
        		//throw new Exception("shuang")
        	}; 
        	reply = get.getInputStream().getText();
                reply_json = slurper.parseText(reply);
                try {
        	        item = reply_json['result']
                	item_json = slurper.parseText(item);
        		action = item_json['%s']
                } catch(Exception ex) {
        		return
        	}
        	if (action == 1) {
        		sleep((24*60*60-60)*1000)
        	} else if (action == 2) {
        		sleep(360*1000)
        	}
        }
        ''' % (agent_url)
        deploy_operations.remove_simulator_agent_script(agent_url)
        deploy_operations.deploy_simulator_agent_script(agent_url, script)
        deploy_operations.install_mini_server()
    else:
        if test_lib.scenario_config == None or test_lib.scenario_file ==None:
            test_util.test_fail('Suite Setup Fail without scenario')
    
        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_stub.deploy_2ha(test_lib.all_scenario_config, test_lib.scenario_file, test_lib.deploy_config)
        mn_ip1 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 0).ip_
        mn_ip2 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 1).ip_
    
        if not xmlobject.has_element(test_lib.deploy_config, 'backupStorages.miniBackupStorage'):
            host_ip1 = test_stub.get_host_by_index_in_scenario_file(test_lib.all_scenario_config, test_lib.scenario_file, 2).ip_
            test_stub.recover_vlan_in_host(host_ip1, test_lib.all_scenario_config, test_lib.deploy_config)
    
        test_stub.wrapper_of_wait_for_management_server_start(600, EXTRA_SUITE_SETUP_SCRIPT)
        test_util.test_logger("@@@DEBUG->suite_setup@@@ os\.environ\[\'ZSTACK_BUILT_IN_HTTP_SERVER_IP\'\]=%s; os\.environ\[\'zstackHaVip\'\]=%s"    \
                              %(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], os.environ['zstackHaVip']) )
        ssh.scp_file("/home/license-10host-10days-hp.txt", "/home/license-10host-10days-hp.txt", mn_ip1, 'root', 'password')
        ssh.scp_file("/home/license-10host-10days-hp.txt", "/home/license-10host-10days-hp.txt", mn_ip2, 'root', 'password')
        if os.path.exists(EXTRA_SUITE_SETUP_SCRIPT):
            os.system("bash %s %s" % (EXTRA_SUITE_SETUP_SCRIPT, mn_ip1))
            os.system("bash %s %s" % (EXTRA_SUITE_SETUP_SCRIPT, mn_ip2))
    
        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_))
    
        test_lib.lib_set_primary_storage_imagecache_gc_interval(1)
        #test_lib.lib_set_reserved_memory('1G')
    
        if test_lib.lib_cur_cfg_is_a_and_b(["test-config-vyos-local-ps.xml"], ["scenario-config-upgrade-3.1.1.xml"]):
            cmd = r"sed -i '$a\172.20.198.8 rsync.repo.zstack.io' /etc/hosts"
            ssh.execute(cmd, mn_ip1, "root", "password", False, 22)
            ssh.execute(cmd, mn_ip2, "root", "password", False, 22)

    test_util.test_pass('Suite Setup Success')