ansible-collections / cisco.iosxr

Ansible Network Collection for Cisco IOSXR
GNU General Public License v3.0
67 stars 47 forks source link

When executing config changes to IOSXR device with the cisco.iosxr.iosxr_lag_interfaces module with the var “ansible_iosxr_commit_label”, the resulting commit record on the device does not have the label #322

Closed digitalfiend64 closed 1 year ago

digitalfiend64 commented 1 year ago
SUMMARY

When executing config changes to IOSXR device with the cisco.iosxr.iosxr_lag_interfaces module with the var “ansible_iosxr_commit_label” provided in the required string format, the resulting commit record on the device does not have the label. Tested on ASR9k device. Label is applied correctly from other example IOSXR modules to same devices, like iosxr_interfaces.

ISSUE TYPE
COMPONENT NAME

cisco.iosxr.iosxr_lag_interfaces

ANSIBLE VERSION

(ansible213_venv) REDACTED@lubuntu-dev: ansible --version
ansible [core 2.14.0]
  config file = /home/REDACTED/.ansible.cfg
  configured module search path = ['/home/REDACTED/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/REDACTED/ansible214_venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/REDACTED/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/REDACTED/ansible214_venv/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (/home/REDACTED/ansible214_venv/bin/python3)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION

(ansible214_venv) REDACTED@lubuntu-dev:~/sf_tmobile/gitlab/sips/ansible-playbooks/yeti-modular-network-services$ ansible-galaxy collection list cisco.iosxr

# /home/REDACTED/.ansible/collections/ansible_collections
Collection  Version
----------- -------
cisco.iosxr 4.0.3
CONFIGURATION

(ansible214_venv) REDACTED@lubuntu-dev:~/sf_tmobile/gitlab/sips/ansible-playbooks/yeti-modular-network-services$ ansible-config dump --only-changed
CONFIG_FILE() = /home/REDACTED/.ansible.cfg
DEFAULT_LOG_PATH(/home/REDACTED/.ansible.cfg) = /home/REDACTED/sf_tmobile/ansible_job_logs/ansible.log
OS / ENVIRONMENT

RP/0/RSP1/CPU0:ASR9K-01#show version Tue Jan 17 13:52:42.385 GMT

Cisco IOS XR Software, Version 6.5.3[Default] Copyright (c) 2019 by Cisco Systems, Inc.

ROM: System Bootstrap, Version 10.65(c) 1994-2014 by Cisco Systems, Inc.

ASR9K-01 uptime is 1 year, 28 weeks, 5 days, 1 minute System image file is "disk0:asr9k-os-mbi-6.5.3/0x100305/mbiasr9k-rsp3.vm"

cisco ASR9K Series (Intel 686 F6M14S4) processor with 16777216K bytes of memory. Intel 686 F6M14S4 processor at 1904MHz, Revision 2.174 ASR-9010 8 Line Card Slot Chassis with V3 AC PEM


<!--- HINT: You can paste gist.github.com links for larger files -->
##### EXPECTED RESULTS
<!--- Describe what you expected to happen when running the steps above -->

After successful commit, the commit history on the IOSXR device will show the custom commit label instead of the default commit id. Example:

RP/0/RSP1/CPU0:ASR9K-01#show configuration commit list | i CR
Tue Jan 17 13:59:39.329 GMT
4    CR017143430_bgp_3     REDACTED-AC   vty3:node0_RSP1_CP  CLI         Tue Jan 17 13:40:17 2023
5    CR017143430_bgp_2     REDACTED-AC   vty3:node0_RSP1_CP  CLI         Tue Jan 17 13:39:59 2023
6    CR017143430_bgp_1     REDACTED-AC   vty3:node0_RSP1_CP  CLI         Tue Jan 17 13:39:46 2023
12   CR017141223_int_5     REDACTED-TZ  vty1:node0_RSP1_CP  CLI         Tue Jan 17 13:20:39 2023
13   CR017141223_int_4     REDACTED-TZ  vty1:node0_RSP1_CP  CLI         Tue Jan 17 13:20:25 2023
14   CR017141223_int_3     REDACTED-TZ  vty1:node0_RSP1_CP  CLI         Tue Jan 17 13:20:11 2023
15   CR017141223_int_2     REDACTED-TZ  vty1:node0_RSP1_CP  CLI         Tue Jan 17 13:19:58 2023
16   CR017141223_int_1     REDACTED-TZ  vty1:node0_RSP1_CP  CLI         Tue Jan 17 13:19:28 2023
19   CR673967105_acl       REDACTED-JG vty1:node0_RSP1_CP  CLI         Tue Jan 17 08:57:36 2023
57   CR013133302_bgp_3     REDACTED-AC   vty1:node0_RSP1_CP  CLI         Fri Jan 13 12:38:41 2023
58   CR013133302_bgp_2     REDACTED-AC   vty1:node0_RSP1_CP  CLI         Fri Jan 13 12:38:24 2023
59   CR013133302_bgp_1     REDACTED-AC   vty1:node0_RSP1_CP  CLI         Fri Jan 13 12:38:11 2023

##### ACTUAL RESULTS
<!--- Describe what actually happened. If possible run with extra
verbosity (-vvvv) →

Example of current commit that fails to apply the commit label:

RP/0/RSP1/CPU0:ASR9K-01#show configuration commit list | i REDACTED-DW
Tue Jan 17 14:01:05.023 GMT
20   1000016508            REDACTED-DW  vty0:node0_RSP1_CP  CLI         Mon Jan 16 13:07:29 2023
21   1000016507            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 12:13:45 2023
22   1000016506            REDACTED-DW  vty0:node0_RSP1_CP  CLI         Mon Jan 16 11:45:05 2023
23   1000016505            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 11:17:25 2023
24   1000016504            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 11:17:12 2023
25   1000016503            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 11:16:59 2023
26   1000016502            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 11:16:46 2023
27   1000016501            REDACTED-DW  vty0:node0_RSP1_CP  CLI         Mon Jan 16 11:13:51 2023
28   1000016500            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 10:59:37 2023
29   1000016499            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 10:59:23 2023
30   1000016498            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 10:59:09 2023
31   1000016497            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 10:58:57 2023
32   1000016496            REDACTED-DW  vty0:node0_RSP1_CP  CLI         Mon Jan 16 10:56:26 2023
33   1000016495            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 10:42:08 2023
34   1000016494            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 10:41:55 2023
35   1000016493            REDACTED-DW  vty1:node0_RSP1_CP  CLI         Mon Jan 16 10:41:43 2023
36   1000016492            REDACTED-DW  vty0:node0_RSP1_CP  CLI         Mon Jan 16 10:39:09 2023
37   1000016491            REDACTED-DW  vty0:node0_RSP1_CP  CLI         Mon Jan 16 09:50:27 2023

<!--- Paste verbatim command output between quotes -->
```paste below
ashwini-mhatre commented 1 year ago

@digitalfiend64 I tried following example

- name: populate lag intergface config
  hosts: iosxr
  gather_facts: false
  tasks:
    - name: Setup
      connection: ansible.netcommon.network_cli
      vars:
          ansible_iosxr_commit_label: commit_label_test
      cisco.iosxr.iosxr_lag_interfaces:
        config:

          - name: Bundle-Ether11
            mode: active
            members:
              - member: GigabitEthernet0/0/0/8
                mode: passive

              - member: GigabitEthernet0/0/0/9
                mode: passive
        state: merged

following is the result on device:

RP/0/RP0/CPU0:foo#show configuration commit list 2                          
Mon Jan 23 13:08:27.518 UTC
SNo. Label/ID              User      Line                Client      Time Stamp
~~~~ ~~~~~~~~              ~~~~      ~~~~                ~~~~~~      ~~~~~~~~~~
1    commit_label_test     admin     vty1:node0_RP0_CPU  CLI         Mon Jan 23 13:07:56 2023
2    1000001161            admin     vty0:node0_RP0_CPU  CLI         Mon Jan 23 13:05:05 2023

Following is the iosxr version on which i tried

RP/0/RP0/CPU0:foo#show version                    
Mon Jan 23 13:10:10.350 UTC
Cisco IOS XR Software, Version 7.2.2
Copyright (c) 2013-2021 by Cisco Systems, Inc.

Build Information:
 Built By     : ingunawa
 Built On     : Mon Jan 25 21:30:50 PST 2021
 Built Host   : iox-ucs-012
 Workspace    : /auto/srcarchive15/prod/7.2.2/xrv9k/ws
 Version      : 7.2.2
 Location     : /opt/cisco/XR/packages/
 Label        : 7.2.2-0

cisco IOS-XRv 9000 () processor
System uptime is 7 weeks 4 days 1 hour 50 minutes

RP/0/RP0/CPU0:foo#
ashwini-mhatre commented 1 year ago

@digitalfiend64 We have also tested this on physical router 7.10.0 which is latest one PF below logs

(ansible_collections) prramoor @ ~/Ansible/iosxr $ ansible-playbook -i inventory.yaml iosxr.yaml -vvvvv 
ansible-playbook [core 2.13.5] (detached HEAD 09cf0ed123) last updated 2023/01/24 16:52:57 (GMT +550)
  config file = /Users/prramoor/Ansible/iosxr/ansible.cfg
  configured module search path = ['/Users/prramoor/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/prramoor/Ansible/iosxr/ansible/lib/ansible
  ansible collection location = /Users/prramoor/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/prramoor/Ansible/iosxr/ansible/bin/ansible-playbook
  python version = 3.8.0 (default, Apr 13 2020, 16:49:15) [Clang 11.0.3 (clang-1103.0.32.29)]
  jinja version = 3.0.3
  libyaml = True
Using /Users/prramoor/Ansible/iosxr/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /Users/prramoor/Ansible/iosxr/inventory.yaml as it did not pass its verify_file() method
script declined parsing /Users/prramoor/Ansible/iosxr/inventory.yaml as it did not pass its verify_file() method
Parsed /Users/prramoor/Ansible/iosxr/inventory.yaml inventory source with yaml plugin
Loading collection cisco.iosxr from /Users/prramoor/Ansible/iosxr/collections/ansible_collections/cisco/iosxr
Loading callback plugin default of type stdout, v2.0 from /Users/prramoor/Ansible/iosxr/ansible/lib/ansible/plugins/callback/default.py
Attempting to use 'default' callback.
Skipping callback 'default', as we already have a stdout callback.
Attempting to use 'junit' callback.
Attempting to use 'minimal' callback.
Skipping callback 'minimal', as we already have a stdout callback.
Attempting to use 'oneline' callback.
Skipping callback 'oneline', as we already have a stdout callback.
Attempting to use 'tree' callback.

PLAYBOOK: iosxr.yaml ********************************************************************************************************************************************************************
Positional arguments: iosxr.yaml
verbosity: 5
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/Users/prramoor/Ansible/iosxr/inventory.yaml',)
forks: 5
1 plays in iosxr.yaml

PLAY [IOS XR comment and commit config testing on 7.3.1 image] **************************************************************************************************************************
META: ran handlers

TASK [Show version] *********************************************************************************************************************************************************************
task path: /Users/prramoor/Ansible/iosxr/iosxr.yaml:6
Loading collection ansible.netcommon from /Users/prramoor/Ansible/iosxr/collections/ansible_collections/ansible/netcommon
<10.64.78.169> attempting to start connection
<10.64.78.169> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /Users/prramoor/Ansible/iosxr/ansible/bin/ansible-connection
<10.64.78.169> local domain socket does not exist, starting it
<10.64.78.169> control socket path is /Users/prramoor/.ansible/pc/1fe240443e
<10.64.78.169> Loading collection ansible.netcommon from /Users/prramoor/Ansible/iosxr/collections/ansible_collections/ansible/netcommon
<10.64.78.169> Loading collection cisco.iosxr from /Users/prramoor/Ansible/iosxr/collections/ansible_collections/cisco/iosxr
<10.64.78.169> local domain socket listeners started successfully
<10.64.78.169> loaded cliconf plugin ansible_collections.cisco.iosxr.plugins.cliconf.iosxr from path /Users/prramoor/Ansible/iosxr/collections/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py for network_os cisco.iosxr.iosxr
<10.64.78.169> ssh type is set to auto
<10.64.78.169> autodetecting ssh_type
<10.64.78.169> ssh type is now set to libssh
<10.64.78.169> 
<10.64.78.169> local domain socket path is /Users/prramoor/.ansible/pc/1fe240443e
<10.64.78.169> Using network group action cisco.iosxr.iosxr for cisco.iosxr.iosxr_command
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.iosxr.iosxr_command  at /Users/prramoor/Ansible/iosxr/collections/ansible_collections/cisco/iosxr/plugins/modules/iosxr_command.py
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.iosxr.iosxr_command
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: complete
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: Result: {'changed': False, 'stdout': ['Cisco IOS XR Software, Version 7.10.1\nCopyright (c) 2013-2022 by Cisco Systems, Inc.\n\nBuild Information:\n Built By     :\n Built On     : Mon Dec 26 17:19:00 IST 2022\n Built Host   :\n Workspace    : \n Version      : 7.10.1\n Location     : /opt/cisco/XR/packages/\n Label        : 7.10.1\n\ncisco NCS-5500 () processor\nSystem uptime is 3 hours 40 minutes'], 'stdout_lines': [['Cisco IOS XR Software, Version 7.10.1', 'Copyright (c) 2013-2022 by Cisco Systems, Inc.', '', 'Build Information:', ' Built By     :', ' Built On     : Mon Dec 26 17:19:00 IST 2022', ' Built Host   : ', ' Workspace    : ', ' Version      : 7.10.1', ' Location     : /opt/cisco/XR/packages/', ' Label        : 7.10.1', '', 'cisco NCS-5500 () processor', 'System uptime is 3 hours 40 minutes']], 'invocation': {'module_args': {'commands': ['show version'], 'match': 'all', 'retries': 10, 'interval': 1, 'wait_for': None}}, '_ansible_parsed': True}
ok: [10.64.78.169] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "commands": [
                "show version"
            ],
            "interval": 1,
            "match": "all",
            "retries": 10,
            "wait_for": null
        }
    },
    "stdout": [
        "Cisco IOS XR Software, Version 7.10.1\nCopyright (c) 2013-2022 by Cisco Systems, Inc.\n\nBuild Information:\n Built By     :\n Built On     : Mon Dec 26 17:19:00 IST 2022\n Built Host   :\n Workspace    : \n Version      : 7.10.1\n Location     : /opt/cisco/XR/packages/\n Label        : 7.10.1\n\ncisco NCS-5500 () processor\nSystem uptime is 3 hours 40 minutes"
    ],
    "stdout_lines": [
        [
            "Cisco IOS XR Software, Version 7.10.1",
            "Copyright (c) 2013-2022 by Cisco Systems, Inc.",
            "",
            "Build Information:",
            " Built By     :",
            " Built On     : Mon Dec 26 17:19:00 IST 2022",
            " Built Host   :",
            " Workspace    :",
            " Version      : 7.10.1",
            " Location     : /opt/cisco/XR/packages/",
            " Label        : 7.10.1",
            "",
            "cisco NCS-5500 () processor",
            "System uptime is 3 hours 40 minutes"
        ]
    ]
}

TASK [Setup] ****************************************************************************************************************************************************************************
task path: /Users/prramoor/Ansible/iosxr/iosxr.yaml:10
Loading collection ansible.netcommon from /Users/prramoor/Ansible/iosxr/collections/ansible_collections/ansible/netcommon
<10.64.78.169> attempting to start connection
<10.64.78.169> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /Users/prramoor/Ansible/iosxr/ansible/bin/ansible-connection
<10.64.78.169> found existing local domain socket, using it!
<10.64.78.169> invoked shell using ssh_type: libssh
<10.64.78.169> ssh connection done, setting terminal
<10.64.78.169> loaded terminal plugin for network_os cisco.iosxr.iosxr
<10.64.78.169> firing event: on_open_shell()
<10.64.78.169> ssh connection has completed successfully
<10.64.78.169> updating play_context for connection
<10.64.78.169> 
<10.64.78.169> local domain socket path is /Users/prramoor/.ansible/pc/1fe240443e
<10.64.78.169> Using network group action cisco.iosxr.iosxr for cisco.iosxr.iosxr_lag_interfaces
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.iosxr.iosxr_lag_interfaces  at /Users/prramoor/Ansible/iosxr/collections/ansible_collections/cisco/iosxr/plugins/modules/iosxr_lag_interfaces.py
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.iosxr.iosxr_lag_interfaces
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: complete
<10.64.78.169> ANSIBLE_NETWORK_IMPORT_MODULES: Result: {'changed': True, 'commands': ['interface Bundle-Ether12', 'lacp mode active', 'interface GigabitEthernet0/0/0/11', 'bundle id 12 mode passive', 'interface GigabitEthernet0/0/0/10', 'bundle id 12 mode passive'], 'before': [{'members': [{'member': 'GigabitEthernet0/0/0/8', 'mode': 'passive'}, {'member': 'GigabitEthernet0/0/0/9', 'mode': 'passive'}], 'mode': 'active', 'name': 'Bundle-Ether11'}], 'after': [{'members': [{'member': 'GigabitEthernet0/0/0/8', 'mode': 'passive'}, {'member': 'GigabitEthernet0/0/0/9', 'mode': 'passive'}], 'mode': 'active', 'name': 'Bundle-Ether11'}, {'members': [{'member': 'GigabitEthernet0/0/0/10', 'mode': 'passive'}, {'member': 'GigabitEthernet0/0/0/11', 'mode': 'passive'}], 'mode': 'active', 'name': 'Bundle-Ether12'}], 'invocation': {'module_args': {'config': [{'name': 'Bundle-Ether12', 'mode': 'active', 'members': [{'member': 'GigabitEthernet0/0/0/11', 'mode': 'passive'}, {'member': 'GigabitEthernet0/0/0/10', 'mode': 'passive'}], 'links': None, 'load_balancing_hash': None}], 'state': 'merged', 'running_config': None}}, '_ansible_parsed': True}
changed: [10.64.78.169] => {
    "after": [
        {
            "members": [
                {
                    "member": "GigabitEthernet0/0/0/8",
                    "mode": "passive"
                },
                {
                    "member": "GigabitEthernet0/0/0/9",
                    "mode": "passive"
                }
            ],
            "mode": "active",
            "name": "Bundle-Ether11"
        },
        {
            "members": [
                {
                    "member": "GigabitEthernet0/0/0/10",
                    "mode": "passive"
                },
                {
                    "member": "GigabitEthernet0/0/0/11",
                    "mode": "passive"
                }
            ],
            "mode": "active",
            "name": "Bundle-Ether12"
        }
    ],
    "before": [
        {
            "members": [
                {
                    "member": "GigabitEthernet0/0/0/8",
                    "mode": "passive"
                },
                {
                    "member": "GigabitEthernet0/0/0/9",
                    "mode": "passive"
                }
            ],
            "mode": "active",
            "name": "Bundle-Ether11"
        }
    ],
    "changed": true,
    "commands": [
        "interface Bundle-Ether12",
        "lacp mode active",
        "interface GigabitEthernet0/0/0/11",
        "bundle id 12 mode passive",
        "interface GigabitEthernet0/0/0/10",
        "bundle id 12 mode passive"
    ],
    "invocation": {
        "module_args": {
            "config": [
                {
                    "links": null,
                    "load_balancing_hash": null,
                    "members": [
                        {
                            "member": "GigabitEthernet0/0/0/11",
                            "mode": "passive"
                        },
                        {
                            "member": "GigabitEthernet0/0/0/10",
                            "mode": "passive"
                        }
                    ],
                    "mode": "active",
                    "name": "Bundle-Ether12"
                }
            ],
            "running_config": null,
            "state": "merged"
        }
    }
}
META: ran handlers
META: ran handlers

PLAY RECAP ******************************************************************************************************************************************************************************
10.64.78.169               : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
RP/0/RP0/CPU0:NCS5500#show configuration commit list 2
Tue Jan 24 11:54:26.828 UTC
SNo. Label/ID              User      Line                Client      Time Stamp
~~~~ ~~~~~~~~              ~~~~      ~~~~                ~~~~~~      ~~~~~~~~~~
1    commit_label_test_1   root      vty0:node0_RP0_CPU  CLI         Tue Jan 24 11:51:33 2023
2    commit_label_test     root      vty0:node0_RP0_CPU  CLI         Tue Jan 24 11:45:21 2023
RP/0/RP0/CPU0:NCS5500#
RP/0/RP0/CPU0:NCS5500#
RP/0/RP0/CPU0:NCS5500#
RP/0/RP0/CPU0:NCS5500#
RP/0/RP0/CPU0:NCS5500#
RP/0/RP0/CPU0:NCS5500#show version 
Tue Jan 24 11:54:32.489 UTC
Cisco IOS XR Software, Version 7.10.1
Copyright (c) 2013-2022 by Cisco Systems, Inc.

Build Information:
 Built By     : 
 Built On     : Mon Dec 26 17:19:00 IST 2022
 Built Host   : 
 Workspace    : 
 Version      : 7.10.1
 Location     : /opt/cisco/XR/packages/
 Label        : 7.10.1

cisco NCS-5500 () processor
System uptime is 3 hours 43 minutes

RP/0/RP0/CPU0:NCS5500#
ashwini-mhatre commented 1 year ago

This is same issue like https://github.com/ansible-collections/cisco.iosxr/issues/314