Merge pull request #14890 from louis-6wind/exabgp4

topotests: convert to exabgp 4 and python3
This commit is contained in:
Martin Winter 2023-12-14 05:46:24 -08:00 committed by GitHub
commit 0d57a9a954
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
88 changed files with 915 additions and 946 deletions

View file

@ -15,7 +15,7 @@ Installing Dependencies
pkg-config libpam0g-dev libjson-c-dev bison flex \
libc-ares-dev python3-dev python3-sphinx \
install-info build-essential libsnmp-dev perl \
libcap-dev python2 libelf-dev libunwind-dev
libcap-dev libelf-dev libunwind-dev
.. include:: building-libunwind-note.rst
@ -23,18 +23,6 @@ Note that Ubuntu 20 no longer installs python 2.x, so it must be
installed explicitly. Ensure that your system has a symlink named
``/usr/bin/python`` pointing at ``/usr/bin/python3``.
In addition, ``pip`` for python2 must be installed if you wish to run
the FRR topotests. That version of ``pip`` is not available from the
ubuntu apt repositories; in order to install it:
.. code-block:: shell
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 ./get-pip.py
# And verify the installation
pip2 --version
.. include:: building-libyang.rst
Protobuf

View file

@ -15,7 +15,7 @@ Installing Dependencies
pkg-config libpam0g-dev libjson-c-dev bison flex \
libc-ares-dev python3-dev python3-sphinx \
install-info build-essential libsnmp-dev perl \
libcap-dev python2 libelf-dev libunwind-dev \
libcap-dev libelf-dev libunwind-dev \
libyang2 libyang2-dev
.. include:: building-libunwind-note.rst
@ -29,18 +29,6 @@ installed explicitly. Ensure that your system has a symlink named
sudo ln -s /usr/bin/python3 /usr/bin/python
python --version
In addition, ``pip`` for python2 must be installed if you wish to run
the FRR topotests. That version of ``pip`` is not available from the
ubuntu apt repositories; in order to install it:
.. code-block:: shell
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 ./get-pip.py
# And verify the installation
pip2 --version
Protobuf
^^^^^^^^

View file

@ -8,14 +8,12 @@ Topotests is a suite of topology tests for FRR built on top of micronet.
Installation and Setup
----------------------
Topotests run under python3. Additionally, for ExaBGP (which is used
in some of the BGP tests) an older python2 version (and the python2
version of ``pip``) must be installed.
Topotests run under python3.
Tested with Ubuntu 20.04,Ubuntu 18.04, and Debian 11.
Instructions are the same for all setups (i.e. ExaBGP is only used for
BGP tests).
Instructions are the same for all setups. However, ExaBGP is only used for
BGP tests.
Tshark is only required if you enable any packet captures on test runs.
@ -39,8 +37,7 @@ Installing Topotest Requirements
python3 -m pip install 'pytest-xdist>=2.3.0'
python3 -m pip install 'scapy>=2.4.5'
python3 -m pip install xmltodict
# Use python2 pip to install older ExaBGP
python2 -m pip install 'exabgp<4.0.0'
python3 -m pip install git+https://github.com/Exa-Networks/exabgp@0659057837cd6c6351579e9f0fa47e9fb7de7311
useradd -d /var/run/exabgp/ -s /bin/false exabgp
# To enable the gRPC topotest install:

View file

@ -52,7 +52,7 @@ RUN apt update && apt upgrade -y && \
libssl-dev \
lua5.3 \
net-tools \
python2 \
python3 \
python3-pip \
snmp \
snmp-mibs-downloader \
@ -67,9 +67,6 @@ RUN apt update && apt upgrade -y && \
wget https://raw.githubusercontent.com/FRRouting/frr-mibs/main/iana/IANA-IPPM-METRICS-REGISTRY-MIB -O /usr/share/snmp/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB && \
wget https://raw.githubusercontent.com/FRRouting/frr-mibs/main/ietf/SNMPv2-PDU -O /usr/share/snmp/mibs/ietf/SNMPv2-PDU && \
wget https://raw.githubusercontent.com/FRRouting/frr-mibs/main/ietf/IPATM-IPMC-MIB -O /usr/share/snmp/mibs/ietf/IPATM-IPMC-MIB && \
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output /tmp/get-pip.py && \
python2 /tmp/get-pip.py && \
rm -f /tmp/get-pip.py && \
python3 -m pip install wheel && \
python3 -m pip install pytest && \
python3 -m pip install pytest-sugar && \
@ -77,7 +74,7 @@ RUN apt update && apt upgrade -y && \
python3 -m pip install "scapy>=2.4.2" && \
python3 -m pip install xmltodict && \
python3 -m pip install grpcio grpcio-tools && \
python2 -m pip install 'exabgp<4.0.0'
python3 -m pip install git+https://github.com/Exa-Networks/exabgp@0659057837cd6c6351579e9f0fa47e9fb7de7311
RUN groupadd -r -g 92 frr && \
groupadd -r -g 85 frrvty && \

