Skip to content

icx_vlan has hardcoded stack/module when using the purge option #268

@NHGmaniac

Description

@NHGmaniac
SUMMARY

the values for stack and module are hardcoded in icx_vlan.py, line 537.
the problem becomes visible in this example module invocation:

changed: [aurea] => {
    "changed": true,
    "commands": [
        "vlan 128",
        "vlan 128 name test-vlan",
        "tagged ethernet 1/1/7"
    ],
    "invocation": {
        "module_args": {
            "aggregate": null,
            "associated_interfaces": null,
            "associated_tagged": null,
            "check_running_config": true,
            "delay": 10,
            "interfaces": {
                "name": [
                    "ethernet 1/1/1"
                ],
                "purge": true
            },
            "ip_arp_inspection": null,
            "ip_dhcp_snooping": null,
            "name": "test-vlan",
            "purge": false,
            "state": "present",
            "stp": null,
            "tagged": {
                "name": [
                    "ethernet 1/3/7"
                ],
                "purge": true
            },
            "vlan_id": 128
        }
    }
}

the invocacation specifies ethernet 1/3/7 as tagged for vlan 128, but the resulting commands add interface ethernet 1/1/7 as tagged. the issue does not occur when not using the purge option.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

icx_vlan

ANSIBLE VERSION
ansible 2.10.9
  config file = None
  configured module search path = ['/home/bene/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/bene/.local/lib/python3.9/site-packages/ansible
  executable location = /home/bene/.local/bin/ansible
  python version = 3.9.4 (default, Apr 20 2021, 15:51:38) [GCC 10.2.0]

CONFIGURATION

OS / ENVIRONMENT

target os: ICX 10.1.00T7f5

STEPS TO REPRODUCE

configure vlan with any interface with a module that is not 1 and use the purge option.

    - name: Add ethernet 1/3/7 as tagged and ethernet 1/1/1 as untagged to vlan 128
      community.network.icx_vlan:
        name: test-vlan
        vlan_id: 128
        tagged:
          purge: yes
          name:
            - ethernet 1/3/7
        interfaces:
          purge: yes
          name:
            - ethernet 1/1/1
EXPECTED RESULTS

interface 1/3/7 gets added as tagged to vlan 128

ACTUAL RESULTS

interface 1/1/7 gets added as tagged to vlan 128

TASK [Add ethernet 1/3/7 as tagged and ethernet 1/1/ as untagged to vlan 128] ********************************************************************************
task path: /home/bene/sync/projects/wlandt16ansible/switches.yml:14
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7f7254090ac0> for vault_id=default
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7f7254090ac0> for vault_id=default
Loading collection ansible.netcommon from /home/bene/.ansible/collections/ansible_collections/ansible/netcommon
redirecting (type: terminal) ansible.builtin.icx to community.network.icx
redirecting (type: cliconf) ansible.builtin.icx to community.network.icx
redirecting (type: become) ansible.builtin.enable to ansible.netcommon.enable
<10.128.128.202> attempting to start connection
<10.128.128.202> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/bene/.local/bin/ansible-connection
<10.128.128.202> found existing local domain socket, using it!
<10.128.128.202> updating play_context for connection
<10.128.128.202> 
<10.128.128.202> local domain socket path is /home/bene/.ansible/pc/ccbaaeec14
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7f7254090ac0> for vault_id=default
<10.128.128.202> ESTABLISH LOCAL CONNECTION FOR USER: bene
<10.128.128.202> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/bene/.ansible/tmp/ansible-local-103952m0zz810k `"&& mkdir "` echo /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/ansible-tmp-1620259835.103415-104260-280742418359513 `" && echo ansible-tmp-1620259835.103415-104260-280742418359513="` echo /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/ansible-tmp-1620259835.103415-104260-280742418359513 `" ) && sleep 0'
Using module file /home/bene/.ansible/collections/ansible_collections/community/network/plugins/modules/icx_vlan.py
<10.128.128.202> PUT /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/tmpprlcaioc TO /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/ansible-tmp-1620259835.103415-104260-280742418359513/AnsiballZ_icx_vlan.py
<10.128.128.202> EXEC /bin/sh -c 'chmod u+x /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/ansible-tmp-1620259835.103415-104260-280742418359513/ /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/ansible-tmp-1620259835.103415-104260-280742418359513/AnsiballZ_icx_vlan.py && sleep 0'
<10.128.128.202> EXEC /bin/sh -c '/usr/bin/python3 /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/ansible-tmp-1620259835.103415-104260-280742418359513/AnsiballZ_icx_vlan.py && sleep 0'
<10.128.128.202> EXEC /bin/sh -c 'rm -f -r /home/bene/.ansible/tmp/ansible-local-103952m0zz810k/ansible-tmp-1620259835.103415-104260-280742418359513/ > /dev/null 2>&1 && sleep 0'
changed: [aurea] => {
    "changed": true,
    "commands": [
        "vlan 128",
        "vlan 128 name test-vlan",
        "tagged ethernet 1/1/7"
    ],
    "invocation": {
        "module_args": {
            "aggregate": null,
            "associated_interfaces": null,
            "associated_tagged": null,
            "check_running_config": true,
            "delay": 10,
            "interfaces": {
                "name": [
                    "ethernet 1/1/1"
                ],
                "purge": true
            },
            "ip_arp_inspection": null,
            "ip_dhcp_snooping": null,
            "name": "test-vlan",
            "purge": false,
            "state": "present",
            "stp": null,
            "tagged": {
                "name": [
                    "ethernet 1/3/7"
                ],
                "purge": true
            },
            "vlan_id": 128
        }
    }
}
META: ran handlers
META: ran handlers

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


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bughas_prmodulemodulepluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions