Add second router for BGP configuration
This patch adjusts CI test and adds support to configure FRR bgpd Change-Id: I451438a9c1a12025af3439895338829b7d5f178f
This commit is contained in:
parent
59270dd41a
commit
00534ccaf8
20
.zuul.yaml
20
.zuul.yaml
@ -1,8 +1,26 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- nodeset:
|
||||||
|
name: debian-buster-2-node
|
||||||
|
nodes:
|
||||||
|
- name: primary
|
||||||
|
label: debian-buster
|
||||||
|
- name: secondary
|
||||||
|
label: debian-buster
|
||||||
|
groups:
|
||||||
|
- name: switch
|
||||||
|
nodes:
|
||||||
|
- primary
|
||||||
|
- name: peers
|
||||||
|
nodes:
|
||||||
|
- primary
|
||||||
|
- secondary
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: ffrouting-deploy
|
name: ffrouting-deploy
|
||||||
parent: base
|
parent: base
|
||||||
run: tests/test.yml
|
run: tests/test.yml
|
||||||
nodeset: debian-buster
|
nodeset: debian-buster-2-node
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
check:
|
check:
|
||||||
|
@ -29,3 +29,7 @@ frr_vlans: []
|
|||||||
|
|
||||||
frr_integrated_config_path: /etc/frr/frr.conf
|
frr_integrated_config_path: /etc/frr/frr.conf
|
||||||
frr_staticd_routes: []
|
frr_staticd_routes: []
|
||||||
|
frr_bgpd_config: []
|
||||||
|
frr_bgpd_enable: "{{ (frr_bgpd_config | length > 0) }}"
|
||||||
|
frr_daemons:
|
||||||
|
bgpd: "{{ frr_bgpd_enable }}"
|
||||||
|
@ -32,4 +32,13 @@
|
|||||||
owner: frr
|
owner: frr
|
||||||
group: frr
|
group: frr
|
||||||
mode: "0640"
|
mode: "0640"
|
||||||
|
validate: /usr/bin/vtysh -C -f %s
|
||||||
|
notify: Restart frr
|
||||||
|
|
||||||
|
- name: Configure supported daemons
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/frr/daemons
|
||||||
|
line: "{{ item.key }}={{ item.value | bool | ternary('yes', 'no') }}"
|
||||||
|
regexp: "^{{ item.key }}"
|
||||||
|
with_dict: "{{ frr_daemons }}"
|
||||||
notify: Restart frr
|
notify: Restart frr
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
include_tasks: frr_vlans.yml
|
include_tasks: frr_vlans.yml
|
||||||
when: frr_vlans | length > 0
|
when: frr_vlans | length > 0
|
||||||
|
|
||||||
|
- name: Gather network facts
|
||||||
|
setup:
|
||||||
|
gather_subset:
|
||||||
|
- network
|
||||||
|
|
||||||
- name: Install frr
|
- name: Install frr
|
||||||
include_tasks: frr_install.yml
|
include_tasks: frr_install.yml
|
||||||
|
|
||||||
|
@ -9,5 +9,9 @@ log syslog informational
|
|||||||
! staticd config
|
! staticd config
|
||||||
{{ frr_staticd_routes | join('\n') }}
|
{{ frr_staticd_routes | join('\n') }}
|
||||||
!
|
!
|
||||||
|
!
|
||||||
|
! bgpd config
|
||||||
|
{{ frr_bgpd_config | join('\n') }}
|
||||||
|
!
|
||||||
line vty
|
line vty
|
||||||
!
|
!
|
16
tests/host_vars/primary
Normal file
16
tests/host_vars/primary
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
frr_vlans:
|
||||||
|
- vlan-raw-device: "{{ ansible_default_ipv4.interface }}"
|
||||||
|
id: 100
|
||||||
|
address: 192.168.1.100
|
||||||
|
netmask: 255.255.255.0
|
||||||
|
network: 192.168.1.0
|
||||||
|
broadcast: 192.168.1.255
|
||||||
|
|
||||||
|
frr_staticd_routes:
|
||||||
|
- ip route 10.0.0.0/24 192.168.1.10
|
||||||
|
|
||||||
|
frr_bgpd_config:
|
||||||
|
- router bgp 1234
|
||||||
|
- "bgp router-id {{ hostvars['primary']['ansible_br_infra']['ipv4']['address'] }}"
|
||||||
|
- "neighbor {{ hostvars['secondary']['ansible_br_infra']['ipv4']['address'] }} remote-as 5678"
|
||||||
|
- network 192.168.1.0/24
|
4
tests/host_vars/secondary
Normal file
4
tests/host_vars/secondary
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
frr_bgpd_config:
|
||||||
|
- router bgp 5678
|
||||||
|
- "bgp router-id {{ hostvars['secondary']['ansible_br_infra']['ipv4']['address'] }}"
|
||||||
|
- "neighbor {{ hostvars['primary']['ansible_br_infra']['ipv4']['address'] }} remote-as 1234"
|
@ -15,10 +15,10 @@
|
|||||||
|
|
||||||
- name: Installing frr
|
- name: Installing frr
|
||||||
hosts: all
|
hosts: all
|
||||||
vars_files:
|
|
||||||
- test_vars.yml
|
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
|
- multi-node-bridge
|
||||||
|
- clear-firewall
|
||||||
- frrouting
|
- frrouting
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
@ -36,6 +36,7 @@
|
|||||||
retries: 5
|
retries: 5
|
||||||
delay: 10
|
delay: 10
|
||||||
with_items: "{{ frr_vlans }}"
|
with_items: "{{ frr_vlans }}"
|
||||||
|
when: inventory_hostname == 'primary'
|
||||||
|
|
||||||
- name: Check service state
|
- name: Check service state
|
||||||
service_facts:
|
service_facts:
|
||||||
@ -45,15 +46,25 @@
|
|||||||
msg: frr is not up
|
msg: frr is not up
|
||||||
when: ansible_facts.services['frr'].state != 'running'
|
when: ansible_facts.services['frr'].state != 'running'
|
||||||
|
|
||||||
- name: Get static routes
|
- name: Get routes
|
||||||
become: true
|
become: true
|
||||||
become_user: root
|
become_user: root
|
||||||
command: "vtysh -c 'show ip route'"
|
command: "vtysh -c 'show ip route'"
|
||||||
register: _frr_get_routes
|
register: _frr_get_routes
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Fail if we're missing routes
|
|
||||||
|
- name: Fail if we're missing static routes
|
||||||
fail:
|
fail:
|
||||||
msg: "We can't find route {{ item }}"
|
msg: "We can't find route {{ item }}"
|
||||||
with_items: "{{ frr_staticd_routes }}"
|
with_items: "{{ frr_staticd_routes }}"
|
||||||
when: item.split(' ')[-1] not in _frr_get_routes.stdout
|
when:
|
||||||
|
- inventory_hostname == 'primary'
|
||||||
|
- item.split(' ')[-1] not in _frr_get_routes.stdout
|
||||||
|
|
||||||
|
- name: Fail if we're missing bgp routes
|
||||||
|
fail:
|
||||||
|
msg: "We can't find route 192.168.1.0/24"
|
||||||
|
when:
|
||||||
|
- inventory_hostname == 'secondary'
|
||||||
|
- "'192.168.1.0/24' not in _frr_get_routes.stdout"
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2020, VEXXHOST, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
frr_vlans:
|
|
||||||
- vlan-raw-device: "{{ ansible_default_ipv4.interface }}"
|
|
||||||
id: 100
|
|
||||||
address: 192.168.1.100
|
|
||||||
netmask: 255.255.255.0
|
|
||||||
network: 192.168.1.0
|
|
||||||
broadcast: 192.168.1.255
|
|
||||||
|
|
||||||
frr_staticd_routes:
|
|
||||||
- ip route 10.0.0.0/24 192.168.1.10
|
|
Loading…
Reference in New Issue
Block a user