View file

@ -1,5 +1,6 @@
[exabgp.api]
ack = false
encoder = text
highres = false
respawn = false

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 1 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 1";
receive-routes;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.101;
local-address 10.0.1.101;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 1 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 1;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.101;
local-address 10.0.1.101;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 10 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 10";
receive-routes;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.110;
local-address 10.0.2.110;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 10 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 10;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.110;
local-address 10.0.2.110;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 11 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 11";
receive-routes;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.111;
local-address 10.0.3.111;
local-as 111;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 11 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 11;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.111;
local-address 10.0.3.111;
local-as 111;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 12 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 12";
receive-routes;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.112;
local-address 10.0.3.112;
local-as 112;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 12 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 12;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.112;
local-address 10.0.3.112;
local-as 112;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 13 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 13";
receive-routes;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.113;
local-address 10.0.3.113;
local-as 113;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 13 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 13;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.113;
local-address 10.0.3.113;
local-as 113;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 14 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 14";
receive-routes;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.114;
local-address 10.0.3.114;
local-as 114;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 14 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 14;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.114;
local-address 10.0.3.114;
local-as 114;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 15 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 15";
receive-routes;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.115;
local-address 10.0.3.115;
local-as 115;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 15 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 15;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.115;
local-address 10.0.3.115;
local-as 115;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 16 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 16";
receive-routes;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.116;
local-address 10.0.4.116;
local-as 116;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 16 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 16;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.116;
local-address 10.0.4.116;
local-as 116;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 17 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 17";
receive-routes;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.117;
local-address 10.0.4.117;
local-as 117;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 17 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 17;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.117;
local-address 10.0.4.117;
local-as 117;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 18 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 18";
receive-routes;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.118;
local-address 10.0.4.118;
local-as 118;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 18 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 18;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.118;
local-address 10.0.4.118;
local-as 118;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 19 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 19";
receive-routes;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.119;
local-address 10.0.4.119;
local-as 119;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 19 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 19;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.119;
local-address 10.0.4.119;
local-as 119;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 2 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 2";
receive-routes;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.102;
local-address 10.0.1.102;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 2 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 2;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.102;
local-address 10.0.1.102;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 20 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 20";
receive-routes;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.120;
local-address 10.0.4.120;
local-as 120;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 20 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 20;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.120;
local-address 10.0.4.120;
local-as 120;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 3 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 3";
receive-routes;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.103;
local-address 10.0.1.103;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 3 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 3;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.103;
local-address 10.0.1.103;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 4 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 4";
receive-routes;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.104;
local-address 10.0.1.104;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 4 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 4;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.104;
local-address 10.0.1.104;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 5 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 5";
receive-routes;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.105;
local-address 10.0.1.105;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 5 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 5;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.105;
local-address 10.0.1.105;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 6 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 6";
receive-routes;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.106;
local-address 10.0.2.106;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 6 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 6;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.106;
local-address 10.0.2.106;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 7 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 7";
receive-routes;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.107;
local-address 10.0.2.107;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 7 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 7;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.107;
local-address 10.0.2.107;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 8 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 8";
receive-routes;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.108;
local-address 10.0.2.108;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 8 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 8;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.108;
local-address 10.0.2.108;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 9 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 9";
receive-routes;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.109;
local-address 10.0.2.109;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 9 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 9;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.109;
local-address 10.0.2.109;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# SPDX-License-Identifier: ISC
#

View file

