本文整理汇总了Python中pyvcloud.system_test_framework.environment.Environment.get_test_vdc方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_test_vdc方法的具体用法?Python Environment.get_test_vdc怎么用?Python Environment.get_test_vdc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.system_test_framework.environment.Environment
的用法示例。
在下文中一共展示了Environment.get_test_vdc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __convert_to_subinterface
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def __convert_to_subinterface(self, client):
vdc = Environment.get_test_vdc(client)
org_vdc_routed_nw = vdc.get_routed_orgvdc_network(
TestNetwork._routed_org_vdc_network_name)
vdc_network = VdcNetwork(client, resource=org_vdc_routed_nw)
result = vdc_network.convert_to_sub_interface()
task = TestNetwork._client.get_task_monitor().wait_for_success(
task=result)
self.assertEqual(task.get('status'), TaskStatus.SUCCESS.value)
# Verify
vdc_network.reload_admin()
reloaded_vdc_network = vdc_network.admin_resource
self.assertTrue(reloaded_vdc_network.Configuration.SubInterface)
# Revert to Internal Interface
result = vdc_network.convert_to_internal_interface()
task = TestNetwork._client.get_task_monitor().wait_for_success(
task=result)
self.assertEqual(task.get('status'), TaskStatus.SUCCESS.value)
# Verify
vdc_network.reload_admin()
reloaded_vdc_network = vdc_network.admin_resource
self.assertFalse(reloaded_vdc_network.Configuration.SubInterface)
示例2: test_0010_vm_setup
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0010_vm_setup(self):
"""Setup the vms required for the other tests in this module.
Create a vApp with just one vm as per the configuration stated above.
This test passes if the vApp and vm hrefs are not None.
"""
logger = Environment.get_default_logger()
TestPVDC._org_client = Environment.get_client_in_default_org(
TestPVDC._test_runner_role)
vdc = Environment.get_test_vdc(TestPVDC._org_client)
logger.debug('Creating vApp ' + TestPVDC._test_vapp_name + '.')
TestPVDC._test_vapp_href = create_customized_vapp_from_template(
client=TestPVDC._org_client,
vdc=vdc,
name=TestPVDC._test_vapp_name,
catalog_name=Environment.get_default_catalog_name(),
template_name=Environment.get_default_template_name(),
memory_size=TestPVDC._test_vapp_first_vm_memory_size,
num_cpu=TestPVDC._test_vapp_first_vm_num_cpu,
disk_size=TestPVDC._test_vapp_first_vm_first_disk_size,
vm_name=TestPVDC._test_vapp_first_vm_name,
nw_adapter_type=TestPVDC._test_vapp_first_vm_network_adapter_type)
self.assertIsNotNone(TestPVDC._test_vapp_href)
vapp = VApp(TestPVDC._org_client, href=TestPVDC._test_vapp_href)
vm_resource = vapp.get_vm(TestPVDC._test_vapp_first_vm_name)
TestPVDC._test_vapp_first_vm_href = vm_resource.get('href')
self.assertIsNotNone(TestPVDC._test_vapp_first_vm_href)
示例3: test_1000_delete_routed_orgvdc_networks
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_1000_delete_routed_orgvdc_networks(self):
vdc = Environment.get_test_vdc(TestNetwork._client)
result = vdc.delete_routed_orgvdc_network(
name=TestNetwork._routed_org_vdc_network_name, force=True)
task = TestNetwork._client.get_task_monitor().wait_for_success(
task=result)
self.assertEqual(task.get('status'), TaskStatus.SUCCESS.value)
示例4: test_0010_get_vapp
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0010_get_vapp(self):
"""Test the method vdc.get_vapp().
This test passes if the expected vApp can be successfully retrieved by
name.
"""
vdc = Environment.get_test_vdc(TestVApp._client)
vapp_resource = vdc.get_vapp(TestVApp._customized_vapp_name)
self.assertIsNotNone(vapp_resource)
示例5: test_0070_get_orgvdc_network_admin_href_as_non_admin_user
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0070_get_orgvdc_network_admin_href_as_non_admin_user(self):
"""Test the method vdc.get_orgvdc_network_admin_href_by_name().
This test passes if the href of the network created during setup is
retrieved successfully without any errors.
"""
vdc = Environment.get_test_vdc(TestNetwork._vapp_author_client)
href = vdc.get_orgvdc_network_admin_href_by_name(
TestNetwork._isolated_orgvdc_network_name)
self.assertIsNotNone(href)
示例6: test_9998_teardown
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_9998_teardown(self):
"""Test the method vdc.delete_vapp().
Invoke the method for all the vApps created by setup.
This test passes if all the tasks for deleting the vApps succeed.
"""
vdc = Environment.get_test_vdc(TestVappDhcp._client)
task = vdc.delete_vapp(name=TestVappDhcp._vapp_name, force=True)
result = TestVappDhcp._client.get_task_monitor().wait_for_success(task)
self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
示例7: test_0090_list_routed_vdc_network_allocated_ip
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0090_list_routed_vdc_network_allocated_ip(self):
vdc = Environment.get_test_vdc(TestNetwork._client)
org_vdc_routed_nw = vdc.get_routed_orgvdc_network(
TestNetwork._routed_org_vdc_network_name)
vdc_network = VdcNetwork(
TestNetwork._client, resource=org_vdc_routed_nw)
allocated_ip_addresses = vdc_network.list_allocated_ip_address()
self.assertEqual(len(allocated_ip_addresses), 1)
ip_address = TestNetwork._routed_orgvdc_network_gateway_ip.split(
'/')[0]
self.assertEqual(allocated_ip_addresses[0]['IP Address'], ip_address)
示例8: test_1000_teardown
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_1000_teardown(self):
"""Test the method System.delete_gateway().
Invoke the method for the gateway created by setup.
This test passes if no errors are generated while deleting the gateway.
"""
vdc = Environment.get_test_vdc(TestGateway._client)
task = vdc.delete_gateway(TestGateway._name)
result = TestGateway._client.get_task_monitor().wait_for_success(
task=task)
self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
示例9: test_0020_get_isolated_orgvdc_network
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0020_get_isolated_orgvdc_network(self):
"""Test the method vdc.get_isolated_orgvdc_network().
Retrieve the isolated orgvdc network created during setup.
This test passes if the network created during setup is retrieved
successfully without any errors.
"""
vdc = Environment.get_test_vdc(TestNetwork._client)
network = vdc.get_isolated_orgvdc_network(
TestNetwork._isolated_orgvdc_network_name)
self.assertEqual(TestNetwork._isolated_orgvdc_network_name,
network.get('name'))
示例10: test_0020_get_nonexistent_vapp
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0020_get_nonexistent_vapp(self):
"""Test the method vdc.get_vapp().
This test passes if the non-existent vApp can't be successfully
retrieved by name.
"""
vdc = Environment.get_test_vdc(TestVApp._client)
try:
vdc.get_vapp(TestVApp._non_existent_vapp_name)
self.fail('Should not be able to fetch vApp ' +
TestVApp._non_existent_vapp_name)
except EntityNotFoundException as e:
return
示例11: test_0005_create_routed_orgvdc_network
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0005_create_routed_orgvdc_network(self):
"""Test creation of routed vdc network.
Fetches the gateway and invoke VDC.create_gateway method.
"""
vdc = Environment.get_test_vdc(TestNetwork._client)
result = vdc.create_routed_vdc_network(
network_name=TestNetwork._routed_org_vdc_network_name,
gateway_name=GatewayConstants.name,
network_cidr=TestNetwork._routed_orgvdc_network_gateway_ip,
description='Dummy description')
task = TestNetwork._client.get_task_monitor().wait_for_success(
task=result.Tasks.Task[0])
assert task.get('status') == TaskStatus.SUCCESS.value
示例12: test_0030_get_non_existent_isolated_orgvdc_network
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0030_get_non_existent_isolated_orgvdc_network(self):
"""Test the method vdc.get_isolated_orgvdc_network().
This test passes if the network retrieval operation fails with a
EntityNotFoundException.
"""
vdc = Environment.get_test_vdc(TestNetwork._client)
try:
vdc.get_isolated_orgvdc_network(
TestNetwork._non_existent_isolated_orgvdc_network_name)
self.fail('Should not be able to fetch isolated orgvdc network ' +
TestNetwork._non_existent_isolated_orgvdc_network_name)
except EntityNotFoundException as e:
return
示例13: _list_connected_vapps
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def _list_connected_vapps(self, client):
vdc = Environment.get_test_vdc(client)
vapp_name = 'test-connected-vapp' + str(uuid1())
vdc.create_vapp(
vapp_name, network=TestNetwork._routed_org_vdc_network_name)
org_vdc_routed_nw = vdc.get_routed_orgvdc_network(
TestNetwork._routed_org_vdc_network_name)
vdc_network = VdcNetwork(client, resource=org_vdc_routed_nw)
connected_vapps = vdc_network.list_connected_vapps()
self.assertEqual(len(connected_vapps), 1)
self.assertEqual(connected_vapps[0].get('Name'), vapp_name)
# Delete test vApp after test
vdc.reload()
vdc.delete_vapp(vapp_name)
示例14: test_9998_teardown
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_9998_teardown(self):
"""Test the method vdc.delete_isolated_orgvdc_network().
Invoke the method for the orgvdc network created by setup.
This test passes if the task for deleting the network succeeds.
"""
logger = Environment.get_default_logger()
vdc = Environment.get_test_vdc(TestNetwork._client)
logger.debug('Deleting isolated orgvdc network : ' +
TestNetwork._isolated_orgvdc_network_name)
result = vdc.delete_isolated_orgvdc_network(
name=TestNetwork._isolated_orgvdc_network_name, force=True)
TestNetwork._client.get_task_monitor().wait_for_success(task=result)
示例15: test_0060_list_orgvdc_network_records_as_non_admin_user
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_vdc [as 别名]
def test_0060_list_orgvdc_network_records_as_non_admin_user(self):
"""Test the method vdc.list_orgvdc_network_records().
This test passes if the record of the network created during setup is
present in the retrieved list of networks.
"""
vdc = Environment.get_test_vdc(TestNetwork._vapp_author_client)
records_list = vdc.list_orgvdc_network_records()
for network_record in records_list:
if network_record[
'name'] == TestNetwork._isolated_orgvdc_network_name:
return
self.fail('Retrieved list of orgvdc network records doesn\'t ' +
'contain ' + TestNetwork._isolated_orgvdc_network_name)