mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 16:48:16 -06:00
Merge f00f717bfb
into b10635a9b1
This commit is contained in:
commit
faee08a5ba
@ -44,7 +44,7 @@ class InterfaceQuerySet(QuerySet):
|
|||||||
|
|
||||||
TYPE_RE = r"SUBSTRING({} FROM '^([^0-9]+)')"
|
TYPE_RE = r"SUBSTRING({} FROM '^([^0-9]+)')"
|
||||||
ID_RE = r"CAST(SUBSTRING({} FROM '^(?:[^0-9]+)(\d{{1,9}})$') AS integer)"
|
ID_RE = r"CAST(SUBSTRING({} FROM '^(?:[^0-9]+)(\d{{1,9}})$') AS integer)"
|
||||||
SLOT_RE = r"CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(\d{{1,9}})\/') AS integer)"
|
SLOT_RE = r"CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(\d{{1,9}})\/?') AS integer)"
|
||||||
SUBSLOT_RE = r"COALESCE(CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(?:\d{{1,9}}\/)(\d{{1,9}})') AS integer), 0)"
|
SUBSLOT_RE = r"COALESCE(CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(?:\d{{1,9}}\/)(\d{{1,9}})') AS integer), 0)"
|
||||||
POSITION_RE = r"COALESCE(CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(?:\d{{1,9}}\/){{2}}(\d{{1,9}})') AS integer), 0)"
|
POSITION_RE = r"COALESCE(CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(?:\d{{1,9}}\/){{2}}(\d{{1,9}})') AS integer), 0)"
|
||||||
SUBPOSITION_RE = r"COALESCE(CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(?:\d{{1,9}}\/){{3}}(\d{{1,9}})') AS integer), 0)"
|
SUBPOSITION_RE = r"COALESCE(CAST(SUBSTRING({} FROM '^(?:[^0-9]+)?(?:\d{{1,9}}\/){{3}}(\d{{1,9}})') AS integer), 0)"
|
||||||
|
@ -216,10 +216,9 @@ class InterfaceTestCase(TestCase):
|
|||||||
device=device1,
|
device=device1,
|
||||||
name='Loopback1'
|
name='Loopback1'
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list(Interface.objects.all().order_naturally()),
|
list(Interface.objects.all().order_naturally()),
|
||||||
[interface1, interface5, interface4, interface3, interface2, interface6]
|
[interface6, interface1, interface5, interface4, interface3, interface2]
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_interface_order_natural_subinterfaces(self):
|
def test_interface_order_natural_subinterfaces(self):
|
||||||
@ -256,7 +255,15 @@ class InterfaceTestCase(TestCase):
|
|||||||
device=device1,
|
device=device1,
|
||||||
name='GigabitEthernet0'
|
name='GigabitEthernet0'
|
||||||
)
|
)
|
||||||
|
interface7 = Interface.objects.create(
|
||||||
|
device=device1,
|
||||||
|
name='Loopback1'
|
||||||
|
)
|
||||||
|
interface8 = Interface.objects.create(
|
||||||
|
device=device1,
|
||||||
|
name='Loopback1.1'
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list(Interface.objects.all().order_naturally()),
|
list(Interface.objects.all().order_naturally()),
|
||||||
[interface4, interface3, interface5, interface2, interface1, interface6]
|
[interface6, interface4, interface3, interface5, interface2, interface1, interface7, interface8]
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user