#!/usr/bin/env python3
import sys
import time
messages = [
'announce route 1.0.0.0/21 next-hop 101.1.101.1 med 200 community [2:1] split /23',
'neighbor 127.0.0.1 announce route 1.1.0.0/16 next-hop 101.1.101.1',
'neighbor 127.0.0.1 local-as 1 announce route 1.2.0.0/22 next-hop 101.1.101.1 split /24',
'neighbor 127.0.0.1 peer-as 1 announce route 1.3.0.0/24 next-hop 101.1.101.1 split /25',
'neighbor 127.0.0.1 local-ip 127.0.0.1 announce route 1.4.0.0/16 next-hop 101.1.101.1 med 200',
'neighbor 127.0.0.1 router-id 1.2.3.4 announce route 1.5.0.0/16 next-hop 101.1.101.1 community [2:1]',
'neighbor absentone local-as 1 peer-as 1 local-ip 127.0.0.1 router-id 1.2.3.4 announce route 9.9.9.9/21 next-hop 101.1.101.1 med 200 community [2:1]',
'neighbor 127.0.0.1 local-as 1 peer-as 1 local-ip 127.0.0.1 router-id 1.2.3.4 announce route 1.6.0.0/21 next-hop 101.1.101.1 med 200 community [2:1]',
'neighbor 127.0.0.1 local-as 2 peer-as 3 local-ip 127.0.0.1 router-id 1.2.3.4 announce route 1.8.0.0/21 next-hop 101.1.101.1 med 200 large-community [2914:1:0]',
]
while messages:
message = messages.pop(0)
sys.stdout.write(message + '\n')
sys.stdout.flush()
time.sleep(0.1)
try:
now = time.time()
while True and time.time() < now + 5:
line = sys.stdin.readline().strip()
if not line or 'shutdown' in line:
break
time.sleep(1)
except IOError:
pass