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

import sys
import time

messages = [
    ('announce route 1.1.0.0/16 next-hop 1.1.1.1', 1),
    ('neighbor 127.0.0.1 teardown 4', 2.5),
    ('announce route 2.2.0.0/16 next-hop 2.2.2.2', 1),
    ('neighbor 127.0.0.1 teardown 4', 2.5),
    ('announce route 3.3.0.0/16 next-hop 3.3.3.3', 1),
]

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

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
