ansible-collections / cisco.ios

Ansible Network Collection for Cisco IOS
GNU General Public License v3.0
277 stars 169 forks source link

ios_facts does not retrieve line protocol information for physical interfaces using ansible core 2.11.1 #489

Closed zaskan closed 2 years ago

zaskan commented 2 years ago
SUMMARY

ios_facts does not retrieve line protocol information for physical interfaces using ansible core 2.11.1

ISSUE TYPE
COMPONENT NAME

IOS_FACTS

ANSIBLE VERSION
2.11.1

##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below
ansible [core 2.11.1] 
  config file = /home/xxxxxxxx/environments/ansible_core_2.11/ansible.cfg
  configured module search path = ['/usr/share/my_modules']
  ansible python module location = /srv/share/ansible-core-2.11-venv-1/lib64/python3.6/site-packages/ansible
  ansible collection location = /home/xxxxxxxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /srv/share/ansible-core-2.11-venv-1/bin/ansible
  python version = 3.6.8 (default, Aug 13 2020, 07:46:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
  jinja version = 3.0.1
OS / ENVIRONMENT

IOS: Version 15.5(1)SY4, hardware is C6800 Series IOS XE: Version 16.09.05, hardware is WS-C3850-48P IOS XE: Version 16.12.3s, hardware is C9300-48UXM/ C9500-48Y4C

STEPS TO REPRODUCE

Playbook
---
# Gather facts from switches
- name: Gather facts from switches
  hosts:
    - c6880-x-le
    - c9300
    - c9500
    - ws-c3850
  serial: 1   # https://github.com/ansible/ansible/issues/40140
  connection: network_cli

  vars:
    playbook_name: gather_facts_office.yml

  vars_files:
    - ../credentials.yml

  roles:
    - roles/gather_facts_localhost
    - roles/gather_facts_office

roles/gather_facts_office/tasks/main.yml
---
# tasks file for roles/gather_facts_office

# Gather interfaces facts
- name: Gather interfaces facts
  ios_facts:
    gather_subset: interfaces

Debug ansible_net_interfaces
ok: [REDACTED] => {
    "ansible_net_interfaces": {
        "TenGigabitEthernet2/5/5": {
            "bandwidth": 1000000,
            "description": "free",
            "duplex": null,
            "ipv4": [],
            "lineprotocol": null,
            "macaddress": "REDACTED",
            "mediatype": "1000BaseLH",
            "mtu": 1500,
            "operstatus": "down",
            "type": "C6k 10000Mb 802.3"
        }

It is not retrieving the line protocol information for the physical interfaces anymore like it did in version 2.4.2.0. We are running this playbook against both IOS and IOS XE devices.

EXPECTED RESULTS

It should return lineprotocol as before.

ACTUAL RESULTS

It is not returning lineprotocol information.

KB-perByte commented 2 years ago

Hey @zaskan As reported in the bug here there have been updates in the IOS collection but no changes were made concerning the facts for which the bug is reported. And the change in ansible core has not much to change with how IOS as a collection itself behaves. Can you share some more config information for us to understand where the problem is? Even looking at the existing integration test cases I can see it is collecting lineprotocol information for the facts module to be specific. Thanks

jepema commented 2 years ago

Hi @KB-perByte. As you can see from the output below (ansible 2.4.2.0) the ios_facts module does return the lineprotocol information for a physical interface.

Debug ansible_net_interfaces ok: [REDACTED] => { "ansible_net_interfaces": { "TenGigabitEthernet2/5/5": { "bandwidth": 1000000, "description": "free", "duplex": null, "ipv4": [], "lineprotocol": "down (notconnect) ", "macaddress": "a89d.21c0.b221", "mediatype": "1000BaseLH", "mtu": 1500, "operstatus": "down", "type": "C6k 10000Mb 802.3" }

KB-perByte commented 2 years ago

hey, @jepema can you specify the cisco.ios the collection version you are using? Thanks

jepema commented 2 years ago

Hi @KB-perByte, we are using version 2.2.0.

KB-perByte commented 2 years ago

Hey @jepema can you try with the latest release of the collection, and confirm if you find the problem is still there? As I mentioned I can see lineprotocol is being collected in the included tests of the collection. Thanks

jepema commented 2 years ago

Hi @KB-perByte, i will do that and report the results as soon as possible.

Thanks you.

jepema commented 2 years ago

Hi @KB-perByte, i have updated the cisco.ios collection as suggested.

/home/xxxxx/.ansible/collections/ansible_collections Collection Version cisco.ios 2.6.0

When i run the playbook again i still see no state for the lineprotocol.

Debug ansible_net_interfaces ok: [REDACTED] => { "ansible_net_interfaces": { "TenGigabitEthernet2/5/5": { "bandwidth": 1000000, "description": "free", "duplex": null, "ipv4": [], "lineprotocol": null, "macaddress": "REDACTED", "mediatype": "1000BaseLH", "mtu": 1500, "operstatus": "down", "type": "C6k 10000Mb 802.3" }

KB-perByte commented 2 years ago

Hey @jepema & @zaskan sorry for getting back so late with the issue, as I mentioned I am able to verify that the module is collecting the lineprotocol information in our CI, I suspect that should be some data that is making the facts incomplete for you.

The base interface facts are the collective output of the following commands

        show interfaces
        show ip interface
        show ipv6 interface
        show lldp
        show cdp

Can you confirm some information on basis of the above commands shared.

  1. is lineprotocol information missing for all the interfaces available or any specific interface.
  2. if it is for the specific one as shared above can you share the show commands output for us to debug better, as the information is visible in my environment.
  3. or is it different among aby specific IOS versions as you mentioned, as I am testing it with a IOS version 15.6(2)T and 16.3.01 where the facts look fine.

Regards

jepema commented 2 years ago

Hi @KB-perByte,

  1. Is lineprotocol information missing for all the interfaces available or any specific interface? The lineprotocol information is only missing from physical interfaces. It is available for loopback and SVI interfaces.

  2. If it is for the specific one as shared above can you share the show commands output for us to debug better, as the information is visible in my environment.

    
    REDACTED#show interfaces tenGigabitEthernet 2/5/5
    TenGigabitEthernet2/5/5 is down, line protocol is down (notconnect)
    Hardware is C6k 10000Mb 802.3, address is xxxx.xxxx.xxxx (bia xxxx.xxxx.xxxx)
    Description: free
    MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
    reliability 255/255, txload 1/255, rxload 1/255
    Encapsulation ARPA, loopback not set
    Keepalive set (10 sec)
    Full-duplex, 1000Mb/s, media type is 1000BaseLH
    input flow-control is off, output flow-control is desired
    Clock mode is auto
    ARP type: ARPA, ARP Timeout 04:00:00
    Last input never, output never, output hang never
    Last clearing of "show interface" counters never
    Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 0
    Queueing strategy: fifo
    Output queue: 0/40 (size/max)
    5 minute input rate 0 bits/sec, 0 packets/sec
    5 minute output rate 0 bits/sec, 0 packets/sec
    0 packets input, 0 bytes, 0 no buffer
    Received 0 broadcasts (0 multicasts)
    0 runts, 0 giants, 0 throttles
    0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
    0 watchdog, 0 multicast, 0 pause input
    0 input packets with dribble condition detected
    0 packets output, 0 bytes, 0 underruns
    0 output errors, 0 collisions, 3 interface resets
    0 unknown protocol drops
    0 babbles, 0 late collision, 0 deferred
    0 lost carrier, 0 no carrier, 0 pause output
    0 output buffer failures, 0 output buffers swapped out

REDACTED#show ip interface TenGigabitEthernet2/5/5 is down, line protocol is down Inbound access list is not set

REDACTED#show lldp Global LLDP Information: Status: ACTIVE LLDP advertisements are sent every 30 seconds LLDP hold time advertised is 120 seconds LLDP interface reinitialisation delay is 2 seconds

REDACTED#show cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled



> 3. Or is it different among any specific IOS versions as you mentioned, as I am testing it with a IOS version 15.6(2)T and 16.3.01 where the facts look fine.
I ran the tests again against the following hardware:
IOS: Version 15.5(1)SY4, hardware is C6800 Series
IOS XE: Version 16.09.05, hardware is WS-C3850-48P
The result remains the same, lineprotocol information is missing.