]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/topotests/bgp_flowspec/test_bgp_flowspec_topo.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / topotests / bgp_flowspec / test_bgp_flowspec_topo.py
index fdd84fcd401a7a9d2c5e0992c5ef9555f982c242..fd675dc8aeb523a55206cdf41bafeb53bb65bb5d 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# SPDX-License-Identifier: ISC
 
 #
 # test_bgp_flowspec_topo.py
@@ -6,20 +7,6 @@
 #
 # Copyright (c) 2019 by 6WIND
 #
-# 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_flowspec_topo.py: Test BGP topology with Flowspec EBGP peering
@@ -54,7 +41,6 @@ import functools
 import os
 import sys
 import pytest
-import getopt
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -65,11 +51,8 @@ sys.path.append(os.path.join(CWD, "../"))
 from lib import topotest
 from lib.topogen import Topogen, TopoRouter, get_topogen
 from lib.topolog import logger
-from lib.lutil import lUtil
-from lib.lutil import luCommand
 
 # Required to instantiate the topology builder class.
-from mininet.topo import Topo
 
 
 pytestmark = [pytest.mark.bgpd]
@@ -82,24 +65,18 @@ pytestmark = [pytest.mark.bgpd]
 #####################################################
 
 
-class BGPFLOWSPECTopo1(Topo):
-    "BGP EBGP Flowspec Topology 1"
-
-    def build(self, **_opts):
-        tgen = get_topogen(self)
-
-        # Setup Routers
-        tgen.add_router("r1")
+def build_topo(tgen):
+    tgen.add_router("r1")
 
-        # Setup Control Path Switch 1. r1-eth0
-        switch = tgen.add_switch("s1")
-        switch.add_link(tgen.gears["r1"])
+    # Setup Control Path Switch 1. r1-eth0
+    switch = tgen.add_switch("s1")
+    switch.add_link(tgen.gears["r1"])
 
-        ## Add eBGP ExaBGP neighbors
-        peer_ip = "10.0.1.101"  ## peer
-        peer_route = "via 10.0.1.1"  ## router
-        peer = tgen.add_exabgp_peer("peer1", ip=peer_ip, defaultRoute=peer_route)
-        switch.add_link(peer)
+    ## Add eBGP ExaBGP neighbors
+    peer_ip = "10.0.1.101"  ## peer
+    peer_route = "via 10.0.1.1"  ## router
+    peer = tgen.add_exabgp_peer("peer1", ip=peer_ip, defaultRoute=peer_route)
+    switch.add_link(peer)
 
 
 #####################################################
@@ -110,7 +87,7 @@ class BGPFLOWSPECTopo1(Topo):
 
 
 def setup_module(module):
-    tgen = Topogen(BGPFLOWSPECTopo1, module.__name__)
+    tgen = Topogen(build_topo, module.__name__)
 
     tgen.start_topology()
     # check for zebra capability