#!/usr/bin/env python3

import os
import sys
import time

sys.stdout.write('neighbor 127.0.0.1 announce route 2605::2/128 next-hop 2001::1 local-preference 500\n')
sys.stdout.flush()
time.sleep(0.2)

sys.stdout.write('neighbor 127.0.0.1 announce route 2605::2/128 next-hop 2001::2 local-preference 500\n')
sys.stdout.flush()
time.sleep(0.2)

sys.stdout.write('neighbor 127.0.0.1 announce route 2605::2/128 next-hop 2001::1 local-preference 500\n')
sys.stdout.flush()

try:
    now = time.time()
    while os.getppid() != 1 and time.time() < now + 5:
        line = sys.stdin.readline().strip()
        if not line or 'shutdown' in line:
            break
        time.sleep(1)
except IOError:
    pass
