本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.create_directly_connected_vdc_network方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.create_directly_connected_vdc_network方法的具体用法?Python VDC.create_directly_connected_vdc_network怎么用?Python VDC.create_directly_connected_vdc_network使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.create_directly_connected_vdc_network方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_010_create_direct_orgvdc_network
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import create_directly_connected_vdc_network [as 别名]
def test_010_create_direct_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_directly_connected_vdc_network(
network_name=self.config['vcd']['vdc_direct_network_name'],
parent_network_name=self.config['vcd']['ext_network_name'],
description='Dummy description')
task = self.client.get_task_monitor().wait_for_success(
task=result.Tasks.Task[0])
assert task.get('status') == TaskStatus.SUCCESS.value
示例2: create_direct_network
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import create_directly_connected_vdc_network [as 别名]
def create_direct_network(ctx, name, parent_network_name, description,
is_shared):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
in_use_vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=in_use_vdc_href)
result = vdc.create_directly_connected_vdc_network(
network_name=name,
parent_network_name=parent_network_name,
description=description,
is_shared=is_shared)
stdout(result.Tasks.Task[0], ctx)
except Exception as e:
stderr(e, ctx)
示例3: create_direct_ovdc_network
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import create_directly_connected_vdc_network [as 别名]
def create_direct_ovdc_network(cls):
"""Creates a direct org vdc network.
The name of the created org vdc network is specified in the
configuration 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 = cls._config['vcd'][
'default_direct ovdc_network_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
cls._logger.debug('Creating direct org-vdc network ' +
expected_net_name)
result = vdc.create_directly_connected_vdc_network(
network_name=expected_net_name,
parent_network_name=cls._config['external_network']['name'],
description='direct org vdc network',
is_shared=False)
cls._sys_admin_client.get_task_monitor()\
.wait_for_success(task=result.Tasks.Task[0])