当前位置: 首页>>代码示例>>Python>>正文


Python Environment.get_vapp_in_test_vdc方法代码示例

本文整理汇总了Python中pyvcloud.system_test_framework.environment.Environment.get_vapp_in_test_vdc方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_vapp_in_test_vdc方法的具体用法?Python Environment.get_vapp_in_test_vdc怎么用?Python Environment.get_vapp_in_test_vdc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyvcloud.system_test_framework.environment.Environment的用法示例。


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

示例1: test_0060_vapp_network_connection

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0060_vapp_network_connection(self):
        """Test vapp.connect/disconnect_org_vdc_network().

        This test passes if the connect and disconnect to orgvdc network
        operations are successful.
        """
        logger = Environment.get_default_logger()

        network_name = Environment.get_default_orgvdc_network_name()

        vapp_name = TestVApp._customized_vapp_name
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=vapp_name)

        logger.debug('Connecting vApp ' + vapp_name + ' to orgvdc network ' +
                     network_name)
        task = vapp.connect_org_vdc_network(network_name)
        result = TestVApp._client.get_task_monitor().wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)

        logger.debug('Disconnecting vApp ' + vapp_name +
                     ' to orgvdc network ' + network_name)
        vapp.reload()
        task = vapp.disconnect_org_vdc_network(network_name)
        result = TestVApp._client.get_task_monitor().wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
开发者ID:vmware,项目名称:pyvcloud,代码行数:28,代码来源:vapp_tests.py

示例2: test_0055_exit_maintenance_mode

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
 def test_0055_exit_maintenance_mode(self):
     logger = Environment.get_default_logger()
     vapp_name = TestVApp._customized_vapp_name
     vapp = Environment.get_vapp_in_test_vdc(
         client=TestVApp._sys_admin_client, vapp_name=vapp_name)
     logger.debug('Exiting maintenance mode of vApp ' + vapp_name)
     vapp.reload()
     result = vapp.exit_maintenance_mode()
     self.assertEqual(result, None)
开发者ID:vmware,项目名称:pyvcloud,代码行数:11,代码来源:vapp_tests.py

示例3: test_0053_discard_suspended_state_vapp

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
 def test_0053_discard_suspended_state_vapp(self):
     logger = Environment.get_default_logger()
     vapp_name = TestVApp._customized_vapp_name
     vapp = Environment.get_vapp_in_test_vdc(
         client=TestVApp._sys_admin_client, vapp_name=vapp_name)
     logger.debug('Discarding suspended state of vApp ' + vapp_name)
     vapp.reload()
     task = vapp.discard_suspended_state_vapp()
     result = TestVApp._client.get_task_monitor().wait_for_success(task)
     self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
开发者ID:vmware,项目名称:pyvcloud,代码行数:12,代码来源:vapp_tests.py

示例4: test_0124_delete_ip_range

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
 def test_0124_delete_ip_range(self):
     vapp = Environment.get_vapp_in_test_vdc(
         client=TestVApp._client, vapp_name=TestVApp._customized_vapp_name)
     task = vapp.delete_ip_range(TestVApp._vapp_network_name,
                                 TestVApp._start_ip_vapp_network,
                                 TestVApp._end_ip_vapp_network)
     TestVApp._client.get_task_monitor().wait_for_success(task=task)
     vapp.reload()
     network_conf = self._network_present(vapp, TestVApp._vapp_network_name)
     ip_ranges = network_conf.Configuration.IpScopes.IpScope.IpRanges
     self.assertEqual(len(ip_ranges), 1)
开发者ID:vmware,项目名称:pyvcloud,代码行数:13,代码来源:vapp_tests.py

