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

Gathering route-maps fails when route-maps are present with more than one parameter #531

Open
insignia96 opened this issue Jan 28, 2025 · 1 comment
Assignees
Labels
bug This issue/PR relates to a bug.

Comments

@insignia96
Copy link

insignia96 commented Jan 28, 2025

SUMMARY

Gathering route-maps fails when route-maps are present with more than one parameter.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.iosxr.iosxr_route_maps
cisco.iosxr.iosxr_facts

ANSIBLE VERSION
ansible [core 2.18.2]
  config file = /home/iolson/ansible-netprov/ansible.cfg
  configured module search path = ['/home/iolson/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible
  ansible collection location = /home/iolson/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/iolson/ansible-netprov/venv/bin/ansible
  python version = 3.11.11 (main, Dec 04 2024, 21:44:34) [GCC] (/home/iolson/ansible-netprov/venv/bin/python3)
  jinja version = 3.1.5
  libyaml = True
COLLECTION VERSION
# /home/iolson/ansible-netprov/venv/lib/python3.11/site-packages/ansible_collections
Collection  Version
----------- -------
cisco.iosxr 10.2.2 

# /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections
Collection  Version
----------- -------
cisco.iosxr 10.2.2 
CONFIGURATION
CONFIG_FILE() = /home/iolson/ansible-netprov/ansible.cfg
DEFAULT_BECOME(/home/iolson/ansible-netprov/ansible.cfg) = True
DEFAULT_BECOME_METHOD(/home/iolson/ansible-netprov/ansible.cfg) = sudo
DEFAULT_HOST_LIST(/home/iolson/ansible-netprov/ansible.cfg) = ['/home/iolson/ansible-netprov/inventory/netbox_inventory.yml']
HOST_KEY_CHECKING(/home/iolson/ansible-netprov/ansible.cfg) = True
PAGER(env: PAGER) = less
RETRY_FILES_ENABLED(/home/iolson/ansible-netprov/ansible.cfg) = False
TRANSFORM_INVALID_GROUP_CHARS(/home/iolson/ansible-netprov/ansible.cfg) = silently

GALAXY_SERVERS:
OS / ENVIRONMENT

Cisco IOS XR Software, Version 7.9.21 on ASR-9903
Control host is OpenSUSE Tumbleweed 20250121

STEPS TO REPRODUCE
- name: Gather facts from IOS-XR
  hosts: core_router
  gather_facts: false
  tasks:
    - name: Gather facts from IOS-XR
      cisco.iosxr.iosxr_facts:
        gather_subset:
          - min
        gather_network_resources:
          - route_maps

With the following route policy present:

route-policy POLICY_TWO_PARAMS($SPECIFICITY,$GEO_LOCATION)
  set community (64496:100, 64496:$SPECIFICITY, 64496:$GEO_LOCATION, 65012:174)
  set local-preference 150
end-policy
EXPECTED RESULTS

Properly gathered facts for route policies

ACTUAL RESULTS
 _________________________________ 
< TASK [Gather facts from IOS-XR] >
 --------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

task path: /home/iolson/ansible-netprov/site.yml:5
Loading collection ansible.netcommon from /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/ansible/utils
<example.router.net> Using network group action cisco.iosxr.iosxr for cisco.iosxr.iosxr_facts
<example.router.net> attempting to start connection
<example.router.net> using connection plugin ansible.netcommon.network_cli
<example.router.net> local domain socket does not exist, starting it
<example.router.net> control socket path is /home/iolson/.ansible/pc/5eaf4b92a3
<example.router.net> Loading collection ansible.builtin from 
<example.router.net> Loading collection ansible.netcommon from /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/ansible/netcommon
<example.router.net> Loading collection ansible.utils from /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/ansible/utils
<example.router.net> Loading collection cisco.iosxr from /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/cisco/iosxr
<example.router.net> local domain socket listeners started successfully
<example.router.net> loaded cliconf plugin ansible_collections.cisco.iosxr.plugins.cliconf.iosxr from path /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py for network_os cisco.iosxr.iosxr
<example.router.net> ssh type is set to auto
<example.router.net> autodetecting ssh_type
<example.router.net> ssh type is now set to libssh
<example.router.net> Loading collection ansible.builtin from 
<example.router.net> local domain socket path is /home/iolson/.ansible/pc/5eaf4b92a3
<example.router.net> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<example.router.net> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.iosxr.iosxr_facts  at /home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/cisco/iosxr/plugins/modules/iosxr_facts.py
<example.router.net> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.iosxr.iosxr_facts
<example.router.net> ANSIBLE_NETWORK_IMPORT_MODULES: complete
The full traceback is:
  File "/home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 128, in get_network_resources_facts
    inst.populate_facts(self._connection, self.ansible_facts, data)
  File "/home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/route_maps/route_maps.py", line 245, in populate_facts
    policy_data = self.get_policydata(connection=connection, name=policy)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/facts/route_maps/route_maps.py", line 40, in get_policydata
    return connection.get(f"show running-config route-policy {name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/iolson/ansible-netprov/venv/lib64/python3.11/site-packages/ansible/module_utils/connection.py", line 183, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [example]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "available_network_resources": false,
            "gather_network_resources": [
                "route_maps"
            ],
            "gather_subset": [
                "min"
            ]
        }
    },
    "msg": "show running-config route-policy POLICY_TWO_PARAMS($SPECIFICITY,\r\n\r% Incomplete command.\r\nRP/0/RP0/CPU0:example#"
}
@insignia96
Copy link
Author

insignia96 commented Jan 28, 2025

The related line appears to be here. The route policies are printed with a space after the comma separating the parameters.

@NilashishC NilashishC added the bug This issue/PR relates to a bug. label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants