Skip to content

Commit 57ed231

Browse files
committed
bgp-ecmp-topo1: fix some pylint warnings
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
1 parent 5a87c58 commit 57ed231

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

bgp-ecmp-topo1/test_bgp_ecmp_topo1.py

+16-11
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@
4848
total_ebgp_peers = 20
4949

5050
#####################################################
51-
##
52-
## Network Topology Definition
53-
##
51+
#
52+
# Network Topology Definition
53+
#
5454
#####################################################
5555

56+
5657
class BGPECMPTopo1(Topo):
5758
"BGP ECMP Topology 1"
5859

@@ -63,13 +64,13 @@ def build(self, **_opts):
6364
router = tgen.add_router('r1')
6465

6566
# Setup Switches - 1 switch per 5 peering routers
66-
for swNum in range(1, (total_ebgp_peers+4)/5 +1):
67+
for swNum in range(1, (total_ebgp_peers + 4) / 5 + 1):
6768
switch = tgen.add_switch('s{}'.format(swNum))
6869
switch.add_link(router)
6970

7071
# Add 'total_ebgp_peers' number of eBGP ExaBGP neighbors
7172
for peerNum in range(1, total_ebgp_peers+1):
72-
swNum = ((peerNum -1) / 5 + 1)
73+
swNum = ((peerNum - 1) / 5 + 1)
7374

7475
peer_ip = '10.0.{}.{}'.format(swNum, peerNum + 100)
7576
peer_route = 'via 10.0.{}.1'.format(swNum)
@@ -81,9 +82,9 @@ def build(self, **_opts):
8182

8283

8384
#####################################################
84-
##
85-
## Tests starting
86-
##
85+
#
86+
# Tests starting
87+
#
8788
#####################################################
8889

8990
def setup_module(module):
@@ -112,10 +113,12 @@ def setup_module(module):
112113
peer.start(peer_dir, env_file)
113114
logger.info(pname)
114115

116+
115117
def teardown_module(module):
116118
tgen = get_topogen()
117119
tgen.stop_topology()
118120

121+
119122
def test_bgp_convergence():
120123
"Test for BGP topology convergence"
121124
tgen = get_topogen()
@@ -135,8 +138,8 @@ def test_bgp_convergence():
135138

136139
def _output_summary_cmp(router, cmd, data):
137140
"""
138-
Runs `cmd` that returns JSON data (normally the command ends with 'json')
139-
and compare with `data` contents.
141+
Runs `cmd` that returns JSON data (normally the command ends
142+
with 'json') and compare with `data` contents.
140143
"""
141144
output = router.vtysh_cmd(cmd, isjson=True)
142145
if 'ipv4Unicast' in output:
@@ -153,6 +156,7 @@ def _output_summary_cmp(router, cmd, data):
153156
assertmsg = 'BGP router network did not converge'
154157
assert res is None, assertmsg
155158

159+
156160
def test_bgp_ecmp():
157161
tgen = get_topogen()
158162

@@ -175,11 +179,12 @@ def test_bgp_ecmp():
175179
expect['routes'][netkey].append(peer)
176180

177181
test_func = functools.partial(topotest.router_json_cmp,
178-
tgen.gears['r1'], 'show ip bgp json', expect)
182+
tgen.gears['r1'], 'show ip bgp json', expect)
179183
_, res = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
180184
assertmsg = 'expected multipath routes in "show ip bgp" output'
181185
assert res is None, assertmsg
182186

187+
183188
if __name__ == '__main__':
184189
args = ["-s"] + sys.argv[1:]
185190
sys.exit(pytest.main(args))

0 commit comments

Comments
 (0)