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


Python Environment.get_test_pvdc_name方法代码示例

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


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

示例1: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_pvdc_name [as 别名]
    def test_0000_setup(self):
        """Add one orgvdc, one gateways and one routed orgvdc networks.

        """
        TestIpSecVpn._client = Environment.get_sys_admin_client()
        TestIpSecVpn._logger = Environment.get_default_logger()
        TestIpSecVpn._config = Environment.get_config()
        TestIpSecVpn._org = Environment.get_test_org(TestIpSecVpn._client)
        TestIpSecVpn._pvdc_name = Environment.get_test_pvdc_name()
        TestIpSecVpn._ext_config = TestIpSecVpn._config['external_network']
        TestIpSecVpn._ext_net_name = TestIpSecVpn._ext_config['name']
        # Create another vdc, gateway and routed network

        self.__create_ovdc()
        self.__create_advanced_gateway()
        self.__create_routed_ovdc_network()
        test_gateway = Environment.get_test_gateway(TestIpSecVpn._client)
        gateway_obj1 = Gateway(TestIpSecVpn._client, GatewayConstants.name,
                               href=test_gateway.get('href'))
        gateway_obj2 = TestIpSecVpn._gateway_obj
        TestIpSecVpn._local_ip = self.__get_ip_address(
            gateway=gateway_obj1, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._peer_ip = self.__get_ip_address(
            gateway=gateway_obj2, ext_net_name=TestIpSecVpn._ext_net_name)

        TestIpSecVpn._runner = CliRunner()
        default_org = self._config['vcd']['default_org_name']
        self._login()
        TestIpSecVpn._runner.invoke(org, ['use', default_org])
        result = TestIpSecVpn._runner.invoke(
            gateway,
            args=[
                'services', 'ipsec-vpn', 'create', TestIpSecVpn._name,
                '--name', TestIpSecVpn._ipsec_vpn_name,
                '--local-id', TestIpSecVpn._local_id,
                '--peer-id', TestIpSecVpn._peer_id,
                '--local-ip', TestIpSecVpn._local_ip,
                '--peer-ip', TestIpSecVpn._peer_ip,
                '--local-subnet', TestIpSecVpn._local_subnet,
                '--peer-subnet', TestIpSecVpn._peer_subnet,
                '--pre-shared-key', TestIpSecVpn._psk, '--enable'])
        self.assertEqual(0, result.exit_code)
开发者ID:vmware,项目名称:vca-cli,代码行数:45,代码来源:ipsec_vpn_tests.py

示例2: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_pvdc_name [as 别名]
    def test_0000_setup(self):
        """Setup the org vdc required for the other tests in this module.

        Create one org vdc as per the configuration stated above. Test the
        method Org.create_org_vdc().

        This test passes if the vdc href is not None.
        """
        logger = Environment.get_default_logger()
        TestOrgVDC._client = Environment.get_sys_admin_client()
        org = Environment.get_test_org(TestOrgVDC._client)

        vdc_name = TestOrgVDC._new_vdc_name
        pvdc_name = Environment.get_test_pvdc_name()
        storage_profiles = [{
            'name': '*',
            'enabled': True,
            'units': 'MB',
            'limit': 0,
            'default': True
        }]

        vdc_resource = org.create_org_vdc(
            vdc_name,
            pvdc_name,
            storage_profiles=storage_profiles,
            uses_fast_provisioning=True,
            is_thin_provision=True)
        TestOrgVDC._client.get_task_monitor().wait_for_success(
            task=vdc_resource.Tasks.Task[0])

        logger.debug('Created ovdc ' + vdc_name + '.')

        # The following contraption is required to get the non admin href of
        # the ovdc. vdc_resource contains the admin version of the href since
        # we created the ovdc as a sys admin.
        org.reload()
        for vdc in org.list_vdcs():
            if vdc.get('name').lower() == vdc_name.lower():
                TestOrgVDC._new_vdc_href = vdc.get('href')

        self.assertIsNotNone(TestOrgVDC._new_vdc_href)
开发者ID:vmware,项目名称:pyvcloud,代码行数:44,代码来源:vdc_tests.py

示例3: test_0000_setup

# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_test_pvdc_name [as 别名]
    def test_0000_setup(self):
        """Setup the org vdc required for the other tests in this module.

        Create one org vdc as per the configuration stated above. Test the
        method Org.create_org_vdc().

        This test passes if the vdc href is not None.
        """
        logger = Environment.get_default_logger()
        TestPVDC._sys_admin_client = Environment.get_sys_admin_client()
        org = Environment.get_test_org(TestPVDC._sys_admin_client)
        platform = Platform(TestPVDC._sys_admin_client)

        vdc_name = TestPVDC._new_vdc_name
        pvdc_name = Environment.get_test_pvdc_name()
        provider_vdc = platform.get_ref_by_name(ResourceType.PROVIDER_VDC,
                                                pvdc_name)
        pvdc_ext_href = get_admin_extension_href(provider_vdc.get('href'))
        pvdc_ext_resource = TestPVDC._sys_admin_client.get_resource(
            pvdc_ext_href)
        vc_name = pvdc_ext_resource.VimServer.get('name')
        res_pools_in_pvdc = TestPVDC._sys_admin_client.get_linked_resource(
            resource=pvdc_ext_resource,
            rel=RelationType.DOWN,
            media_type=EntityType.VMW_PROVIDER_VDC_RESOURCE_POOL_SET.value)
        if hasattr(res_pools_in_pvdc,
                   '{' + NSMAP['vmext'] + '}VMWProviderVdcResourcePool'):
            src_respool = res_pools_in_pvdc.VMWProviderVdcResourcePool[0]
        name_filter = ('vcName', vc_name)
        query = TestPVDC._sys_admin_client.get_typed_query(
            ResourceType.RESOURCE_POOL.value,
            query_result_format=QueryResultFormat.RECORDS,
            equality_filter=name_filter)
        res_pools_in_use = {}
        for res_pool in list(query.execute()):
            res_pools_in_use[res_pool.get('moref')] = res_pool.get('name')
        source_respool_name = res_pools_in_use[
            src_respool.ResourcePoolVimObjectRef.MoRef]
        TestPVDC._source_resource_pool = source_respool_name

        storage_profiles = [{
            'name': '*',
            'enabled': True,
            'units': 'MB',
            'limit': 0,
            'default': True
        }]
        vdc_resource = org.create_org_vdc(
            vdc_name,
            pvdc_name,
            storage_profiles=storage_profiles,
            uses_fast_provisioning=True,
            is_thin_provision=True)
        TestPVDC._sys_admin_client.get_task_monitor().wait_for_success(
            task=vdc_resource.Tasks.Task[0])

        logger.debug('Created ovdc ' + vdc_name + '.')

        # The following contraption is required to get the non admin href of
        # the ovdc. vdc_resource contains the admin version of the href since
        # we created the ovdc as a sys admin.
        org.reload()
        for vdc in org.list_vdcs():
            if vdc.get('name').lower() == vdc_name.lower():
                TestPVDC._new_vdc_href = vdc.get('href')

        self.assertIsNotNone(TestPVDC._new_vdc_href)
开发者ID:vmware,项目名称:pyvcloud,代码行数:69,代码来源:pvdc_tests.py


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