本文整理匯總了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