Add the case of the ifname being the source of an l2xc to the is_l2() logic1

This is more strict than VPP itself, which does allow a destination to
be L3 while the source is L2:

DBGvpp# show mode
l3 local0
l3 GigabitEthernet3/0/0
l3 GigabitEthernet3/0/1
l3 HundredGigabitEthernet12/0/0
l3 HundredGigabitEthernet12/0/1

DBGvpp# set interface l2 xconnect GigabitEthernet3/0/0 GigabitEthernet3/0/1

DBGvpp# show mode
l3 local0
l2 xconnect GigabitEthernet3/0/0 GigabitEthernet3/0/1
l3 GigabitEthernet3/0/1
l3 HundredGigabitEthernet12/0/0
l3 HundredGigabitEthernet12/0/1

But it seems undesirable to have Gi3/0/1 be in l3 mode even though it's
the target of a cross connect, so I'm going to leave the behavior
stricter than VPP.
This commit is contained in:
Pim van Pelt
2022-03-22 14:21:30 +00:00
parent 5ebaf5e005
commit 6688c6b243
2 changed files with 5 additions and 1 deletions

View File

@ -125,6 +125,8 @@ class TestInterfaceMethods(unittest.TestCase):
def test_l2(self):
self.assertTrue(interface.is_l2(self.cfg, "GigabitEthernet3/0/0"))
self.assertFalse(interface.is_l2(self.cfg, "GigabitEthernet1/0/0"))
self.assertTrue(interface.is_l2(self.cfg, "GigabitEthernet3/0/2.100"))
self.assertTrue(interface.is_l2(self.cfg, "GigabitEthernet3/0/2.200"))
def test_l3(self):
self.assertTrue(interface.is_l3(self.cfg, "GigabitEthernet1/0/0"))