Skip to content

Commit 7842d4e

Browse files
authored
Changes before the presentation at HL2025: (#3)
* Add README.md with quick start guide * Add demo env configuration files and instructions * Added a conscious error about the absence of JQ in the tools * Fixed dependencies: Added PyYAML as a required dependency * Fixed a bug in accessing the timeout parameter * Fixed typo in evpn-connector config sample
1 parent 0b06b2c commit 7842d4e

File tree

15 files changed

+409
-3
lines changed

15 files changed

+409
-3
lines changed

README.md

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,137 @@
11
# evpn-connector
22

3-
The main task of this daemon is to interact with the gobgp and ovs to provide a connection using the EVPN protocol
3+
[![Python Version](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
4+
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
5+
6+
A service for automating the management distributed switch or router based on EVPN standards
7+
8+
9+
## Key Features
10+
11+
* **EVPN Standards Support:**
12+
* RFC 7432: BGP MPLS-Based Ethernet VPN
13+
* RFC 8365: Network Virtualization Overlay
14+
* RFC 7988: Ingress Replication Tunnels in Multicast VPN
15+
* RFC 9135: Integrated Routing and Bridging in Ethernet VPN
16+
* RFC 9136: IP Prefix Advertisement in Ethernet VPN
17+
* **Hardware Integration:** Interaction with the hardware switch and routers via EVPN
18+
* **GoBGP Integration:** Interaction with the gobgpd daemon to pull or push EVPN annouces
19+
* **OpenvSwitch Management:** Direct management of bridges and flows within the OpenvSwitch system
20+
* **Reconciliation Loop Design:** Built on a closed-loop control architecture to ensure fault tolerance and reduce the impact of external factors
21+
* **Configurability:** Flexible setup via INI daemon configuration files and JSON clients configuration files
22+
23+
## Documentation
24+
The details of the EVPN's operation and evpn-connector daemon workflow are described in the [presentation](https://vkvideo.ru/video-164978780_456239752) (in Russian only).
25+
26+
## Installation & Quick Start
27+
28+
### Prerequisites
29+
30+
* **Python 3.8
31+
* **System Dependencies:**
32+
* `gobgp` (for interaction via BGP within the EVPN control plane)
33+
* `openvswitch-switch` (for interaction via VXLAN within the EVPN data plane)
34+
* **Permissions:** Requires `root` privileges for interaction with OpenvSwitch
35+
36+
37+
1. **Install dependencies:**
38+
39+
On Ubuntu/Debian:
40+
```bash
41+
sudo apt update
42+
sudo apt install openvswitch-switch openvswitch-common gobgpd
43+
```
44+
On CentOS/RHEL:
45+
```bash
46+
sudo yum install gobgp openvswitch
47+
# or for newer versions:
48+
# sudo dnf install gobgp openvswitch
49+
```
50+
2. **(Optional) Install latest GoBGP from binary release:**
51+
```bash
52+
wget https://github.com/osrg/gobgp/releases/download/v3.34.0/gobgp_3.34.0_linux_amd64.tar.gz
53+
mkdir gobgp
54+
tar -xf gobgp_3.34.0_linux_amd64.tar.gz -C gobgp/
55+
```
56+
3. **(Recommended) Create a virtual environment:**
57+
Recommended installation gobgp versions >= v3.34
58+
```bash
59+
python3 -m venv evpn
60+
source evpn/bin/activate
61+
pip install --upgrade pip setuptools
62+
```
63+
4. **Install evpn-connector:**
64+
```bash
65+
pip install evpn-connector
66+
```
67+
### Configuration
68+
69+
Before the first run, you need to create a configuration file.
70+
71+
1. **GoBGP config:** Copy the example configuration file and adapt it to your environment.
72+
```bash
73+
cp etc/gobgpd/gobgp.conf.sample /etc/gobgpd/gobgp.conf
74+
```
75+
It is necessary to configure gobgp so that all nodes can exchange announces with afi-safi **"l2evpn-evpn"**
76+
77+
2. **evpn-connector config:** Copy the example configuration file and adapt it to your environment.
78+
```bash
79+
mkdir /etc/evpn_connector/
80+
cp etc/evpn_connector/logging.yaml /etc/evpn_connector/logging.yaml
81+
cp etc/evpn_connector/evpn_connector.cfg.sample /etc/evpn_connector/evpn_connector.conf
82+
```
83+
3. **Edit `/etc/evpn_connector/evpn_connector.conf`:** Specify the necessary parameters:
84+
* `[gobgp] section`: Settings for connecting to the GoBGP daemon
85+
* `[gobgp] source_ip`: Source IP address for all VXLAN packets
86+
* `[ovs] section`: Settings for OpenvSwitch dataplane parameters
87+
* `[ovs] switch_name`: Name of switch created in OvS
88+
* `[daemon] section`: Settings for evpn_connector daemon
89+
* `[daemon] configs_dir`: Path to client configs
90+
91+
4. **Client configs:** Create clients configs. Example config:
92+
* For L2 connectivity
93+
```json
94+
{
95+
"cfg_type": "l2", // Config type for L2 connectivity use "l2"
96+
"mac": "36:e7:a5:7e:0c:81", // MAC address of client
97+
"ip": "10.0.0.1", // IP address of client
98+
"vni": 10, // VXLAN segment identifier
99+
"ofport": 1000, // OpenFlow port number in current OpenvSwitch switch
100+
"type": "flat", // OpenvSwitch port type. May be "flat" and "vlan"
101+
"tag": 0, // OpenvSwitch port segment identifier. Ignored on "flat"
102+
"imp_rt": ["65000:10"], // List of imported BGP Route Targets
103+
"exp_rt": ["65000:10"] // List of exported BGP Route Targets
104+
}
105+
```
106+
* For L3 connectivity
107+
```json
108+
{
109+
"cfg_type": "l3", // Config type for L3 connectivity use "l3"
110+
"mac": "36:e7:a5:7e:0c:81", // MAC address of client
111+
"routes": ["10.0.0.1/32"], // List of CIDR prefixes for this client
112+
"vni": 10, // VXLAN segment identifier
113+
"ofport": 1000, // OpenFlow port number in current OpenvSwitch switch
114+
"type": "flat", // OpenvSwitch port type. May be "flat" and "vlan"
115+
"tag": 0, // OpenvSwitch port segment identifier. Ignored on "flat"
116+
"imp_rt": ["65000:10"], // List of imported BGP Route Targets
117+
"exp_rt": ["65000:10"] // List of exported BGP Route Targets
118+
}
119+
```
120+
Need create json config for all clients in **configs_dir**
121+
```bash
122+
mkdir /var/lib/evpn_connector/client_configs/
123+
vim /var/lib/evpn_connector/client_configs/vm1.json
124+
```
125+
### Running the Service
126+
127+
Start the service by specifying the path to your configuration file:
128+
129+
1. **Run GoBGP:**
130+
```bash
131+
sudo gobgpd -f /etc/gobgpd/gobgp.conf
132+
```
133+
2. **Run evpn-connector**
134+
```bash
135+
source evpn/bin/activate
136+
evpn-connector --config-file ~/evpn/config/evpn_connector.cfg --daemon-configs_dir "/var/lib/evpn_connector/client_configs/"
137+
```

docs/demo/CONFIGURE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Configuring demo env:
2+
3+
1. Download Debian 12 nocloud image:
4+
```bash
5+
wget https://cdimage.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2
6+
```
7+
2. Run virtual machines via virt-manager or qemu:
8+
```
9+
Hostname: compute1, ip_address: 10.10.10.1
10+
Hostname: compute2, ip_address: 10.10.10.2
11+
```
12+
3. Install packages:
13+
```bash
14+
sudo apt update
15+
sudo apt install build-essential zlib1g-dev libffi-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev liblzma-dev libncurses-dev screen tcpdump openvswitch-switch openvswitch-common jq curl git wget
16+
```
17+
4. Install pyenv:
18+
```bash
19+
curl -fsSL https://pyenv.run | bash
20+
```
21+
5. Add to end of `.bashrc` and reenter to bash:
22+
```bash
23+
export PYENV_ROOT="$HOME/.pyenv"
24+
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
25+
eval "$(pyenv init - bash)"
26+
export PATH="$HOME/gobgp:$PATH"
27+
bold=$(tput bold)
28+
red=$(tput setaf 1)
29+
green=$(tput setaf 2)
30+
blue=$(tput setaf 4)
31+
reset=$(tput sgr0)
32+
PS1='\[$red\]\h\[$reset\]:\[$bold\]\w\[$reset\]\$ '
33+
```
34+
6. Install python3.8 for evpn-connector:
35+
```bash
36+
pyenv install 3.8.20
37+
pyenv global system 3.8
38+
```
39+
7. Create venv for evpn-connector and activate:
40+
```bash
41+
python3.8 -m venv ~/evpn/
42+
source evpn/bin/activate
43+
```
44+
8. Install evpn-connector from pip
45+
```bash
46+
pip install --upgrade pip setuptools
47+
pip install evpn-connector
48+
```
49+
9. Download and install GoBGP from binary:
50+
```bash
51+
wget https://github.com/osrg/gobgp/releases/download/v3.34.0/gobgp_3.34.0_linux_amd64.tar.gz
52+
mkdir gobgp
53+
tar -xf gobgp_3.34.0_linux_amd64.tar.gz -C gobgp/
54+
rm gobgp_3.34.0_linux_amd64.tar.gz
55+
```
56+
10. Clone evpn-connector git repo:
57+
```bash
58+
git clone https://github.com/vktechdev/evpn_connector
59+
```
60+
11. Copy configs for all daemons from repo (for each compute host separately):
61+
```bash
62+
cp -r evpn_connector/docs/source/demo/compute1/* ~/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[DEFAULT]
2+
verbose = True
3+
debug = True
4+
5+
[logging]
6+
config = logging.yaml
7+
8+
[agent]
9+
sync_period = 10
10+
11+
[victoria_metrics]
12+
enabled = False
13+
host = "127.0.0.1"
14+
port = 8126
15+
prefix = "apps.evpn_connector.dev"
16+
obsender_host = "sprut.compute.i"
17+
18+
[sentry]
19+
enabled = False
20+
dsn = "http://01b92236b6514577812280415d631354@192.168.220.220:9000/2"
21+
traces_sample_rate = 1.0
22+
env = devenv
23+
24+
[gobgp]
25+
gobgp_channel = "localhost:50051"
26+
grpc_timeout_sec = 100
27+
# Don't change this param without gobgp restart
28+
source_ip = "10.10.10.1"
29+
as_number = 1
30+
31+
[ovs]
32+
switch_name = "evpn"
33+
vxlan_udp_port = 4789
34+
enable_sudo = True
35+
ovs_vsctl_bin_path="/usr/bin/ovs-vsctl"
36+
ovs_ofctl_bin_path="/usr/bin/ovs-ofctl"
37+
38+
[anycast]
39+
anycast_status_file = /tmp/anycast_status_file

docs/demo/compute1/gobgp.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[global.config]
2+
as = 65100
3+
router-id = "10.10.10.1"
4+
local-address-list = [ "10.10.10.1" ]
5+
6+
[[neighbors]]
7+
[neighbors.config]
8+
peer-as = 65200
9+
neighbor-address = "10.10.10.2"
10+
[neighbors.ebgp-multihop.config]
11+
enabled = true
12+
multihop-ttl = 7
13+
[[neighbors.afi-safis]]
14+
[neighbors.afi-safis.config]
15+
afi-safi-name = "l2vpn-evpn"

docs/demo/compute1/logging.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 1
2+
formatters:
3+
aardvark:
4+
format: '%(asctime)15s.%(msecs)03d %(processName)s pid:%(process)d tid:%(thread)d %(levelname)s %(name)s:%(lineno)d %(message)s'
5+
datefmt: '%Y-%m-%dT%H:%M:%S'
6+
# this one should only be used by handlers that support topology_id attribute
7+
# and since it may be used by multiple modules, actual_module attribute
8+
# should also be added (module will give a short name, pathname is too long)
9+
10+
handlers:
11+
console:
12+
class : logging.StreamHandler
13+
formatter: aardvark
14+
stream : ext://sys.stdout
15+
16+
loggers:
17+
# by default all existing loggers are disabled upon the application
18+
# of this config. To re-enable a logger and it's childer just add it
19+
# to the loggers section with any even empty fields.
20+
obsender:
21+
handlers: [console]
22+
level: WARNING
23+
propagate: False
24+
25+
loopster:
26+
level: WARNING
27+
28+
evpn_connector: {}
29+
30+
root:
31+
handlers: [console]
32+
level: INFO
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"cfg_type": "l3",
3+
"mac": "36:e7:a5:7e:0c:81",
4+
"routes": ["172.16.0.1/32"],
5+
"vni": 10,
6+
"ofport": 1001,
7+
"type": "flat",
8+
"tag": 0,
9+
"imp_rt": ["65000:10"],
10+
"exp_rt": ["65000:10"]
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"cfg_type": "l3",
3+
"mac": "36:e7:a5:7e:0c:82",
4+
"routes": ["172.16.0.2/32"],
5+
"vni": 10,
6+
"ofport": 1002,
7+
"type": "flat",
8+
"tag": 0,
9+
"imp_rt": ["65000:10"],
10+
"exp_rt": ["65000:10"]
11+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[DEFAULT]
2+
verbose = True
3+
debug = True
4+
5+
[logging]
6+
config = logging.yaml
7+
8+
[agent]
9+
sync_period = 10
10+
11+
[victoria_metrics]
12+
enabled = False
13+
host = "127.0.0.1"
14+
port = 8126
15+
prefix = "apps.evpn_connector.dev"
16+
obsender_host = "sprut.compute.i"
17+
18+
[sentry]
19+
enabled = False
20+
dsn = "http://01b92236b6514577812280415d631354@192.168.220.220:9000/2"
21+
traces_sample_rate = 1.0
22+
env = devenv
23+
24+
[gobgp]
25+
gobgp_channel = "localhost:50051"
26+
grpc_timeout_sec = 100
27+
# Don't change this param without gobgp restart
28+
source_ip = "10.10.10.2"
29+
as_number = 1
30+
31+
[ovs]
32+
switch_name = "evpn"
33+
vxlan_udp_port = 4789
34+
enable_sudo = True
35+
ovs_vsctl_bin_path="/usr/bin/ovs-vsctl"
36+
ovs_ofctl_bin_path="/usr/bin/ovs-ofctl"
37+
38+
[anycast]
39+
anycast_status_file = /tmp/anycast_status_file

docs/demo/compute2/gobgp.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[global.config]
2+
as = 65200
3+
router-id = "10.10.10.2"
4+
local-address-list = [ "10.10.10.2" ]
5+
6+
[[neighbors]]
7+
[neighbors.config]
8+
peer-as = 65100
9+
neighbor-address = "10.10.10.1"
10+
[neighbors.ebgp-multihop.config]
11+
enabled = true
12+
multihop-ttl = 7
13+
[[neighbors.afi-safis]]
14+
[neighbors.afi-safis.config]
15+
afi-safi-name = "l2vpn-evpn"

0 commit comments

Comments
 (0)