本文整理汇总了Python中zstackwoodpecker.test_lib.lib_get_l3_by_name函数的典型用法代码示例。如果您正苦于以下问题:Python lib_get_l3_by_name函数的具体用法?Python lib_get_l3_by_name怎么用?Python lib_get_l3_by_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lib_get_l3_by_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
vr_uuid = vr.uuid
l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
#ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
#ps_uuid = ps.uuid
#ps_ops.change_primary_storage_state(ps_uuid, 'disable')
test_stub.disable_all_pss()
if not test_lib.lib_wait_target_up(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to runnning when PS change to disable state')
vm.set_state(vm_header.RUNNING)
vm.check()
vm.suspend()
vm.check()
#ps_ops.change_primary_storage_state(ps_uuid, 'enable')
test_stub.enable_all_pss()
host_ops.reconnect_host(host_uuid)
vm_ops.reconnect_vr(vr_uuid)
test_util.test_pass('PS disable mode Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:34,代码来源:test_disable_ps_suspend_vm.py
示例2: test
def test():
flavor = case_flavor[os.environ.get('CASE_FLAVOR')]
test_util.test_dsc("create vpc vrouter and attach vpc l3 to vpc")
for vpc_name in vpc_name_list:
vr_list.append(test_stub.create_vpc_vrouter(vpc_name))
for vr, l3_list in izip(vr_list, vpc_l3_list):
test_stub.attach_l3_to_vpc_vr(vr, l3_list)
for vpc1_l3 in vpc_l3_list[0]:
vpc1_l3_uuid.append(test_lib.lib_get_l3_by_name(vpc1_l3).uuid)
for vpc2_l3 in vpc_l3_list[1]:
vpc2_l3_uuid.append(test_lib.lib_get_l3_by_name(vpc2_l3).uuid)
vpc1_l3_uuid.append(test_lib.lib_get_l3_by_name(public_net).uuid)
vpc2_l3_uuid.append(test_lib.lib_get_l3_by_name(public_net).uuid)
test_util.test_dsc("disable snat before create ospf")
for vr in vr_list:
vpc_ops.set_vpc_vrouter_network_service_state(vr.inv.uuid, networkService='SNAT', state='disable')
test_util.test_dsc("create ospf")
vpc_ops.create_vrouter_ospf_area(areaId=ospf_area_id, areaType=ospf_area_type, areaAuth=area_auth_type, password=area_auth_password)
area_uuid = test_lib.lib_get_ospf_area_by_area_id(areaId=ospf_area_id).uuid
test_util.test_dsc("add vpc to ospf")
for vr in vr_list:
vr_uuid.append(vr.inv.uuid)
test_util.test_dsc("change router id")
for i in range(2):
vpc_ops.set_vrouter_router_id(vRouterUuid=vr_uuid[i], routerId=new_router_id[i])
test_util.test_dsc("get router id and check")
result = []
for vrouter_uuid in vr_uuid:
result.append(vpc_ops.get_vrouter_router_id(vRouterUuid=vrouter_uuid))
if result != new_router_id:
test_util.test_fail('change router id failed')
for vpc_l3 in vpc1_l3_uuid:
vpc_ops.add_vrouter_networks_to_ospf_area(vr_uuid[0], [vpc_l3], area_uuid)
for vpc_l3 in vpc2_l3_uuid:
vpc_ops.add_vrouter_networks_to_ospf_area(vr_uuid[1], [vpc_l3], area_uuid)
time.sleep(60)
test_util.test_dsc("check ospf neighbor state")
for vr in vr_uuid:
if vpc_ops.get_vrouter_ospf_neighbor(vr):
if 'Full' not in vpc_ops.get_vrouter_ospf_neighbor(vr)[0]['state']:
print vpc_ops.get_vrouter_ospf_neighbor(vr)[0]['state']
test_util.test_fail('cannot form ospf neighbor, test fail')
else:
test_util.test_fail('cannot form ospf neighbor, test fail')
test_lib.lib_error_cleanup(test_obj_dict)
test_stub.remove_all_vpc_vrouter()
test_stub.delete_all_ospf_area()
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:60,代码来源:test_vpc_ospf_change_router_id.py
示例3: test
def test():
test_util.test_dsc('''
Test Description:
Will create 1 VM with 3 l3 networks. 1 l3_network is not using VR; 1 l3_network is using novlan VR; 1 l3_network is using vlan VR.
Resource required:
Need support 3 VMs (1 test VM + 2 VR VMs) existing at the same time.
This test required a special image, which was configed with at least 3 enabled NICs (e.g. eth0, eth1, eth2).
''')
image_name = os.environ.get('imageName_net')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list = [l3_net_uuid]
l3_name = os.environ.get('l3VlanNetworkName3')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list.append(l3_net_uuid)
l3_name = os.environ.get('l3VlanNetworkName4')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list.append(l3_net_uuid)
vm = test_stub.create_vm(l3_net_list, image_uuid, '3_l3_vm')
test_obj_dict.add_vm(vm)
vm.check()
if len(vm.vm.vmNics) == 3:
test_util.test_logger("Find 3 expected Nics in new created VM.")
else:
test_util.test_fail("New create VM doesn't not have 3 Nics. It only have %s" % len(vm.get_vm().vmNics))
vm.destroy()
test_util.test_pass('Create 1 VM with 3 l3_network (1 vlan VR, 1 novlan VR and 1 no VR L3network) successfully.')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_3l3s_vm.py
示例4: test
def test():
image_name = os.environ.get('ipv6ImageName')
ipv4_net_uuid = test_lib.lib_get_l3_by_name(os.environ.get('l3PublicNetworkName')).uuid
ipv6_net_uuid = test_lib.lib_get_l3_by_name(os.environ.get('l3PublicNetworkName1')).uuid
print "ipv4_net_uuid is : %s , ipv6_net_uuid is : %s" %(ipv4_net_uuid, ipv6_net_uuid)
vm1 = test_stub.create_vm(l3_name = os.environ.get('l3PublicNetworkName'), vm_name = 'vm_1 IPv6 2 stack test', system_tags = ["dualStackNic::%s::%s" %(ipv4_net_uuid, ipv6_net_uuid)], image_name = image_name)
vm2 = test_stub.create_vm(l3_name = os.environ.get('l3PublicNetworkName'), vm_name = 'vm_2 IPv6 2 stack test', system_tags = ["dualStackNic::%s::%s" %(ipv4_net_uuid, ipv6_net_uuid)], image_name = image_name)
time.sleep(120) #waiting for vm bootup
ipv4 = None
ipv6 = None
vms = res_ops.query_resource(res_ops.VM_INSTANCE)
vm1_nic1 = vms[1].vmNics[0].usedIps[0].ip
vm1_nic2 = vms[1].vmNics[0].usedIps[1].ip
vm2_nic1 = vms[0].vmNics[0].usedIps[0].ip
vm2_nic2 = vms[0].vmNics[0].usedIps[1].ip
for ip in [vm1_nic1, vm1_nic2]:
if "172.20" in ip:
ipv4 = ip
for ip in [vm2_nic1, vm2_nic2]:
if "1000:2000" in ip:
ipv6 = ip
for ip in [vm2_nic1, vm2_nic2]:
if "172" in ip:
vm2_ipv4 = ip
print "vm1_nic1 : %s, vm1_nic2: %s, vm2_nic1 :%s,vm2_nic2 :%s, ipv4 :%s, ipv6 :%s." %(vm1_nic1, vm1_nic2, vm2_nic1, vm2_nic2, ipv4, ipv6)
cmd = "ping6 -c 4 %s" %(ipv6)
(retcode, output, erroutput) = ssh.execute(cmd, ipv4, "root", "password", True, 22)
cmd1 = "ping -c 4 %s" %(vm2_ipv4)
(retcode1, output1, erroutput1) = ssh.execute(cmd1, ipv4, "root", "password", True, 22)
print "retcode is: %s; output is : %s.; erroutput is: %s" %(retcode, output , erroutput)
print "retcode1 is: %s; output1 is : %s.; erroutput1 is: %s" %(retcode1, output1 , erroutput1)
if retcode != 0 and retcode1 != 0:
test_util.test_fail('Test Create IPv6 VM Failed.')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:35,代码来源:test_dualStackNic.py
示例5: test
def test():
test_util.test_dsc('Create test vm with EIP and check.')
vm = test_stub.create_vlan_vm(os.environ.get('l3VlanNetworkName1'))
test_obj_dict.add_vm(vm)
pri_l3_name = os.environ.get('l3VlanNetworkName1')
pri_l3_uuid = test_lib.lib_get_l3_by_name(pri_l3_name).uuid
pub_l3_name = os.environ.get('l3PublicNetworkName')
pub_l3_uuid = test_lib.lib_get_l3_by_name(pub_l3_name).uuid
vm_nic = vm.vm.vmNics[0]
vm_nic_uuid = vm_nic.uuid
vip = test_stub.create_vip('create_eip_test', pub_l3_uuid)
test_obj_dict.add_vip(vip)
eip = test_stub.create_eip('create eip test', vip_uuid=vip.get_vip().uuid, vnic_uuid=vm_nic_uuid, vm_obj=vm)
vip.attach_eip(eip)
vm.check()
if not test_lib.lib_check_directly_ping(vip.get_vip().ip):
test_util.test_fail('expected to be able to ping vip while it fail')
vm.destroy()
test_obj_dict.rm_vm(vm)
if test_lib.lib_check_directly_ping(vip.get_vip().ip):
test_util.test_fail('not expected to be able to ping vip while it succeed')
eip.delete()
vip.delete()
test_obj_dict.rm_vip(vip)
test_util.test_pass('Create EIP for VM Success')
开发者ID:TinaL3,项目名称:zstack-woodpecker,代码行数:32,代码来源:test_create_eip_vm.py
示例6: test
def test():
test_util.test_dsc('Create test vm with EIP and check.')
vm = test_stub.create_vlan_vm(os.environ.get('l3VlanNetworkName1'))
test_obj_dict.add_vm(vm)
l3_name = os.environ.get('l3VlanNetworkName1')
vr1_l3_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
vrs = test_lib.lib_find_vr_by_l3_uuid(vr1_l3_uuid)
temp_vm1 = None
if not vrs:
#create temp_vm1 for getting vlan1's vr for test pf_vm portforwarding
temp_vm1 = test_stub.create_vlan_vm()
test_obj_dict.add_vm(temp_vm1)
vr1 = test_lib.lib_find_vr_by_vm(temp_vm1.vm)[0]
else:
vr1 = vrs[0]
l3_name = os.environ.get('l3NoVlanNetworkName1')
vr2_l3_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
vrs = test_lib.lib_find_vr_by_l3_uuid(vr2_l3_uuid)
temp_vm2 = None
if not vrs:
#create temp_vm2 for getting novlan's vr for test pf_vm portforwarding
temp_vm2 = test_stub.create_user_vlan_vm()
test_obj_dict.add_vm(temp_vm2)
vr2 = test_lib.lib_find_vr_by_vm(temp_vm2.vm)[0]
else:
vr2 = vrs[0]
#we do not need temp_vm1 and temp_vm2, since we just use their VRs.
if temp_vm1:
temp_vm1.destroy()
test_obj_dict.rm_vm(temp_vm1)
if temp_vm2:
temp_vm2.destroy()
test_obj_dict.rm_vm(temp_vm2)
vm_nic = vm.vm.vmNics[0]
vm_nic_uuid = vm_nic.uuid
pri_l3_uuid = vm_nic.l3NetworkUuid
vr = test_lib.lib_find_vr_by_l3_uuid(pri_l3_uuid)[0]
vr_pub_nic = test_lib.lib_find_vr_pub_nic(vr)
l3_uuid = vr_pub_nic.l3NetworkUuid
vip = test_stub.create_vip('create_eip_test', l3_uuid)
test_obj_dict.add_vip(vip)
eip = test_stub.create_eip('create eip test', vip_uuid=vip.get_vip().uuid, vnic_uuid=vm_nic_uuid, vm_obj=vm)
vip.attach_eip(eip)
vm.check()
vip.check()
vm.destroy()
test_obj_dict.rm_vm(vm)
vip.check()
eip.delete()
vip.delete()
test_obj_dict.rm_vip(vip)
test_util.test_pass('Create EIP for VM Success')
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:58,代码来源:test_create_eip_vm.py
示例7: test
def test():
test_util.test_dsc('Create test vm with EIP and check.')
vm1 = test_stub.create_vlan_vm(os.environ.get('l3VlanNetworkName1'))
test_obj_dict.add_vm(vm1)
vm2 = test_stub.create_vlan_vm(os.environ.get('l3VlanNetworkName1'))
test_obj_dict.add_vm(vm2)
pri_l3_name = os.environ.get('l3VlanNetworkName1')
pri_l3_uuid = test_lib.lib_get_l3_by_name(pri_l3_name).uuid
pub_l3_name = os.environ.get('l3PublicNetworkName')
pub_l3_uuid = test_lib.lib_get_l3_by_name(pub_l3_name).uuid
vm1_nic = vm1.vm.vmNics[0]
vm1_nic_uuid = vm1_nic.uuid
vm2_nic = vm2.vm.vmNics[0]
vm2_nic_uuid = vm2_nic.uuid
[test_stub.run_command_in_vm(vm.get_vm(), 'iptables -F') for vm in (vm1, vm2)]
vip = test_stub.create_vip('create_eip_test', pub_l3_uuid)
vip_ip = vip.get_vip().ip
test_obj_dict.add_vip(vip)
eip = test_stub.create_eip('create eip test', vip_uuid=vip.get_vip().uuid, vnic_uuid=vm1_nic_uuid, vm_obj=vm1)
vip.attach_eip(eip)
vm1.check()
pri_l3_gateway = os.environ.get('vlanIpRangeGateway1')
cmd1 = "ping -c 5 %s" % (vip_ip)
(retcode1, output1, erroutput1) = ssh.execute(cmd1, ext_host_ip, "root", ext_host_pwd, True, 22)
print "retcode1 is: %s; output1 is : %s.; erroutput1 is: %s" % (retcode1, output1, erroutput1)
cmd2 = "arp -n | grep -w %s" % (pri_l3_gateway)
if test_lib.lib_execute_command_in_flat_vm(vm2.vm, cmd2, l3_uuid=pri_l3_uuid):
vm1.destroy()
vm2.destroy()
vm1.expunge()
vm2.expunge()
eip.delete()
vip.delete()
test_util.test_fail('Gateway leak to other vm, test failed.')
vm1.destroy()
vm2.destroy()
vm1.expunge()
vm2.expunge()
eip.delete()
vip.delete()
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:53,代码来源:test_eip_gateway_leak.py
示例8: test
def test():
test_util.test_dsc('''
Test Description:
This case is test for detach a NIC from a stop or a running windows VM
Will create 1 test windows VM with 1 NIC firstly.
Then attach a new NIC to Stopped VM with different L3 Network.
Then Stop the VM.
Then detach the new NIC
Then start the VM and check the network.
Then attach a new NIC again
Then detach the NIC
''')
image_name = os.environ.get('imageName_windows')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list = [l3_net_uuid]
l3_name2 = os.environ.get('l3VlanNetworkName5')
l3_net_uuid2 = test_lib.lib_get_l3_by_name(l3_name2).uuid
vm_instance_offering = test_lib.lib_create_instance_offering(cpuNum = 2,
memorySize = 2048 * 1024 * 1024)
test_obj_dict.add_instance_offering(vm_instance_offering)
vm = test_stub.create_vm(l3_net_list, image_uuid, 'windows2012_vm', \
default_l3_uuid = l3_net_uuid, instance_offering_uuid = vm_instance_offering.uuid)
test_obj_dict.add_vm(vm)
vm.add_nic(l3_net_uuid2)
attached_nic = test_lib.lib_get_vm_last_nic(vm.get_vm())
if l3_net_uuid2 != attached_nic.l3NetworkUuid:
test_util.test_fail("After attach a nic, VM:%s last nic is not belong l3: %s" % (vm.get_vm().uuid, l3_net_uuid2))
vm.stop()
time.sleep(5)
vm.remove_nic(attached_nic.uuid)
time.sleep(5)
vm.start()
time.sleep(50)
vm.add_nic(l3_net_uuid2)
attached_nic = test_lib.lib_get_vm_last_nic(vm.get_vm())
if l3_net_uuid2 != attached_nic.l3NetworkUuid:
test_util.test_fail("After attach a nic again, VM:%s last nic is not belong l3: %s" % (vm.get_vm().uuid, l3_net_uuid2))
time.sleep(5)
vm.remove_nic(attached_nic.uuid)
time.sleep(5)
vm.destroy()
test_util.test_pass('Test Attach Nic with VM reboot action successfully.')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:52,代码来源:test_windows_detach_nic_stop_run_vm.py
示例9: test
def test():
test_util.test_dsc('''Will mainly doing random test for all kinds of snapshot operations. VM, Volume and Image operations will also be tested. If reach 1 hour successful running condition, testing will success and quit. SG actions, and VIP actions are removed in this robot test.
VM resources: a special Utility vm is required to do volume attach/detach operation.
''')
target_running_vm = 4
public_l3 = test_lib.lib_get_l3_by_name(os.environ.get('l3PublicNetworkName'))
vm_create_option = test_util.VmOption()
#image has to use virtual router image, as it needs to do port checking
vm_create_option.set_image_uuid(test_lib.lib_get_image_by_name(img_name=os.environ.get('imageName_net')).uuid)
utility_vm_create_option = test_util.VmOption()
utility_vm_create_option.set_image_uuid(test_lib.lib_get_image_by_name(img_name=os.environ.get('imageName_net')).uuid)
l3_uuid = test_lib.lib_get_l3_by_name(os.environ.get('l3VlanNetworkName1')).uuid
utility_vm_create_option.set_l3_uuids([l3_uuid])
priority_actions = test_state.TestAction.snapshot_actions * 4
utility_vm = test_lib.lib_create_vm(utility_vm_create_option)
test_dict.add_utility_vm(utility_vm)
if os.environ.get('ZSTACK_SIMULATOR') != "yes":
utility_vm.check()
test_util.test_dsc('Random Test Begin. Test target: 4 coexisting running VM (not include VR and SG target test VMs.).')
robot_test_obj = test_util.Robot_Test_Object()
robot_test_obj.set_test_dict(test_dict)
robot_test_obj.set_vm_creation_option(vm_create_option)
priority_action_obj = action_select.ActionPriority()
priority_action_obj.add_priority_action_list(priority_actions)
robot_test_obj.set_priority_actions(priority_action_obj)
robot_test_obj.set_exclusive_actions_list(\
test_state.TestAction.vip_actions + \
test_state.TestAction.image_actions + \
test_state.TestAction.sg_actions + \
[ test_state.TestAction.create_volume ])
robot_test_obj.set_public_l3(public_l3)
robot_test_obj.set_utility_vm(utility_vm)
robot_test_obj.set_random_type(action_select.fair_strategy)
rounds = 1
current_time = time.time()
timeout_time = current_time + 3600
while time.time() <= timeout_time:
test_util.test_dsc('New round %s starts: random operation pickup.' % rounds)
test_lib.lib_vm_random_operation(robot_test_obj)
test_util.test_dsc('===============Round %s finished. Begin status checking.================' % rounds)
rounds += 1
test_lib.lib_robot_status_check(test_dict)
test_util.test_dsc('Reach test pass exit criterial: 1 hour.')
test_lib.lib_robot_cleanup(test_dict)
test_util.test_pass('Snapshots Robot Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:52,代码来源:test_scsi_volume_snapshot_robot_1_hour.py
示例10: test
def test():
global l2_net_uuid
global cluster_uuid
global vm
cluster1 = res_ops.get_resource(res_ops.CLUSTER)[0]
cluster2 = res_ops.get_resource(res_ops.CLUSTER)[1]
vm_creation_option = test_util.VmOption()
image_name = os.environ.get('imageName_s')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l2_net_uuid = test_lib.lib_get_l3_by_name(l3_name).l2NetworkUuid
l2_net_type = res_ops.get_resource(res_ops.L2_NETWORK, uuid=l2_net_uuid)[0].type
test_util.test_logger("[email protected]@:%s" %(l2_net_type))
if l2_net_type == "VxlanNetwork":
test_util.test_skip("Vxlan network not support detach l2 network, therefore, skip the test")
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
vm_creation_option.set_l3_uuids([l3_net_uuid])
vm_creation_option.set_image_uuid(image_uuid)
vm_creation_option.set_cluster_uuid(cluster1.uuid)
vm_creation_option.set_instance_offering_uuid(instance_offering_uuid)
vm_creation_option.set_name('multicluster_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
vm2 = test_vm_header.ZstackTestVm()
vm_creation_option.set_cluster_uuid(cluster2.uuid)
vm2.set_creation_option(vm_creation_option)
vm2.create()
vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
if len(vrs) == 0:
test_util.test_skip("skip the test for non vr")
vr = vrs[0]
cluster_uuid = vr.clusterUuid
net_ops.detach_l2(l2_net_uuid, cluster_uuid)
vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
if len(vrs) == 0:
test_util.test_skip("skip the test for non vr")
vr = vrs[0]
if vr.clusterUuid == cluster_uuid:
test_util.test_logger('vr is expected to migrate to another cluster')
vm.destroy()
vm2.destroy()
net_ops.attach_l2(l2_net_uuid, cluster_uuid)
test_util.test_pass('Create detach l2 from clsuter vr migrate Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:50,代码来源:test_detach_l2_vr.py
示例11: test
def test():
test_util.test_dsc('''
Will doing random test for VIP operations, including VIP create/delete, PF create/attach/detach/remove, EIP create/attach/detach/remove. VM operations will also be tested. If reach max 4 coexisting running vm, testing will success and quit. SG actions, Volume actions and Image actions are removed in this robot test.
VM resources: VIP testing needs at least 3 VRs are running.
''')
target_running_vm = 4
public_l3 = test_lib.lib_get_l3_by_name(os.environ.get('l3PublicNetworkName'))
vm_create_option = test_util.VmOption()
#image has to use virtual router image, as it needs to do port checking
vm_create_option.set_image_uuid(test_lib.lib_get_image_by_name(img_name=os.environ.get('imageName_net')).uuid)
priority_actions = test_state.TestAction.snapshot_actions * 4
utility_vm_create_option = test_util.VmOption()
utility_vm_create_option.set_image_uuid(test_lib.lib_get_image_by_name(img_name=os.environ.get('imageName_net')).uuid)
l3_uuid = test_lib.lib_get_l3_by_name(os.environ.get('l3VlanNetworkName1')).uuid
utility_vm_create_option.set_l3_uuids([l3_uuid])
utility_vm = test_lib.lib_create_vm(utility_vm_create_option)
test_dict.add_utility_vm(utility_vm)
if os.environ.get('ZSTACK_SIMULATOR') != "yes":
utility_vm.check()
test_util.test_dsc('Random Test Begin. Test target: 4 coexisting running VM (not include VR and SG target test VMs.).')
robot_test_obj = test_util.Robot_Test_Object()
robot_test_obj.set_test_dict(test_dict)
robot_test_obj.set_vm_creation_option(vm_create_option)
priority_action_obj = action_select.ActionPriority()
priority_action_obj.add_priority_action_list(priority_actions)
robot_test_obj.set_priority_actions(priority_action_obj)
robot_test_obj.set_exclusive_actions_list(\
test_state.TestAction.vip_actions + \
test_state.TestAction.image_actions + \
test_state.TestAction.sg_actions + \
[test_state.TestAction.create_volume])
robot_test_obj.set_public_l3(public_l3)
robot_test_obj.set_utility_vm(utility_vm)
rounds = 1
while len(test_dict.get_vm_list(vm_header.RUNNING)) < target_running_vm:
test_util.test_dsc('New round %s starts: random operation pickup.' % rounds)
test_lib.lib_vm_random_operation(robot_test_obj)
test_util.test_dsc('===============Round %s finished. Begin status checking.================' % rounds)
rounds += 1
test_lib.lib_robot_status_check(test_dict)
test_util.test_dsc('Reach test pass exit criterial.')
test_lib.lib_robot_cleanup(test_dict)
test_util.test_pass('Snapshots Robot Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:49,代码来源:test_scsi_volume_4vm_snapshot_robot.py
示例12: test
def test():
test_util.test_dsc('''
Test Description:
Will create 1 test VM with 1 NIC firstly.
Then will attach a new NIC to VM with different L3 Network.
''')
image_name = os.environ.get('imageName_net')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list = [l3_net_uuid]
l3_name = os.environ.get('l3VlanNetworkName3')
l3_net_uuid2 = test_lib.lib_get_l3_by_name(l3_name).uuid
vm = test_stub.create_vm(l3_net_list, image_uuid, 'attach_nic_vm', \
default_l3_uuid = l3_net_uuid)
test_obj_dict.add_vm(vm)
#vm.check()
#change static IP need to stop VM firstly.
vm.stop()
vm.add_nic(l3_net_uuid2)
ip_address2 = net_ops.get_free_ip(l3_net_uuid2)[0].ip
static_ip_system_tag2 = test_lib.lib_create_vm_static_ip_tag(\
l3_net_uuid2, \
ip_address2)
tag_ops.create_system_tag('VmInstanceVO', vm.get_vm().uuid, \
static_ip_system_tag2)
vm.start()
attached_nic = test_lib.lib_get_vm_last_nic(vm.get_vm())
if l3_net_uuid2 != attached_nic.l3NetworkUuid:
test_util.test_fail("After attach a nic, VM:%s last nic is not belong l3: %s" % (vm.get_vm().uuid, l3_net_uuid2))
test_lib.lib_restart_vm_network(vm.get_vm())
if attached_nic.ip != ip_address2:
test_util.test_fail('new added NIC ip address:%s is not static ip: %s' \
% (attached_nic.ip, ip_address2))
vm.check()
vm.remove_nic(attached_nic.uuid)
attached_nic = test_lib.lib_get_vm_last_nic(vm.get_vm())
if l3_net_uuid != attached_nic.l3NetworkUuid:
test_util.test_fail("After detached NIC, VM:%s only nic is not belong l3: %s" % (vm.get_vm().uuid, l3_net_uuid2))
vm.destroy()
test_util.test_pass('Test Attach Nic to VM successfully.')
开发者ID:lstfyt,项目名称:zstack-woodpecker,代码行数:49,代码来源:test_attach_nic_with_static_ip.py
示例13: test
def test():
image_name = os.environ.get('imageName')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_uuid_list = [l3_net_uuid]
vm_creation_option = test_util.VmOption()
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
vm_name = 'parallel_vm-'
vm_creation_option.set_instance_offering_uuid(instance_offering_uuid)
vm_creation_option.set_l3_uuids(l3_uuid_list)
vm_creation_option.set_image_uuid(image_uuid)
#vm_creation_option.set_data_disk_uuids(disk_offering_uuids)
for i in range(parallel_num):
i = i + 1
vm_creation_option.set_name(vm_name + str(i))
vm = zstack_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
test_obj_dict.add_vm(vm)
#vm.destroy()
test_util.test_pass('Parallelly Create 10 VM successfully')
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:25,代码来源:test_poc_10_vm_parallel.py
示例14: test
def test():
global default_l3_mtu
test_util.test_dsc('Create test vm and check. VR has DNS SNAT EIP PF and DHCP services')
l3_name = os.environ.get('l3PublicNetworkName')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
default_l3_mtu = net_ops.get_l3_mtu(l3_net_uuid)
vm = test_stub.create_vlan_vm(l3_name)
test_obj_dict.add_vm(vm)
vm.check()
script_file = tempfile.NamedTemporaryFile(delete=False)
script_file.write('tracepath -n yyk.net | tail -1 | grep "pmtu %s"' % (default_l3_mtu))
script_file.close()
if not test_lib.lib_execute_shell_script_in_vm(vm.get_vm(), script_file.name):
test_util.test_fail("fail to check mtu in [vm:] %s" % (vm.get_vm().uuid))
os.unlink(script_file.name)
net_ops.set_l3_mtu(l3_net_uuid, 1200)
vm.reboot()
vm.check()
script_file = tempfile.NamedTemporaryFile(delete=False)
script_file.write('tracepath -n yyk.net | tail -1 | grep "pmtu 1200"')
script_file.close()
if not test_lib.lib_execute_shell_script_in_vm(vm.get_vm(), script_file.name):
test_util.test_fail("fail to check mtu in [vm:] %s" % (vm.get_vm().uuid))
os.unlink(script_file.name)
vm.destroy()
test_util.test_pass('Create VirtualRouter VM DNS DHCP SANT EIP PF Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:29,代码来源:test_update_l3_mtu.py
示例15: test
def test():
global session_uuid
session_uuid = acc_ops.login_as_admin()
l3_1_name = os.environ.get('l3VlanNetworkName1')
l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
#create VRs.
vrs = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)
if not vrs:
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
vm.destroy()
vr1 = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
else:
vr1 = vrs[0]
vm_ops.stop_vm(vr1.uuid)
if test_lib.lib_get_ha_enable() != 'true' or vr1.applianceVmType != "vrouter":
vm_ops.start_vm(vr1.uuid)
vr1_mgmt_ip = test_lib.lib_find_vr_mgmt_ip(vr1)
if not test_lib.lib_wait_target_up(vr1_mgmt_ip, '7272', 120):
test_util.test_fail('vr: %s is not startup in 120 seconds. Fail to reboot it. ' % vr1.uuid)
timeout = time.time() + 60
while time.time() < timeout:
cond = res_ops.gen_query_conditions('uuid', '=', vr1.uuid)
vms = res_ops.query_resource(res_ops.VM_INSTANCE, cond)
if vms[0].status == 'Connected':
test_util.test_pass('Test Reconnect VR VM start VRs success')
time.sleep(1)
test_util.test_fail('VR VM: %s is not connected within 60 seconds' % vr1.uuid)
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:32,代码来源:test_stop_start_vr.py
示例16: test
def test():
test_util.test_dsc('Test VM online change instance offering')
image_name = os.environ.get('imageName_net')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list = [l3_net_uuid]
vm = test_stub.create_vm(l3_net_list, image_uuid, 'online_chg_offering_vm', system_tags=['instanceOfferingOnlinechange::true'])
test_obj_dict.add_vm(vm)
vm.check()
cpuNum = 2
memorySize = 666 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
new_offering2 = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering2)
new_offering_uuid2 = new_offering2.uuid
vm.change_instance_offering(new_offering_uuid)
vm.change_instance_offering(new_offering_uuid2)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:32,代码来源:test_chg_instance_offering_online3.py
示例17: test
def test():
image_name = os.environ.get('imageName_net')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_uuid_list = [l3_net_uuid]
vm_creation_option = test_util.VmOption()
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
times = 1
vm_name = '24hr_vm-'
vm_creation_option.set_instance_offering_uuid(instance_offering_uuid)
vm_creation_option.set_l3_uuids(l3_uuid_list)
vm_creation_option.set_image_uuid(image_uuid)
#vm_creation_option.set_data_disk_uuids(disk_offering_uuids)
current_time = time.time()
end_time = current_time + duration
while current_time < end_time:
times = times + 1
vm_creation_option.set_name(vm_name + str(times))
vm = zstack_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
time.sleep(5)
vm.destroy()
test_util.test_pass('Keep create/destroy %s VMs in 24 hrs pass' % times)
开发者ID:KevinDavidMitnick,项目名称:zstack-woodpecker,代码行数:27,代码来源:test_poc_24hr_create_destroy.py
示例18: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
allow_ps_list = [inventory.CEPH_PRIMARY_STORAGE_TYPE, "SharedBlock"]
test_lib.skip_test_when_ps_type_not_in_list(allow_ps_list)
test_util.test_dsc('Create test vm and check')
bs_cond = res_ops.gen_query_conditions("status", '=', "Connected")
bss = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, bs_cond, \
None)
if not bss:
test_util.test_skip("not find available backup storage. Skip test")
test_lib.lib_set_delete_policy('vm', 'Delay')
test_lib.lib_set_delete_policy('volume', 'Delay')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
vr_uuid = vr.uuid
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('rootDiskOfferingName'))
volume_creation_option = test_util.VolumeOption()
volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)
volume_creation_option.set_system_tags(['ephemeral::shareable', 'capability::virtio-scsi'])
volume = test_stub.create_volume(volume_creation_option)
test_obj_dict.add_volume(volume)
volume.check()
volume.attach(vm)
#ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
#ps_uuid = ps.uuid
#ps_ops.change_primary_storage_state(ps_uuid, 'disable')
test_stub.disable_all_pss()
if not test_lib.lib_wait_target_up(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to running when PS change to disable state')
vm.set_state(vm_header.RUNNING)
vm.check()
volume.delete()
volume.check()
volume.expunge()
volume.check()
#ps_ops.change_primary_storage_state(ps_uuid, 'enable')
test_stub.enable_all_pss()
host_ops.reconnect_host(host_uuid)
vm_ops.reconnect_vr(vr_uuid)
vm.destroy()
test_lib.lib_set_delete_policy('vm', 'Direct')
test_lib.lib_set_delete_policy('volume', 'Direct')
test_util.test_pass('Delete volume under PS disable mode Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:60,代码来源:test_disable_ps_expunge_attached_share_vol.py
示例19: test
def test():
if "test-config-vpc-dns.xml" != os.path.basename(os.environ.get('WOODPECKER_TEST_CONFIG_FILE')).strip():
test_util.test_skip('Skip test on test config except test-config-vpc-dns.xml')
test_util.test_dsc("1. create vpc vrouter")
vr = test_stub.create_vpc_vrouter(vpc_vr_name)
vr_uuid = vr.inv.uuid
vpc_l3_uuid = test_lib.lib_get_l3_by_name(vpc_l3_name).uuid
test_util.test_dsc("2. attach vpc network to vpc router")
test_stub.attach_l3_to_vpc_vr_by_uuid(vr, vpc_l3_uuid)
test_util.test_dsc("3. add dns to vpc network and vpc router")
for dns in l3_dns_list:
vpcdns_ops.add_dns_to_l3_network(vpc_l3_uuid, dns)
vpcdns_ops.add_dns_to_vpc_router(vr_uuid, default_dns)
test_util.test_dsc("4. get vpc dns list and check")
vpc_dns_info = test_stub.query_vpc_vrouter(vpc_vr_name).inv.dns
for vpc_dns in vpc_dns_info:
vpc_dns_list_end.append(vpc_dns['dns'])
if vpc_dns_list_end != vpc_dns_list_begin:
test_util.test_fail("add dns to vpc network take effect on vpc router, not expected.")
else:
for dns in l3_dns_list:
vpcdns_ops.remove_dns_from_l3_network(vpc_l3_uuid, dns)
test_util.test_pass("add dns to vpc network take no effect on vpc router, expected result.")
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:30,代码来源:add_dns_to_vpc_network.py
示例20: test
def test():
global vm, host3_uuid
if test_lib.lib_get_ha_enable() != 'true':
test_util.test_skip("vm ha not enabled. Skip test")
conf_ops.change_global_config('ha', 'allow.slibing.cross.clusters', 'true')
vm_creation_option = test_util.VmOption()
image_name = os.environ.get('imageName_s')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
#l3_name = os.environ.get('l3NoVlanNetworkName1')
#l3_name = os.environ.get('l3VlanNetworkName1')
l3_name = os.environ.get('l3PublicNetworkName')
host3_name = os.environ.get('hostName3')
host4_name = os.environ.get('hostName4')
conditions1 = res_ops.gen_query_conditions('name', '=', host3_name)
host3_uuid = res_ops.query_resource(res_ops.HOST, conditions1)[0].uuid
host3_ip = res_ops.query_resource(res_ops.HOST, conditions1)[0].managementIp
conditions2 = res_ops.gen_query_conditions('name', '=', host4_name)
host4_uuid = res_ops.query_resource(res_ops.HOST, conditions2)[0].uuid
host4_ip = res_ops.query_resource(res_ops.HOST, conditions2)[0].managementIp
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
vm_creation_option.set_l3_uuids([l3_net_uuid])
vm_creation_option.set_image_uuid(image_uuid)
vm_creation_option.set_instance_offering_uuid(instance_offering_uuid)
vm_creation_option.set_name('multihost_basic_vm')
vm_creation_option.set_host_uuid(host3_uuid)
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
time.sleep(30)
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
time.sleep(5)
vm.check()
ssh_cmd1 = 'ssh -oStrictHostKeyChecking=no -oCheckHostIP=no -oUserKnownHostsFile=/dev/null %s' % host3_ip
cmd = '%s "poweroff" ' % ssh_cmd1
process_result = test_stub.execute_shell_in_process(cmd, tmp_file)
time.sleep(360)
host3_status = res_ops.query_resource(res_ops.HOST, conditions1)[0].status
if host3_status == "Disconnected":
conditions3 = res_ops.gen_query_conditions('uuid', '=', vm.vm.uuid)
vm_status = res_ops.query_resource(res_ops.VM_INSTANCE, conditions3)[0].state
vm_host_uuid = res_ops.query
|
请发表评论