]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/topotests/evpn_pim_1/test_evpn_pim_topo1.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / topotests / evpn_pim_1 / test_evpn_pim_topo1.py
index b1f5daef1e435fc47f43aa2400bc54e12126bca9..c0621d75a50601b4090224f133b20f36a4e43392 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# SPDX-License-Identifier: ISC
 
 #
 # test_evpn-pim_topo1.py
@@ -7,20 +8,6 @@
 # Cumulus Networks, Inc.
 # Donald Sharp
 #
-# 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_evpn_pim_topo1.py: Testing evpn-pim
@@ -28,7 +15,6 @@ test_evpn_pim_topo1.py: Testing evpn-pim
 """
 
 import os
-import re
 import sys
 import pytest
 import json
@@ -47,7 +33,6 @@ 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
 
 pytestmark = [pytest.mark.bgpd, pytest.mark.bgpd]
 
@@ -59,41 +44,34 @@ pytestmark = [pytest.mark.bgpd, pytest.mark.bgpd]
 #####################################################
 
 
-class NetworkTopo(Topo):
-    "evpn-pim Topology 1"
-
-    def build(self, **_opts):
-        "Build function"
-
-        tgen = get_topogen(self)
-
-        tgen.add_router("spine")
-        tgen.add_router("leaf1")
-        tgen.add_router("leaf2")
-        tgen.add_router("host1")
-        tgen.add_router("host2")
+def build_topo(tgen):
+    tgen.add_router("spine")
+    tgen.add_router("leaf1")
+    tgen.add_router("leaf2")
+    tgen.add_router("host1")
+    tgen.add_router("host2")
 
-        # On main router
-        # First switch is for a dummy interface (for local network)
-        # spine-eth0 is connected to leaf1-eth0
-        switch = tgen.add_switch("sw1")
-        switch.add_link(tgen.gears["spine"])
-        switch.add_link(tgen.gears["leaf1"])
+    # On main router
+    # First switch is for a dummy interface (for local network)
+    # spine-eth0 is connected to leaf1-eth0
+    switch = tgen.add_switch("sw1")
+    switch.add_link(tgen.gears["spine"])
+    switch.add_link(tgen.gears["leaf1"])
 
-        # spine-eth1 is connected to leaf2-eth0
-        switch = tgen.add_switch("sw2")
-        switch.add_link(tgen.gears["spine"])
-        switch.add_link(tgen.gears["leaf2"])
+    # spine-eth1 is connected to leaf2-eth0
+    switch = tgen.add_switch("sw2")
+    switch.add_link(tgen.gears["spine"])
+    switch.add_link(tgen.gears["leaf2"])
 
-        # leaf1-eth1 is connected to host1-eth0
-        switch = tgen.add_switch("sw3")
-        switch.add_link(tgen.gears["leaf1"])
-        switch.add_link(tgen.gears["host1"])
+    # leaf1-eth1 is connected to host1-eth0
+    switch = tgen.add_switch("sw3")
+    switch.add_link(tgen.gears["leaf1"])
+    switch.add_link(tgen.gears["host1"])
 
-        # leaf2-eth1 is connected to host2-eth0
-        switch = tgen.add_switch("sw4")
-        switch.add_link(tgen.gears["leaf2"])
-        switch.add_link(tgen.gears["host2"])
+    # leaf2-eth1 is connected to host2-eth0
+    switch = tgen.add_switch("sw4")
+    switch.add_link(tgen.gears["leaf2"])
+    switch.add_link(tgen.gears["host2"])
 
 
 #####################################################
@@ -105,7 +83,7 @@ class NetworkTopo(Topo):
 
 def setup_module(module):
     "Setup topology"
-    tgen = Topogen(NetworkTopo, module.__name__)
+    tgen = Topogen(build_topo, module.__name__)
     tgen.start_topology()
 
     leaf1 = tgen.gears["leaf1"]