ansible-collections / cisco.iosxr

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

iosxr_l2_interfaces - issue with multiple action states #379

Closed KB-perByte closed 1 year ago

KB-perByte commented 1 year ago
SUMMARY

Action states do not produce valid configuration commands and muliple tracebacks

ISSUE TYPE
COMPONENT NAME

l2_interfaces

ANSIBLE VERSION
N/R
COLLECTION VERSION
cisco.iosxr 5.0.1
CONFIGURATION
OS / ENVIRONMENT
Cisco IOS XR Software, Version 7.0.2
Copyright (c) 2013-2020 by Cisco Systems, Inc.

Build Information:
 Built By     : ahoang
 Built On     : Fri Mar 13 22:27:54 PDT 2020
 Built Host   : iox-ucs-029
 Workspace    : /auto/srcarchive15/prod/7.0.2/xrv9k/ws
 Version      : 7.0.2
 Location     : /opt/cisco/XR/packages/
 Label        : 7.0.2

cisco IOS-XRv 9000 () processor System uptime is 9 weeks 5 days 5 hours 6 minutes

STEPS TO REPRODUCE

Playbooks added here are out of module examples

- name: Merge provided configuration with device configuration
  cisco.iosxr.iosxr_l2_interfaces:
    config:
    - name: GigabitEthernet0/0/0/3
      native_vlan: 20
    - name: GigabitEthernet0/0/0/4
      native_vlan: 40
      l2transport: true
      l2protocol:
      - stp: tunnel
    - name: GigabitEthernet0/0/0/3.900
      l2transport: true
      q_vlan:
      - 20
      - 40
    state: merged

errors out as

fatal: [10.0.150.231]: FAILED! => changed=false 
  module_stderr: '''NoneType'' object is not iterable'
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error

replaced state

- name: Replaces device configuration of listed interfaces with provided configuration
  cisco.iosxr.iosxr_l2_interfaces:
    config:
    - name: GigabitEthernet0/0/0/4
      native_vlan: 40
      l2transport: true
      l2protocol:
      - stp: forward
    - name: GigabitEthernet0/0/0/3.900
      q_vlan:
      - 20
      - any
    state: replaced

errors out with q_vlan value as any

  invocation:
    module_args:
      config:
      - encapsulation: null
        l2protocol:
        - cdp: null
          cpsv: null
          pvst: null
          stp: forward
          vtp: null
        l2transport: true
        name: GigabitEthernet0/0/0/4
        native_vlan: 40
        propagate: null
        q_vlan: null
      - encapsulation: null
        l2protocol: null
        l2transport: null
        name: GigabitEthernet0/0/0/3.900
        native_vlan: null
        propagate: null
        q_vlan:
        - 20
      running_config: null
      state: replaced
  msg: 'Elements value for option ''q_vlan'' found in ''config'' is of type <class ''ansible.parsing.yaml.objects.AnsibleUnicode''> and we were unable to convert to int: <class ''ansible.parsing.yaml.objects.AnsibleUnicode''> cannot be converted to an int

also, if any from q_vlan is removed

  module_stderr: |-
    l2transport l2protocol cpsv None
                                                             ^
    % Invalid input detected at '^' marker.
    RP/0/RP0/CPU0:ios(config-if)#
  module_stdout: ''
  msg: |-
    MODULE FAILURE
    See stdout/stderr for the exact error

notes - the condition gets none at l2protocol https://github.com/KB-perByte/iosxr/blob/5232275fcae9b9e928e145c74659d4a15e573662/plugins/module_utils/network/iosxr/config/l2_interfaces/l2_interfaces.py#L317

                if l2transport or l2protocol:
                    if not l2protocol:
                        l2protocol = []
                    for each in l2protocol:
                        each = dict(each)
EXPECTED RESULTS
ACTUAL RESULTS
ashwini-mhatre commented 1 year ago

@KB-perByte native-vlan, l2protocol cdp,pvst,stp,vtp only available for xr version< 7.0.0

KB-perByte commented 1 year ago

@ashwini-mhatre should we have those options in examples? and what is the sope of the supported versions for XR?