]> git.proxmox.com Git - mirror_frr.git/blame - tests/bgpd/test_aspath.py
Merge pull request #3310 from adeg/bugfix/bgpd-mplsvpn-route-import-check
[mirror_frr.git] / tests / bgpd / test_aspath.py
CommitLineData
a4b74d05
CF
1import frrtest
2import re
3
4re_okfail = re.compile(r'^(?:\x1b\[3[12]m)?(?P<ret>OK|failed)'.encode('utf8'),
5 re.MULTILINE)
6
7class TestAspath(frrtest.TestMultiOut):
8 program = './test_aspath'
9
10 def _parsertest(self, line):
11 if not hasattr(self, 'parserno'):
12 self.parserno = -1
13 self.parserno += 1
14
15 self._onesimple("test %d" % self.parserno)
16 self._okfail("%s:" % line, okfail=re_okfail)
17 self._okfail("empty prepend %s:" % line, okfail=re_okfail)
18
19 def _attrtest(self, line):
20 if not hasattr(self, 'attrno'):
21 self.attrno = -1
22 self.attrno += 1
23
24 self._onesimple("aspath_attr test %d" % self.attrno)
25 self._okfail(line, okfail=re_okfail)
26
27TestAspath.parsertest("seq1")
28TestAspath.parsertest("seq2")
29TestAspath.parsertest("seq3")
30TestAspath.parsertest("seqset")
31TestAspath.parsertest("seqset2")
32TestAspath.parsertest("multi")
33TestAspath.parsertest("confed")
34TestAspath.parsertest("confed2")
35TestAspath.parsertest("confset")
36TestAspath.parsertest("confmulti")
37TestAspath.parsertest("seq4")
38TestAspath.parsertest("tripleseq1")
39TestAspath.parsertest("someprivate")
40TestAspath.parsertest("allprivate")
41TestAspath.parsertest("long")
42TestAspath.parsertest("seq1extra")
43TestAspath.parsertest("empty")
44TestAspath.parsertest("redundantset")
45TestAspath.parsertest("reconcile_lead_asp")
46TestAspath.parsertest("reconcile_new_asp")
47TestAspath.parsertest("reconcile_confed")
48TestAspath.parsertest("reconcile_start_trans")
49TestAspath.parsertest("reconcile_start_trans4")
50TestAspath.parsertest("reconcile_start_trans_error")
51TestAspath.parsertest("redundantset2")
52TestAspath.parsertest("zero-size overflow")
53TestAspath.parsertest("zero-size overflow + valid segment")
54TestAspath.parsertest("invalid segment type")
55
56for i in range(10):
57 TestAspath.okfail("prepend test %d" % i)
58for i in range(5):
59 TestAspath.okfail("aggregate test %d" % i)
60for i in range(5):
61 TestAspath.okfail("reconcile test %d" % i)
62for _ in range(22):
63 TestAspath.okfail("left cmp ")
64
65TestAspath.okfail("empty_get_test")
66
67TestAspath.attrtest("basic test")
68TestAspath.attrtest("length too short")
69TestAspath.attrtest("length too long")
70TestAspath.attrtest("incorrect flag")
71TestAspath.attrtest("as4_path, with as2 format data")
72TestAspath.attrtest("as4, with incorrect attr length")
73TestAspath.attrtest("basic 4-byte as-path")
74TestAspath.attrtest("4b AS_PATH: too short")
75TestAspath.attrtest("4b AS_PATH: too long")
76TestAspath.attrtest("4b AS_PATH: too long2")
77TestAspath.attrtest("4b AS_PATH: bad flags")
78TestAspath.attrtest("4b AS4_PATH w/o AS_PATH")
79TestAspath.attrtest("4b AS4_PATH: confed")