Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BGP configuration doesn't work with Vyos 1.4.x #343

Open
mstanis opened this issue Jun 6, 2024 · 3 comments
Open

BGP configuration doesn't work with Vyos 1.4.x #343

mstanis opened this issue Jun 6, 2024 · 3 comments
Labels
1.4 Compatibility with 1.4 versions 1.5 Compatibility with 1.5 versions bgp_address_family bgp address family resource module bgp_global bgp global resource module

Comments

@mstanis
Copy link

mstanis commented Jun 6, 2024

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'
@sever-sever
Copy link
Member

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.

@mstanis
Copy link
Author

mstanis commented Jun 6, 2024

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

@gaige
Copy link

gaige commented Jul 28, 2024

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...

@gaige gaige added bgp_global bgp global resource module bgp_address_family bgp address family resource module 1.4 Compatibility with 1.4 versions 1.5 Compatibility with 1.5 versions labels Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.4 Compatibility with 1.4 versions 1.5 Compatibility with 1.5 versions bgp_address_family bgp address family resource module bgp_global bgp global resource module
Development

No branches or pull requests

3 participants