本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.create_routed_vdc_network方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.create_routed_vdc_network方法的具体用法?Python VDC.create_routed_vdc_network怎么用?Python VDC.create_routed_vdc_network使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.create_routed_vdc_network方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_routed_ovdc_network
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import create_routed_vdc_network [as 别名]
def create_routed_ovdc_network(cls):
"""Creates a routed org vdc network.
The name of the created org vdc network is specified in the
ovdc_network_constant file, skips creating one, if such a network already
exists.
:raises: Exception: if the class variable _ovdc_href is not populated.
"""
cls._basic_check()
if cls._ovdc_href is None:
raise Exception('OrgVDC ' +
cls._config['vcd']['default_ovdc_name'] +
' doesn\'t exist.')
vdc = VDC(cls._sys_admin_client, href=cls._ovdc_href)
expected_net_name = OvdcNetConstants.routed_net_name
records_list = vdc.list_orgvdc_network_records()
for network_record in records_list:
if network_record['name'].lower() == expected_net_name.lower():
cls._logger.debug('Reusing existing direct org-vdc network ' +
expected_net_name)
return
result = vdc.create_routed_vdc_network(
network_name=OvdcNetConstants.routed_net_name,
gateway_name=GatewayConstants.name,
network_cidr=OvdcNetConstants.routed_orgvdc_network_gateway_ip,
description='org vdc network description')
cls._sys_admin_client.get_task_monitor() \
.wait_for_success(task=result.Tasks.Task[0])
示例2: test_005_create_routed_orgvdc_network
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import create_routed_vdc_network [as 别名]
def test_005_create_routed_orgvdc_network(self):
org_record = self.client.get_org_by_name(
self.config['vcd']['org_name'])
org = Org(self.client, href=org_record.get('href'))
vdc_resource = org.get_vdc(self.config['vcd']['vdc_name'])
vdc = VDC(self.client, href=vdc_resource.get('href'))
result = vdc.create_routed_vdc_network(
network_name=self.config['vcd']['vdc_routed_network_name'],
gateway_name=self.config['vcd']['routed_network_gateway_name'],
network_cidr=self.config['vcd']['network_cidr'],
description='Dummy description')
task = self.client.get_task_monitor().wait_for_success(
task=result.Tasks.Task[0])
assert task.get('status') == TaskStatus.SUCCESS.value
示例3: __create_routed_ovdc_network
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import create_routed_vdc_network [as 别名]
def __create_routed_ovdc_network(self):
"""Creates a routed org vdc network.
:raises: Exception: if the class variable _ovdc_href is not populated.
"""
vdc_reource = TestIpSecVpn._vdc_resource
vdc = VDC(TestIpSecVpn._client, resource=vdc_reource)
routednet = vdc.create_routed_vdc_network(
network_name=TestIpSecVpn._routed_network_name,
gateway_name=TestIpSecVpn._gateway_name,
network_cidr=TestIpSecVpn._routed_orgvdc_network_gateway_ip,
description='org vdc network description')
TestIpSecVpn._client.get_task_monitor() \
.wait_for_success(task=routednet.Tasks.Task[0])
TestIpSecVpn._routednet_href = routednet.get('href')
TestIpSecVpn._routednet_obj = VdcNetwork(TestIpSecVpn._client,
href=TestIpSecVpn.
_routednet_href)
TestIpSecVpn._routednet_resource = TestIpSecVpn. \
_routednet_obj.get_resource()