本文整理汇总了Python中pyvcloud.vcd.vdc.VDC.list_orgvdc_direct_networks方法的典型用法代码示例。如果您正苦于以下问题:Python VDC.list_orgvdc_direct_networks方法的具体用法?Python VDC.list_orgvdc_direct_networks怎么用?Python VDC.list_orgvdc_direct_networks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vdc.VDC
的用法示例。
在下文中一共展示了VDC.list_orgvdc_direct_networks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_040_list_direct_orgvdc_networks
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import list_orgvdc_direct_networks [as 别名]
def test_040_list_direct_orgvdc_networks(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.list_orgvdc_direct_networks()
assert len(result) > 0
示例2: list_direct_networks
# 需要导入模块: from pyvcloud.vcd.vdc import VDC [as 别名]
# 或者: from pyvcloud.vcd.vdc.VDC import list_orgvdc_direct_networks [as 别名]
def list_direct_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)
direct_nets = vdc.list_orgvdc_direct_networks()
result = []
for direct_net in direct_nets:
result.append({'name': direct_net.get('name')})
stdout(result, ctx)
except Exception as e:
if type(e).__name__ == 'AccessForbiddenException':
message = "Access denied.\nPlease try following command"
message += '\nvcd network list'
stdout(message, ctx)
stderr(e, ctx)