]> git.puffer.fish Git - mirror/frr.git/commitdiff
topotests: pim-basic: fix some rough edges 3983/head
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 20 Mar 2019 17:03:57 +0000 (14:03 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 20 Mar 2019 17:03:57 +0000 (14:03 -0300)
Move daemon configuration to appropriated files and use `json_cmp` to
assert the values we expect.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
tests/topotests/pim-basic/r1/frr.conf [deleted file]
tests/topotests/pim-basic/r1/pimd.conf
tests/topotests/pim-basic/r1/zebra.conf
tests/topotests/pim-basic/r2/frr.conf [deleted file]
tests/topotests/pim-basic/r2/zebra.conf
tests/topotests/pim-basic/test_pim.py

diff --git a/tests/topotests/pim-basic/r1/frr.conf b/tests/topotests/pim-basic/r1/frr.conf
deleted file mode 100644 (file)
index 36433f7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-hostname r1
-interface r1-eth0
- ip address 10.0.20.1/24
-!
-interface lo
- ip address 10.254.0.1/32
-!
-hostname r1
-!
-!
-interface r1-eth0
-  ip igmp
-  ip pim sm
-!
-interface lo
-  ip pim sm
-!
-ip pim rp 10.254.0.1
-
index faf7543ba8b1a6489ac0eeb5fd37509e9e93f649..5740c66e24212792d90dbaca3ea2d61f5120cbe8 100644 (file)
@@ -1 +1,10 @@
 hostname r1
+!
+interface r1-eth0
+  ip igmp
+  ip pim sm
+!
+interface lo
+  ip pim sm
+!
+ip pim rp 10.254.0.1
index faf7543ba8b1a6489ac0eeb5fd37509e9e93f649..2bf71294d03f6fe2d4ad91321a80fbcccfcf0620 100644 (file)
@@ -1 +1,8 @@
 hostname r1
+!
+interface r1-eth0
+ ip address 10.0.20.1/24
+!
+interface lo
+ ip address 10.254.0.1/32
+!
diff --git a/tests/topotests/pim-basic/r2/frr.conf b/tests/topotests/pim-basic/r2/frr.conf
deleted file mode 100644 (file)
index 6473a46..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-hostname r2
-interface r2-eth0
- ip address 10.0.20.2/24
-!
-interface lo
- ip address 10.254.0.2/32
-!
-hostname r2
-interface r2-eth0
- ip address 10.0.21.2/24
-!
-interface lo
- ip address 10.254.0.2/32
-!
index 932cff6f3b5307b0efb2964a5566d6e6b8325149..cb30858f58b43e343b7a27517e7b5eb4efb150cf 100644 (file)
@@ -1 +1,8 @@
 hostname r2
+!
+interface r2-eth0
+ ip address 10.0.20.2/24
+!
+interface lo
+ ip address 10.254.0.2/32
+!
index 5d4f4b85872781168b06cb6695a9003b7d8c2e69..6d54b8f2f022f0120569203fb854fff640c9208f 100644 (file)
@@ -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():