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

vyos_bgp_global setting neighbor passive causes module to try configuring neighbhr next-hop-self #269

Open
rbh1981 opened this issue Aug 25, 2022 · 3 comments

Comments

@rbh1981
Copy link

rbh1981 commented Aug 25, 2022

SUMMARY

When using module vyos_bgp_global to configure neighbor as passive it causes ansible to try configuring 'neighbor

nexthop-self'. Commenting out the passive variable allows play to execute properly (but not set passive neighbor config).

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vyos_bgp_global

ANSIBLE VERSION
ansible [core 2.12.7]
  config file = /home/xxxxxx/xxxxxx/ansible.cfg
  configured module search path = ['/home/xxxxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/xxxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True

COLLECTION VERSION
# /usr/lib/python3/dist-packages/ansible_collections
Collection Version
---------- -------
vyos.vyos  2.8.0  

CONFIGURATION
DEFAULT_GATHERING(/home/xxxx/xxxx/ansible.cfg) = explicit
DEFAULT_HOST_LIST(/home/xxxx/xxxxx/ansible.cfg) = ['/home/xxxx/xxxx/hosts.yml']
DISPLAY_SKIPPED_HOSTS(/home/xxxx/xxxx/ansible.cfg) = False
HOST_KEY_CHECKING(/home/xxxx/xxxx/ansible.cfg) = False
PERSISTENT_COMMAND_TIMEOUT(/home/xxxx/xxxx/ansible.cfg) = 30
PERSISTENT_CONNECT_TIMEOUT(/home/xxxx/xxxx/ansible.cfg) = 60

OS / ENVIRONMENT

Ubuntu Server 20.04 on Azure

STEPS TO REPRODUCE

Run ansible play trying to set neighbor passive and ansible will error out

# Ansible play
- name: "Configure BGP Global"
  vyos.vyos.vyos_bgp_global:
    config: "{{ bgp_global }}"

# bgp_global host variable file
bgp_global:
  as_number: 64555
  bgp_params:
    default:
      no_ipv4_unicast: true
    router_id: 10.1.1.1
    log_neighbor_changes: true
  neighbor:
    - address: 10.240.10.20
      passive: true
      remote_as: 64555
    - address: 10.240.10.30
      passive: true
      remote_as: 64555
    - address: 10.240.10.40
      passive: true
      remote_as: 64555
EXPECTED RESULTS

bgp_global moduel should configure specified neighbor as passive:

set protocols bgp 64555 neighbor 10.240.10.40 passive

ACTUAL RESULTS

Ansible tries to configure neighbor

nexthop-self.

ansible.module_utils.connection.ConnectionError: set protocols bgp 64555 neighbor 10.240.10.40 nexthop-self                                                                                                                                                                                                                                     
  Configuration path: protocols bgp 64555 neighbor 10.240.10.40 [nexthop-self] is not valid                                                                             
  Set failed                                                                                                                                                            
                        
@rbh1981
Copy link
Author

rbh1981 commented Aug 26, 2022

Updated ansible galaxy collection vyos.vyos to latest 3.0.1 and problem still exists.

@rbh1981
Copy link
Author

rbh1981 commented Sep 2, 2022

Found the problem in the following:
/vyos.vyos/plugins/module_utils/network/vyos/rm_templates/bgp_global.py line 879:

"setval": "protocols bgp {{ as_number }} neighbor {{ neighbor.address }} nexthop-self",

It should be:

"setval": "protocols bgp {{ as_number }} neighbor {{ neighbor.address }} passive",

@rbh1981
Copy link
Author

rbh1981 commented Jun 16, 2023

Problem still exists in /vyos.vyos/plugins/module_utils/network/vyos/rm_templates/bgp_global.py

setval for neighbor.passive is trying to configure nexthop-self

        "name": "**neighbor.passive**",
        "getval": re.compile(
            r"""
            ^set
            \s+protocols
            \s+bgp
            \s+(?P<as_num>\d+)
            \s+neighbor
            \s+(?P<address>\S+)
            \s+passive
            *$""",
            re.VERBOSE,
        ),
        "setval": "protocols bgp {{ as_number }} neighbor {{ neighbor.address }} **nexthop-self**",
        "compval": "neighbor.passive",
        "result": {
            "as_number": "{{ as_num }}",
            "neighbor": {
                "{{ address }}": {
                    "address": "{{ address }}",
                    "passive": "{{ True }}"
                }
            }
        }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant