junipernetworks.junos icon indicating copy to clipboard operation
junipernetworks.junos copied to clipboard

junos_lag_interfaces can't gather members from MX204 ( JUNOS 20.4R2-S1.6 )

Open EpiqSty opened this issue 3 years ago • 9 comments

SUMMARY

junos_lag_interfaces can't gather members from MX204 ( JUNOS 20.4R2-S1.6 ).

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • junos_lag_interfaces ( state gathered)
ANSIBLE VERSION
$ ansible --version
ansible [core 2.11.6] 
  config file = /home/epiq/git/noc-docs/ansible/ansible.cfg
  configured module search path = ['/home/epiq/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/epiq/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 2.11.1
  libyaml = True
COLLECTION VERSION
$ ansible-galaxy collection list junipernetworks.junos
[DEPRECATION WARNING]: [defaults]callback_whitelist option, normalizing names to new standard, use callbacks_enabled instead. This feature will be removed from ansible-core in version 2.15. 
Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

# /usr/lib/python3/dist-packages/ansible_collections
Collection            Version
--------------------- -------
junipernetworks.junos 2.6.0  

# /home/epiq/.ansible/collections/ansible_collections
Collection            Version
--------------------- -------
junipernetworks.junos 2.6.0  
CONFIGURATION
$ ansible-config dump --only-changed
CALLBACKS_ENABLED(/home/epiq/ansible/ansible.cfg) = ['profile_tasks']
DEFAULT_GATHERING(/home/epiq/ansible/ansible.cfg) = explicit
DEFAULT_HOST_LIST(/home/epiq/ansible/ansible.cfg) = ['/home/epiq/ansible/hosts']
DEFAULT_TIMEOUT(/home/epiq/ansible/ansible.cfg) = 40
HOST_KEY_CHECKING(/home/epiq/ansible/ansible.cfg) = False
PARAMIKO_HOST_KEY_AUTO_ADD(/home/epiq/ansible/ansible.cfg) = True
PARAMIKO_LOOK_FOR_KEYS(/home/epiq/ansible/ansible.cfg) = False
PERSISTENT_COMMAND_TIMEOUT(/home/epiq/ansible/ansible.cfg) = 600
PERSISTENT_CONNECT_RETRY_TIMEOUT(/home/epiq/ansible/ansible.cfg) = 450
PERSISTENT_CONNECT_TIMEOUT(/home/epiq/ansible/ansible.cfg) = 600
OS / ENVIRONMENT

on Ansible control host:

$ cat /etc/issue
Ubuntu 20.04.3 LTS \n \l

On Juniper devices: --- JUNOS 20.4R2-S1.6 Kernel 64-bit JNPR-11.0-20210429.58e41ab_buil at JNP204 [MX204]

STEPS TO REPRODUCE

Configure minimal lag setup,e.g.:

mx204> show configuration interfaces xe-0/1/4 
description "{ae0}";
gigether-options {
    802.3ad ae0;
}

mx204> show configuration interfaces xe-0/1/5    
description "{ae0}";
gigether-options {
    802.3ad ae0;
}

mx204> show configuration interfaces ae0         
description "ae0";
vlan-tagging;
mtu 9192;
aggregated-ether-options {
    minimum-links 1;
    link-speed 10g;
    lacp {
        active;
    }
}
#!/usr/bin/env ansible-playbook
---
- name: Gathering LAG ports
  hosts: juniper

  tasks:

  - name: Gather junos lag interfaces as in given arguments
    junipernetworks.junos.junos_lag_interfaces:
      state: gathered
    register: lag_ints

  - name: show results
    debug:
      msg: >-
        {{ lag_ints }}
EXPECTED RESULTS
{
    "msg": {
        "changed": false,
        "failed": false,
        "gathered": [
            {
                "members": [
                    {
                        "member": "xe-0/1/4"
                    },
                    {
                        "member": "xe-0/1/5"
                    }
                ],
                "mode": "active",
                "name": "ae0"
            }
        ]
    }
}
ACTUAL RESULTS
{
    "msg": {
        "changed": false,
        "failed": false,
        "gathered": [
            {
                "mode": "active",
                "name": "ae0"
            },
            {
                "mode": "active",
                "name": "ae1"
            }
        ]
    }
}

EpiqSty avatar Nov 11 '21 18:11 EpiqSty

FYI, I just ran into this issue. It happens on ANY MX device on ANY version. This boils down to MXs having a different configuration schema than non-MX devices. MXs will only accept "gigether-options 802.3ad aeX" where non-MX devices (depending on the version) will accept only ether-options or gigether-options and ether-options.

Youlll probably need look for either in gather_facts and allow setting a device type in the lag modules for building configurations.

roadracer96 avatar Sep 27 '22 00:09 roadracer96

@roadracer96 yeah, personally i've ended up with a fallback to the rescue, with use the shell module when detecting such an issue.

EpiqSty avatar Sep 29 '22 18:09 EpiqSty

After over a year, when can we expect some movement on this one? It is a pretty substantial issue, IMHO.

roadracer96 avatar Dec 22 '22 20:12 roadracer96

My feeling are that it's probably will never be fixed, MX204 as getting close to EOL.

EpiqSty avatar Dec 23 '22 14:12 EpiqSty

Ita ALL MXs. Not just the 204. Every MX that has ever existed is subject to this issue.

On Fri, Dec 23, 2022, 9:15 AM Epiq Sty @.***> wrote:

My feeling are that it's probably will never be fixed, MX204 as getting close to EOL.

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/junipernetworks.junos/issues/253#issuecomment-1363987852, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCMTM6IZQO24TT7CWIG2GDWOWXWHANCNFSM5H3BNGTQ . You are receiving this because you were mentioned.Message ID: @.*** com>

roadracer96 avatar Dec 23 '22 16:12 roadracer96

Im just going to point out that the Juniper MX is the flagship Juniper device and this short-coming is an enormous setback in functionality on these devices.

roadracer96 avatar Jun 06 '23 17:06 roadracer96

2 years now.... @rohitthakur2590 If you need an MX to test against, I can make one available.

roadracer96 avatar Nov 01 '23 13:11 roadracer96

@roadracer96
Thank you for your patience. You're correct; the issue likely arises from differences in schema. I see this as an opportunity for enhancement. Could you still provide access to an MX for testing purposes?

rohitthakur2590 avatar May 08 '24 06:05 rohitthakur2590

I should be able to make something available in our lab. Give me a week or two to get approval and get something setup.

On Wed, May 8, 2024, 2:09 AM Rohit Thakur @.***> wrote:

@roadracer96 https://github.com/roadracer96 Thank you for your patience. You're correct; the issue likely arises from differences in schema. I see this as an opportunity for enhancement. Could you still provide access to an MX for testing purposes?

— Reply to this email directly, view it on GitHub https://github.com/ansible-collections/junipernetworks.junos/issues/253#issuecomment-2099811872, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCMTM2277QXHHH7ZXUPH5DZBG6RDAVCNFSM5H3BNGT2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBZHE4DCMJYG4ZA . You are receiving this because you were mentioned.Message ID: @.*** com>

roadracer96 avatar May 08 '24 11:05 roadracer96

@roadracer96 @EpiqSty Could you Please review/test and see if this works for you?

rohitthakur2590 avatar Jun 18 '24 07:06 rohitthakur2590

Surprisingly, even 3 years later I still lacking this exact feature, just faced same bug recently. So thanks a lot I'll try check it this week and will update you back here.

EpiqSty avatar Jun 18 '24 07:06 EpiqSty

@rohitthakur2590 so far i can't get new results, sadly - there are still no members interfaces populated in the reply. This is how i do the testing:

$ ansible-galaxy collection install git+https://github.com/rohitthakur2590/junipernetworks.junos.git
Cloning into '/home/epiqsty/.ansible/tmp/ansible-local-24l92ttcb1/tmpm3cvzhpe/junipernetworks.junosa6pr9xyu'...
remote: Enumerating objects: 977, done.
remote: Counting objects: 100% (977/977), done.
remote: Compressing objects: 100% (566/566), done.
remote: Total 977 (delta 426), reused 658 (delta 314), pack-reused 0
Receiving objects: 100% (977/977), 675.76 KiB | 8.66 MiB/s, done.
Resolving deltas: 100% (426/426), done.
Your branch is up to date with 'origin/main'.
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'junipernetworks.junos:9.0.0' to '/home/epiqsty/.ansible/collections/ansible_collections/junipernetworks/junos'
Created collection for junipernetworks.junos:9.0.0 at /home/epiqsty/.ansible/collections/ansible_collections/junipernetworks/junos
junipernetworks.junos:9.0.0 was installed successfully
'ansible.netcommon:6.1.3' is already installed, skipping.
'ansible.utils:4.1.0' is already installed, skipping.

$  ansible-playbook playbooks/junos_lag_interfaces.yml -l mx204 -vvvv
ansible-playbook [core 2.17.1]
  config file = /home/epiqsty/ansible.cfg
  configured module search path = ['/home/epiqsty/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/dist-packages/ansible
  ansible collection location = /home/epiqsty/.ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
Using /home/epiqsty/ansible.cfg as config file
setting up inventory plugins
Loading collection ansible.builtin from 
host_list declined parsing /home/epiqsty/hosts as it did not pass its verify_file() method
script declined parsing /home/epiqsty/hosts as it did not pass its verify_file() method
auto declined parsing /home/epiqsty/hosts as it did not pass its verify_file() method
Parsed /home/epiqsty/hosts inventory source with ini plugin
setting up inventory plugins
Loading collection junipernetworks.junos from /home/epiqsty/.ansible/collections/ansible_collections/junipernetworks/junos
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.11/dist-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: junos_lag_interfaces.yml ******************************************************************************************************************
Positional arguments: playbooks/junos_lag_interfaces.yml
verbosity: 4
connection: ssh
become_method: sudo
tags: ('all',)
inventory: ('/home/epiqsty/hosts')
subset: mx204
forks: 14
1 plays in playbooks/junos_lag_interfaces.yml

PLAY [Gathering LAG ports] **************************************************************************************************************************
Loading collection ansible.netcommon from /usr/local/lib/python3.11/dist-packages/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /usr/local/lib/python3.11/dist-packages/ansible_collections/ansible/utils
redirecting (type: netconf) ansible.builtin.junos to junipernetworks.junos.junos
<mx204> Using network group action junipernetworks.junos.junos for junipernetworks.junos.junos_lag_interfaces
<mx204> attempting to start connection
<mx204> using connection plugin ansible.netcommon.netconf
Found ansible-connection at path /usr/local/bin/ansible-connection
<mx204> local domain socket does not exist, starting it
<mx204> control socket path is /home/epiqsty/.ansible/pc/783f3da3b7
<mx204> Loading collection ansible.builtin from 
<mx204> Loading collection ansible.netcommon from /usr/local/lib/python3.11/dist-packages/ansible_collections/ansible/netcommon
<mx204> Loading collection ansible.utils from /usr/local/lib/python3.11/dist-packages/ansible_collections/ansible/utils
<mx204> redirecting (type: netconf) ansible.builtin.junos to junipernetworks.junos.junos
<mx204> Loading collection junipernetworks.junos from /home/epiqsty/.ansible/collections/ansible_collections/junipernetworks/junos
<mx204> local domain socket listeners started successfully
<mx204> loaded netconf plugin ansible_collections.junipernetworks.junos.plugins.netconf.junos from path /home/epiqsty/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/netconf/junos.py for network_os junos
<mx204> Loading collection ansible.builtin from 
<mx204> local domain socket path is /home/epiqsty/.ansible/pc/783f3da3b7
<mx204> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<mx204> ANSIBLE_NETWORK_IMPORT_MODULES: found junipernetworks.junos.junos_lag_interfaces  at /home/epiqsty/.ansible/collections/ansible_collections/junipernetworks/junos/plugins/modules/junos_lag_interfaces.py
<mx204> ANSIBLE_NETWORK_IMPORT_MODULES: running junipernetworks.junos.junos_lag_interfaces
<mx204> ANSIBLE_NETWORK_IMPORT_MODULES: complete

TASK [Gather junos lag interfaces as in given arguments] ********************************************************************************************
task path: /home/epiqsty/playbooks/junos_lag_interfaces.yml:9
ok: [mx204] => {
    "changed": false,
    "gathered": [
        {
            "mode": "active",
            "name": "ae0"
        },
        {
            "mode": "active",
            "name": "ae1"
        },
        {
            "mode": "active",
            "name": "ae2"
        }
    ],
    "invocation": {
        "module_args": {
            "config": null,
            "running_config": null,
            "state": "gathered"
        }
    }
}
Loading collection ansible.netcommon from /usr/local/lib/python3.11/dist-packages/ansible_collections/ansible/netcommon
Loading collection ansible.utils from /usr/local/lib/python3.11/dist-packages/ansible_collections/ansible/utils
redirecting (type: netconf) ansible.builtin.junos to junipernetworks.junos.junos

TASK [show results] *********************************************************************************************************************************
task path: /home/epiqsty/playbooks/junos_lag_interfaces.yml:14
ok: [mx204] => {
    "msg": {
        "changed": false,
        "failed": false,
        "gathered": [
            {
                "mode": "active",
                "name": "ae0"
            },
            {
                "mode": "active",
                "name": "ae1"
            },
            {
                "mode": "active",
                "name": "ae2"
            }
        ]
    }
}

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

$ head /home/epiqsty/.ansible/collections/ansible_collections/junipernetworks/junos/CHANGELOG.rst                          
==============================================
Junipernetworks Junos Collection Release Notes
==============================================

.. contents:: Topics


v9.0.0
======

So, please let me know if i have to install your fix some different way ...

EpiqSty avatar Jun 19 '24 16:06 EpiqSty

@EpiqSty I understand. Using the command ansible-galaxy collection install git+https://github.com/rohitthakur2590/junipernetworks.junos.git will not fetch the changes from the pull request; it will only install the main branch from the repository. To access the changes in the PR, you will need to clone the junipernetworks.junos repository and check out the specific PR branch. If you need any further assistance with this, please let me know

rohitthakur2590 avatar Jun 19 '24 16:06 rohitthakur2590

@rohitthakur2590 ok, got it, so using this syntax:

$ ansible-galaxy collection install git+https://github.com/rohitthakur2590/junipernetworks.junos.git,sub_interfaces_fix

i've got members in result:

$  ansible-playbook playbooks/junos_lag_interfaces.yml -l mx204      

PLAY [Gathering LAG ports] *****************************************************************************************************

TASK [Gather junos lag interfaces as in given arguments] ***********************************************************************
ok: [mx204]

TASK [show results] ************************************************************************************************************
ok: [mx204] => {
    "msg": {
        "changed": false,
        "failed": false,
        "gathered": [
            {
                "members": [
                    {
                        "ether_option_type": "ether",
                        "member": "xe-0/1/4"
                    },
                    {
                        "ether_option_type": "ether",
                        "member": "xe-0/1/5"
                    }
                ],
                "mode": "active",
                "name": "ae0"
            },
            {
                "members": [
                    {
                        "ether_option_type": "ether",
                        "member": "xe-0/1/6"
                    },
                    {
                        "ether_option_type": "ether",
                        "member": "xe-0/1/7"
                    }
                ],
                "mode": "active",
                "name": "ae1"
            },
            {
                "members": [
                    {
                        "ether_option_type": "ether",
                        "member": "et-0/0/0"
                    }
                ],
                "mode": "active",
                "name": "ae2"
            }
        ]
    }
}

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

Let me double check with other devices but so far it looks working as expected.

EpiqSty avatar Jun 19 '24 22:06 EpiqSty

Ok, I see no breaking changes with other devices, the only SRX345 not showing anything still (but it was before the fix as well and it's not in the current issue scope anyway). So let's treat this problem as fixed, please proceed with merge/release. Thanks!

EpiqSty avatar Jun 21 '24 14:06 EpiqSty