mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 10:09:17 +00:00
bgp-ecmp-topo1: fix some pylint warnings
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
47bbb80ad2
commit
b941f9587f
@ -48,11 +48,12 @@ from mininet.topo import Topo
|
|||||||
total_ebgp_peers = 20
|
total_ebgp_peers = 20
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
##
|
#
|
||||||
## Network Topology Definition
|
# Network Topology Definition
|
||||||
##
|
#
|
||||||
#####################################################
|
#####################################################
|
||||||
|
|
||||||
|
|
||||||
class BGPECMPTopo1(Topo):
|
class BGPECMPTopo1(Topo):
|
||||||
"BGP ECMP Topology 1"
|
"BGP ECMP Topology 1"
|
||||||
|
|
||||||
@ -63,13 +64,13 @@ class BGPECMPTopo1(Topo):
|
|||||||
router = tgen.add_router('r1')
|
router = tgen.add_router('r1')
|
||||||
|
|
||||||
# Setup Switches - 1 switch per 5 peering routers
|
# Setup Switches - 1 switch per 5 peering routers
|
||||||
for swNum in range(1, (total_ebgp_peers+4)/5 +1):
|
for swNum in range(1, (total_ebgp_peers + 4) / 5 + 1):
|
||||||
switch = tgen.add_switch('s{}'.format(swNum))
|
switch = tgen.add_switch('s{}'.format(swNum))
|
||||||
switch.add_link(router)
|
switch.add_link(router)
|
||||||
|
|
||||||
# Add 'total_ebgp_peers' number of eBGP ExaBGP neighbors
|
# Add 'total_ebgp_peers' number of eBGP ExaBGP neighbors
|
||||||
for peerNum in range(1, total_ebgp_peers+1):
|
for peerNum in range(1, total_ebgp_peers+1):
|
||||||
swNum = ((peerNum -1) / 5 + 1)
|
swNum = ((peerNum - 1) / 5 + 1)
|
||||||
|
|
||||||
peer_ip = '10.0.{}.{}'.format(swNum, peerNum + 100)
|
peer_ip = '10.0.{}.{}'.format(swNum, peerNum + 100)
|
||||||
peer_route = 'via 10.0.{}.1'.format(swNum)
|
peer_route = 'via 10.0.{}.1'.format(swNum)
|
||||||
@ -81,9 +82,9 @@ class BGPECMPTopo1(Topo):
|
|||||||
|
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
##
|
#
|
||||||
## Tests starting
|
# Tests starting
|
||||||
##
|
#
|
||||||
#####################################################
|
#####################################################
|
||||||
|
|
||||||
def setup_module(module):
|
def setup_module(module):
|
||||||
@ -112,10 +113,12 @@ def setup_module(module):
|
|||||||
peer.start(peer_dir, env_file)
|
peer.start(peer_dir, env_file)
|
||||||
logger.info(pname)
|
logger.info(pname)
|
||||||
|
|
||||||
|
|
||||||
def teardown_module(module):
|
def teardown_module(module):
|
||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
tgen.stop_topology()
|
tgen.stop_topology()
|
||||||
|
|
||||||
|
|
||||||
def test_bgp_convergence():
|
def test_bgp_convergence():
|
||||||
"Test for BGP topology convergence"
|
"Test for BGP topology convergence"
|
||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
@ -135,8 +138,8 @@ def test_bgp_convergence():
|
|||||||
|
|
||||||
def _output_summary_cmp(router, cmd, data):
|
def _output_summary_cmp(router, cmd, data):
|
||||||
"""
|
"""
|
||||||
Runs `cmd` that returns JSON data (normally the command ends with 'json')
|
Runs `cmd` that returns JSON data (normally the command ends
|
||||||
and compare with `data` contents.
|
with 'json') and compare with `data` contents.
|
||||||
"""
|
"""
|
||||||
output = router.vtysh_cmd(cmd, isjson=True)
|
output = router.vtysh_cmd(cmd, isjson=True)
|
||||||
if 'ipv4Unicast' in output:
|
if 'ipv4Unicast' in output:
|
||||||
@ -153,6 +156,7 @@ def test_bgp_convergence():
|
|||||||
assertmsg = 'BGP router network did not converge'
|
assertmsg = 'BGP router network did not converge'
|
||||||
assert res is None, assertmsg
|
assert res is None, assertmsg
|
||||||
|
|
||||||
|
|
||||||
def test_bgp_ecmp():
|
def test_bgp_ecmp():
|
||||||
tgen = get_topogen()
|
tgen = get_topogen()
|
||||||
|
|
||||||
@ -175,11 +179,12 @@ def test_bgp_ecmp():
|
|||||||
expect['routes'][netkey].append(peer)
|
expect['routes'][netkey].append(peer)
|
||||||
|
|
||||||
test_func = functools.partial(topotest.router_json_cmp,
|
test_func = functools.partial(topotest.router_json_cmp,
|
||||||
tgen.gears['r1'], 'show ip bgp json', expect)
|
tgen.gears['r1'], 'show ip bgp json', expect)
|
||||||
_, res = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
|
_, res = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
|
||||||
assertmsg = 'expected multipath routes in "show ip bgp" output'
|
assertmsg = 'expected multipath routes in "show ip bgp" output'
|
||||||
assert res is None, assertmsg
|
assert res is None, assertmsg
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
args = ["-s"] + sys.argv[1:]
|
args = ["-s"] + sys.argv[1:]
|
||||||
sys.exit(pytest.main(args))
|
sys.exit(pytest.main(args))
|
||||||
|
Loading…
Reference in New Issue
Block a user