summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bgpd/test_aspath.c29
-rw-r--r--tests/bgpd/test_aspath.py2
-rw-r--r--tests/bgpd/test_mp_attr.c21
-rw-r--r--tests/isisd/test_fuzz_isis_tlv_tests.h.gzbin206007 -> 182891 bytes
-rwxr-xr-xtests/topotests/all-protocol-startup/test_all_protocol_startup.py4
-rwxr-xr-xtests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py6
-rwxr-xr-xtests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py9
-rw-r--r--tests/topotests/bgp_prefix_sid/__init__.py0
-rw-r--r--tests/topotests/bgp_prefix_sid/exabgp.env53
-rw-r--r--tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg103
-rwxr-xr-xtests/topotests/bgp_prefix_sid/peer2/exa-receive.py37
-rw-r--r--tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg19
-rw-r--r--tests/topotests/bgp_prefix_sid/r1/bgpd.conf15
-rw-r--r--tests/topotests/bgp_prefix_sid/r1/zebra.conf7
-rwxr-xr-xtests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py173
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/ldpd.conf25
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf7
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json12
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/show_ip_route.ref171
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_binding.ref55
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_discovery.ref11
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_neighbor.ref10
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r1/zebra.conf17
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/ldpd.conf28
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf7
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json31
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/show_ip_route.ref209
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_binding.ref63
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_discovery.ref18
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_neighbor.ref16
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r2/zebra.conf27
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/ldpd.conf24
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf8
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json20
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/show_ip_route.ref209
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_binding.ref62
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_discovery.ref11
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_neighbor.ref10
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r3/zebra.conf22
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/ldpd.conf24
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf7
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json21
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/show_ip_route.ref196
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_binding.ref68
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_discovery.ref2
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_neighbor.ref2
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/r4/zebra.conf17
-rw-r--r--tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.dot76
-rwxr-xr-xtests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.py227
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/ldpd.conf24
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/ospfd.conf7
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json12
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/show_ip_route.ref171
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/show_ldp_binding.ref61
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/show_ldp_discovery.ref11
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/show_ldp_neighbor.ref10
-rw-r--r--tests/topotests/ldp-oc-topo1/r1/zebra.conf17
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/ldpd.conf28
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/ospfd.conf7
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json31
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/show_ip_route.ref209
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/show_ldp_binding.ref63
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/show_ldp_discovery.ref18
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/show_ldp_neighbor.ref16
-rw-r--r--tests/topotests/ldp-oc-topo1/r2/zebra.conf27
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/ldpd.conf24
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/ospfd.conf8
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json20
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/show_ip_route.ref209
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/show_ldp_binding.ref61
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/show_ldp_discovery.ref11
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/show_ldp_neighbor.ref10
-rw-r--r--tests/topotests/ldp-oc-topo1/r3/zebra.conf22
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/ldpd.conf24
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/ospfd.conf7
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json21
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/show_ip_route.ref196
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/show_ldp_binding.ref68
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/show_ldp_discovery.ref2
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/show_ldp_neighbor.ref2
-rw-r--r--tests/topotests/ldp-oc-topo1/r4/zebra.conf17
-rw-r--r--tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.dot76
-rwxr-xr-xtests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.py227
-rw-r--r--tests/topotests/ldp-topo1/r1/ip_mpls_route.ref1
-rw-r--r--tests/topotests/lib/bgp.py4
-rwxr-xr-xtests/topotests/ospf6-topo1/test_ospf6_topo1.py12
-rw-r--r--tests/topotests/pim-basic/r1/pimd.conf4
-rw-r--r--tests/topotests/pim-basic/r1/zebra.conf3
-rw-r--r--tests/topotests/pim-basic/r3/pimd.conf1
-rw-r--r--tests/topotests/pim-basic/r3/zebra.conf8
-rw-r--r--tests/topotests/pim-basic/rp/pimd.conf3
-rw-r--r--tests/topotests/pim-basic/test_pim.py13
92 files changed, 3932 insertions, 25 deletions
diff --git a/tests/bgpd/test_aspath.c b/tests/bgpd/test_aspath.c
index 9feec7156a..b94355e8b8 100644
--- a/tests/bgpd/test_aspath.c
+++ b/tests/bgpd/test_aspath.c
@@ -474,6 +474,20 @@ static struct test_segment {
14,
{NULL, NULL, 0, 0, 0, 0, 0, 0},
},
+ {
+ /* 28 */
+ "BGP_AS_ZERO",
+ "seq(8466,3,52737,0,4096)",
+ {0x2, 0x5,
+ 0x21, 0x12,
+ 0x00, 0x03,
+ 0xce, 0x01,
+ 0x00, 0x00,
+ 0x10, 0x00},
+ 12,
+ {"8466 3 52737 0 4096", "8466 3 52737 0 4096", 5, 0,
+ NOT_ALL_PRIVATE, 4096, 4, 8466},
+ },
{NULL, NULL, {0}, 0, {NULL, 0, 0}}};
#define COMMON_ATTRS \
@@ -678,6 +692,21 @@ static struct aspath_tests {
COMMON_ATTR_SIZE + 3,
&test_segments[0],
},
+ /* 13 */
+ {
+ "4b AS4_PATH: BGP_AS_ZERO",
+ &test_segments[28],
+ "8466 3 52737 0 4096",
+ AS4_DATA,
+ -1,
+ PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV,
+ {
+ COMMON_ATTRS,
+ BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL,
+ BGP_ATTR_AS4_PATH, 22,
+ },
+ COMMON_ATTR_SIZE + 3,
+ },
{NULL, NULL, NULL, 0, 0, 0, {0}, 0},
};
diff --git a/tests/bgpd/test_aspath.py b/tests/bgpd/test_aspath.py
index 15ae514c87..5fa1f11629 100644
--- a/tests/bgpd/test_aspath.py
+++ b/tests/bgpd/test_aspath.py
@@ -52,6 +52,7 @@ TestAspath.parsertest("redundantset2")
TestAspath.parsertest("zero-size overflow")
TestAspath.parsertest("zero-size overflow + valid segment")
TestAspath.parsertest("invalid segment type")
+TestAspath.parsertest("BGP_AS_ZERO")
for i in range(10):
TestAspath.okfail("prepend test %d" % i)
@@ -77,3 +78,4 @@ TestAspath.attrtest("4b AS_PATH: too long2")
TestAspath.attrtest("4b AS_PATH: bad flags")
TestAspath.attrtest("4b AS4_PATH w/o AS_PATH")
TestAspath.attrtest("4b AS4_PATH: confed")
+TestAspath.attrtest("4b AS4_PATH: BGP_AS_ZERO")
diff --git a/tests/bgpd/test_mp_attr.c b/tests/bgpd/test_mp_attr.c
index c97ea57150..7fabaad7fa 100644
--- a/tests/bgpd/test_mp_attr.c
+++ b/tests/bgpd/test_mp_attr.c
@@ -951,12 +951,19 @@ static struct test_segment mp_prefix_sid[] = {
"PREFIX-SID",
"PREFIX-SID Test 1",
{
- 0x01, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x02,
- 0x03, 0x00, 0x08, 0x00,
- 0x00, 0x0a, 0x1b, 0xfe,
- 0x00, 0x00, 0x0a
+ /* TLV[0] Latel-Index TLV */
+ 0x01, /* Type 0x01:Label-Index */
+ 0x00, 0x07, /* Length */
+ 0x00, /* RESERVED */
+ 0x00, 0x00, /* Flags */
+ 0x00, 0x00, 0x00, 0x02, /* Label Index */
+
+ /* TLV[1] SRGB TLV */
+ 0x03, /* Type 0x03:SRGB */
+ 0x00, 0x08, /* Length */
+ 0x00, 0x00, /* Flags */
+ 0x0a, 0x1b, 0xfe, /* SRGB[0] first label */
+ 0x00, 0x00, 0x0a /* SRBG[0] nb-labels in range */
},
.len = 21,
.parses = SHOULD_PARSE,
@@ -1027,7 +1034,7 @@ static void parse_test(struct peer *peer, struct test_segment *t, int type)
parse_ret = bgp_mp_unreach_parse(&attr_args, &nlri);
break;
case BGP_ATTR_PREFIX_SID:
- parse_ret = bgp_attr_prefix_sid(&attr_args, &nlri);
+ parse_ret = bgp_attr_prefix_sid(&attr_args);
break;
default:
printf("unknown type");
diff --git a/tests/isisd/test_fuzz_isis_tlv_tests.h.gz b/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
index 46e45e5ee0..4f59d1d7c0 100644
--- a/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
+++ b/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
Binary files differ
diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
index 16609221c1..a671e14e07 100755
--- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
+++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
@@ -307,7 +307,7 @@ def test_converge_protocols():
expected = open(v4_routesFile).read().rstrip()
expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1)
- actual = net['r%s' %i].cmd('vtysh -c "show ip route" | /usr/bin/tail -n +7 | sort 2> /dev/null').rstrip()
+ actual = net['r%s' %i].cmd('vtysh -c "show ip route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null').rstrip()
# Drop time in last update
actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual)
actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)
@@ -329,7 +329,7 @@ def test_converge_protocols():
expected = open(v6_routesFile).read().rstrip()
expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1)
- actual = net['r%s' %i].cmd('vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | sort 2> /dev/null').rstrip()
+ actual = net['r%s' %i].cmd('vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null').rstrip()
# Drop time in last update
actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual)
actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1)
diff --git a/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py b/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py
index 59858d6fd3..e2bd80daa8 100755
--- a/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py
+++ b/tests/topotests/bfd-bgp-cbit-topo3/test_bfd_bgp_cbit_topo3.py
@@ -142,7 +142,7 @@ def test_bfd_connection():
test_func = partial(topotest.router_json_cmp,
router, 'show bfd peers json', expected)
- _, result = topotest.run_and_expect(test_func, None, count=8, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=16, wait=0.5)
assertmsg = '"{}" JSON output mismatches'.format(router.name)
assert result is None, assertmsg
@@ -173,7 +173,7 @@ def test_bfd_loss_intermediate():
test_func = partial(topotest.router_json_cmp,
router, 'show bfd peers json', expected)
- _, result = topotest.run_and_expect(test_func, None, count=8, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=16, wait=0.5)
assertmsg = '"{}" JSON output mismatches'.format(router.name)
assert result is None, assertmsg
@@ -229,7 +229,7 @@ def test_bfd_comes_back_again():
test_func = partial(topotest.router_json_cmp,
router, 'show bfd peers json', expected)
- _, result = topotest.run_and_expect(test_func, None, count=8, wait=0.5)
+ _, result = topotest.run_and_expect(test_func, None, count=16, wait=0.5)
assertmsg = '"{}" JSON output mismatches'.format(router.name)
assert result is None, assertmsg
diff --git a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py
index e99111d90b..43639a81d1 100755
--- a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py
+++ b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py
@@ -79,6 +79,9 @@ try:
except IOError:
assert False, "Could not read file {}".format(jsonFile)
+#Global Variable
+KEEPALIVETIMER = 2
+HOLDDOWNTIMER = 6
class CreateTopo(Topo):
"""
@@ -292,8 +295,8 @@ def test_bgp_timers_functionality(request):
"r2": {
"dest_link":{
"r1": {
- "keepalivetimer": 60,
- "holddowntimer": 180,
+ "keepalivetimer": KEEPALIVETIMER,
+ "holddowntimer": HOLDDOWNTIMER
}
}
}
@@ -319,8 +322,6 @@ def test_bgp_timers_functionality(request):
write_test_footer(tc_name)
-
-
def test_static_routes(request):
""" Test to create and verify static routes. """
diff --git a/tests/topotests/bgp_prefix_sid/__init__.py b/tests/topotests/bgp_prefix_sid/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/__init__.py
diff --git a/tests/topotests/bgp_prefix_sid/exabgp.env b/tests/topotests/bgp_prefix_sid/exabgp.env
new file mode 100644
index 0000000000..6c554f5fa8
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/exabgp.env
@@ -0,0 +1,53 @@
+
+[exabgp.api]
+encoder = text
+highres = false
+respawn = false
+socket = ''
+
+[exabgp.bgp]
+openwait = 60
+
+[exabgp.cache]
+attributes = true
+nexthops = true
+
+[exabgp.daemon]
+daemonize = true
+pid = '/var/run/exabgp/exabgp.pid'
+user = 'exabgp'
+
+[exabgp.log]
+all = false
+configuration = true
+daemon = true
+destination = '/var/log/exabgp.log'
+enable = true
+level = INFO
+message = false
+network = true
+packets = false
+parser = false
+processes = true
+reactor = true
+rib = false
+routes = false
+short = false
+timers = false
+
+[exabgp.pdb]
+enable = false
+
+[exabgp.profile]
+enable = false
+file = ''
+
+[exabgp.reactor]
+speed = 1.0
+
+[exabgp.tcp]
+acl = false
+bind = ''
+delay = 0
+once = false
+port = 179
diff --git a/tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg b/tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg
new file mode 100644
index 0000000000..5b55366a0e
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg
@@ -0,0 +1,103 @@
+group controller {
+ neighbor 10.0.0.1 {
+ router-id 10.0.0.101;
+ local-address 10.0.0.101;
+ local-as 2;
+ peer-as 1;
+
+ family {
+ ipv4 nlri-mpls;
+ }
+
+ static {
+ # ref: draft-ietf-idr-bgp-prefix-sid-27
+ #
+ # IANA temporarily assigned the following:
+ # attribute code type (suggested value: 40) to
+ # the BGP Prefix-SID attribute
+ #
+ # 0 1 2 3
+ # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | Type | Length | RESERVED |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | Flags | Label Index |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | Label Index |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # Figure. Label-Index TLV (Prefix-SID type-1)
+ #
+ # 0 1 2 3
+ # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | Type | Length | Flags |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | Flags |
+ # +-+-+-+-+-+-+-+-+
+ #
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | SRGB 1 (6 octets) |
+ # | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ #
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | SRGB n (6 octets) |
+ # | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<Paste>
+ # Figure. Originator SRGB TLV (Prefix-SID type-3)
+
+ # ExaBGP generic-attribute binary pattern:
+ # Attribute-type: 0x28 (40:BGP_PREFIX_SID)
+ # Attribute-flag: 0xc0 (Option, Transitive)
+ # Attribute-body: Label-Index TLV and Originator SRGB TLV
+ # Label-Index TLV: 0x01000700000000000001
+ # Type (08bit): 0x01
+ # Length (16bit): 0x0007
+ # RESERVED (08bit): 0x00
+ # Flags (16bit): 0x0000
+ # Label Index (32bit): 0x00000001
+ # Originator SRGB TLV: 0x03000800000c350000000a
+ # Type (08bit): 0x03
+ # Length (16bit): 0x0008 (nb-SRGB is 1)
+ # Flags (16bit): 0x0000
+ # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
+ route 3.0.0.1/32 next-hop 10.0.0.101 label [800001] attribute [0x28 0xc0 0x0100070000000000000103000800000c350000000a];
+
+ # ExaBGP generic-attribute binary pattern:
+ # Attribute-type: 0x28 (40:BGP_PREFIX_SID)
+ # Attribute-flag: 0xc0 (Option, Transitive)
+ # Attribute-body: Label-Index TLV and Originator SRGB TLV
+ # Label-Index TLV: 0x01000700000000000001
+ # Type (08bit): 0x01
+ # Length (16bit): 0x0007
+ # RESERVED (08bit): 0x00
+ # Flags (16bit): 0x0000
+ # Label Index (32bit): 0x00000002
+ # Originator SRGB TLV: 0x03000800000c350000000a
+ # Type (08bit): 0x03
+ # Length (16bit): 0x0008 (nb-SRGB is 1)
+ # Flags (16bit): 0x0000
+ # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
+ route 3.0.0.2/32 next-hop 10.0.0.101 label [800002] attribute [0x28 0xc0 0x0100070000000000000203000800000c350000000a];
+
+ # ExaBGP generic-attribute binary pattern:
+ # Attribute-type: 0x28 (40:BGP_PREFIX_SID)
+ # Attribute-flag: 0xc0 (Option, Transitive)
+ # Attribute-body: Label-Index TLV and Originator SRGB TLV
+ # Label-Index TLV: 0x01000700000000000001
+ # Type (08bit): 0x01
+ # Length (16bit): 0x0007
+ # RESERVED (08bit): 0x00
+ # Flags (16bit): 0x0000
+ # Label Index (32bit): 0x00000003
+ # Originator SRGB TLV: 0x03000800000c350000000a
+ # Type (08bit): 0x03
+ # Length (16bit): 0x0008 (nb-SRGB is 1)
+ # Flags (16bit): 0x0000
+ # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
+ route 3.0.0.3/32 next-hop 10.0.0.101 label [800003] attribute [0x28 0xc0 0x0100070000000000000303000800000c350000000a];
+ }
+ }
+}
diff --git a/tests/topotests/bgp_prefix_sid/peer2/exa-receive.py b/tests/topotests/bgp_prefix_sid/peer2/exa-receive.py
new file mode 100755
index 0000000000..eaa6a67872
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/peer2/exa-receive.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+"""
+exa-receive.py: Save received routes form ExaBGP into file
+"""
+
+from sys import stdin,argv
+from datetime import datetime
+
+# 1st arg is peer number
+peer = int(argv[1])
+
+# When the parent dies we are seeing continual newlines, so we only access so many before stopping
+counter = 0
+
+routesavefile = open('/tmp/peer%s-received.log' % peer, 'w')
+
+while True:
+ try:
+ line = stdin.readline()
+ routesavefile.write(line)
+ routesavefile.flush()
+
+ if line == "":
+ counter += 1
+ if counter > 100:
+ break
+ continue
+
+ counter = 0
+ except KeyboardInterrupt:
+ pass
+ except IOError:
+ # most likely a signal during readline
+ pass
+
+routesavefile.close()
diff --git a/tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg b/tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg
new file mode 100644
index 0000000000..dabd88e03d
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg
@@ -0,0 +1,19 @@
+group controller {
+
+ process receive-routes {
+ run "/etc/exabgp/exa-receive.py 2";
+ receive-routes;
+ encoder json;
+ }
+
+ neighbor 10.0.0.1 {
+ router-id 10.0.0.102;
+ local-address 10.0.0.102;
+ local-as 3;
+ peer-as 1;
+
+ family {
+ ipv4 nlri-mpls;
+ }
+ }
+}
diff --git a/tests/topotests/bgp_prefix_sid/r1/bgpd.conf b/tests/topotests/bgp_prefix_sid/r1/bgpd.conf
new file mode 100644
index 0000000000..7a38cc307f
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/r1/bgpd.conf
@@ -0,0 +1,15 @@
+log stdout notifications
+log monitor notifications
+log commands
+!
+router bgp 1
+ bgp router-id 10.0.0.1
+ no bgp default ipv4-unicast
+ neighbor 10.0.0.101 remote-as 2
+ neighbor 10.0.0.102 remote-as 3
+ !
+ address-family ipv4 labeled-unicast
+ neighbor 10.0.0.101 activate
+ neighbor 10.0.0.102 activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_prefix_sid/r1/zebra.conf b/tests/topotests/bgp_prefix_sid/r1/zebra.conf
new file mode 100644
index 0000000000..0cd26052f2
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/r1/zebra.conf
@@ -0,0 +1,7 @@
+hostname r1
+!
+interface r1-eth0
+ ip address 10.0.0.1/24
+ no shutdown
+!
+line vty
diff --git a/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py b/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py
new file mode 100755
index 0000000000..dc203cabc5
--- /dev/null
+++ b/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py
@@ -0,0 +1,173 @@
+#!/usr/bin/env python
+
+#
+# test_bgp_prefix_sid.py
+# Part of NetDEF Topology Tests
+#
+# Copyright (c) 2020 by LINE Corporation
+# Copyright (c) 2020 by Hiroki Shirokura <slank.dev@gmail.com>
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+test_bgp_prefix_sid.py: Test BGP topology with EBGP on prefix-sid
+"""
+
+import json
+import os
+import sys
+import functools
+import pytest
+
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, '../'))
+
+# pylint: disable=C0413
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+from mininet.topo import Topo
+
+
+class TemplateTopo(Topo):
+ def build(self, **_opts):
+ tgen = get_topogen(self)
+ router = tgen.add_router('r1')
+ switch = tgen.add_switch('s1')
+ switch.add_link(router)
+
+ switch = tgen.gears['s1']
+ peer1 = tgen.add_exabgp_peer('peer1', ip='10.0.0.101', defaultRoute='via 10.0.0.1')
+ peer2 = tgen.add_exabgp_peer('peer2', ip='10.0.0.102', defaultRoute='via 10.0.0.1')
+ switch.add_link(peer1)
+ switch.add_link(peer2)
+
+
+def setup_module(module):
+ tgen = Topogen(TemplateTopo, module.__name__)
+ tgen.start_topology()
+
+ router = tgen.gears['r1']
+ router.load_config(TopoRouter.RD_ZEBRA, os.path.join(CWD, '{}/zebra.conf'.format('r1')))
+ router.load_config(TopoRouter.RD_BGP, os.path.join(CWD, '{}/bgpd.conf'.format('r1')))
+ router.start()
+
+ logger.info('starting exaBGP on peer1')
+ peer_list = tgen.exabgp_peers()
+ for pname, peer in peer_list.iteritems():
+ peer_dir = os.path.join(CWD, pname)
+ env_file = os.path.join(CWD, 'exabgp.env')
+ logger.info('Running ExaBGP peer')
+ peer.start(peer_dir, env_file)
+ logger.info(pname)
+
+
+def teardown_module(module):
+ tgen = get_topogen()
+ tgen.stop_topology()
+
+
+def test_r1_receive_and_advertise_prefix_sid_type1():
+ tgen = get_topogen()
+ router = tgen.gears['r1']
+
+ def _check_type1_r1(router, prefix, remoteLabel, labelIndex):
+ output = router.vtysh_cmd('show bgp ipv4 labeled-unicast {} json'.format(prefix))
+ output = json.loads(output)
+ expected = {
+ 'prefix': prefix,
+ 'advertisedTo': { '10.0.0.101':{}, '10.0.0.102':{} },
+ 'paths': [{
+ 'valid':True,
+ 'remoteLabel': remoteLabel,
+ 'labelIndex': labelIndex,
+ }]
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_check_type1_r1, router, '3.0.0.1/32', 800001, 1)
+ success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result is None, 'Failed _check_type1_r1 in "{}"'.format(router)
+
+ test_func = functools.partial(_check_type1_r1, router, '3.0.0.2/32', 800002, 2)
+ success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result is None, 'Failed _check_type1_r1 in "{}"'.format(router)
+
+
+def exabgp_get_update_prefix(filename, afi, nexthop, prefix):
+ with open('/tmp/peer2-received.log') as f:
+ for line in f.readlines():
+ output = json.loads(line)
+ ret = output.get('neighbor')
+ if ret is None:
+ continue
+ ret = ret.get('message')
+ if ret is None:
+ continue
+ ret = ret.get('update')
+ if ret is None:
+ continue
+ ret = ret.get('announce')
+ if ret is None:
+ continue
+ ret = ret.get(afi)
+ if ret is None:
+ continue
+ ret = ret.get(nexthop)
+ if ret is None:
+ continue
+ ret = ret.get(prefix)
+ if ret is None:
+ continue
+ return output
+ return "Not found"
+
+
+def test_peer2_receive_prefix_sid_type1():
+ tgen = get_topogen()
+ peer2 = tgen.gears['peer2']
+
+ def _check_type1_peer2(prefix, labelindex):
+ output = exabgp_get_update_prefix('/tmp/peer2-received.log', 'ipv4 nlri-mpls', '10.0.0.101', prefix)
+ expected = {
+ 'type': 'update',
+ 'neighbor': {
+ 'ip': '10.0.0.1',
+ 'message': {
+ 'update': {
+ 'attribute': {
+ 'attribute-0x28-0xE0': '0x010007000000{:08x}'.format(labelindex)
+ },
+ 'announce': { 'ipv4 nlri-mpls': { '10.0.0.101': {} } }
+ }
+ }
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_check_type1_peer2, '3.0.0.1/32', labelindex=1)
+ success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result is None, 'Failed _check_type1_peer2 in "{}"'.format('peer2')
+
+ test_func = functools.partial(_check_type1_peer2, '3.0.0.2/32', labelindex=2)
+ success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result is None, 'Failed _check_type1_peer2 in "{}"'.format('peer2')
+
+
+if __name__ == '__main__':
+ args = ["-s"] + sys.argv[1:]
+ ret = pytest.main(args)
+ sys.exit(ret)
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/ldpd.conf b/tests/topotests/ldp-oc-acl-topo1/r1/ldpd.conf
new file mode 100644
index 0000000000..85bb970fdf
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/ldpd.conf
@@ -0,0 +1,25 @@
+hostname r1
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 1.1.1.1
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 1.1.1.1
+ label local allocate host-routes
+ !
+ interface r1-eth0
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf
new file mode 100644
index 0000000000..6daf034d18
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf
@@ -0,0 +1,7 @@
+hostname r1
+log file ospfd.log
+!
+router ospf
+ router-id 1.1.1.1
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..2c493173f5
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json
@@ -0,0 +1,12 @@
+{
+ "neighbors":{
+ "2.2.2.2":[
+ {
+ "priority":1,
+ "state":"Full\/DR",
+ "address":"10.0.1.2",
+ "ifaceName":"r1-eth0:10.0.1.1"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_route.ref b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_route.ref
new file mode 100644
index 0000000000..d75b8f21db
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_route.ref
@@ -0,0 +1,171 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"connected",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0/24":[
+ {
+ "prefix":"10.0.1.0/24",
+ "protocol":"ospf",
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.1.0/24",
+ "protocol":"connected",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0/24":[
+ {
+ "prefix":"10.0.2.0/24",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0/24":[
+ {
+ "prefix":"10.0.3.0/24",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0/24":[
+ {
+ "prefix":"123.0.1.0/24",
+ "protocol":"ospf",
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"123.0.1.0/24",
+ "protocol":"connected",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_binding.ref b/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_binding.ref
new file mode 100644
index 0000000000..ccc8413646
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_binding.ref
@@ -0,0 +1,55 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"2.2.2.2",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"2.2.2.2",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"2.2.2.2",
+ "localLabel":"-",
+ "remoteLabel":"imp-null",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"2.2.2.2",
+ "localLabel":"-",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"2.2.2.2",
+ "localLabel":"-",
+ "inUse":1
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_discovery.ref b/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_discovery.ref
new file mode 100644
index 0000000000..b349f4418f
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_discovery.ref
@@ -0,0 +1,11 @@
+{
+ "adjacencies":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "type":"link",
+ "interface":"r1-eth0",
+ "helloHoldtime":15
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..4bff444a46
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/show_ldp_neighbor.ref
@@ -0,0 +1,10 @@
+{
+ "neighbors":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "state":"OPERATIONAL",
+ "transportAddress":"2.2.2.2"
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/zebra.conf b/tests/topotests/ldp-oc-acl-topo1/r1/zebra.conf
new file mode 100644
index 0000000000..83aea46e64
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r1/zebra.conf
@@ -0,0 +1,17 @@
+log file zebra.log
+!
+hostname r1
+!
+interface lo
+ ip address 1.1.1.1/32
+!
+interface r1-eth0
+ description to sw0
+ ip address 10.0.1.1/24
+ ip address 123.0.1.1/24
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/ldpd.conf b/tests/topotests/ldp-oc-acl-topo1/r2/ldpd.conf
new file mode 100644
index 0000000000..e1a552c701
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/ldpd.conf
@@ -0,0 +1,28 @@
+hostname r2
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 2.2.2.2
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 2.2.2.2
+ !
+ interface r2-eth0
+ !
+ interface r2-eth1
+ !
+ interface r2-eth2
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf
new file mode 100644
index 0000000000..8678813665
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf
@@ -0,0 +1,7 @@
+hostname r2
+log file ospfd.log
+!
+router ospf
+ router-id 2.2.2.2
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..55f12359e5
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json
@@ -0,0 +1,31 @@
+{
+ "neighbors":{
+ "1.1.1.1":[
+ {
+ "priority":1,
+ "state":"Full\/Backup",
+ "address":"10.0.1.1",
+ "ifaceName":"r2-eth0:10.0.1.2",
+ "retransmitCounter":0,
+ "requestCounter":0,
+ "dbSummaryCounter":0
+ }
+ ],
+ "3.3.3.3":[
+ {
+ "priority":1,
+ "state":"Full\/Backup",
+ "address":"10.0.2.3",
+ "ifaceName":"r2-eth1:10.0.2.2"
+ }
+ ],
+ "4.4.4.4":[
+ {
+ "priority":1,
+ "state":"Full\/DR",
+ "address":"10.0.2.4",
+ "ifaceName":"r2-eth1:10.0.2.2"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_route.ref b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_route.ref
new file mode 100644
index 0000000000..060c0b429d
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_route.ref
@@ -0,0 +1,209 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":0,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.4",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0\/24":[
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0\/24":[
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0\/24":[
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0\/24":[
+ {
+ "prefix":"123.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_binding.ref b/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_binding.ref
new file mode 100644
index 0000000000..ea32de3eda
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_binding.ref
@@ -0,0 +1,63 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"1.1.1.1",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"3.3.3.3",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"3.3.3.3",
+ "localLabel":"imp-null",
+ "remoteLabel":"imp-null",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"3.3.3.3",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"123.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_discovery.ref b/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_discovery.ref
new file mode 100644
index 0000000000..8129570082
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_discovery.ref
@@ -0,0 +1,18 @@
+{
+ "adjacencies":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"1.1.1.1",
+ "type":"link",
+ "interface":"r2-eth0",
+ "helloHoldtime":15
+ },
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"3.3.3.3",
+ "type":"link",
+ "interface":"r2-eth1",
+ "helloHoldtime":15
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..eed35289ea
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/show_ldp_neighbor.ref
@@ -0,0 +1,16 @@
+{
+ "neighbors":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"1.1.1.1",
+ "state":"OPERATIONAL",
+ "transportAddress":"1.1.1.1"
+ },
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"3.3.3.3",
+ "state":"OPERATIONAL",
+ "transportAddress":"3.3.3.3"
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/zebra.conf b/tests/topotests/ldp-oc-acl-topo1/r2/zebra.conf
new file mode 100644
index 0000000000..1f1e3e391a
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r2/zebra.conf
@@ -0,0 +1,27 @@
+log file zebra.log
+!
+hostname r2
+!
+interface lo
+ ip address 2.2.2.2/32
+!
+interface r2-eth0
+ description to sw0
+ ip address 10.0.1.2/24
+! no link-detect
+!
+interface r2-eth1
+ description to sw1
+ ip address 10.0.2.2/24
+! no link-detect
+!
+interface r2-eths2
+ description to sw2
+ ip address 10.0.3.2/24
+! no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/ldpd.conf b/tests/topotests/ldp-oc-acl-topo1/r3/ldpd.conf
new file mode 100644
index 0000000000..4e66b140ac
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/ldpd.conf
@@ -0,0 +1,24 @@
+hostname r3
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 3.3.3.3
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 3.3.3.3
+ !
+ interface r3-eth0
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf
new file mode 100644
index 0000000000..202be238ec
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf
@@ -0,0 +1,8 @@
+hostname r3
+password 1
+log file ospfd.log
+!
+router ospf
+ router-id 3.3.3.3
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..24502ed813
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json
@@ -0,0 +1,20 @@
+{
+ "neighbors":{
+ "2.2.2.2":[
+ {
+ "priority":1,
+ "state":"Full\/DROther",
+ "address":"10.0.2.2",
+ "ifaceName":"r3-eth0:10.0.2.3"
+ }
+ ],
+ "4.4.4.4":[
+ {
+ "priority":1,
+ "state":"Full\/DR",
+ "address":"10.0.2.4",
+ "ifaceName":"r3-eth0:10.0.2.3"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_route.ref b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_route.ref
new file mode 100644
index 0000000000..40800762ba
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_route.ref
@@ -0,0 +1,209 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":0,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.4",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0\/24":[
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0\/24":[
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0\/24":[
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r3-eth1",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r3-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0\/24":[
+ {
+ "prefix":"123.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":30,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_binding.ref b/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_binding.ref
new file mode 100644
index 0000000000..bb1b2b3023
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_binding.ref
@@ -0,0 +1,62 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"2.2.2.2",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"2.2.2.2",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"2.2.2.2",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"2.2.2.2",
+ "localLabel":"imp-null",
+ "remoteLabel":"imp-null",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"123.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_discovery.ref b/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_discovery.ref
new file mode 100644
index 0000000000..c3a07e7e38
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_discovery.ref
@@ -0,0 +1,11 @@
+{
+ "adjacencies":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "type":"link",
+ "interface":"r3-eth0",
+ "helloHoldtime":15
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..4bff444a46
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/show_ldp_neighbor.ref
@@ -0,0 +1,10 @@
+{
+ "neighbors":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "state":"OPERATIONAL",
+ "transportAddress":"2.2.2.2"
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/zebra.conf b/tests/topotests/ldp-oc-acl-topo1/r3/zebra.conf
new file mode 100644
index 0000000000..234c215ddf
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r3/zebra.conf
@@ -0,0 +1,22 @@
+log file zebra.log
+!
+hostname r3
+!
+interface lo
+ ip address 3.3.3.3/32
+!
+interface r3-eth0
+ description to sw1
+ ip address 10.0.2.3/24
+! no link-detect
+!
+interface r3-eth1
+ description to sw2
+ ip address 10.0.3.3/24
+! no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/ldpd.conf b/tests/topotests/ldp-oc-acl-topo1/r4/ldpd.conf
new file mode 100644
index 0000000000..6b7d28f983
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/ldpd.conf
@@ -0,0 +1,24 @@
+hostname r4
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 4.4.4.4
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 4.4.4.4
+ !
+ !interface r4-eth0
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf
new file mode 100644
index 0000000000..569dbc54e2
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf
@@ -0,0 +1,7 @@
+hostname r4
+log file ospfd.log
+!
+router ospf
+ router-id 4.4.4.4
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..794410522d
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json
@@ -0,0 +1,21 @@
+
+{
+ "neighbors":{
+ "2.2.2.2":[
+ {
+ "priority":1,
+ "state":"Full\/DROther",
+ "address":"10.0.2.2",
+ "ifaceName":"r4-eth0:10.0.2.4"
+ }
+ ],
+ "3.3.3.3":[
+ {
+ "priority":1,
+ "state":"Full\/Backup",
+ "address":"10.0.2.3",
+ "ifaceName":"r4-eth0:10.0.2.4"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_route.ref b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_route.ref
new file mode 100644
index 0000000000..c9b83a1c73
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_route.ref
@@ -0,0 +1,196 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":0,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0\/24":[
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0\/24":[
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0\/24":[
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0\/24":[
+ {
+ "prefix":"123.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":30,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_binding.ref b/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_binding.ref
new file mode 100644
index 0000000000..2a46c40346
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_binding.ref
@@ -0,0 +1,68 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"123.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_discovery.ref b/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_discovery.ref
new file mode 100644
index 0000000000..2c63c08510
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_discovery.ref
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..2c63c08510
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/show_ldp_neighbor.ref
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/zebra.conf b/tests/topotests/ldp-oc-acl-topo1/r4/zebra.conf
new file mode 100644
index 0000000000..7e291053e5
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/r4/zebra.conf
@@ -0,0 +1,17 @@
+log file zebra.log
+!
+hostname r4
+!
+interface lo
+ ip address 4.4.4.4/32
+!
+interface r4-eth0
+ description to sw1
+ ip address 10.0.2.4/24
+! no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.dot b/tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.dot
new file mode 100644
index 0000000000..62058e3cb1
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.dot
@@ -0,0 +1,76 @@
+## Color coding:
+#########################
+## Main FRR: #f08080 red
+## Switches: #d0e0d0 gray
+## RIP: #19e3d9 Cyan
+## RIPng: #fcb314 dark yellow
+## OSPFv2: #32b835 Green
+## OSPFv3: #19e3d9 Cyan
+## ISIS IPv4 #fcb314 dark yellow
+## ISIS IPv6 #9a81ec purple
+## BGP IPv4 #eee3d3 beige
+## BGP IPv6 #fdff00 yellow
+##### Colors (see http://www.color-hex.com/)
+
+graph template {
+ label="Test Topology - LDP-OC 1";
+
+ # Routers
+ r1 [
+ shape=doubleoctagon,
+ label="r1",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r2 [
+ shape=doubleoctagon
+ label="r2",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r3 [
+ shape=doubleoctagon
+ label="r3",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r4 [
+ shape=doubleoctagon
+ label="r4",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+
+
+ # Switches
+ s0 [
+ shape=oval,
+ label="10.0.1.0/24",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ s1 [
+ shape=oval,
+ label="10.0.2.0/24",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ s2 [
+ shape=oval,
+ label="10.0.3.0/24",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+
+ # Connections
+
+ r1 -- s0 [label="eth0"];
+ r2 -- s0 [label="eth0"];
+
+ r2 -- s1 [label="eth1"];
+ r3 -- s1 [label="eth0"];
+ r4 -- s1 [label="eth0"];
+
+ r2 -- s2 [label="eth2"];
+ r3 -- s2 [label="eth1"];
+}
diff --git a/tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.py b/tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.py
new file mode 100755
index 0000000000..47b32a16e6
--- /dev/null
+++ b/tests/topotests/ldp-oc-acl-topo1/test_ldp_oc_acl_topo1.py
@@ -0,0 +1,227 @@
+#!/usr/bin/env python
+
+#
+# test_ldp_oc_acl_topo1.py
+# Part of NetDEF Topology Tests
+#
+# Copyright (c) 2020 by Volta Networks
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+test_ldp_oc_acl_topo1.py: Simple FRR/Quagga LDP Test
+
+ +---------+
+ | r1 |
+ | 1.1.1.1 |
+ +----+----+
+ | .1 r1-eth0
+ |
+ ~~~~~~~~~~~~~
+ ~~ sw0 ~~
+ ~~ 10.0.1.0/24 ~~
+ ~~~~~~~~~~~~~
+ |10.0.1.0/24
+ |
+ | .2 r2-eth0
+ +----+----+
+ | r2 |
+ | 2.2.2.2 |
+ +--+---+--+
+ r2-eth2 .2 | | .2 r2-eth1
+ ______/ \______
+ / \
+ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
+~~ sw2 ~~ ~~ sw1 ~~
+~~ 10.0.3.0/24 ~~ ~~ 10.0.2.0/24 ~~
+ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
+ | / |
+ \ _________/ |
+ \ / \
+r3-eth1 .3 | | .3 r3-eth0 | .4 r4-eth0
+ +----+--+---+ +----+----+
+ | r3 | | r4 |
+ | 3.3.3.3 | | 4.4.4.4 |
+ +-----------+ +---------+
+"""
+
+import os
+import sys
+import pytest
+import json
+from time import sleep
+from functools import partial
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, '../'))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+from mininet.topo import Topo
+
+class TemplateTopo(Topo):
+ "Test topology builder"
+ def build(self, *_args, **_opts):
+ "Build function"
+ tgen = get_topogen(self)
+
+ #
+ # Define FRR Routers
+ #
+ for router in ['r1', 'r2', 'r3', 'r4']:
+ tgen.add_router(router)
+
+ #
+ # Define connections
+ #
+ switch = tgen.add_switch('s0')
+ switch.add_link(tgen.gears['r1'])
+ switch.add_link(tgen.gears['r2'])
+
+ switch = tgen.add_switch('s1')
+ switch.add_link(tgen.gears['r2'])
+ switch.add_link(tgen.gears['r3'])
+ switch.add_link(tgen.gears['r4'])
+
+ switch = tgen.add_switch('s2')
+ switch.add_link(tgen.gears['r2'])
+ switch.add_link(tgen.gears['r3'])
+
+def setup_module(mod):
+ "Sets up the pytest environment"
+ tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen.start_topology()
+
+ router_list = tgen.routers()
+
+ # For all registered routers, load the zebra configuration file
+ for rname, router in router_list.iteritems():
+ router.load_config(
+ TopoRouter.RD_ZEBRA,
+ os.path.join(CWD, '{}/zebra.conf'.format(rname))
+ )
+ # Don't start ospfd and ldpd in the CE nodes
+ if router.name[0] == 'r':
+ router.load_config(
+ TopoRouter.RD_OSPF,
+ os.path.join(CWD, '{}/ospfd.conf'.format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_LDP,
+ os.path.join(CWD, '{}/ldpd.conf'.format(rname))
+ )
+
+ tgen.start_router()
+
+def teardown_module(mod):
+ "Teardown the pytest environment"
+ tgen = get_topogen()
+
+ # This function tears down the whole topology.
+ tgen.stop_topology()
+
+
+def router_compare_json_output(rname, command, reference):
+ "Compare router JSON output"
+
+ logger.info('Comparing router "%s" "%s" output', rname, command)
+
+ tgen = get_topogen()
+ filename = '{}/{}/{}'.format(CWD, rname, reference)
+ expected = json.loads(open(filename).read())
+
+ # Run test function until we get an result. Wait at most 80 seconds.
+ test_func = partial(topotest.router_json_cmp,
+ tgen.gears[rname], command, expected)
+ _, diff = topotest.run_and_expect(test_func, None, count=160, wait=0.5)
+
+ assertmsg = '"{}" JSON output mismatches the expected result'.format(rname)
+ assert diff is None, assertmsg
+
+def test_ospf_convergence():
+ logger.info("Test: check OSPF adjacencies")
+
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show ip ospf neighbor json", "show_ip_ospf_neighbor.json")
+
+def test_rib():
+ logger.info("Test: verify RIB")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show ip route json", "show_ip_route.ref")
+
+def test_ldp_adjacencies():
+ logger.info("Test: verify LDP adjacencies")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show mpls ldp discovery json", "show_ldp_discovery.ref")
+
+def test_ldp_neighbors():
+ logger.info("Test: verify LDP neighbors")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show mpls ldp neighbor json", "show_ldp_neighbor.ref")
+
+def test_ldp_bindings():
+ logger.info("Test: verify LDP bindings")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show mpls ldp binding json", "show_ldp_binding.ref")
+
+# Memory leak test template
+def test_memory_leak():
+ "Run the memory leak test and report results."
+ tgen = get_topogen()
+ if not tgen.is_memleak_enabled():
+ pytest.skip('Memory leak test/report is disabled')
+
+ tgen.report_memory_leaks()
+
+if __name__ == '__main__':
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/ldp-oc-topo1/r1/ldpd.conf b/tests/topotests/ldp-oc-topo1/r1/ldpd.conf
new file mode 100644
index 0000000000..2a8e023832
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/ldpd.conf
@@ -0,0 +1,24 @@
+hostname r1
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 1.1.1.1
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 1.1.1.1
+ !
+ interface r1-eth0
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/r1/ospfd.conf b/tests/topotests/ldp-oc-topo1/r1/ospfd.conf
new file mode 100644
index 0000000000..6daf034d18
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/ospfd.conf
@@ -0,0 +1,7 @@
+hostname r1
+log file ospfd.log
+!
+router ospf
+ router-id 1.1.1.1
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..2c493173f5
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json
@@ -0,0 +1,12 @@
+{
+ "neighbors":{
+ "2.2.2.2":[
+ {
+ "priority":1,
+ "state":"Full\/DR",
+ "address":"10.0.1.2",
+ "ifaceName":"r1-eth0:10.0.1.1"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-topo1/r1/show_ip_route.ref b/tests/topotests/ldp-oc-topo1/r1/show_ip_route.ref
new file mode 100644
index 0000000000..d75b8f21db
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/show_ip_route.ref
@@ -0,0 +1,171 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"connected",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0/24":[
+ {
+ "prefix":"10.0.1.0/24",
+ "protocol":"ospf",
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.1.0/24",
+ "protocol":"connected",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0/24":[
+ {
+ "prefix":"10.0.2.0/24",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0/24":[
+ {
+ "prefix":"10.0.3.0/24",
+ "protocol":"ospf",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0/24":[
+ {
+ "prefix":"123.0.1.0/24",
+ "protocol":"ospf",
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"123.0.1.0/24",
+ "protocol":"connected",
+ "selected":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r1-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r1/show_ldp_binding.ref b/tests/topotests/ldp-oc-topo1/r1/show_ldp_binding.ref
new file mode 100644
index 0000000000..99a59668f8
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/show_ldp_binding.ref
@@ -0,0 +1,61 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"2.2.2.2",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"2.2.2.2",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"2.2.2.2",
+ "localLabel":"imp-null",
+ "remoteLabel":"imp-null",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"2.2.2.2",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"2.2.2.2",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"123.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r1/show_ldp_discovery.ref b/tests/topotests/ldp-oc-topo1/r1/show_ldp_discovery.ref
new file mode 100644
index 0000000000..b349f4418f
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/show_ldp_discovery.ref
@@ -0,0 +1,11 @@
+{
+ "adjacencies":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "type":"link",
+ "interface":"r1-eth0",
+ "helloHoldtime":15
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r1/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-topo1/r1/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..4bff444a46
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/show_ldp_neighbor.ref
@@ -0,0 +1,10 @@
+{
+ "neighbors":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "state":"OPERATIONAL",
+ "transportAddress":"2.2.2.2"
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r1/zebra.conf b/tests/topotests/ldp-oc-topo1/r1/zebra.conf
new file mode 100644
index 0000000000..83aea46e64
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r1/zebra.conf
@@ -0,0 +1,17 @@
+log file zebra.log
+!
+hostname r1
+!
+interface lo
+ ip address 1.1.1.1/32
+!
+interface r1-eth0
+ description to sw0
+ ip address 10.0.1.1/24
+ ip address 123.0.1.1/24
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/r2/ldpd.conf b/tests/topotests/ldp-oc-topo1/r2/ldpd.conf
new file mode 100644
index 0000000000..e1a552c701
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/ldpd.conf
@@ -0,0 +1,28 @@
+hostname r2
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 2.2.2.2
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 2.2.2.2
+ !
+ interface r2-eth0
+ !
+ interface r2-eth1
+ !
+ interface r2-eth2
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/r2/ospfd.conf b/tests/topotests/ldp-oc-topo1/r2/ospfd.conf
new file mode 100644
index 0000000000..8678813665
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/ospfd.conf
@@ -0,0 +1,7 @@
+hostname r2
+log file ospfd.log
+!
+router ospf
+ router-id 2.2.2.2
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..55f12359e5
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json
@@ -0,0 +1,31 @@
+{
+ "neighbors":{
+ "1.1.1.1":[
+ {
+ "priority":1,
+ "state":"Full\/Backup",
+ "address":"10.0.1.1",
+ "ifaceName":"r2-eth0:10.0.1.2",
+ "retransmitCounter":0,
+ "requestCounter":0,
+ "dbSummaryCounter":0
+ }
+ ],
+ "3.3.3.3":[
+ {
+ "priority":1,
+ "state":"Full\/Backup",
+ "address":"10.0.2.3",
+ "ifaceName":"r2-eth1:10.0.2.2"
+ }
+ ],
+ "4.4.4.4":[
+ {
+ "priority":1,
+ "state":"Full\/DR",
+ "address":"10.0.2.4",
+ "ifaceName":"r2-eth1:10.0.2.2"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-topo1/r2/show_ip_route.ref b/tests/topotests/ldp-oc-topo1/r2/show_ip_route.ref
new file mode 100644
index 0000000000..060c0b429d
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/show_ip_route.ref
@@ -0,0 +1,209 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":0,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.4",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0\/24":[
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0\/24":[
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0\/24":[
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":3,
+ "interfaceName":"r2-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0\/24":[
+ {
+ "prefix":"123.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.1.1",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r2-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r2/show_ldp_binding.ref b/tests/topotests/ldp-oc-topo1/r2/show_ldp_binding.ref
new file mode 100644
index 0000000000..95fb847c1e
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/show_ldp_binding.ref
@@ -0,0 +1,63 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"1.1.1.1",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"3.3.3.3",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"1.1.1.1",
+ "localLabel":"imp-null",
+ "remoteLabel":"imp-null",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"3.3.3.3",
+ "localLabel":"imp-null",
+ "remoteLabel":"imp-null",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"3.3.3.3",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"123.0.1.0/24",
+ "neighborId":"1.1.1.1",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r2/show_ldp_discovery.ref b/tests/topotests/ldp-oc-topo1/r2/show_ldp_discovery.ref
new file mode 100644
index 0000000000..8129570082
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/show_ldp_discovery.ref
@@ -0,0 +1,18 @@
+{
+ "adjacencies":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"1.1.1.1",
+ "type":"link",
+ "interface":"r2-eth0",
+ "helloHoldtime":15
+ },
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"3.3.3.3",
+ "type":"link",
+ "interface":"r2-eth1",
+ "helloHoldtime":15
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r2/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-topo1/r2/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..eed35289ea
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/show_ldp_neighbor.ref
@@ -0,0 +1,16 @@
+{
+ "neighbors":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"1.1.1.1",
+ "state":"OPERATIONAL",
+ "transportAddress":"1.1.1.1"
+ },
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"3.3.3.3",
+ "state":"OPERATIONAL",
+ "transportAddress":"3.3.3.3"
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r2/zebra.conf b/tests/topotests/ldp-oc-topo1/r2/zebra.conf
new file mode 100644
index 0000000000..1f1e3e391a
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r2/zebra.conf
@@ -0,0 +1,27 @@
+log file zebra.log
+!
+hostname r2
+!
+interface lo
+ ip address 2.2.2.2/32
+!
+interface r2-eth0
+ description to sw0
+ ip address 10.0.1.2/24
+! no link-detect
+!
+interface r2-eth1
+ description to sw1
+ ip address 10.0.2.2/24
+! no link-detect
+!
+interface r2-eths2
+ description to sw2
+ ip address 10.0.3.2/24
+! no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/r3/ldpd.conf b/tests/topotests/ldp-oc-topo1/r3/ldpd.conf
new file mode 100644
index 0000000000..4e66b140ac
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/ldpd.conf
@@ -0,0 +1,24 @@
+hostname r3
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 3.3.3.3
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 3.3.3.3
+ !
+ interface r3-eth0
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/r3/ospfd.conf b/tests/topotests/ldp-oc-topo1/r3/ospfd.conf
new file mode 100644
index 0000000000..202be238ec
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/ospfd.conf
@@ -0,0 +1,8 @@
+hostname r3
+password 1
+log file ospfd.log
+!
+router ospf
+ router-id 3.3.3.3
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..24502ed813
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json
@@ -0,0 +1,20 @@
+{
+ "neighbors":{
+ "2.2.2.2":[
+ {
+ "priority":1,
+ "state":"Full\/DROther",
+ "address":"10.0.2.2",
+ "ifaceName":"r3-eth0:10.0.2.3"
+ }
+ ],
+ "4.4.4.4":[
+ {
+ "priority":1,
+ "state":"Full\/DR",
+ "address":"10.0.2.4",
+ "ifaceName":"r3-eth0:10.0.2.3"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-topo1/r3/show_ip_route.ref b/tests/topotests/ldp-oc-topo1/r3/show_ip_route.ref
new file mode 100644
index 0000000000..40800762ba
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/show_ip_route.ref
@@ -0,0 +1,209 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":0,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.4",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0\/24":[
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0\/24":[
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0\/24":[
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r3-eth1",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":3,
+ "interfaceName":"r3-eth1",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0\/24":[
+ {
+ "prefix":"123.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":30,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r3-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r3/show_ldp_binding.ref b/tests/topotests/ldp-oc-topo1/r3/show_ldp_binding.ref
new file mode 100644
index 0000000000..100dd307ea
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/show_ldp_binding.ref
@@ -0,0 +1,61 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"2.2.2.2",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"2.2.2.2",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"2.2.2.2",
+ "remoteLabel":"imp-null",
+ "inUse":1
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"2.2.2.2",
+ "localLabel":"imp-null",
+ "remoteLabel":"imp-null",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"123.0.1.0/24",
+ "neighborId":"2.2.2.2",
+ "inUse":1
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r3/show_ldp_discovery.ref b/tests/topotests/ldp-oc-topo1/r3/show_ldp_discovery.ref
new file mode 100644
index 0000000000..c3a07e7e38
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/show_ldp_discovery.ref
@@ -0,0 +1,11 @@
+{
+ "adjacencies":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "type":"link",
+ "interface":"r3-eth0",
+ "helloHoldtime":15
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r3/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-topo1/r3/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..4bff444a46
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/show_ldp_neighbor.ref
@@ -0,0 +1,10 @@
+{
+ "neighbors":[
+ {
+ "addressFamily":"ipv4",
+ "neighborId":"2.2.2.2",
+ "state":"OPERATIONAL",
+ "transportAddress":"2.2.2.2"
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r3/zebra.conf b/tests/topotests/ldp-oc-topo1/r3/zebra.conf
new file mode 100644
index 0000000000..234c215ddf
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r3/zebra.conf
@@ -0,0 +1,22 @@
+log file zebra.log
+!
+hostname r3
+!
+interface lo
+ ip address 3.3.3.3/32
+!
+interface r3-eth0
+ description to sw1
+ ip address 10.0.2.3/24
+! no link-detect
+!
+interface r3-eth1
+ description to sw2
+ ip address 10.0.3.3/24
+! no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/r4/ldpd.conf b/tests/topotests/ldp-oc-topo1/r4/ldpd.conf
new file mode 100644
index 0000000000..6b7d28f983
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/ldpd.conf
@@ -0,0 +1,24 @@
+hostname r4
+log file ldpd.log
+!
+debug mpls ldp zebra
+debug mpls ldp event
+debug mpls ldp errors
+debug mpls ldp messages recv
+debug mpls ldp messages sent
+debug mpls ldp discovery hello recv
+debug mpls ldp discovery hello sent
+!
+mpls ldp
+ router-id 4.4.4.4
+ ordered-control
+ !
+ address-family ipv4
+ discovery transport-address 4.4.4.4
+ !
+ !interface r4-eth0
+ !
+ !
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/r4/ospfd.conf b/tests/topotests/ldp-oc-topo1/r4/ospfd.conf
new file mode 100644
index 0000000000..569dbc54e2
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/ospfd.conf
@@ -0,0 +1,7 @@
+hostname r4
+log file ospfd.log
+!
+router ospf
+ router-id 4.4.4.4
+ network 0.0.0.0/0 area 0
+!
diff --git a/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json
new file mode 100644
index 0000000000..794410522d
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json
@@ -0,0 +1,21 @@
+
+{
+ "neighbors":{
+ "2.2.2.2":[
+ {
+ "priority":1,
+ "state":"Full\/DROther",
+ "address":"10.0.2.2",
+ "ifaceName":"r4-eth0:10.0.2.4"
+ }
+ ],
+ "3.3.3.3":[
+ {
+ "priority":1,
+ "state":"Full\/Backup",
+ "address":"10.0.2.3",
+ "ifaceName":"r4-eth0:10.0.2.4"
+ }
+ ]
+ }
+}
diff --git a/tests/topotests/ldp-oc-topo1/r4/show_ip_route.ref b/tests/topotests/ldp-oc-topo1/r4/show_ip_route.ref
new file mode 100644
index 0000000000..c9b83a1c73
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/show_ip_route.ref
@@ -0,0 +1,196 @@
+{
+ "1.1.1.1/32":[
+ {
+ "prefix":"1.1.1.1/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "3.3.3.3/32":[
+ {
+ "prefix":"3.3.3.3/32",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":10,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "4.4.4.4/32":[
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":0,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"4.4.4.4/32",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":1,
+ "interfaceName":"lo",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.1.0\/24":[
+ {
+ "prefix":"10.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.2.0\/24":[
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"ospf",
+ "distance":110,
+ "metric":10,
+ "nexthops":[
+ {
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ },
+ {
+ "prefix":"10.0.2.0\/24",
+ "protocol":"connected",
+ "selected":true,
+ "destSelected":true,
+ "distance":0,
+ "metric":0,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "directlyConnected":true,
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "10.0.3.0\/24":[
+ {
+ "prefix":"10.0.3.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":20,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ],
+ "123.0.1.0\/24":[
+ {
+ "prefix":"123.0.1.0\/24",
+ "protocol":"ospf",
+ "selected":true,
+ "destSelected":true,
+ "distance":110,
+ "metric":30,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.2",
+ "afi":"ipv4",
+ "interfaceIndex":2,
+ "interfaceName":"r4-eth0",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r4/show_ldp_binding.ref b/tests/topotests/ldp-oc-topo1/r4/show_ldp_binding.ref
new file mode 100644
index 0000000000..2a46c40346
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/show_ldp_binding.ref
@@ -0,0 +1,68 @@
+{
+ "bindings":[
+ {
+ "addressFamily":"ipv4",
+ "prefix":"1.1.1.1/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"2.2.2.2/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"3.3.3.3/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"4.4.4.4/32",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.2.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"10.0.3.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ },
+ {
+ "addressFamily":"ipv4",
+ "prefix":"123.0.1.0/24",
+ "neighborId":"0.0.0.0",
+ "localLabel":"imp-null",
+ "remoteLabel":"-",
+ "inUse":0
+ }
+ ]
+}
diff --git a/tests/topotests/ldp-oc-topo1/r4/show_ldp_discovery.ref b/tests/topotests/ldp-oc-topo1/r4/show_ldp_discovery.ref
new file mode 100644
index 0000000000..2c63c08510
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/show_ldp_discovery.ref
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/topotests/ldp-oc-topo1/r4/show_ldp_neighbor.ref b/tests/topotests/ldp-oc-topo1/r4/show_ldp_neighbor.ref
new file mode 100644
index 0000000000..2c63c08510
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/show_ldp_neighbor.ref
@@ -0,0 +1,2 @@
+{
+}
diff --git a/tests/topotests/ldp-oc-topo1/r4/zebra.conf b/tests/topotests/ldp-oc-topo1/r4/zebra.conf
new file mode 100644
index 0000000000..7e291053e5
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/r4/zebra.conf
@@ -0,0 +1,17 @@
+log file zebra.log
+!
+hostname r4
+!
+interface lo
+ ip address 4.4.4.4/32
+!
+interface r4-eth0
+ description to sw1
+ ip address 10.0.2.4/24
+! no link-detect
+!
+ip forwarding
+!
+!
+line vty
+!
diff --git a/tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.dot b/tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.dot
new file mode 100644
index 0000000000..62058e3cb1
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.dot
@@ -0,0 +1,76 @@
+## Color coding:
+#########################
+## Main FRR: #f08080 red
+## Switches: #d0e0d0 gray
+## RIP: #19e3d9 Cyan
+## RIPng: #fcb314 dark yellow
+## OSPFv2: #32b835 Green
+## OSPFv3: #19e3d9 Cyan
+## ISIS IPv4 #fcb314 dark yellow
+## ISIS IPv6 #9a81ec purple
+## BGP IPv4 #eee3d3 beige
+## BGP IPv6 #fdff00 yellow
+##### Colors (see http://www.color-hex.com/)
+
+graph template {
+ label="Test Topology - LDP-OC 1";
+
+ # Routers
+ r1 [
+ shape=doubleoctagon,
+ label="r1",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r2 [
+ shape=doubleoctagon
+ label="r2",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r3 [
+ shape=doubleoctagon
+ label="r3",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+ r4 [
+ shape=doubleoctagon
+ label="r4",
+ fillcolor="#f08080",
+ style=filled,
+ ];
+
+
+ # Switches
+ s0 [
+ shape=oval,
+ label="10.0.1.0/24",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ s1 [
+ shape=oval,
+ label="10.0.2.0/24",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+ s2 [
+ shape=oval,
+ label="10.0.3.0/24",
+ fillcolor="#d0e0d0",
+ style=filled,
+ ];
+
+ # Connections
+
+ r1 -- s0 [label="eth0"];
+ r2 -- s0 [label="eth0"];
+
+ r2 -- s1 [label="eth1"];
+ r3 -- s1 [label="eth0"];
+ r4 -- s1 [label="eth0"];
+
+ r2 -- s2 [label="eth2"];
+ r3 -- s2 [label="eth1"];
+}
diff --git a/tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.py b/tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.py
new file mode 100755
index 0000000000..eda1b37e52
--- /dev/null
+++ b/tests/topotests/ldp-oc-topo1/test_ldp_oc_topo1.py
@@ -0,0 +1,227 @@
+#!/usr/bin/env python
+
+#
+# test_ldp_oc_topo1.py
+# Part of NetDEF Topology Tests
+#
+# Copyright (c) 2020 by by Volta Networks
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+test_ldp_oc_topo1.py: Simple FRR/Quagga LDP Test
+
+ +---------+
+ | r1 |
+ | 1.1.1.1 |
+ +----+----+
+ | .1 r1-eth0
+ |
+ ~~~~~~~~~~~~~
+ ~~ sw0 ~~
+ ~~ 10.0.1.0/24 ~~
+ ~~~~~~~~~~~~~
+ |10.0.1.0/24
+ |
+ | .2 r2-eth0
+ +----+----+
+ | r2 |
+ | 2.2.2.2 |
+ +--+---+--+
+ r2-eth2 .2 | | .2 r2-eth1
+ ______/ \______
+ / \
+ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
+~~ sw2 ~~ ~~ sw1 ~~
+~~ 10.0.3.0/24 ~~ ~~ 10.0.2.0/24 ~~
+ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~
+ | / |
+ \ _________/ |
+ \ / \
+r3-eth1 .3 | | .3 r3-eth0 | .4 r4-eth0
+ +----+--+---+ +----+----+
+ | r3 | | r4 |
+ | 3.3.3.3 | | 4.4.4.4 |
+ +-----------+ +---------+
+"""
+
+import os
+import sys
+import pytest
+import json
+from time import sleep
+from functools import partial
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, '../'))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+from mininet.topo import Topo
+
+class TemplateTopo(Topo):
+ "Test topology builder"
+ def build(self, *_args, **_opts):
+ "Build function"
+ tgen = get_topogen(self)
+
+ #
+ # Define FRR Routers
+ #
+ for router in ['r1', 'r2', 'r3', 'r4']:
+ tgen.add_router(router)
+
+ #
+ # Define connections
+ #
+ switch = tgen.add_switch('s0')
+ switch.add_link(tgen.gears['r1'])
+ switch.add_link(tgen.gears['r2'])
+
+ switch = tgen.add_switch('s1')
+ switch.add_link(tgen.gears['r2'])
+ switch.add_link(tgen.gears['r3'])
+ switch.add_link(tgen.gears['r4'])
+
+ switch = tgen.add_switch('s2')
+ switch.add_link(tgen.gears['r2'])
+ switch.add_link(tgen.gears['r3'])
+
+def setup_module(mod):
+ "Sets up the pytest environment"
+ tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen.start_topology()
+
+ router_list = tgen.routers()
+
+ # For all registered routers, load the zebra configuration file
+ for rname, router in router_list.iteritems():
+ router.load_config(
+ TopoRouter.RD_ZEBRA,
+ os.path.join(CWD, '{}/zebra.conf'.format(rname))
+ )
+ # Don't start ospfd and ldpd in the CE nodes
+ if router.name[0] == 'r':
+ router.load_config(
+ TopoRouter.RD_OSPF,
+ os.path.join(CWD, '{}/ospfd.conf'.format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_LDP,
+ os.path.join(CWD, '{}/ldpd.conf'.format(rname))
+ )
+
+ tgen.start_router()
+
+def teardown_module(mod):
+ "Teardown the pytest environment"
+ tgen = get_topogen()
+
+ # This function tears down the whole topology.
+ tgen.stop_topology()
+
+
+def router_compare_json_output(rname, command, reference):
+ "Compare router JSON output"
+
+ logger.info('Comparing router "%s" "%s" output', rname, command)
+
+ tgen = get_topogen()
+ filename = '{}/{}/{}'.format(CWD, rname, reference)
+ expected = json.loads(open(filename).read())
+
+ # Run test function until we get an result. Wait at most 80 seconds.
+ test_func = partial(topotest.router_json_cmp,
+ tgen.gears[rname], command, expected)
+ _, diff = topotest.run_and_expect(test_func, None, count=160, wait=0.5)
+
+ assertmsg = '"{}" JSON output mismatches the expected result'.format(rname)
+ assert diff is None, assertmsg
+
+def test_ospf_convergence():
+ logger.info("Test: check OSPF adjacencies")
+
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show ip ospf neighbor json", "show_ip_ospf_neighbor.json")
+
+def test_rib():
+ logger.info("Test: verify RIB")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show ip route json", "show_ip_route.ref")
+
+def test_ldp_adjacencies():
+ logger.info("Test: verify LDP adjacencies")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show mpls ldp discovery json", "show_ldp_discovery.ref")
+
+def test_ldp_neighbors():
+ logger.info("Test: verify LDP neighbors")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show mpls ldp neighbor json", "show_ldp_neighbor.ref")
+
+def test_ldp_bindings():
+ logger.info("Test: verify LDP bindings")
+ tgen = get_topogen()
+
+ # Skip if previous fatal error condition is raised
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ for rname in ['r1', 'r2', 'r3', 'r4']:
+ router_compare_json_output(rname, "show mpls ldp binding json", "show_ldp_binding.ref")
+
+# Memory leak test template
+def test_memory_leak():
+ "Run the memory leak test and report results."
+ tgen = get_topogen()
+ if not tgen.is_memleak_enabled():
+ pytest.skip('Memory leak test/report is disabled')
+
+ tgen.report_memory_leaks()
+
+if __name__ == '__main__':
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/ldp-topo1/r1/ip_mpls_route.ref b/tests/topotests/ldp-topo1/r1/ip_mpls_route.ref
index f244122f1a..a13c1d459b 100644
--- a/tests/topotests/ldp-topo1/r1/ip_mpls_route.ref
+++ b/tests/topotests/ldp-topo1/r1/ip_mpls_route.ref
@@ -3,3 +3,4 @@ xx as to xx via inet 10.0.1.2 dev r1-eth0 proto xx
xx via inet 10.0.1.2 dev r1-eth0 proto xx
xx via inet 10.0.1.2 dev r1-eth0 proto xx
xx via inet 10.0.1.2 dev r1-eth0 proto xx
+
diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py
index f3c17be684..997b72d691 100644
--- a/tests/topotests/lib/bgp.py
+++ b/tests/topotests/lib/bgp.py
@@ -382,8 +382,8 @@ def __create_bgp_neighbor(topo, input_dict, router, addr_type, add_neigh=True):
disable_connected = peer.setdefault("disable_connected_check",
False)
- keep_alive = peer.setdefault("keep_alive", 60)
- hold_down = peer.setdefault("hold_down", 180)
+ keep_alive = peer.setdefault("keepalivetimer", 60)
+ hold_down = peer.setdefault("holddowntimer", 180)
password = peer.setdefault("password", None)
max_hop_limit = peer.setdefault("ebgp_multihop", 1)
diff --git a/tests/topotests/ospf6-topo1/test_ospf6_topo1.py b/tests/topotests/ospf6-topo1/test_ospf6_topo1.py
index cb0c4af221..2f7a4ce4e3 100755
--- a/tests/topotests/ospf6-topo1/test_ospf6_topo1.py
+++ b/tests/topotests/ospf6-topo1/test_ospf6_topo1.py
@@ -319,18 +319,18 @@ def test_linux_ipv6_kernel_routingTable():
# Now compare the routing tables (after substituting link-local addresses)
for i in range(1, 5):
- if topotest.version_cmp(platform.release(), '5.3') < 0:
+ # Actual output from router
+ actual = tgen.gears['r{}'.format(i)].run('ip -6 route').rstrip()
+ if "nhid" in actual:
+ refTableFile = os.path.join(CWD, 'r{}/ip_6_address.nhg.ref'.format(i))
+ else:
refTableFile = os.path.join(CWD, 'r{}/ip_6_address.ref'.format(i))
- else:
- refTableFile = os.path.join(CWD, 'r{}/ip_6_address.nhg.ref'.format(i))
- if os.path.isfile(refTableFile):
+ if os.path.isfile(refTableFile):
expected = open(refTableFile).read().rstrip()
# Fix newlines (make them all the same)
expected = ('\n'.join(expected.splitlines())).splitlines(1)
- # Actual output from router
- actual = tgen.gears['r{}'.format(i)].run('ip -6 route').rstrip()
# Mask out Link-Local mac addresses
for ll in linklocals:
actual = actual.replace(ll[1], "fe80::__(%s)__" % ll[0])
diff --git a/tests/topotests/pim-basic/r1/pimd.conf b/tests/topotests/pim-basic/r1/pimd.conf
index cec765699d..f64a46deb3 100644
--- a/tests/topotests/pim-basic/r1/pimd.conf
+++ b/tests/topotests/pim-basic/r1/pimd.conf
@@ -7,6 +7,10 @@ interface r1-eth0
interface r1-eth1
ip pim
!
+interface r1-eth2
+ ip igmp
+ ip pim
+!
interface lo
ip pim
!
diff --git a/tests/topotests/pim-basic/r1/zebra.conf b/tests/topotests/pim-basic/r1/zebra.conf
index b0a25f12aa..e43041758b 100644
--- a/tests/topotests/pim-basic/r1/zebra.conf
+++ b/tests/topotests/pim-basic/r1/zebra.conf
@@ -6,6 +6,9 @@ interface r1-eth0
interface r1-eth1
ip address 10.0.30.1/24
!
+interface r1-eth2
+ ip address 10.0.40.1/24
+!
interface lo
ip address 10.254.0.1/32
!
diff --git a/tests/topotests/pim-basic/r3/pimd.conf b/tests/topotests/pim-basic/r3/pimd.conf
new file mode 100644
index 0000000000..f94ee99930
--- /dev/null
+++ b/tests/topotests/pim-basic/r3/pimd.conf
@@ -0,0 +1 @@
+hostname r3
diff --git a/tests/topotests/pim-basic/r3/zebra.conf b/tests/topotests/pim-basic/r3/zebra.conf
new file mode 100644
index 0000000000..8e58e8c66a
--- /dev/null
+++ b/tests/topotests/pim-basic/r3/zebra.conf
@@ -0,0 +1,8 @@
+hostname r3
+!
+interface r3-eth0
+ ip address 10.0.40.4/24
+!
+interface lo
+ ip address 10.254.0.4/32
+!
diff --git a/tests/topotests/pim-basic/rp/pimd.conf b/tests/topotests/pim-basic/rp/pimd.conf
index 3f1b4d65c9..6e35c97971 100644
--- a/tests/topotests/pim-basic/rp/pimd.conf
+++ b/tests/topotests/pim-basic/rp/pimd.conf
@@ -7,3 +7,6 @@ interface lo
ip pim
!
ip pim rp 10.254.0.3
+ip pim register-accept-list ACCEPT
+
+ip prefix-list ACCEPT seq 5 permit 10.0.20.0/24 le 32
diff --git a/tests/topotests/pim-basic/test_pim.py b/tests/topotests/pim-basic/test_pim.py
index 0e0569e234..9101d7e035 100644
--- a/tests/topotests/pim-basic/test_pim.py
+++ b/tests/topotests/pim-basic/test_pim.py
@@ -46,14 +46,18 @@ class PIMTopo(Topo):
"Build function"
tgen = get_topogen(self)
- for routern in range(1, 3):
+ for routern in range(1, 4):
tgen.add_router('r{}'.format(routern))
tgen.add_router('rp')
+ # rp ------ r1 -------- r2
+ # \
+ # --------- r3
# r1 -> .1
# r2 -> .2
# rp -> .3
+ # r3 -> .4
# loopback network is 10.254.0.X/32
#
# r1 <- sw1 -> r2
@@ -70,6 +74,10 @@ class PIMTopo(Topo):
sw.add_link(tgen.gears['r1'])
sw.add_link(tgen.gears['rp'])
+ # 10.0.40.0/24
+ sw = tgen.add_switch('sw3')
+ sw.add_link(tgen.gears['r1'])
+ sw.add_link(tgen.gears['r3'])
def setup_module(mod):
"Sets up the pytest environment"
@@ -130,12 +138,15 @@ def test_pim_send_mcast_stream():
pytest.skip(tgen.errors)
rp = tgen.gears['rp']
+ r3 = tgen.gears['r3']
r2 = tgen.gears['r2']
r1 = tgen.gears['r1']
# Let's establish a S,G stream from r2 -> r1
CWD = os.path.dirname(os.path.realpath(__file__))
r2.run("{}/mcast-tx.py --ttl 5 --count 5 --interval 10 229.1.1.1 r2-eth0 > /tmp/bar".format(CWD))
+ # And from r3 -> r1
+ r3.run("{}/mcast-tx.py --ttl 5 --count 5 --interval 10 229.1.1.1 r3-eth0 > /tmp/bar".format(CWD))
# Let's see that it shows up and we have established some basic state
out = r1.vtysh_cmd("show ip pim upstream json", isjson=True)