本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.list_orgvdc_network_records方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.list_orgvdc_network_records方法的具体用法?Python VDC.list_orgvdc_network_records怎么用?Python VDC.list_orgvdc_network_records使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.list_orgvdc_network_records方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_routed_ovdc_network
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import list_orgvdc_network_records [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: list_orgvdc_networks
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import list_orgvdc_network_records [as 别名]
def list_orgvdc_networks(ctx):
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.list_orgvdc_network_records()
stdout(result, 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 list_orgvdc_network_records [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])