Add a few additional useful functions
- is_*() returns True if the interface name is of a certain type is_bondethernet() is_loopback() is_bvi() is_bridgedomain() is_vxlan_tunnel() is_phy() - get_phys() by process of elimination, returns all interface names that are supposed to be physical network interfaces. Add unit tests for validator/vxlan_tunnel.py => Notable: while here, fix a bug in get_by_name() Add unit tests for all the is_*() and get_phys() functions.
This commit is contained in:
@ -180,3 +180,14 @@ class TestInterfaceMethods(unittest.TestCase):
|
||||
|
||||
ifname, iface = interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.201")
|
||||
self.assertEqual(ifname, "GigabitEthernet1/0/1.200")
|
||||
|
||||
def test_get_phys(self):
|
||||
phys = interface.get_phys(self.cfg)
|
||||
print(phys)
|
||||
self.assertEqual(len(phys), 6)
|
||||
self.assertIn("GigabitEthernet1/0/0", phys)
|
||||
self.assertNotIn("GigabitEthernet1/0/0.100", phys)
|
||||
|
||||
def test_is_phy(self):
|
||||
self.assertTrue(interface.is_phy(self.cfg, "GigabitEthernet1/0/0"))
|
||||
self.assertFalse(interface.is_phy(self.cfg, "GigabitEthernet1/0/0.100"))
|
||||
|
Reference in New Issue
Block a user