First Upload

This commit is contained in:
2024-11-06 19:09:33 +00:00
commit d971d5d522
22 changed files with 5606 additions and 0 deletions

26
gobgp/Dockerfile Executable file
View File

@@ -0,0 +1,26 @@
FROM ubuntu:24.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get remove -y binutils && \
apt-get install -y \
python3 \
python3-pip \
python3-venv \
wget && \
rm -rf /var/lib/apt/lists/*
COPY ./requirements.txt /tmp/requirements.txt
RUN python3 -m venv venv && chmod +x venv
RUN . venv/bin/activate && pip3 install -r /tmp/requirements.txt
RUN wget https://github.com/osrg/gobgp/releases/download/v3.27.0/gobgp_3.27.0_linux_amd64.tar.gz && \
tar -xzvf gobgp_3.27.0_linux_amd64.tar.gz && \
mv gobgp /usr/local/bin/gobgp && \
mv gobgpd /usr/local/bin/gobgpd && \
rm gobgp_3.27.0_linux_amd64.tar.gz
COPY ./gobgpd.conf /root/gobgp/gobgpd.conf
COPY ./entrypoint.sh /root/gobgp/entrypoint.sh
COPY ./startup.sh /root/gobgp/startup.sh
RUN chmod +x /root/gobgp/entrypoint.sh && \
chmod +x /root/gobgp/startup.sh
ENTRYPOINT ["/root/gobgp/entrypoint.sh"]

3
gobgp/entrypoint.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec gobgpd -f /root/gobgp/gobgpd.conf &
exec /root/gobgp/startup.sh

15
gobgp/gobgpd.conf Executable file
View File

@@ -0,0 +1,15 @@
[global.config]
as = 400848
router-id = "172.16.1.66"
[[neighbors]]
[neighbors.config]
neighbor-address = "172.16.1.27"
peer-as = 400848
route-flap-damping = "True"
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "ipv4-unicast"
[[neighbors.afi-safis]]
[neighbors.afi-safis.config]
afi-safi-name = "ipv6-unicast"

3
gobgp/requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
pymongo >= 4.8.0
dnspython >= 2.6.1
ipaddress >= 1.0.23

7
gobgp/startup.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
## Production
. venv/bin/activate
gobgp monitor global rib -j | /var/tmp/gobgp_to_mongo.py
##
## Dev Test
# cat /var/tmp/log/bgp.dump.json | /var/tmp/gobgp_to_mongo.py