diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-03-20 14:03:57 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-03-20 14:03:57 -0300 |
| commit | 79d70a4c1b2c3901fa409979674cb0fcf704c8fa (patch) | |
| tree | 66294c2a92efd93d410992c05e910dc7e8a601f6 /tests/topotests/pim-basic/test_pim.py | |
| parent | 86439e8d5f9793b9685c686ceef196017e865e41 (diff) | |
topotests: pim-basic: fix some rough edges
Move daemon configuration to appropriated files and use `json_cmp` to
assert the values we expect.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'tests/topotests/pim-basic/test_pim.py')
| -rw-r--r-- | tests/topotests/pim-basic/test_pim.py | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/tests/topotests/pim-basic/test_pim.py b/tests/topotests/pim-basic/test_pim.py index 5d4f4b8587..6d54b8f2f0 100644 --- a/tests/topotests/pim-basic/test_pim.py +++ b/tests/topotests/pim-basic/test_pim.py @@ -71,10 +71,7 @@ def setup_module(mod): # After loading the configurations, this function loads configured daemons. tgen.start_router() - for rname, router in tgen.routers().iteritems(): - router.run("vtysh -f {}".format(os.path.join(CWD, '{}/frr.conf'.format(rname)))) - #tgen.mininet_cli() def teardown_module(mod): "Teardown the pytest environment" @@ -98,17 +95,22 @@ def test_pim_send_mcast_stream(): # Let's establish a S,G stream from r2 -> r1 CWD = os.path.dirname(os.path.realpath(__file__)) - out2 = r2.run("{}/mcast-tx.py --ttl 5 --count 5 --interval 10 229.1.1.1 r2-eth0 > /tmp/bar".format(CWD)) + r2.run("{}/mcast-tx.py --ttl 5 --count 5 --interval 10 229.1.1.1 r2-eth0 > /tmp/bar".format(CWD)) # Let's see that it shows up and we have established some basic state - out1 = r1.vtysh_cmd("show ip pim upstream json", isjson=True) + out = r1.vtysh_cmd("show ip pim upstream json", isjson=True) + expected = { + '229.1.1.1': { + '10.0.20.2': { + 'firstHopRouter': 1, + 'joinState': 'NotJoined', + 'regState': 'RegPrune', + 'inboundInterface': 'r1-eth0', + } + } + } - sg = out1['229.1.1.1']['10.0.20.2'] - assert sg['firstHopRouter'] == 1 - assert sg['joinState'] == "NotJoined" - assert sg['regState'] == "RegPrune" - assert sg['inboundInterface'] == "r1-eth0" - #tgen.mininet_cli() + assert topotest.json_cmp(out, expected) is None, 'failed to converge pim' def test_pim_igmp_report(): @@ -125,15 +127,21 @@ def test_pim_igmp_report(): # Let's send a igmp report from r2->r1 CWD = os.path.dirname(os.path.realpath(__file__)) - out2 = r2.run("{}/mcast-rx.py 229.1.1.2 r2-eth0 &".format(CWD)) - - out1 = r1.vtysh_cmd("show ip pim upstream json", isjson=True) - starg = out1['229.1.1.2']['*'] - assert starg['sourceIgmp'] == 1 - assert starg['joinState'] == "Joined" - assert starg['regState'] == "RegNoInfo" - assert starg['sptBit'] == 0 - #tgen.mininet_cli() + r2.run("{}/mcast-rx.py 229.1.1.2 r2-eth0 &".format(CWD)) + + out = r1.vtysh_cmd("show ip pim upstream json", isjson=True) + expected = { + '229.1.1.2': { + '*': { + 'sourceIgmp': 1, + 'joinState': 'Joined', + 'regState': 'RegNoInfo', + 'sptBit': 0, + } + } + } + + assert topotest.json_cmp(out, expected) is None, 'failed to converge pim' def test_memory_leak(): |
