summaryrefslogtreecommitdiffstats
path: root/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py
blob: 0e50d46041e748587a0be257f289d49c5109a1fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3

"""
exa-send.py: Send a few testroutes with ExaBGP
"""

from sys import stdout, argv
from time import sleep

sleep(5)

# 1st arg is peer number
# 2nd arg is number of routes to send
peer = int(argv[1])
numRoutes = int(argv[2])

# Announce numRoutes different routes per PE
for i in range(0, numRoutes):
    stdout.write(
        "announce route 10.%s.%s.0/24 med 100 community %i:1 next-hop 172.16.1.%i\n"
        % ((peer + 100), i, peer, peer)
    )
    stdout.flush()

# Announce 1 overlapping route per peer
stdout.write("announce route 10.0.1.0/24 med %i next-hop 172.16.1.%i\n" % (peer, peer))
stdout.flush()

# Loop endlessly to allow ExaBGP to continue running
while True:
    sleep(1)