#!/usr/pkg/bin/python3.13

import sys
import time

messages = [
    'announce attributes med 100 next-hop 101.1.101.1 nlri 1.0.0.1/32 1.0.0.2/32',
    'announce attributes local-preference 200 as-path [ 1 2 3 4 ] next-hop 202.2.202.2 nlri 2.0.0.1/32 2.0.0.2/32',
]

while messages:
    message = messages.pop(0)
    sys.stdout.write(message + '\n')
    sys.stdout.flush()
    time.sleep(0.3)

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