示例5: test_0030_add_delete_vm

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0030_add_delete_vm(self):
        """Test the method vapp.add_vms() and vapp.delete_vms().

        This test passes if the supplied vm is sucessfully added to the vApp
        and then successfully removed from the vApp.
        """
        logger = Environment.get_default_logger()
        vapp_name = TestVApp._empty_vapp_name
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=vapp_name)

        source_vapp_name = TestVApp._customized_vapp_name
        source_vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=source_vapp_name)
        source_vapp_resource = source_vapp.get_resource()
        source_vm_name = TestVApp._customized_vapp_vm_name
        target_vm_name = TestVApp._additional_vm_name
        spec = {
            'vapp': source_vapp_resource,
            'source_vm_name': source_vm_name,
            'target_vm_name': target_vm_name
        }

        logger.debug('Adding vm ' + target_vm_name + ' to vApp ' + vapp_name)
        # deploy and power_on are false to make sure that the subsequent
        # deletion of vm doesn't require additional power operations
        task = vapp.add_vms([spec],
                            deploy=False,
                            power_on=False,
                            all_eulas_accepted=True)
        result = TestVApp._client.get_task_monitor().wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)

        logger.debug('Removing vm ' + target_vm_name + ' from vApp ' +
                     vapp_name)
        vapp.reload()
        task = vapp.delete_vms([target_vm_name])
        result = TestVApp._client.get_task_monitor().wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
开发者ID:vmware,项目名称:pyvcloud,代码行数:41,代码来源:vapp_tests.py

示例6: test_0100_vapp_metadata

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0100_vapp_metadata(self):
        """Test the methods related to metadata manipulation in vapp.py.

        This test passes if all the metadata operations are successful.
        """
        logger = Environment.get_default_logger()
        vapp_name = TestVApp._empty_vapp_name
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=vapp_name)

        # add new metadata
        logger.debug(f'Adding metadata [key={TestVApp._metadata_key},'
                     'value={TestVApp._metadata_value}]) to vApp:'
                     '{vapp_name}')
        task = vapp.set_metadata(
            domain=MetadataDomain.GENERAL.value,
            visibility=MetadataVisibility.READ_WRITE,
            key=TestVApp._metadata_key,
            value=TestVApp._metadata_value)
        result = TestVApp._client.get_task_monitor().wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)

        # retrieve metadata
        logger.debug(f'Retriving metadata with key='
                     '{TestVApp._metadata_key} from vApp:{vapp_name}.')
        entries = metadata_to_dict(vapp.get_metadata())
        self.assertTrue(
            TestVApp._metadata_key in entries, f'Should have '
            'been able to retrieve metadata entry with '
            'key={TestVApp._metadata_key}.')

        # update metadata value as org admin
        logger.debug(f'Updtaing metadata on vApp:{vapp_name} with key='
                     '{TestVApp._metadata_key} to value='
                     '{TestVApp._metadata_new_value}.')
        task = vapp.set_metadata(
            domain=MetadataDomain.GENERAL.value,
            visibility=MetadataVisibility.READ_WRITE,
            key=TestVApp._metadata_key,
            value=TestVApp._metadata_new_value)
        TestVApp._client.get_task_monitor().wait_for_success(task)
        entries = metadata_to_dict(vapp.get_metadata())
        self.assertEqual(TestVApp._metadata_new_value,
                         entries[TestVApp._metadata_key])

        # remove metadata entry
        logger.debug(f'Removing metadata with '
                     'key={TestVApp._metadata_key} from vApp:{vapp_name}.')
        task = vapp.remove_metadata(key=TestVApp._metadata_key)
        result = TestVApp._client.get_task_monitor().wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
开发者ID:vmware,项目名称:pyvcloud,代码行数:53,代码来源:vapp_tests.py

