def create_router_to_agent_binding(self, context, agent, router):
        router_id = router['id']
        agent_id = agent['id']
        if self.router_scheduler:
            try:
                if router.get('ha'):
                    plugin = manager.NeutronManager.get_service_plugins().get(
                        service_constants.L3_ROUTER_NAT)
                    self.router_scheduler.create_ha_port_and_bind(
                        plugin, context, router['id'],
                        router['tenant_id'], agent)
                else:
                    self.router_scheduler.bind_router(
                        context, router_id, agent)
            except db_exc.DBError:
                raise l3agentscheduler.RouterSchedulingFailed(
                    router_id=router_id, agent_id=agent_id)
Create router to agent binding.
dataset/ETHPy150Open openstack/neutron/neutron/db/l3_agentschedulers_db.py/L3AgentSchedulerDbMixin.create_router_to_agent_binding