mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38:38 -06:00
feat(virtualization): Add tests for VLAN mode filtering
Introduces tests to validate filtering by `mode` for VMInterface. Ensures correct filtering for 802.1Q VLAN mode.
This commit is contained in:
parent
adb6b3aa1d
commit
9203f65f98
@ -605,6 +605,7 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|||||||
mtu=100,
|
mtu=100,
|
||||||
vrf=vrfs[0],
|
vrf=vrfs[0],
|
||||||
description='foobar1',
|
description='foobar1',
|
||||||
|
mode=InterfaceModeChoices.MODE_ACCESS,
|
||||||
vlan_translation_policy=vlan_translation_policies[0],
|
vlan_translation_policy=vlan_translation_policies[0],
|
||||||
),
|
),
|
||||||
VMInterface(
|
VMInterface(
|
||||||
@ -614,6 +615,7 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|||||||
mtu=200,
|
mtu=200,
|
||||||
vrf=vrfs[1],
|
vrf=vrfs[1],
|
||||||
description='foobar2',
|
description='foobar2',
|
||||||
|
mode=InterfaceModeChoices.MODE_TAGGED,
|
||||||
vlan_translation_policy=vlan_translation_policies[0],
|
vlan_translation_policy=vlan_translation_policies[0],
|
||||||
),
|
),
|
||||||
VMInterface(
|
VMInterface(
|
||||||
@ -699,6 +701,10 @@ class VMInterfaceTestCase(TestCase, ChangeLoggedFilterSetTests):
|
|||||||
params = {'description': ['foobar1', 'foobar2']}
|
params = {'description': ['foobar1', 'foobar2']}
|
||||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||||
|
|
||||||
|
def test_mode(self):
|
||||||
|
params = {'mode': [InterfaceModeChoices.MODE_ACCESS]}
|
||||||
|
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
|
||||||
|
|
||||||
def test_vlan(self):
|
def test_vlan(self):
|
||||||
vlan = VLAN.objects.filter(qinq_role=VLANQinQRoleChoices.ROLE_SERVICE).first()
|
vlan = VLAN.objects.filter(qinq_role=VLANQinQRoleChoices.ROLE_SERVICE).first()
|
||||||
params = {'vlan_id': vlan.pk}
|
params = {'vlan_id': vlan.pk}
|
||||||
|
Loading…
Reference in New Issue
Block a user