示例7: test_0040_customized_vapp

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0040_customized_vapp(self):
        """Test the correctness of the customization of vdc.instantiate_vapp().

        This test passes if the customized vApp is retrieved successfully
        and it's verified that the vApp is correctly customized as per the
        config in this file.
        """
        vapp_name = TestVApp._customized_vapp_name
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=vapp_name)
        vapp_resource = vapp.get_resource()

        self.assertEqual(vapp_resource.Description.text,
                         TestVApp._customized_vapp_description)

        vms = vapp_resource.xpath(
            '//vcloud:VApp/vcloud:Children/vcloud:Vm', namespaces=NSMAP)
        self.assertTrue(len(vms) >= 1)
        first_vm = vms[0]

        self.assertEqual(
            first_vm.get('name'), TestVApp._customized_vapp_vm_name)

        self.assertEqual(first_vm.GuestCustomizationSection.ComputerName.text,
                         TestVApp._customized_vapp_vm_hostname)

        items = first_vm.xpath(
            '//ovf:VirtualHardwareSection/ovf:Item',
            namespaces={'ovf': NSMAP['ovf']})
        self.assertTrue(len(items) > 0)

        cpu_size = None
        memory_size = None
        disk_size = None
        for item in items:
            if item['{' + NSMAP['rasd'] + '}ResourceType'] == 3:
                cpu_size = item['{' + NSMAP['rasd'] + '}VirtualQuantity']
            elif item['{' + NSMAP['rasd'] + '}ResourceType'] == 4:
                memory_size = item['{' + NSMAP['rasd'] + '}VirtualQuantity']
            elif item['{' + NSMAP['rasd'] + '}ResourceType'] == 17:
                disk_size = item['{' + NSMAP['rasd'] + '}VirtualQuantity']

        self.assertIsNotNone(cpu_size)
        self.assertEqual(cpu_size, TestVApp._customized_vapp_num_cpu)
        self.assertIsNotNone(memory_size)
        self.assertEqual(memory_size, TestVApp._customized_vapp_memory_size)
        self.assertIsNotNone(disk_size)
        self.assertEqual(disk_size,
                         (TestVApp._customized_vapp_disk_size * 1024 * 1024))
开发者ID:vmware,项目名称:pyvcloud,代码行数:51,代码来源:vapp_tests.py

示例8: test_0080_vapp_lease

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0080_vapp_lease(self):
        """Test the method vapp.set_lease().

        This test passes if the lease setting operation completes successfully.
        """
        vapp_name = TestVApp._empty_vapp_name
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=vapp_name)

        task = vapp.set_lease(
            deployment_lease=TestVApp._empty_vapp_runtime_lease,
            storage_lease=TestVApp._empty_vapp_storage_lease)
        result = TestVApp._client.get_task_monitor().\
            wait_for_success(task=task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)
开发者ID:vmware,项目名称:pyvcloud,代码行数:17,代码来源:vapp_tests.py

示例9: test_0140_upgrade_virtual_hardware

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0140_upgrade_virtual_hardware(self):
        logger = Environment.get_default_logger()
        vapp_name = TestVApp._customized_vapp_name
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._sys_admin_client, vapp_name=vapp_name)

        logger.debug('Un-deploying vApp ' + vapp_name)
        task = vapp.undeploy()
        result = TestVApp._sys_admin_client.get_task_monitor(
        ).wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)

        logger.debug('Upgrading virtual hardware of vApp ' + vapp_name)
        no_of_vm_upgraded = vapp.upgrade_virtual_hardware()
        self.assertEqual(no_of_vm_upgraded, len(vapp.get_all_vms()))
开发者ID:vmware,项目名称:pyvcloud,代码行数:17,代码来源:vapp_tests.py

示例10: test_0011_edit_vapp_name_desc

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0011_edit_vapp_name_desc(self):
        """Test the method vapp.edit_name_and_description().

        This test passes if the name and desc of the vapp is changed.
        """
        vapp_resource = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=TestVApp._customized_vapp_name)
        self.assertIsNotNone(vapp_resource)

        self._update_vapp_name_desc(vapp_resource, 'testname1289', 'testdesc')

        # reset vapp to old name
        self._update_vapp_name_desc(vapp_resource,
                                    TestVApp._customized_vapp_name,
                                    TestVApp._customized_vapp_description)
开发者ID:vmware,项目名称:pyvcloud,代码行数:17,代码来源:vapp_tests.py

示例11: test_0130_delete_vapp_network

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0130_delete_vapp_network(self):
        """Test the method vapp.delete_vapp_network().

        This test passes if delete network is successful.
        """
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=TestVApp._customized_vapp_name)

        task = vapp.delete_vapp_network(TestVApp._vapp_network_name)
        TestVApp._client.get_task_monitor().wait_for_success(task=task)

        # Verification
        vapp.reload()
        self.assertFalse(
            self._is_network_present(vapp, TestVApp._vapp_network_name))
开发者ID:vmware,项目名称:pyvcloud,代码行数:17,代码来源:vapp_tests.py

