'Create router to agent binding.'

def create_router_to_agent_binding(self, context, agent, router):

    router_id = router['id']
    agent_id = agent['id']
    if self.router_scheduler:
        plugin = directory.get_plugin(plugin_constants.L3)
        try:
            if router.get('ha'):
                self.router_scheduler.create_ha_port_and_bind(plugin, context, router['id'], router['tenant_id'], agent, is_manual_scheduling=True)
            else:
                self.router_scheduler.bind_router(plugin, context, router_id, agent.id)
        except db_exc.DBError:
            raise l3agentscheduler.RouterSchedulingFailed(router_id=router_id, agent_id=agent_id)
