Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
knewell committed Apr 20, 2020
0 parents commit c95ca0c
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exabgp.conf
venv
api-full-rrc14.run
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3

RUN pip install exabgp
RUN mkdir -p /etc/exabgp && exabgp --fi > /usr/local/etc/exabgp/exabgp.env
RUN mkfifo /run/exabgp.in && \
mkfifo /run/exabgp.out && \
chmod 666 /run/exabgp.in && \
chmod 666 /run/exabgp.out

RUN apt update && apt install net-tools nano
COPY exabgp.env /usr/local/etc/exabgp/

ENTRYPOINT ["exabgp"]
CMD ["--help"]
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Clone
```bash
git clone
```

## Build
```bash
docker build -t exabgp-full-table .
```
Copy and edit exabgp.conf.dist
```bash
cp exabgp.conf.dist exabgp.conf
```
Extract api-full-rrc14.run.tgz
```bash
tar zxvpf api-full-rrc14.run.tgz
```

## Run
```bash
docker run -d --name exabgp --rm -v $(pwd)/exabgp.conf:/etc/exabgp/exabgp.conf -v $(pwd)/api-full-rrc14.run:/api-full-rrc14.run exabgp-full-table /etc/exabgp/exabgp.conf
```

## Generate data
Data was downloaded from RIPE RIS rrc14 (Palo Alto, CA)
[http://data.ris.ripe.net/rrc14/]

mrtparse [https://github.com/t2mune/mrtparse] to convert to ExaBGP API format
```bash
./mrt2exabgp.py -P latest-bview.gz < api-full-rrc14.run
```
Binary file added api-full-rrc14.run.tgz
Binary file not shown.
42 changes: 42 additions & 0 deletions api.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python

import sys
import time

msgs = [
'announce route 1.0.0.0/24 origin IGP as-path [2914 13335 ] med 10 aggregator (13335:172.68.188.1) community [2914:410 2914:1008 2914:2000 2914:3000] next-hop 198.32.176.14',
'announce route 1.0.4.0/22 origin IGP as-path [2914 15412 4826 38803 56203 ] med 22001 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14',
'announce route 1.0.4.0/24 origin IGP as-path [2914 15412 4826 38803 56203 ] med 22001 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14',
'announce route 1.0.5.0/24 origin IGP as-path [2914 15412 4826 38803 56203 ] med 22001 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14',
'announce route 223.255.248.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14',
'announce route 223.255.249.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14',
'announce route 223.255.250.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14',
'announce route 223.255.251.0/24 origin IGP as-path [2914 6453 63199 ] med 23 community [2914:420 2914:1008 2914:2000 2914:3000 6453:3000 6453:3100 6453:3103] next-hop 198.32.176.14',
'announce route 223.255.252.0/24 origin IGP as-path [2914 4134 58519 ] med 21 community [2914:420 2914:1008 2914:2000 2914:3000] next-hop 198.32.176.14',
'announce route 223.255.253.0/24 origin IGP as-path [2914 4134 58519 ] med 21 community [2914:420 2914:1008 2914:2000 2914:3000] next-hop 198.32.176.14',
'announce route 223.255.254.0/24 origin IGP as-path [2914 4657 55415 55415 55415 55415 55415 55415 55415 ] med 21990 community [2914:410 2914:1405 2914:2406 2914:3400] next-hop 198.32.176.14'
]

# while msgs:
# msg = msgs.pop(0)
# if isinstance(msg, str):
# sys.stdout.write(msg + '\n')
# sys.stdout.flush()
# else:
# time.sleep(msg)
messages = [
'announce route 100.10.0.0/24 next-hop self',
'announce route 200.20.0.0/24 next-hop self',
]

time.sleep(1)

#Iterate through messages
for message in messages:
sys.stdout.write(message + '\n')
sys.stdout.flush()
time.sleep(1)

while True:
time.sleep(1)

21 changes: 21 additions & 0 deletions exabgp.conf.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
process announce-routes {
run python api-full-rrc14.run;
encoder text;
}


neighbor {neighbor IP} {
router-id {local host IP};
local-address 172.17.0.2; #Docker container IP
local-as {local AS};
peer-as {remote AS};
hold-time 90;
family {
ipv4 unicast;
ipv6 unicast;
}

api {
processes [announce-routes];
}
}
57 changes: 57 additions & 0 deletions exabgp.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

[exabgp.api]
ack = false
chunk = 1
cli = true
compact = false
encoder = json
respawn = true
terminate = false

[exabgp.bgp]
openwait = 60

[exabgp.cache]
attributes = true
nexthops = true

[exabgp.daemon]
daemonize = false
drop = true
pid = ''
umask = '0o137'
user = 'nobody'

[exabgp.log]
all = false
configuration = true
daemon = true
destination = 'stdout'
enable = true
level = INFO
message = false
network = true
packets = false
parser = false
processes = true
reactor = true
rib = false
routes = false
short = false
timers = false

[exabgp.pdb]
enable = false

[exabgp.profile]
enable = false
file = ''

[exabgp.reactor]
speed = 1.0

[exabgp.tcp]
acl = false
bind = ''
exonce = false
port = 179

0 comments on commit c95ca0c

Please sign in to comment.