#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
#
# Copyright (c) 2019 by VMware, Inc. ("VMware")
# Used Copyright (c) 2018 by Network Device Education Foundation, Inc.
# ("NetDEF") in this file.
#
-# 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 VMWARE DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE 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.
-#
"""
<example>.py: Test <example tests>.
import sys
import time
import json
-import inspect
import pytest
# Save the Current Working Directory to find configuration files.
from lib.topogen import Topogen, get_topogen
# Required to instantiate the topology builder class.
-from mininet.topo import Topo
# Import topoJson from lib, to create topology and initial configuration
from lib.common_config import (
input_dict = {}
-class TemplateTopo(Topo):
- """
- Test topology builder
-
- * `Topo`: Topology object
- """
-
- def build(self, *_args, **_opts):
- "Build function"
- tgen = get_topogen(self)
+def build_topo(tgen):
+ "Build function"
- # This function only purpose is to create topology
- # as defined in input json file.
- #
- # Example
- #
- # Creating 2 routers having single links in between,
- # which is used to establised BGP neighborship
+ # This function only purpose is to create topology
+ # as defined in input json file.
+ #
+ # Example
+ #
+ # Creating 2 routers having single links in between,
+ # which is used to establised BGP neighborship
- # Building topology from json file
- build_topo_from_json(tgen, topo)
+ # Building topology from json file
+ build_topo_from_json(tgen, topo)
def setup_module(mod):
logger.info("Running setup_module to create topology")
# This function initiates the topology build with Topogen...
- tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen = Topogen(build_topo, mod.__name__)
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# This function only purpose is to create configuration
def test_bgp_convergence(request):
- " Test BGP daemon convergence "
+ "Test BGP daemon convergence"
tgen = get_topogen()
global bgp_convergence
def test_static_routes(request):
- " Test to create and verify static routes. "
+ "Test to create and verify static routes."
tgen = get_topogen()
if bgp_convergence is not True: