Skip to content

Commit

Permalink
Fix Cumulus (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertvolkmann authored Jul 19, 2024
1 parent 54fd8f1 commit 872652e
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
./test/ci-cleanup.sh
./test/integration.sh
env:
MINI_LAB_FLAVOR: ${{ matrix.flavors.name }}
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions roles/cumulus/handlers/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
enabled: true
state: restarted

- name: reload interfaces
shell: sleep 3; ifreload -a
async: 1
poll: 0
notify: wait for new connection

- name: wait for new connection
wait_for_connection:
connect_timeout: 20
sleep: 5
delay: 5
timeout: 300

- name: reload frr
service:
name: frr
enabled: true
state: reloaded

- name: restart frr
service:
name: frr
Expand All @@ -36,3 +55,9 @@
name: lldpd
enabled: true
state: restarted

- name: restart ntp@mgmt
service:
name: ntp@mgmt
enabled: true
state: restarted
21 changes: 21 additions & 0 deletions roles/cumulus/tasks/router.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@
state: restarted
when: ("macaddress" not in lldpd_subtype_check.stdout)

- name: populate service facts
service_facts:

- name: render interfaces configuration
template:
src: interfaces.j2
dest: /etc/network/interfaces
validate: '/sbin/ifup --syntax-check --all --interfaces %s'
notify: reload interfaces
when: "ansible_facts.services['metal-core.service'] is not defined"

- name: render resolv.conf
template:
src: resolv.conf.j2
Expand All @@ -48,6 +59,16 @@
dest: /etc/frr/daemons
notify: restart frr

- name: render frr configuration
template:
src: frr.conf.j2
dest: /etc/frr/frr.conf
validate: '/usr/bin/vtysh --dryrun --inputfile %s'
tags: frr
register: frr_rendered
notify: reload frr
when: "ansible_facts.services['metal-core.service'] is not defined"

- name: set hostname
nclu:
commands:
Expand Down
41 changes: 41 additions & 0 deletions roles/cumulus/templates/frr.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#jinja2: lstrip_blocks: "True", trim_blocks: "True"
frr version 4.0+cl3u9
frr defaults datacenter
hostname {{ ansible_hostname }}
username cumulus nopassword
!
service integrated-vtysh-config
!
log syslog informational
!
vrf mgmt
ip route 10.0.1.0/24 {{ ansible_host }} nexthop-vrf default
exit-vrf
!
router bgp {{ asn }}
bgp router-id {{ lo }}
neighbor FABRIC peer-group
neighbor FABRIC remote-as external
{% for iface in uplinks %}
neighbor {{ iface.name }} interface peer-group FABRIC
{% endfor %}
!
address-family ipv4 unicast
neighbor FABRIC activate
redistribute connected route-map LOOPBACKS
exit-address-family
!
address-family l2vpn evpn
neighbor FABRIC activate
advertise-all-vni
exit-address-family
!
route-map LOOPBACKS permit 10
match interface lo
!
{% if metal_partition_mgmt_gateway %}
ip route 0.0.0.0/0 {{ metal_partition_mgmt_gateway }} nexthop-vrf mgmt
!
{% endif %}
line vty
!
51 changes: 51 additions & 0 deletions roles/cumulus/templates/interfaces.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*.intf

# The loopback network interface
auto lo
iface lo inet loopback
address {{ lo }}/32

# The primary network interface
auto eth0
iface eth0
address {{ ansible_host }}/24
gateway {{ metal_partition_mgmt_gateway }}
vrf mgmt

auto mgmt
iface mgmt
address 127.0.0.1/8
vrf-table auto

{% for iface in uplinks %}
auto {{ iface.name }}
iface {{ iface.name }}
mtu {{ mtu.vxlan }}

{% endfor %}

auto bridge
iface bridge
bridge-ports vni104000
bridge-vids 4000
bridge-vlan-aware yes

auto vlan4000
iface vlan4000
mtu {{ mtu.default }}
address {{ metal_core_cidr }}
vlan-id 4000
vlan-raw-device bridge

auto vni104000
iface vni104000
mtu {{ mtu.default }}
bridge-access 4000
bridge-learning off
mstpctl-bpduguard yes
mstpctl-portbpdufilter yes
vxlan-id 104000
vxlan-local-tunnelip {{ lo }}

0 comments on commit 872652e

Please sign in to comment.