BGP configuration doesn't work with Vyos 1.4.x
SUMMARY
I tried to use this module to automate BGP configuration but it doesn't work with Vyos 1.4.x due to invalid syntax of configuration commands this module tries to send.
ISSUE TYPE
- Bug Report
COMPONENT NAME
vyos.vyos.vyos_bgp_address_family
vyos.vyos.vyos_bgp_global
ANSIBLE VERSION
ansible 2.10.8
COLLECTION VERSION
vyos.vyos 4.1.0
CONFIGURATION
ansible-config dump --only-changeded
CONFIG_FILE() = None
OS / ENVIRONMENT
ubuntu ansible==10.0.1 ansible-core==2.17.0 ansible-pylibssh==1.1.0 bcrypt==4.1.3 cffi==1.16.0 cryptography==42.0.8 Jinja2==3.1.4 jmespath==1.0.1 MarkupSafe==2.1.5 packaging==24.0 paramiko==3.4.0 pycparser==2.22 PyNaCl==1.5.0 PyYAML==6.0.1 resolvelib==1.0.1
STEPS TO REPRODUCE
Run a playbook forom module examples
- name: configure bgp
vyos.vyos.vyos_bgp_address_family:
config:
as_number: "100"
address_family:
- afi: "ipv4"
redistribute:
- protocol: "static"
metric: 50
neighbors:
- neighbor_address: "20.33.1.1/24"
address_family:
- afi: "ipv4"
allowas_in: 4
as_override: True
attribute_unchanged:
med: True
- afi: "ipv6"
default_originate: "map01"
distribute_list:
- action: "export"
acl: 10
- neighbor_address: "100.11.34.12"
address_family:
- afi: "ipv4"
maximum_prefix: 45
nexthop_self: True
route_map:
- action: "export"
route_map: "map01"
- action: "import"
route_map: "map01"
weight: 50
EXPECTED RESULTS
BGP is configured on Vyos router
ACTUAL RESULTS
Getting syntax error message. I guess there was a change in Vyos BGP configuration command structure.
TASK [configure bgp] ******************************************************************************************************************************************
fatal: [vyos_router]: FAILED! => {"changed": false, "module_stderr": "set protocols bgp 100 address-family ipv4-unicast redistribute static metric 50\r\n\r\n Configuration path: protocols bgp [100] is not valid\r\n Set failed\r\n\r\n[edit]\r\r\nvyos@vyos# ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"}
working commands should be:
set protocols bgp system-as '100'
set protocols bgp address-family ipv4-unicast redistribute static metric '50'
VyOS 1.4 has a different syntax for configuration BGP compared to 1.3/1.2 It will be cool to add some "version" feature for the playbook.
yes indeed, that would be really nice. I will try to play myself with "vyos/vyos/plugins/module_utils/network/vyos/rm_templates/bgp_address_family.py" over the weekend and see if I can make this working with 1.4
The version logic is a little tricky, but I've been working on an update that handles 1.2, 1.3, 1.4 and mostly 1.5. There is some opportunity for auto-detection when talking to real device, but a bit tricker when using offline modes.
I'm making my way to BGP...
@andamasov This an probably be closed and merged with the other BGP story.
@gaige I moved it to https://vyos.dev/T6892 we can merge in as duplicate there to preserve info but let me know to what task should be primary