Add pagination parameters for extension extraroute
Fixes bug 1131560 Change-Id: Ice84aa90ef8a39efdd9c287cca9b90c4ee355b7f
This commit is contained in:
parent
b590f9dd56
commit
ce5abf2577
@ -142,10 +142,13 @@ class ExtraRoute_db_mixin(l3_db.L3_NAT_db_mixin):
|
|||||||
context, id)
|
context, id)
|
||||||
return router
|
return router
|
||||||
|
|
||||||
def get_routers(self, context, filters=None, fields=None):
|
def get_routers(self, context, filters=None, fields=None,
|
||||||
|
sorts=None, limit=None, marker=None,
|
||||||
|
page_reverse=False):
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
routers = super(ExtraRoute_db_mixin, self).get_routers(
|
routers = super(ExtraRoute_db_mixin, self).get_routers(
|
||||||
context, filters, fields)
|
context, filters, fields, sorts=sorts, limit=limit,
|
||||||
|
marker=marker, page_reverse=page_reverse)
|
||||||
for router in routers:
|
for router in routers:
|
||||||
router['routes'] = self._get_extra_routes_by_router_id(
|
router['routes'] = self._get_extra_routes_by_router_id(
|
||||||
context, router['id'])
|
context, router['id'])
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import contextlib
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from webob import exc
|
from webob import exc
|
||||||
|
|
||||||
@ -447,3 +448,30 @@ class ExtraRouteDBTestCase(test_l3.L3NatDBTestCase):
|
|||||||
body = self._show('routers', r['router']['id'])
|
body = self._show('routers', r['router']['id'])
|
||||||
gw_info = body['router']['external_gateway_info']
|
gw_info = body['router']['external_gateway_info']
|
||||||
self.assertEquals(gw_info, None)
|
self.assertEquals(gw_info, None)
|
||||||
|
|
||||||
|
def test_router_list_with_sort(self):
|
||||||
|
with contextlib.nested(self.router(name='router1'),
|
||||||
|
self.router(name='router2'),
|
||||||
|
self.router(name='router3')
|
||||||
|
) as (router1, router2, router3):
|
||||||
|
self._test_list_with_sort('router', (router3, router2, router1),
|
||||||
|
[('name', 'desc')])
|
||||||
|
|
||||||
|
def test_router_list_with_pagination(self):
|
||||||
|
with contextlib.nested(self.router(name='router1'),
|
||||||
|
self.router(name='router2'),
|
||||||
|
self.router(name='router3')
|
||||||
|
) as (router1, router2, router3):
|
||||||
|
self._test_list_with_pagination('router',
|
||||||
|
(router1, router2, router3),
|
||||||
|
('name', 'asc'), 2, 2)
|
||||||
|
|
||||||
|
def test_router_list_with_pagination_reverse(self):
|
||||||
|
with contextlib.nested(self.router(name='router1'),
|
||||||
|
self.router(name='router2'),
|
||||||
|
self.router(name='router3')
|
||||||
|
) as (router1, router2, router3):
|
||||||
|
self._test_list_with_pagination_reverse('router',
|
||||||
|
(router1, router2,
|
||||||
|
router3),
|
||||||
|
('name', 'asc'), 2, 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user