示例12: test_0056_download_ova

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0056_download_ova(self):
        logger = Environment.get_default_logger()
        vapp_name = TestVApp._customized_vapp_name
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._sys_admin_client, vapp_name=vapp_name)

        logger.debug('Un-deploying vApp ' + vapp_name)
        task = vapp.undeploy()
        result = TestVApp._client.get_task_monitor().wait_for_success(task)
        self.assertEqual(result.get('status'), TaskStatus.SUCCESS.value)

        logger.debug('Downloading a vApp ' + vapp_name)
        vapp.reload()
        bytes_written = vapp.download_ova(TestVApp._ova_file_name)
        self.assertNotEqual(bytes_written, 0)

        logger.debug('Remove downloaded ' + TestVApp._ova_file_name)
        os.remove(TestVApp._ova_file_name)
开发者ID:vmware,项目名称:pyvcloud,代码行数:20,代码来源:vapp_tests.py

示例13: test_0125_update_dns_vapp_network

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
 def test_0125_update_dns_vapp_network(self):
     vapp = Environment.get_vapp_in_test_vdc(
         client=TestVApp._client, vapp_name=TestVApp._customized_vapp_name)
     task = vapp.update_dns_vapp_network(
         TestVApp._vapp_network_name, TestVApp._new_vapp_network_dns1,
         TestVApp._new_vapp_network_dns2,
         TestVApp._new_vapp_network_dns_suffix)
     TestVApp._client.get_task_monitor().wait_for_success(task=task)
     vapp.reload()
     network_conf = self._network_present(vapp, TestVApp._vapp_network_name)
     IpScope = network_conf.Configuration.IpScopes.IpScope
     self.assertEqual(IpScope.Dns1, TestVApp._new_vapp_network_dns1)
     self.assertEqual(IpScope.Dns2, TestVApp._new_vapp_network_dns2)
     self.assertEqual(IpScope.DnsSuffix,
                      TestVApp._new_vapp_network_dns_suffix)
     task = vapp.update_dns_vapp_network(
         TestVApp._vapp_network_name, TestVApp._vapp_network_dns1,
         TestVApp._vapp_network_dns2, TestVApp._vapp_network_dns_suffix)
     TestVApp._client.get_task_monitor().wait_for_success(task=task)
开发者ID:vmware,项目名称:pyvcloud,代码行数:21,代码来源:vapp_tests.py

示例14: test_0121_update_vapp_network

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0121_update_vapp_network(self):
        """Test the method update_vapp_network().

        This test passes if update network is successful.
        """
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=TestVApp._customized_vapp_name)
        new_name = 'new _name'
        new_description = 'new_description'
        task = vapp.update_vapp_network(TestVApp._vapp_network_name, new_name,
                                        new_description)
        TestVApp._client.get_task_monitor().wait_for_success(task=task)

        # Verification
        vapp.reload()
        self.assertFalse(
            self._is_network_present(vapp, TestVApp._vapp_network_name))
        task = vapp.update_vapp_network(new_name, TestVApp._vapp_network_name,
                                        None)
        TestVApp._client.get_task_monitor().wait_for_success(task=task)
开发者ID:vmware,项目名称:pyvcloud,代码行数:22,代码来源:vapp_tests.py

示例15: test_0120_reset_vapp_network

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_vapp_in_test_vdc [as 别名]
    def test_0120_reset_vapp_network(self):
        """Test the method vapp.reset_vapp_network().

        This test passes if reset network is successful.
        """
        vapp = Environment.get_vapp_in_test_vdc(
            client=TestVApp._client, vapp_name=TestVApp._customized_vapp_name)

        # make sure the vApp is powered on before resetting
        task = vapp.undeploy()
        TestVApp._client.get_task_monitor().wait_for_success(task=task)
        vapp.reload()
        task = vapp.deploy(power_on=True)
        TestVApp._client.get_task_monitor().wait_for_success(task=task)
        vapp.reload()
        self.assertTrue(vapp.is_powered_on())

        task = vapp.reset_vapp_network(TestVApp._vapp_network_name)
        TestVApp._client.get_task_monitor().wait_for_success(task=task)
        vapp.reload()
开发者ID:vmware,项目名称:pyvcloud,代码行数:22,代码来源:vapp_tests.py


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