#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
#
# test_evpn-pim_topo1.py
# 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
"""
import os
-import re
import sys
import pytest
import json
from lib.topolog import logger
# Required to instantiate the topology builder class.
-from mininet.topo import Topo
+
+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"])
#####################################################
def setup_module(module):
"Setup topology"
- tgen = Topogen(NetworkTopo, module.__name__)
+ tgen = Topogen(build_topo, module.__name__)
tgen.start_topology()
leaf1 = tgen.gears["leaf1"]