def add_type_and_hosting_device_info(self, context, router,<EOL>binding_info_db=None, schedule=True):
try:<EOL><INDENT>if binding_info_db is None:<EOL><INDENT>binding_info_db = self._get_router_binding_info(context,<EOL>router['<STR_LIT:id>'])<EOL><DEDENT><DEDENT>except RouterBindingInfoError:<EOL><INDENT>LOG.debug('<STR_LIT>'<EOL>'<STR_LIT>', router['<STR_LIT:id>'])<EOL>router['<STR_LIT>'] = None<EOL>return<EOL><DEDENT>router['<STR_LIT>'] = {<EOL>'<STR_LIT:id>': binding_info_db.router_type.id,<EOL>'<STR_LIT:name>': binding_info_db.router_type.name,<EOL>'<STR_LIT>':<EOL>binding_info_db.router_type.cfg_agent_service_helper,<EOL>'<STR_LIT>': binding_info_db.router_type.cfg_agent_driver}<EOL>router[routerrole.ROUTER_ROLE_ATTR] = binding_info_db.role<EOL>router['<STR_LIT>'] = binding_info_db.share_hosting_device<EOL>if binding_info_db.router_type_id == self.get_namespace_router_type_id(<EOL>context):<EOL><INDENT>router['<STR_LIT>'] = None<EOL>return<EOL><DEDENT>if binding_info_db.hosting_device is None:<EOL><INDENT>router['<STR_LIT>'] = None<EOL>if schedule is True and binding_info_db.auto_schedule is True:<EOL><INDENT>self.backlog_router(context, binding_info_db)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>router['<STR_LIT>'] = self._dev_mgr.get_device_info_for_agent(<EOL>context, binding_info_db.hosting_device)<EOL><DEDENT>
Adds type and hosting device information to a router.