@ -1,5 +1,6 @@
[exabgp.api]
ack = false
encoder = text
highres = false
respawn = false

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 1 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 1";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.1;
local-address 172.16.1.1;
local-as 65001;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 1 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 1;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.1;
local-address 172.16.1.1;
local-as 65001;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 2 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 2";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.2;
local-address 172.16.1.2;
local-as 65002;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 2 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 2;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.2;
local-address 172.16.1.2;
local-as 65002;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 3 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 3";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.3;
local-address 172.16.1.3;
local-as 65003;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 3 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 3;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.3;
local-address 172.16.1.3;
local-as 65003;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 4 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 4";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.4;
local-address 172.16.1.4;
local-as 65004;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 4 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 4;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.4;
local-address 172.16.1.4;
local-as 65004;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 5 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 5";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.5;
local-address 172.16.1.5;
local-as 65005;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 5 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 5;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.5;
local-address 172.16.1.5;
local-as 65005;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 6 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 6";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.6;
local-address 172.16.1.6;
local-as 65006;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 6 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 6;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.6;
local-address 172.16.1.6;
local-as 65006;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 7 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 7";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.7;
local-address 172.16.1.7;
local-as 65007;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 7 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 7;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.7;
local-address 172.16.1.7;
local-as 65007;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 8 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 8";
receive-routes;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.8;
local-address 172.16.1.8;
local-as 65008;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 8 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 8;
encoder text;
}
neighbor 172.16.1.254 {
router-id 172.16.1.8;
local-address 172.16.1.8;
local-as 65008;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,5 +1,6 @@
[exabgp.api]
ack = false
encoder = text
highres = false
respawn = false
@ -43,7 +44,7 @@ enable = false
file = ''
[exabgp.reactor]
speed = 1.0
speed = 5.0
[exabgp.tcp]
acl = false

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys

View file

@ -1,21 +1,17 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer1.in";
encoder text;
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 1";
receive-routes;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.2;
local-address 10.0.1.2;
local-as 64510;
peer-as 64510;
}
process announce-routes {
run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer1.in;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 1;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.2;
local-address 10.0.1.2;
local-as 64510;
peer-as 64510;
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys

View file

@ -1,21 +1,17 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer2.in";
encoder text;
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 2";
receive-routes;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.2;
local-address 10.0.2.2;
local-as 64511;
peer-as 64511;
}
process announce-routes {
run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer2.in;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 2;
encoder text;
}
neighbor 10.0.2.1 {
router-id 10.0.2.2;
local-address 10.0.2.2;
local-as 64511;
peer-as 64511;
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys

View file

@ -1,21 +1,17 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer3.in";
encoder text;
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 3";
receive-routes;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.2;
local-address 10.0.3.2;
local-as 64502;
peer-as 64501;
}
process announce-routes {
run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer3.in;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 3;
encoder text;
}
neighbor 10.0.3.1 {
router-id 10.0.3.2;
local-address 10.0.3.2;
local-as 64502;
peer-as 64501;
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys

View file

@ -1,21 +1,17 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer4.in";
encoder text;
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 4";
receive-routes;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.2;
local-address 10.0.4.2;
local-as 64503;
peer-as 64501;
}
process announce-routes {
run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer4.in;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 4;
encoder text;
}
neighbor 10.0.4.1 {
router-id 10.0.4.2;
local-address 10.0.4.2;
local-as 64503;
peer-as 64501;
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -62,6 +62,19 @@ from lib.topolog import logger
pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
# Prefixes used in the test
prefix1 = "203.0.113.0/30"
prefix2 = "203.0.113.4/30"
prefix3 = "203.0.113.8/30"
# Next hops used for iBGP/confed routes
resolved_nh1 = "198.51.100.1"
resolved_nh2 = "198.51.100.2"
# BGP route used for recursive resolution
bgp_resolving_prefix = "198.51.100.0/24"
# Next hop that will require non-connected recursive resolution
ebgp_resolved_nh = "198.51.100.10"
def build_topo(tgen):
"Build function"
@ -125,36 +138,26 @@ def teardown_module(mod):
tgen.stop_topology()
def test_bgp_peer_type_multipath_relax():
def exabgp_cmd(peer, cmd):
pipe = open("/run/exabgp_{}.in".format(peer), "w")
with pipe:
pipe.write(cmd)
pipe.close()
def test_bgp_peer_type_multipath_relax_test1():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
def exabgp_cmd(peer, cmd):
pipe = open("/run/exabgp_{}.in".format(peer), "w")
with pipe:
pipe.write(cmd)
pipe.close()
# Prefixes used in the test
prefix1 = "203.0.113.0/30"
prefix2 = "203.0.113.4/30"
prefix3 = "203.0.113.8/30"
# Next hops used for iBGP/confed routes
resolved_nh1 = "198.51.100.1"
resolved_nh2 = "198.51.100.2"
# BGP route used for recursive resolution
bgp_resolving_prefix = "198.51.100.0/24"
# Next hop that will require non-connected recursive resolution
ebgp_resolved_nh = "198.51.100.10"
r1 = tgen.gears["r1"]
# Send a non-connected route to resolve others
exabgp_cmd(
"peer3", "announce route {} next-hop self\n".format(bgp_resolving_prefix)
)
router = tgen.gears["r1"]
# It seems that if you write to the exabgp socket too quickly in
# succession, requests get lost. So verify prefix1 now instead of
@ -177,7 +180,7 @@ def test_bgp_peer_type_multipath_relax():
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip bgp {} json".format(prefix1),
expected,
)
@ -185,6 +188,16 @@ def test_bgp_peer_type_multipath_relax():
assertMsg = "Mixed-type multipath not found"
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test2():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
logger.info("Create and verify eBGP and iBGP+confed multipaths")
exabgp_cmd(
"peer1",
@ -203,38 +216,66 @@ def test_bgp_peer_type_multipath_relax():
reffile = os.path.join(CWD, "r1/multipath.json")
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp, router, "show ip bgp json", expected
topotest.router_json_cmp, r1, "show ip bgp json", expected
)
_, res = topotest.run_and_expect(test_func, None, count=10, wait=1)
assertMsg = "Not all expected multipaths found"
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test3():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
logger.info("Toggle peer-type multipath-relax and verify the changes")
router.vtysh_cmd(
r1.vtysh_cmd(
"conf\n router bgp 64510\n no bgp bestpath peer-type multipath-relax\n"
)
# This file verifies "multipath" is not set
reffile = os.path.join(CWD, "r1/not-multipath.json")
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp, router, "show ip bgp json", expected
topotest.router_json_cmp, r1, "show ip bgp json", expected
)
_, res = topotest.run_and_expect(test_func, None, count=10, wait=1)
assertMsg = "Disabling peer-type multipath-relax did not take effect"
assert res is None, assertMsg
router.vtysh_cmd(
"conf\n router bgp 64510\n bgp bestpath peer-type multipath-relax\n"
)
def test_bgp_peer_type_multipath_relax_test4():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
r1.vtysh_cmd("conf\n router bgp 64510\n bgp bestpath peer-type multipath-relax\n")
reffile = os.path.join(CWD, "r1/multipath.json")
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp, router, "show ip bgp json", expected
topotest.router_json_cmp, r1, "show ip bgp json", expected
)
_, res = topotest.run_and_expect(test_func, None, count=10, wait=1)
assertMsg = "Reenabling peer-type multipath-relax did not take effect"
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test5():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
logger.info("Check recursive resolution of eBGP next hops is not affected")
# eBGP next hop resolution rejects recursively resolved next hops by
# default, even with peer-type multipath-relax
@ -245,7 +286,7 @@ def test_bgp_peer_type_multipath_relax():
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip bgp {} json".format(prefix3),
expected,
)
@ -253,6 +294,16 @@ def test_bgp_peer_type_multipath_relax():
assertMsg = "Recursive eBGP next hop not as expected for {}".format(prefix3)
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test6():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
exabgp_cmd(
"peer4", "announce route {} next-hop {}\n".format(prefix1, ebgp_resolved_nh)
)
@ -260,7 +311,7 @@ def test_bgp_peer_type_multipath_relax():
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip bgp {} json".format(prefix1),
expected,
)
@ -268,14 +319,24 @@ def test_bgp_peer_type_multipath_relax():
assertMsg = "Recursive eBGP next hop not as expected for {}".format(prefix1)
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test7():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
# When other config allows recursively resolved eBGP next hops,
# such next hops in all-eBGP multipaths should be valid
router.vtysh_cmd("conf\n router bgp 64510\n neighbor 10.0.4.2 ebgp-multihop\n")
r1.vtysh_cmd("conf\n router bgp 64510\n neighbor 10.0.4.2 ebgp-multihop\n")
reffile = os.path.join(CWD, "r1/prefix3-recursive.json")
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip bgp {} json".format(prefix3),
expected,
)
@ -287,7 +348,7 @@ def test_bgp_peer_type_multipath_relax():
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip bgp {} json".format(prefix1),
expected,
)
@ -295,6 +356,16 @@ def test_bgp_peer_type_multipath_relax():
assertMsg = "Recursive eBGP next hop not as expected for {}".format(prefix1)
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test8():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
logger.info("Check mixed-type multipath next hop recursive resolution in FIB")
# There are now two eBGP-learned routes with a recursively resolved next;
# hop; one is all-eBGP multipath, and the other is iBGP/eBGP/
@ -305,7 +376,7 @@ def test_bgp_peer_type_multipath_relax():
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip route {} json".format(prefix3),
expected,
)
@ -313,6 +384,16 @@ def test_bgp_peer_type_multipath_relax():
assertMsg = "FIB next hops mismatch for all-eBGP multipath"
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test9():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
# check confed-external enables recursively resolved next hops by itself
exabgp_cmd(
"peer1",
@ -324,7 +405,7 @@ def test_bgp_peer_type_multipath_relax():
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip route {} json".format(prefix1),
expected,
)
@ -332,6 +413,16 @@ def test_bgp_peer_type_multipath_relax():
assertMsg = "FIB next hops mismatch for eBGP+confed-external multipath"
assert res is None, assertMsg
def test_bgp_peer_type_multipath_relax_test10():
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r1 = tgen.gears["r1"]
# check iBGP by itself
exabgp_cmd(
"peer1",
@ -349,7 +440,7 @@ def test_bgp_peer_type_multipath_relax():
expected = json.loads(open(reffile).read())
test_func = functools.partial(
topotest.router_json_cmp,
router,
r1,
"show ip route {} json".format(prefix1),
expected,
)

View file

@ -1,5 +1,6 @@
[exabgp.api]
ack = false
encoder = text
highres = false
respawn = false

View file

@ -1,103 +1,101 @@
group controller {
neighbor 10.0.0.1 {
router-id 10.0.0.101;
local-address 10.0.0.101;
local-as 2;
peer-as 1;
neighbor 10.0.0.1 {
router-id 10.0.0.101;
local-address 10.0.0.101;
local-as 2;
peer-as 1;
family {
ipv4 nlri-mpls;
}
family {
ipv4 nlri-mpls;
}
static {
# ref: draft-ietf-idr-bgp-prefix-sid-27
#
# IANA temporarily assigned the following:
# attribute code type (suggested value: 40) to
# the BGP Prefix-SID attribute
#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Type | Length | RESERVED |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Flags | Label Index |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Label Index |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# Figure. Label-Index TLV (Prefix-SID type-1)
#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Type | Length | Flags |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Flags |
# +-+-+-+-+-+-+-+-+
#
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | SRGB 1 (6 octets) |
# | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | SRGB n (6 octets) |
# | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<Paste>
# Figure. Originator SRGB TLV (Prefix-SID type-3)
static {
# ref: draft-ietf-idr-bgp-prefix-sid-27
#
# IANA temporarily assigned the following:
# attribute code type (suggested value: 40) to
# the BGP Prefix-SID attribute
#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Type | Length | RESERVED |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Flags | Label Index |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Label Index |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# Figure. Label-Index TLV (Prefix-SID type-1)
#
# 0 1 2 3
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Type | Length | Flags |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Flags |
# +-+-+-+-+-+-+-+-+
#
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | SRGB 1 (6 octets) |
# | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | SRGB n (6 octets) |
# | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<Paste>
# Figure. Originator SRGB TLV (Prefix-SID type-3)
# ExaBGP generic-attribute binary pattern:
# Attribute-type: 0x28 (40:BGP_PREFIX_SID)
# Attribute-flag: 0xc0 (Option, Transitive)
# Attribute-body: Label-Index TLV and Originator SRGB TLV
# Label-Index TLV: 0x01000700000000000001
# Type (08bit): 0x01
# Length (16bit): 0x0007
# RESERVED (08bit): 0x00
# Flags (16bit): 0x0000
# Label Index (32bit): 0x00000001
# Originator SRGB TLV: 0x03000800000c350000000a
# Type (08bit): 0x03
# Length (16bit): 0x0008 (nb-SRGB is 1)
# Flags (16bit): 0x0000
# SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
route 3.0.0.1/32 next-hop 10.0.0.101 label [800001] attribute [0x28 0xc0 0x0100070000000000000103000800000c350000000a];
# ExaBGP generic-attribute binary pattern:
# Attribute-type: 0x28 (40:BGP_PREFIX_SID)
# Attribute-flag: 0xc0 (Option, Transitive)
# Attribute-body: Label-Index TLV and Originator SRGB TLV
# Label-Index TLV: 0x01000700000000000001
# Type (08bit): 0x01
# Length (16bit): 0x0007
# RESERVED (08bit): 0x00
# Flags (16bit): 0x0000
# Label Index (32bit): 0x00000001
# Originator SRGB TLV: 0x03000800000c350000000a
# Type (08bit): 0x03
# Length (16bit): 0x0008 (nb-SRGB is 1)
# Flags (16bit): 0x0000
# SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
route 3.0.0.1/32 next-hop 10.0.0.101 label [800001] attribute [0x28 0xc0 0x0100070000000000000103000800000c350000000a];
# ExaBGP generic-attribute binary pattern:
# Attribute-type: 0x28 (40:BGP_PREFIX_SID)
# Attribute-flag: 0xc0 (Option, Transitive)
# Attribute-body: Label-Index TLV and Originator SRGB TLV
# Label-Index TLV: 0x01000700000000000001
# Type (08bit): 0x01
# Length (16bit): 0x0007
# RESERVED (08bit): 0x00
# Flags (16bit): 0x0000
# Label Index (32bit): 0x00000002
# Originator SRGB TLV: 0x03000800000c350000000a
# Type (08bit): 0x03
# Length (16bit): 0x0008 (nb-SRGB is 1)
# Flags (16bit): 0x0000
# SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
route 3.0.0.2/32 next-hop 10.0.0.101 label [800002] attribute [0x28 0xc0 0x0100070000000000000203000800000c350000000a];
# ExaBGP generic-attribute binary pattern:
# Attribute-type: 0x28 (40:BGP_PREFIX_SID)
# Attribute-flag: 0xc0 (Option, Transitive)
# Attribute-body: Label-Index TLV and Originator SRGB TLV
# Label-Index TLV: 0x01000700000000000001
# Type (08bit): 0x01
# Length (16bit): 0x0007
# RESERVED (08bit): 0x00
# Flags (16bit): 0x0000
# Label Index (32bit): 0x00000002
# Originator SRGB TLV: 0x03000800000c350000000a
# Type (08bit): 0x03
# Length (16bit): 0x0008 (nb-SRGB is 1)
# Flags (16bit): 0x0000
# SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
route 3.0.0.2/32 next-hop 10.0.0.101 label [800002] attribute [0x28 0xc0 0x0100070000000000000203000800000c350000000a];
# ExaBGP generic-attribute binary pattern:
# Attribute-type: 0x28 (40:BGP_PREFIX_SID)
# Attribute-flag: 0xc0 (Option, Transitive)
# Attribute-body: Label-Index TLV and Originator SRGB TLV
# Label-Index TLV: 0x01000700000000000001
# Type (08bit): 0x01
# Length (16bit): 0x0007
# RESERVED (08bit): 0x00
# Flags (16bit): 0x0000
# Label Index (32bit): 0x00000003
# Originator SRGB TLV: 0x03000800000c350000000a
# Type (08bit): 0x03
# Length (16bit): 0x0008 (nb-SRGB is 1)
# Flags (16bit): 0x0000
# SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
route 3.0.0.3/32 next-hop 10.0.0.101 label [800003] attribute [0x28 0xc0 0x0100070000000000000303000800000c350000000a];
}
# ExaBGP generic-attribute binary pattern:
# Attribute-type: 0x28 (40:BGP_PREFIX_SID)
# Attribute-flag: 0xc0 (Option, Transitive)
# Attribute-body: Label-Index TLV and Originator SRGB TLV
# Label-Index TLV: 0x01000700000000000001
# Type (08bit): 0x01
# Length (16bit): 0x0007
# RESERVED (08bit): 0x00
# Flags (16bit): 0x0000
# Label Index (32bit): 0x00000003
# Originator SRGB TLV: 0x03000800000c350000000a
# Type (08bit): 0x03
# Length (16bit): 0x0008 (nb-SRGB is 1)
# Flags (16bit): 0x0000
# SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1)
route 3.0.0.3/32 next-hop 10.0.0.101 label [800003] attribute [0x28 0xc0 0x0100070000000000000303000800000c350000000a];
}
}

View file

@ -1,19 +1,22 @@
group controller {
process receive-routes {
run /etc/exabgp/exa-receive.py --no-timestamp 2;
encoder json;
}
process receive-routes {
run "/etc/exabgp/exa-receive.py --no-timestamp 2";
receive-routes;
encoder json;
neighbor 10.0.0.1 {
router-id 10.0.0.102;
local-address 10.0.0.102;
local-as 3;
peer-as 1;
family {
ipv4 nlri-mpls;
}
neighbor 10.0.0.1 {
router-id 10.0.0.102;
local-address 10.0.0.102;
local-as 3;
peer-as 1;
family {
ipv4 nlri-mpls;
api {
processes [ receive-routes ];
receive {
parsed;
update;
}
}
}

View file

@ -120,13 +120,9 @@ def exabgp_get_update_prefix(filename, afi, nexthop, prefix):
ret = ret.get(afi)
if ret is None:
continue
ret = ret.get(nexthop)
if ret is None:
continue
ret = ret.get(prefix)
if ret is None:
continue
return output
for nh in ret.get(nexthop, []):
if nh.get("nlri") == prefix:
return output
return "Not found"
@ -135,33 +131,39 @@ def test_peer2_receive_prefix_sid_type1():
peer2 = tgen.gears["peer2"]
logfile = "{}/{}-received.log".format(peer2.gearlogdir, peer2.name)
def _check_type1_peer2(prefix, labelindex):
def _check_type1_peer2(prefix, label):
output = exabgp_get_update_prefix(
logfile, "ipv4 nlri-mpls", "10.0.0.101", prefix
)
expected = {
"type": "update",
"neighbor": {
"ip": "10.0.0.1",
"address": {
"peer": "10.0.0.1",
},
"message": {
"update": {
"attribute": {
"attribute-0x28-0xE0": "0x010007000000{:08x}".format(
labelindex
)
"announce": {
"ipv4 nlri-mpls": {
"10.0.0.101": [
{
"nlri": prefix,
"label": [[label]],
}
]
}
},
"announce": {"ipv4 nlri-mpls": {"10.0.0.101": {}}},
}
},
},
}
return topotest.json_cmp(output, expected)
test_func = functools.partial(_check_type1_peer2, "3.0.0.1/32", labelindex=1)
test_func = functools.partial(_check_type1_peer2, "3.0.0.1/32", label=8001)
success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")
test_func = functools.partial(_check_type1_peer2, "3.0.0.2/32", labelindex=2)
test_func = functools.partial(_check_type1_peer2, "3.0.0.2/32", label=8002)
success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2")

View file

@ -1,29 +1,27 @@
group controller {
neighbor 10.0.0.1 {
router-id 10.0.0.101;
local-address 10.0.0.101;
local-as 2;
peer-as 1;
neighbor 10.0.0.1 {
router-id 10.0.0.101;
local-address 10.0.0.101;
local-as 2;
peer-as 1;
family {
ipv6 mpls-vpn;
family {
ipv6 mpls-vpn;
}
static {
route 2001:1::/64 {
rd 2:10;
next-hop 2001::2;
extended-community [ target:2:10 ];
label 3;
attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ];
}
static {
route 2001:1::/64 {
rd 2:10;
next-hop 2001::2;
extended-community [ target:2:10 ];
label 3;
attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ];
}
route 2001:2::/64 {
rd 2:10;
next-hop 2001::2;
extended-community [ target:2:10 ];
label 3;
attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ];
}
route 2001:2::/64 {
rd 2:10;
next-hop 2001::2;
extended-community [ target:2:10 ];
label 3;
attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ];
}
}
}

View file

@ -21,5 +21,7 @@ router bgp 1
!
address-family ipv6 vpn
neighbor 10.0.0.101 activate
neighbor 10.0.0.101 route-map DENY_ALL out
exit-address-family
!
route-map DENY_ALL deny 10

View file

@ -1,10 +1,6 @@
{
"2:10":{
"prefix":"2001:1::\/64",
"advertisedTo":{
"10.0.0.101":{
}
},
"paths":[
{
"aspath":{

View file

@ -1,10 +1,6 @@
{
"2:10":{
"prefix":"2001:2::\/64",
"advertisedTo":{
"10.0.0.101":{
}
},
"paths":[
{
"aspath":{

View file

@ -3,7 +3,7 @@ neighbor 10.0.0.1 {
local-address 10.0.0.2;
local-as 65001;
peer-as 65534;
md5 test123;
md5-password test123;
static {
route 192.168.100.1/32 {

View file

@ -1,5 +1,6 @@
[exabgp.api]
ack = false
encoder = text
highres = false
respawn = false

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
exa-send.py: Send a few testroutes with ExaBGP

View file

@ -1,21 +1,18 @@
group controller {
process announce-routes {
run "/etc/exabgp/exa-send.py 1 10";
}
process receive-routes {
run "/etc/exabgp/exa-receive.py 1";
receive-routes;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.101;
local-address 10.0.1.101;
local-as 99;
peer-as 100;
graceful-restart;
}
process announce-routes {
run /etc/exabgp/exa-send.py 1 10;
encoder text;
}
process receive-routes {
run /etc/exabgp/exa-receive.py 1;
encoder text;
}
neighbor 10.0.1.1 {
router-id 10.0.1.101;
local-address 10.0.1.101;
local-as 99;
peer-as 100;
capability {graceful-restart;}
api {processes [ announce-routes, receive-routes ];}
}

View file

@ -14,6 +14,7 @@ import socket
import subprocess
import sys
import traceback
import configparser
from collections import OrderedDict
from copy import deepcopy
from datetime import datetime, timedelta
@ -21,12 +22,6 @@ from functools import wraps
from re import search as re_search
from time import sleep
try:
# Imports from python2
import ConfigParser as configparser
except ImportError:
# Imports from python3
import configparser
from lib.micronet import comm_error
from lib.topogen import TopoRouter, get_topogen

View file

@ -81,20 +81,20 @@ def is_string(value):
def get_exabgp_cmd(commander=None):
"""Return the command to use for ExaBGP version < 4."""
"""Return the command to use for ExaBGP version >= 4.2.11"""
if commander is None:
commander = Commander("exabgp", logger=logging.getLogger("exabgp"))
def exacmd_version_ok(exacmd):
logger.debug("checking %s for exabgp < version 4", exacmd)
logger.debug("checking %s for exabgp version >= 4.2.11", exacmd)
_, stdout, _ = commander.cmd_status(exacmd + " -v", warn=False)
m = re.search(r"ExaBGP\s*:\s*((\d+)\.(\d+)(?:\.(\d+))?)", stdout)
if not m:
return False
version = m.group(1)
if topotest.version_cmp(version, "4") >= 0:
logging.debug("found exabgp version >= 4 in %s will keep looking", exacmd)
if topotest.version_cmp(version, "4.2.11") < 0:
logging.debug("found exabgp version < 4.2.11 in %s will keep looking", exacmd)
return False
logger.info("Using ExaBGP version %s in %s", version, exacmd)
return True
@ -102,14 +102,14 @@ def get_exabgp_cmd(commander=None):
exacmd = commander.get_exec_path("exabgp")
if exacmd and exacmd_version_ok(exacmd):
return exacmd
py2_path = commander.get_exec_path("python2")
if py2_path:
exacmd = py2_path + " -m exabgp"
py3_path = commander.get_exec_path("python3")
if py3_path:
exacmd = py3_path + " -m exabgp"
if exacmd_version_ok(exacmd):
return exacmd
py2_path = commander.get_exec_path("python")
if py2_path:
exacmd = py2_path + " -m exabgp"
py3_path = commander.get_exec_path("python")
if py3_path:
exacmd = py3_path + " -m exabgp"
if exacmd_version_ok(exacmd):
return exacmd
return None
@ -1198,7 +1198,7 @@ class TopoExaBGP(TopoHost):
* Run ExaBGP with env file `env_file` and configuration peer*/exabgp.cfg
"""
exacmd = self.tgen.get_exabgp_cmd()
assert exacmd, "Can't find a usabel ExaBGP (must be < version 4)"
assert exacmd, "Can't find a usable ExaBGP (must be version >= 4.2.11)"
self.run("mkdir -p /etc/exabgp")
self.run("chmod 755 /etc/exabgp")
@ -1209,8 +1209,22 @@ class TopoExaBGP(TopoHost):
self.run("chmod 644 /etc/exabgp/*")
self.run("chmod a+x /etc/exabgp/*.py")
self.run("chown -R exabgp:exabgp /etc/exabgp")
self.run("[ -p /var/run/exabgp.in ] || mkfifo /var/run/exabgp.in")
self.run("[ -p /var/run/exabgp.out ] || mkfifo /var/run/exabgp.out")
self.run("chown exabgp:exabgp /var/run/exabgp.{in,out}")
self.run("chmod 600 /var/run/exabgp.{in,out}")
output = self.run(exacmd + " -e /etc/exabgp/exabgp.env /etc/exabgp/exabgp.cfg")
log_dir = os.path.join(self.logdir, self.name)
self.run("chmod 777 {}".format(log_dir))
log_file = os.path.join(log_dir, "exabgp.log")
env_cmd = "env exabgp.log.level=INFO "
env_cmd += "exabgp.log.destination={} ".format(log_file)
output = self.run(
env_cmd + exacmd + " -e /etc/exabgp/exabgp.env /etc/exabgp/exabgp.cfg "
)
if output is None or len(output) == 0:
output = "<none>"
@ -1371,7 +1385,7 @@ def diagnose_env_linux(rundir):
logger.info("LDPd tests will not run (missing mpls-iptunnel kernel module)")
if not get_exabgp_cmd():
logger.warning("Failed to find exabgp < 4")
logger.warning("Failed to find exabgp >= 4.2.11")
logger.removeHandler(fhandler)
fhandler.close()

View file

@ -1,6 +1,8 @@
# Skip pytests example directory
[pytest]
# NEEDS_EXABGP_4_2_11_FRR
# asyncio_mode = auto
# We always turn this on inside conftest.py, default shown