示例#1
0
 def test_subnet_pagination(self):
     subnets_per_page = 1
     network = dict(name="public", tenant_id="fake")
     ipnet = netaddr.IPNetwork("0.0.0.0/24")
     next_ip = ipnet.ipv6().first + 1
     subnet_1 = dict(id=1, cidr="0.0.0.0/24", next_auto_assign_ip=next_ip,
                     ip_policy=None, tenant_id="fake")
     subnet_2 = dict(id=2, cidr="1.1.1.0/24", next_auto_assign_ip=next_ip,
                     ip_policy=None, tenant_id="fake")
     with self._stubs(network, [subnet_1, subnet_2]):
         subnets_unpaged = subnet_api.get_subnets(self.context, filters={})
         subnets_paged = subnet_api.get_subnets(self.context,
                                                subnets_per_page, False,
                                                [('id', 'asc')],
                                                filters={})
         self.assertEqual(len(subnets_paged), subnets_per_page)
         self.assertNotEqual(len(subnets_unpaged), subnets_per_page)
示例#2
0
 def get_subnets(self,
                 context,
                 limit=None,
                 page_reverse=False,
                 sorts=['id'],
                 marker=None,
                 filters=None,
                 fields=None):
     return subnets.get_subnets(context, limit, page_reverse, sorts, marker,
                                filters, fields)
示例#3
0
 def test_subnet_pagination(self):
     subnets_per_page = 1
     network = dict(name="public", tenant_id="fake")
     ipnet = netaddr.IPNetwork("0.0.0.0/24")
     next_ip = ipnet.ipv6().first + 1
     subnet_1 = dict(id=1,
                     cidr="0.0.0.0/24",
                     next_auto_assign_ip=next_ip,
                     ip_policy=None,
                     tenant_id="fake")
     subnet_2 = dict(id=2,
                     cidr="1.1.1.0/24",
                     next_auto_assign_ip=next_ip,
                     ip_policy=None,
                     tenant_id="fake")
     with self._stubs(network, [subnet_1, subnet_2]):
         subnets_unpaged = subnet_api.get_subnets(self.context, filters={})
         subnets_paged = subnet_api.get_subnets(self.context,
                                                subnets_per_page,
                                                False, ['id'],
                                                filters={})
         self.assertEqual(len(subnets_paged), subnets_per_page)
         self.assertNotEqual(len(subnets_unpaged), subnets_per_page)
示例#4
0
文件: plugin.py 项目: lmaycotte/quark
 def get_subnets(self, context, limit=None, page_reverse=False, sorts=None,
                 marker=None, filters=None, fields=None):
     return subnets.get_subnets(context, limit, page_reverse, sorts, marker,
                                filters, fields)
示例#5
0
文件: plugin.py 项目: sumanthns/quark
 def get_subnets(self, context, filters=None, fields=None):
     return subnets.get_subnets(context, filters, fields)
示例#6
0
文件: plugin.py 项目: thomasem/quark
 def get_subnets(self, context, filters=None, fields=None):
     return subnets.get_subnets(context, filters, fields)