No place is using _get_router_ids, it is dead method now.
And for l3_db.Router related query, it always based on certain
filters, such as on which host, extra attribute is distributed
or HA. While this method cannot fix those requirements.
Method _get_router_ids is created in patch
I35eae975209316aad6b2c97c909dce385729864d , its purpose is to
avoid DB query to fetch full data for routers while only id is
needed. But in patch Ie561b19a2e58a2a563d79b75421e9e24c70f36f9 ,
its caller was removed, but seems we forget to remove this dead
method at that time.
Change-Id: I924e3e652deea2f89c4aaf1fd780e467ea81b843
if ports:
return ports[0]
- def _get_router_ids(self, context):
- """Function to retrieve router IDs for a context without joins"""
- query = self._model_query(context, l3_db.Router.id)
- return [row[0] for row in query]
-
def delete_floatingip_agent_gateway_port(
self, context, host_id, ext_net_id):
"""Function to delete FIP gateway port with given ext_net_id."""
self.assertEqual(
router['id'], result[router['id']]['id'])
- def test_get_router_ids(self):
- router = self._create_router()
- self.assertEqual(
- router['id'],
- self.l3_plugin._get_router_ids(self.context)[0])
- self._create_router()
- self.assertEqual(
- 2, len(self.l3_plugin._get_router_ids(self.context)))
-
def test_agent_gw_port_delete_when_last_gateway_for_ext_net_removed(self):
kwargs = {'arg_list': (external_net.EXTERNAL,),
external_net.EXTERNAL: True}
result = self._create_router(router)
self.assertEqual(expected, result.extra_attributes['distributed'])
- def test_router_id_query(self):
- # need to create an object that has the common db method required
- class DVRwithCommon(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
- common_db_mixin.CommonDbMixin):
- pass
- self.mixin = DVRwithCommon()
- routers = [self._create_router({'name': '%s' % x,
- 'admin_state_up': True})
- for x in range(10)]
- expected = [router['id'] for router in routers]
- router_ids = self.mixin._get_router_ids(self.ctx)
- self.assertEqual(sorted(expected), sorted(router_ids))
-
def test_create_router_db_default(self):
self._test__create_router_db(expected=False)