Add the beginning of a test_qinx() suite, will complete after a refactor in an upcoming commit
This commit is contained in:
@ -11,10 +11,11 @@ interfaces:
|
||||
mtu: 9000
|
||||
encapsulation:
|
||||
dot1q: 1000
|
||||
exact-match: True
|
||||
addresses: [ "10.0.1.1/30" ]
|
||||
201:
|
||||
encapsulation:
|
||||
dot1ad: 1000
|
||||
dot1q: 1000
|
||||
inner-dot1q: 1000
|
||||
exact-match: True
|
||||
addresses: [ "10.0.2.1/30" ]
|
||||
|
@ -42,9 +42,9 @@ def get_qinx_parent_by_name(yaml, ifname):
|
||||
if not sub_encap:
|
||||
continue
|
||||
if qinx_encap['dot1q'] > 0 and sub_encap['dot1q'] == qinx_encap['dot1q']:
|
||||
return sub_ifname
|
||||
return sub_iface
|
||||
if qinx_encap['dot1ad'] > 0 and sub_encap['dot1ad'] == qinx_encap['dot1ad']:
|
||||
return sub_ifname
|
||||
return sub_iface
|
||||
return None
|
||||
|
||||
|
||||
|
@ -116,8 +116,8 @@ class TestInterfaceMethods(unittest.TestCase):
|
||||
self.assertFalse(interface.is_l3(self.cfg, "GigabitEthernet3/0/0"))
|
||||
|
||||
def test_qinx_parent(self):
|
||||
self.assertEqual(interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.202"), "GigabitEthernet1/0/1.200")
|
||||
self.assertEqual(interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.203"), "GigabitEthernet1/0/1.201")
|
||||
self.assertIsNotNone(interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.202"))
|
||||
self.assertIsNotNone(interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.203"))
|
||||
self.assertIsNone(interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1"))
|
||||
self.assertIsNone(interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.100"))
|
||||
self.assertIsNone(interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.200"))
|
||||
|
@ -1,6 +1,7 @@
|
||||
import unittest
|
||||
import yaml
|
||||
import validator.lcp as lcp
|
||||
import validator.interface as interface
|
||||
|
||||
class TestLCPMethods(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@ -13,3 +14,13 @@ class TestLCPMethods(unittest.TestCase):
|
||||
|
||||
## TODO(pim) - ensure that is_unique also takes synthesized LCPs into account
|
||||
## self.assertFalse(lcp.is_unique(self.cfg, "e1.1000"))
|
||||
|
||||
def test_qinx(self):
|
||||
qinq_iface = interface.get_by_name(self.cfg, "GigabitEthernet1/0/1.201")
|
||||
mid_iface = interface.get_qinx_parent_by_name(self.cfg, "GigabitEthernet1/0/1.201")
|
||||
parent_iface = interface.get_parent_by_name(self.cfg, "GigabitEthernet1/0/1.201")
|
||||
|
||||
# TODO(pim) - complete once get_*_by_name() returns a dict
|
||||
# print("qinq", qinq_iface)
|
||||
# print("mid", mid_iface)
|
||||
# print("parent", parent_iface)
|
||||
|
Reference in New Issue
Block a user