

def add_router_to_l3_agent(self, context, agent_id, router_id):
    'Add a l3 agent to host a router.'
    with context.session.begin(subtransactions=True):
        router = self.get_router(context, router_id)
        agent = self._get_agent(context, agent_id)
        self.validate_agent_router_combination(context, agent, router)
        if (not self.check_agent_router_scheduling_needed(context, agent, router)):
            return
    self.create_router_to_agent_binding(context, agent, router)
    l3_notifier = self.agent_notifiers.get(constants.AGENT_TYPE_L3)
    if l3_notifier:
        l3_notifier.router_added_to_agent(context, [router_id], agent.host)

dataset/ETHPy150Open openstack/neutron/neutron/db/l3_agentschedulers_db.py L3AgentSchedulerDbMixin.add_router_to_l3_agent/original