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

Enabling send-community on BGP peers with no additional arguments fails #467

Open
jagexjake opened this issue Oct 13, 2023 · 0 comments · May be fixed by #482
Open

Enabling send-community on BGP peers with no additional arguments fails #467

jagexjake opened this issue Oct 13, 2023 · 0 comments · May be fixed by #482
Assignees

Comments

@jagexjake
Copy link

SUMMARY

I am trying to manage BGP peers that are in VRF's, however I keep getting an error:
"Unsupported parameters for (basic.py) module: config.vrfs.neighbor.send_community.set. Supported parameters include: state, running_config, config."

ISSUE TYPE
  • Bug Report
COMPONENT NAME

eos_bgp_global (config.vrfs.neighbor.send_community.se)

ANSIBLE VERSION
ansible [core 2.14.1]
  config file = /Users/user/git/ansible-arista/ansible.cfg
  configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/user/.pyenv/versions/3.11.1/bin/ansible
  python version = 3.11.1 (main, Jan 27 2023, 00:37:35) [Clang 14.0.0 (clang-1400.0.29.202)] (/Users/user/.pyenv/versions/3.11.1/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
# /Users/user/.ansible/collections/ansible_collections
Collection Version
---------- -------
arista.eos 6.1.2

# /Users/user/.pyenv/versions/3.11.1/lib/python3.11/site-packages/ansible_collections
Collection Version
---------- -------
arista.eos 6.0.0
CONFIGURATION
CONFIG_FILE() = /Users/user/git/ansible-arista/ansible.cfg
DEFAULT_HOST_LIST(/Users/user/git/ansible-arista/ansible.cfg) = ['/Users/user/git/ansible-arista/inventory']
DEFAULT_LOG_PATH(/Users/user/git/ansible-arista/ansible.cfg) = /Users/user/git/ansible-arista/ansible.log
DEFAULT_TIMEOUT(/Users/user/git/ansible-arista/ansible.cfg) = 5
HOST_KEY_CHECKING(/Users/user/git/ansible-arista/ansible.cfg) = False
INTERPRETER_PYTHON(/Users/user/git/ansible-arista/ansible.cfg) = /usr/bin/env python3
OS / ENVIRONMENT
  • EOS 4.28.8M
STEPS TO REPRODUCE

Below is example configuration on a router:

router bgp 65000
   distance bgp 20 200 200
   !
   vrf internal
      router-id 10.0.0.18
      neighbor 10.0.0.19 remote-as 65000
      neighbor 10.0.0.19 next-hop-self
      neighbor 10.0.0.19 description router2
      neighbor 10.0.0.19 route-map Internal-Routes-In in
      neighbor 10.0.0.19 route-map Internal-Routes-Out out
      redistribute bgp leaked
      !
      address-family ipv4
         neighbor 10.0.0.19 activate
   !
   vrf external
      neighbor 10.0.1.189 remote-as 65001
      neighbor 10.0.1.189 bfd
      neighbor 10.0.1.189 description uplink
      neighbor 10.0.1.189 route-map External-Routes-In in
      neighbor 10.0.1.189 route-map External-Routes-Out out
      neighbor 10.0.1.189 send-community
      neighbor 10.0.1.189 password 7 1a2b3c4d5e6f7g8h9i
      neighbor 10.0.1.189 maximum-routes 0
      redistribute connected include leaked route-map Internal-Routes-Leak
      redistribute bgp leaked
      !
      address-family ipv4
         neighbor 10.0.1.189 activate

I then have this playbook:

- hosts: all
  connection: network_cli
  gather_facts: no

  tasks:
    - name: Gather configuration
      arista.eos.eos_facts:
        gather_subset:
          - config

    - name: Gather BGP Info
      arista.eos.eos_bgp_global:
        state: gathered
        running_config: "{{ ansible_net_config }}"
      register: eos_bgp

    - name: Render BGP info
      arista.eos.eos_bgp_global:
        state: rendered
        config: "{{ eos_bgp.gathered }}"
      register: eos_bgp_rendered

    - name: Set current BGP as fact
      set_fact:
        existing_bgp: "{{ eos_bgp_rendered.rendered }}"

    - name: Push data to hostvars
      lineinfile:
        line: "{{ lookup('template','bgp.j2') }}"
        path: "{{playbook_dir}}/host_vars/{{inventory_hostname}}.yml"
      when: bgp_config is not defined

Where I am trying to generate the config files with this jinja template:

### BGP ###
bgp_config: |
{% for line in existing_bgp %}
 {% if loop.first %}
 {{ line }}
 {% else %}
  {{ line }}
 {% endif %}
{% endfor %}

However, I think it is because of send-community and no extra positional parameters afterwards?
I have

EXPECTED RESULTS

Expect existing configuration on a server to be parseable

ACTUAL RESULTS

PLAY [all] *********************************************************************************************************************************************************************************************************

TASK [Gather configuration] ****************************************************************************************************************************************************************************************
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
ok: [router1]

TASK [Gather BGP Info] *********************************************************************************************************************************************************************************************
[WARNING]: Both option neighbor_address and its alias peer are set.
fatal: [router1]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (basic.py) module: config.vrfs.neighbor.send_community.set. Supported parameters include: config, state, running_config."}

PLAY RECAP *********************************************************************************************************************************************************************************************************
router1 : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Notes:
when I remove the neighbor x.x.x.x send-community it can then gather the BGP info ... so seems that just enabling send community breaks it?
I then move onto the next issue of encrypted passworsd having issues of being parsed and then rendered:

PLAY [all] *********************************************************************************************************************************************************************************************************

TASK [Gather configuration] ****************************************************************************************************************************************************************************************
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
ok: [router1]

TASK [Gather BGP Info] *********************************************************************************************************************************************************************************************
[WARNING]: Both option neighbor_address and its alias peer are set.
ok: [router1]

TASK [Render BGP info] *********************************************************************************************************************************************************************************************
fatal: [router1]: FAILED! => {"changed": false, "msg": "argument 'type' is of type <class 'ansible.utils.unsafe_proxy.AnsibleUnsafeText'> found in 'config -> vrfs -> neighbor -> encryption_password'. and we were unable to convert to int: <class 'ansible.utils.unsafe_proxy.AnsibleUnsafeText'> cannot be converted to an int"}

PLAY RECAP *********************************************************************************************************************************************************************************************************
router1 : ok=2    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

  • Also notice that you can only configure one type of route-map per peer? Why can't we configure a route-map in and outbound per peer?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants