本文整理汇总了Python中vnc_api.vnc_api.VncApi.physical_router_update方法的典型用法代码示例。如果您正苦于以下问题:Python VncApi.physical_router_update方法的具体用法?Python VncApi.physical_router_update怎么用?Python VncApi.physical_router_update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnc_api.vnc_api.VncApi
的用法示例。
在下文中一共展示了VncApi.physical_router_update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DeviceInfo
# 需要导入模块: from vnc_api.vnc_api import VncApi [as 别名]
# 或者: from vnc_api.vnc_api.VncApi import physical_router_update [as 别名]
#.........这里部分代码省略.........
return False
finally:
ssh_conn.close()
# end _ssh_check
def _pr_object_create_update(
self,
oid_mapped,
fq_name,
update):
pr_uuid = None
msg = None
try:
os_version = oid_mapped.get('os-version', None)
serial_num = oid_mapped.get('serial-number', None)
physicalrouter = PhysicalRouter(
parent_type='global-system-config',
fq_name=fq_name,
physical_router_management_ip=oid_mapped.get('host'),
physical_router_vendor_name=oid_mapped.get('vendor'),
physical_router_product_name=oid_mapped.get('product'),
physical_router_device_family=oid_mapped.get('family'),
physical_router_vnc_managed=True,
physical_router_hostname=fq_name[-1],
display_name=fq_name[-1],
physical_router_serial_number=serial_num,
physical_router_managed_state='active',
physical_router_user_credentials={
'username': oid_mapped.get('username'),
'password': oid_mapped.get('password')
}
)
if update:
pr_unicode_obj = self.vncapi.physical_router_update(
physicalrouter)
if pr_unicode_obj:
pr_obj_dict = ast.literal_eval(pr_unicode_obj)
pr_uuid = pr_obj_dict['physical-router']['uuid']
msg = "Discovered %s:\n Host name: %s\n Vendor: %s\n" \
" Model: %s" % (
oid_mapped.get('host'),
fq_name[1],
oid_mapped.get('vendor'),
oid_mapped.get('product')
)
self.logger.info("Discovered {} : {}".format(
oid_mapped.get('host'), pr_uuid
))
else:
# underlay_managed flag should only be set at physical-router
# creation time
physicalrouter.set_physical_router_underlay_managed(
self.job_ctx.get('job_input').get('manage_underlay', True)
)
pr_uuid = self.vncapi.physical_router_create(physicalrouter)
msg = "Discovered device details: {} : {} : {}".format(
oid_mapped.get('host'), fq_name[1], oid_mapped.get(
'product'))
self.logger.info("Device created with uuid- {} : {}".format(
oid_mapped.get(
'host'), pr_uuid))
self.module.send_prouter_object_log(fq_name, "DISCOVERED",
os_version, serial_num)
except(RefsExistError, Exception) as ex:
if isinstance(ex, RefsExistError):
return REF_EXISTS_ERROR, None