]> git.proxmox.com Git - mirror_frr.git/blame - tests/topotests/bgp-ecmp-topo1/peer16/exa-send.py
tests: Run python formatter (black) for topotests
[mirror_frr.git] / tests / topotests / bgp-ecmp-topo1 / peer16 / exa-send.py
CommitLineData
ac1087fa
MW
1#!/usr/bin/env python
2
3"""
4exa-send.py: Send a few testroutes with ExaBGP
5"""
6
787e7624 7from sys import stdout, argv
ac1087fa
MW
8from time import sleep
9
10sleep(5)
11
12# 1st arg is peer number
13# 2nd arg is number of routes to send
14peer = int(argv[1])
15numRoutes = int(argv[2])
787e7624 16if peer <= 10:
ac1087fa
MW
17 asnum = 99
18else:
787e7624 19 asnum = peer + 100
ac1087fa
MW
20
21# Announce numRoutes equal routes per PE - different neighbor AS
22for i in range(0, numRoutes):
787e7624 23 stdout.write(
24 "announce route 10.201.%s.0/24 med 100 next-hop 10.0.%i.%i origin igp\n"
25 % (i, (((peer - 1) / 5) + 1), peer + 100)
26 )
ac1087fa
MW
27 stdout.flush()
28
29# Announce numRoutes equal routes per PE - different neighbor AS, but same source AS
30for i in range(0, numRoutes):
787e7624 31 stdout.write(
32 "announce route 10.202.%s.0/24 med 100 next-hop 10.0.%i.%i origin igp as-path [ %i 200 ]\n"
33 % (i, (((peer - 1) / 5) + 1), peer + 100, asnum)
34 )
ac1087fa
MW
35 stdout.flush()
36
37# Announce numRoutes equal routes with different med per PE and different neighbor AS
38for i in range(0, numRoutes):
787e7624 39 stdout.write(
40 "announce route 10.203.%s.0/24 med %i next-hop 10.0.%i.%i origin igp\n"
41 % (i, peer, (((peer - 1) / 5) + 1), peer + 100)
42 )
ac1087fa
MW
43 stdout.flush()
44
45# Announce numRoutes equal routes with different med per PE and different neighbor AS, but same source AS
46for i in range(0, numRoutes):
787e7624 47 stdout.write(
48 "announce route 10.204.%s.0/24 med %i next-hop 10.0.%i.%i origin igp as-path [ %i 200 ]\n"
49 % (i, peer, (((peer - 1) / 5) + 1), peer + 100, asnum)
50 )
ac1087fa
MW
51 stdout.flush()
52
53# Announce 2 different route per peer
787e7624 54stdout.write(
55 "announce route 10.205.%i.0/24 next-hop 10.0.%i.%i origin igp\n"
56 % (peer, (((peer - 1) / 5) + 1), peer + 100)
57)
58stdout.write(
59 "announce route 10.206.%i.0/24 next-hop 10.0.%i.%i origin igp as-path [ %i 200 ]\n"
60 % (peer, (((peer - 1) / 5) + 1), peer + 100, asnum)
61)
ac1087fa
MW
62stdout.flush()
63
787e7624 64# Loop endlessly to allow ExaBGP to continue running
ac1087fa
MW
65while True:
66 sleep(1)