candidates = plugin.get_l3_agent_candidates(router, [l3_agent])
if not candidates:
to_removed_ids.append(router['id'])
- router_ids = set(unscheduled_router_ids) - set(to_removed_ids)
+ router_ids = set([r['id'] for r in routers]) - set(to_removed_ids)
if not router_ids:
LOG.warn(_('No routers compatible with L3 agent configuration'
' on host %s'), host)
self.assertEqual(1, num_before_remove)
self.assertEqual(0, num_after_remove)
+ def test_router_auto_schedule_with_invalid_router(self):
+ with self.router() as router:
+ l3_rpc = l3_rpc_base.L3RpcCallbackMixin()
+ self._register_agent_states()
+ # deleted router
+ ret_a = l3_rpc.sync_routers(self.adminContext, host=L3_HOSTA,
+ router_ids=[router['router']['id']])
+ self.assertFalse(ret_a)
+ # non-existent router
+ ret_a = l3_rpc.sync_routers(self.adminContext, host=L3_HOSTA,
+ router_ids=[uuidutils.generate_uuid()])
+ self.assertFalse(ret_a)
+
def test_router_auto_schedule_with_hosted(self):
with self.router() as router:
l3_rpc = l3_rpc_base.L3RpcCallbackMixin()