'Validate if the router can be correctly assigned to the agent.
:raises: RouterL3AgentMismatch if attempting to assign DVR router
to legacy agent.
:raises: InvalidL3Agent if attempting to assign router to an
unsuitable agent (disabled, type != L3, incompatible configuration)
:raises: DVRL3CannotAssignToDvrAgent if attempting to assign a
router to an agent in \'dvr\' mode.'

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

    if (agent['agent_type'] != constants.AGENT_TYPE_L3):
        raise l3agentscheduler.InvalidL3Agent(id=agent['id'])
    agent_mode = self._get_agent_mode(agent)
    if (agent_mode == constants.L3_AGENT_MODE_DVR):
        raise l3agentscheduler.DVRL3CannotAssignToDvrAgent()
    if ((agent_mode == constants.L3_AGENT_MODE_LEGACY) and router.get('distributed')):
        raise l3agentscheduler.RouterL3AgentMismatch(router_id=router['id'], agent_id=agent['id'])
    is_suitable_agent = (agentschedulers_db.services_available(agent['admin_state_up']) and self.get_l3_agent_candidates(context, router, [agent], ignore_admin_state=True))
    if (not is_suitable_agent):
        raise l3agentscheduler.InvalidL3Agent(id=agent['id'])
