ansible-collections / dellemc.os10

GNU General Public License v3.0
37 stars 49 forks source link

Switchport mode trunk is unrecognized command in specific circumstances #74

Open woyteck1 opened 3 years ago

woyteck1 commented 3 years ago
SUMMARY

When a new port-channel is configured within vlans, and first vlan where it's configured is as tagged, and then a second vlan is configured as untagged vlan, the switch comes up with an error.

Once first entry commented out, it passes fine. Then, when entry added again, it passes fine and required configuration is achieved.

ISSUE TYPE
COMPONENT NAME

os10_vlan

ANSIBLE VERSION
ansible 2.10.5
  config file = /home/wojciechk/git/auto/ansible.cfg
  configured module search path = [u'/home/wojciechk/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/wojciechk/git/auto/.venv/local/lib/python2.7/site-packages/ansible
  executable location = /home/wojciechk/git/auto/.venv/bin/ansible
  python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
CONFIGURATION
ALLOW_WORLD_READABLE_TMPFILES(/home/wojciechk/git/auto/ansible.cfg) = True
ANSIBLE_COW_SELECTION(/home/wojciechk/git/auto/ansible.cfg) = stegosaurus
ANSIBLE_FORCE_COLOR(/home/wojciechk/git/auto/ansible.cfg) = True
ANSIBLE_NOCOWS(/home/wojciechk/git/auto/ansible.cfg) = True
COLLECTIONS_PATHS(/home/wojciechk/git/auto/ansible.cfg) = [u'/home/wojciechk/git/auto/galaxy-roles']
DEFAULT_FORKS(/home/wojciechk/git/auto/ansible.cfg) = 20
DEFAULT_LOG_PATH(/home/wojciechk/git/auto/ansible.cfg) = /home/wojciechk/git/auto/log_ansible.txt
DEFAULT_MANAGED_STR(/home/wojciechk/git/auto/ansible.cfg) = This file is being managed with Ansible. Do NOT update it manually.
DEFAULT_ROLES_PATH(/home/wojciechk/git/auto/ansible.cfg) = [u'/home/wojciechk/git/auto/galaxy-roles', u'/home/wojciechk/git/auto/roles']
DEFAULT_TRANSPORT(/home/wojciechk/git/auto/ansible.cfg) = ssh
DISPLAY_SKIPPED_HOSTS(env: ANSIBLE_DISPLAY_SKIPPED_HOSTS) = True
HOST_KEY_CHECKING(/home/wojciechk/git/auto/ansible.cfg) = False
INTERPRETER_PYTHON(/home/wojciechk/git/auto/ansible.cfg) = /usr/bin/python3
INVENTORY_ENABLED(/home/wojciechk/git/auto/ansible.cfg) = [u'auto', u'vmware_vm_inventory', u'yaml', u'host_list']
OS / ENVIRONMENT

Current Type : S5148F Hardware Revision : A00 Software Version : 10.4.3.6

STEPS TO REPRODUCE

I have multiple vlans configured. I have added port-channel 3 to the configuration, and added it to relevant vlans. Once first entry (for vlan12) was commented out, it passes fine. Then, when entry added again, it passes fine and required configuration is achieved. (IPs changed for privacy).


os10_vlan:
  default_vlan_id: 1
  vlan 12:
    description: "lan"
    tagged_members:
      - port: port-channel 1
        state: present
      - port: port-channel 3
        state: present
    untagged_members:
      - port: port-channel 2
        state: present
    state: present
  vlan 2000:
    description: "VLAN"
    state: present
    tagged_members:
      - port: ethernet 1/1/1
        state: present
      - port: ethernet 1/1/49
        state: present
  vlan 2001:
    description: "network"
    ip_and_mask: "1.1.1.1/24"
    untagged_members:
      - port: ethernet 1/1/3
        state: present
      - port: ethernet 1/1/4
        state: present
    tagged_members:
      - port: ethernet 1/1/49
        state: present
  vlan 2254:
    description: "link"
    ip_and_mask: "2.2.2.2/30"
    untagged_members:
      - port: ethernet 1/1/1
        state: present
  vlan 2255:
    description: "network"
    ip_and_mask: "3.3.3.3/26"
    untagged_members:
      - port: ethernet 1/1/49
        state: present
      - port: port-channel 1
        state: present
      - port: port-channel 3
        state: present

os10_lag:
  Po 1:
    type: dynamic
    min_links: 1
    max_bundle_size: 2
    lacp_system_priority: 2
    channel_members:
      - port: ethernet 1/1/47
        mode: "active"
        port_priority: 3
        lacp_rate_fast: true
      - port: ethernet 1/1/48
        mode: "active"
        port_priority: 3
        lacp_rate_fast: true
    state: present
  Po 2:
    type: dynamic
    min_links: 1
    max_bundle_size: 2
    lacp_system_priority: 2
    channel_members:
      - port: ethernet 1/1/45
        mode: "active"
        port_priority: 3
        lacp_rate_fast: true
      - port: ethernet 1/1/46
        mode: "active"
        port_priority: 3
        lacp_rate_fast: true
    state: present
  Po 3:
    type: dynamic
    min_links: 1
    max_bundle_size: 2
    lacp_system_priority: 2
    channel_members:
      - port: ethernet 1/1/43
        mode: "active"
        port_priority: 3
        lacp_rate_fast: true
      - port: ethernet 1/1/44
        mode: "active"
        port_priority: 3
        lacp_rate_fast: true
    state: present
EXPECTED RESULTS

Port-channel 3 added will have trunk mode enabled, with access mode for vlan 2255 and trunk mode for vlan 12.

TASK [dellemc.os10.os10_vlan : Provisioning VLAN configuration for os10] **************************************************************************************************
changed: [sw1] => {
    "changed": true,
    "commands": [
        "interface ethernet1/1/1",
        "switchport trunk allowed vlan 2000",
        "interface ethernet1/1/49",
        "switchport trunk allowed vlan 2000",
        "switchport trunk allowed vlan 2001",
        "default vlan-id 1",
        "commit"
    ],
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "config": null,
            "lines": null,
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": "\n\ninterface vlan2255\n description \"network\"\n\n ip address 3.3.3.3/26\n\n\n\ninterface ethernet1/1/49\n switchport access vlan 2255\ninterface port-channel1\n switchport access vlan 2255\ninterface port-channel3\n switchport access vlan 2255\n\n\n\n\ninterface vlan2254\n description \"link\"\n\n ip address 2.2.2.2/30\n\n\n\ninterface ethernet1/1/1\n switchport access vlan 2254\n\n\n\n\ninterface vlan2000\n description \"VLAN\"\n\n\n\n\n\ninterface ethernet1/1/1\n switchport mode trunk\n switchport trunk allowed vlan 2000\ninterface ethernet1/1/49\n switchport mode trunk\n switchport trunk allowed vlan 2000\n\n\n\ninterface vlan2001\n description \"network\"\n\n ip address 1.1.1.1/24\n\n\n\ninterface ethernet1/1/3\n switchport access vlan 2001\ninterface ethernet1/1/4\n switchport access vlan 2001\n\ninterface ethernet1/1/49\n switchport mode trunk\n switchport trunk allowed vlan 2001\n\n\n\ninterface vlan12\n description \"lan\"\n\n\n\n\ninterface port-channel2\n switchport access vlan 12\n\ninterface port-channel1\n switchport mode trunk\n switchport trunk allowed vlan 12\ninterface port-channel3\n switchport mode trunk\n switchport trunk allowed vlan 12\n\ndefault vlan-id 1\n",
            "update": "merge"
        }
    },
    "saved": false,
    "updates": [
        "interface ethernet1/1/1",
        "switchport trunk allowed vlan 2000",
        "interface ethernet1/1/49",
        "switchport trunk allowed vlan 2000",
        "switchport trunk allowed vlan 2001",
        "default vlan-id 1",
        "commit"
    ]
}
ACTUAL RESULTS
TASK [dellemc.os10.os10_vlan : Provisioning VLAN configuration for os10] **************************************************************************************************
task path: /home/wojciechk/git/auto/.venv/local/lib/python2.7/site-packages/ansible_collections/dellemc/os10/roles/os10_vlan/tasks/main.yml:11
redirecting (type: lookup) ansible.builtin.hashi_vault to community.general.hashi_vault
Loading collection community.general from /home/wojciechk/git/auto/.venv/local/lib/python2.7/site-packages/ansible_collections/community/general
redirecting (type: lookup) ansible.builtin.hashi_vault to community.general.hashi_vault
<sw1> attempting to start connection
<sw1> using connection plugin ansible.netcommon.network_cli
redirecting (type: lookup) ansible.builtin.hashi_vault to community.general.hashi_vault
Found ansible-connection at path /home/wojciechk/git/auto/.venv/bin/ansible-connection
<sw1> found existing local domain socket, using it!
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<sw1> updating play_context for connection
<sw1>
<sw1> local domain socket path is /home/wojciechk/.ansible/pc/78caabb89b
redirecting (type: lookup) ansible.builtin.hashi_vault to community.general.hashi_vault
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_config to dellemc.os10.os10
<sw1> ESTABLISH LOCAL CONNECTION FOR USER: wojciechk
<sw1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5 `"&& mkdir "` echo /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/ansible-tmp-1615484858.45-5859-119454577488412 `" && echo ansible-tmp-1615484858.45-5859-119454577488412="` echo /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/ansible-tmp-1615484858.45-5859-119454577488412 `" ) && sleep 0'
Using module file /home/wojciechk/git/auto/.venv/local/lib/python2.7/site-packages/ansible_collections/dellemc/os10/plugins/modules/os10_config.py
<sw1> PUT /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/tmpxcMOEd TO /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/ansible-tmp-1615484858.45-5859-119454577488412/AnsiballZ_os10_config.py
<sw1> EXEC /bin/sh -c 'chmod u+x /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/ansible-tmp-1615484858.45-5859-119454577488412/ /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/ansible-tmp-1615484858.45-5859-119454577488412/AnsiballZ_os10_config.py && sleep 0'
<sw1> EXEC /bin/sh -c '/usr/bin/python3 /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/ansible-tmp-1615484858.45-5859-119454577488412/AnsiballZ_os10_config.py && sleep 0'
<sw1> EXEC /bin/sh -c 'rm -f -r /home/wojciechk/.ansible/tmp/ansible-local-5707nYRky5/ansible-tmp-1615484858.45-5859-119454577488412/ > /dev/null 2>&1 && sleep 0'
fatal: [sw1]: FAILED! => {
    "changed": false,
    "command": "switchport mode trunk",
    "invocation": {
        "module_args": {
            "after": null,
            "backup": false,
            "backup_options": null,
            "before": null,
            "config": null,
            "lines": null,
            "match": "line",
            "parents": null,
            "provider": null,
            "replace": "line",
            "save": false,
            "src": "\n\ninterface vlan2255\n description \"network\"\n\n ip address 3.3.3.3/26\n\n\n\ninterface ethernet1/1/49\n switchport access vlan 2255\ninterface port-channel1\n switchport access vlan 2255\ninterface port-channel3\n switchport access vlan 2255\n\n\n\n\ninterface vlan2254\n description \"link\"\n\n ip address 2.2.2.2/30\n\n\n\ninterface ethernet1/1/1\n switchport access vlan 2254\n\n\n\n\ninterface vlan2000\n description \"VLAN\"\n\n\n\n\n\ninterface ethernet1/1/1\n switchport mode trunk\n switchport trunk allowed vlan 2000\ninterface ethernet1/1/49\n switchport mode trunk\n switchport trunk allowed vlan 2000\n\n\n\ninterface vlan2001\n description \"network\"\n\n ip address 1.1.1.1/24\n\n\n\ninterface ethernet1/1/3\n switchport access vlan 2001\ninterface ethernet1/1/4\n switchport access vlan 2001\n\ninterface ethernet1/1/49\n switchport mode trunk\n switchport trunk allowed vlan 2001\n\n\n\ninterface vlan12\n description \"lan\"\n\n\n\n\ninterface port-channel2\n switchport access vlan 12\n\ninterface port-channel1\n switchport mode trunk\n switchport trunk allowed vlan 12\ninterface port-channel3\n switchport mode trunk\n switchport trunk allowed vlan 12\n\ndefault vlan-id 1\n",
            "update": "merge"
        }
    },
    "msg": "switchport mode trunk\r\n% Error: Unrecognized command.\r\n\u0007sw1(conf-if-vl-12)# ",
    "rc": -32603
}
woyteck1 commented 3 years ago

To add to this one, once a port has been disabled and had switchport: false The the VLAN role is helpless witch turning it back on. Regardless whether I want switchport mode access or mode trunk, the role is unable to turn it on.

fatal: [lon1sw1]: FAILED! => changed=false
  command: switchport access vlan 2001
  msg: |-
    switchport access vlan 2001
    % Error: vlan2001, Interface being added (to VLAN) is not in switchport mode access or trunk!.
    lon1sw1(conf-if-eth1/1/5)#
  rc: -32603

Please fix it, as I need to apply fixes manually everytime this shows up...