ansible-collections / cisco.nxos

Ansible Network Collection for Cisco NXOS
GNU General Public License v3.0
116 stars 109 forks source link

cisco.nxos.nxos_vrf_af does not accept "auto" as route-target #429

Open alexanderdeca opened 2 years ago

alexanderdeca commented 2 years ago
SUMMARY

When configuring vrf address family ipv4 rout-targets both, "auto" is not pushed towards the nxos device, however specifying a community in format xxxx:xxx is accepted.

ISSUE TYPE
COMPONENT NAME

cisco.nxos.nxos_vrf_af

ANSIBLE VERSION
ansible [core 2.12.2]
  config file = /Users/adeca/Devel/ipnexia/nx-os/ansible.cfg
  configured module search path = ['/Users/adeca/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/adeca/.virtualenvs/ipnexia/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/adeca/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/adeca/.virtualenvs/ipnexia/bin/ansible
  python version = 3.9.10 (main, Jan 15 2022, 11:48:04) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 2.11.3
  libyaml = True
COLLECTION VERSION
# /Users/adeca/.virtualenvs/ipnexia/lib/python3.9/site-packages/ansible_collections
Collection Version
---------- -------
cisco.nxos 2.8.2  

# /Users/adeca/.ansible/collections/ansible_collections
Collection Version
---------- -------
cisco.nxos 2.8.2  
CONFIGURATION
HOST_KEY_CHECKING(/Users/adeca/Devel/ipnexia/nx-os/ansible.cfg) = False
OS / ENVIRONMENT

Software BIOS: version 07.69 NXOS: version 9.3(8)

STEPS TO REPRODUCE

Configuration is not adapted accordingly on nxos device with statement - rt: auto with no visible error when executing playbook and with -rt: 65000:1000 config is pushed.


- name: CONFIGURE TENANT VRFs (cont'd)
  cisco.nxos.nxos_vrf_af:
    vrf: "{{ item.vrf }}"
    afi: ipv4
    #route_target_both_auto_evpn: true
    route_targets:
    - rt: **auto**
      direction: both
      state: absent
  loop: "{{ vrfs }}"
EXPECTED RESULTS

vrf context voice vni 12004 rd auto address-family ipv4 unicast route-target both auto route-target both auto evpn

ACTUAL RESULTS

vrf context voice vni 12004 rd auto address-family ipv4 unicast ---> missing statement route-target both auto evpn


WITH **AUTO **
============
ok: [10.255.0.6] => (item={'vrf': 'voice', 'vni_id': 12004, 'afi': 'ipv4', 'safi': 'unicast'}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "commands": [],
    "invocation": {
        "module_args": {
            "afi": "ipv4",
            "provider": null,
            "route_target_both_auto_evpn": null,
            "route_targets": [
                {
                    "direction": "both",
                    "rt": "auto",
                    "state": "present"
                }
            ],
            "state": "present",
            "vrf": "voice"
        }
    },
    "item": {
        "afi": "ipv4",
        "safi": "unicast",
        "vni_id": 12004,
        "vrf": "voice"
    }
}

WITH **65000:100 **
================

changed: [10.255.0.6] => (item={'vrf': 'voice', 'vni_id': 12004, 'afi': 'ipv4', 'safi': 'unicast'}) => {
    "ansible_loop_var": "item",
    "changed": true,
    "commands": [
        "vrf context voice",
        "address-family ipv4 unicast",
        "route-target import 65100:100",
        "route-target export 65100:100"
    ],
    "invocation": {
        "module_args": {
            "afi": "ipv4",
            "provider": null,
            "route_target_both_auto_evpn": null,
            "route_targets": [
                {
                    "direction": "both",
                    "rt": "65100:100",
                    "state": "present"
                }
            ],
            "state": "present",
            "vrf": "voice"
        }
    },
    "item": {
        "afi": "ipv4",
        "safi": "unicast",
        "vni_id": 12004,
        "vrf": "voice"
    }
}
alexanderdeca commented 2 years ago

Hey Guys,

Anything I can do to help ?

cheers

saruter commented 2 years ago

Hi, I can confirm the behaviour. No chance to configure "route-target both auto"

NilashishC commented 2 years ago

@alexanderdeca I am not able to reproduce this issue with the following task:

    - name: CONFIGURE TENANT VRFs (cont'd)
      cisco.nxos.nxos_vrf_af:
        vrf: "{{ item.vrf }}"
        afi: ipv4
        route_targets:
          - rt: auto
            direction: both
            state: present
      loop: "{{ vrfs }}"
      vars:
        vrfs:
          - {'vrf': 'voice', 'vni_id': 12004, 'afi': 'ipv4', 'safi': 'unicast'}
changed: [nxos1] => (item={'vrf': 'voice', 'vni_id': 12004, 'afi': 'ipv4', 'safi': 'unicast'}) => changed=true 
  ansible_loop_var: item
  commands:
  - vrf context voice
  - address-family ipv4 unicast
  - route-target both auto
  invocation:
    module_args:
      afi: ipv4
      provider: null
      route_target_both_auto_evpn: null
      route_targets:
      - direction: both
        rt: auto
        state: present
      state: present
      vrf: voice
  item:
    afi: ipv4
    safi: unicast
    vni_id: 12004
    vrf: voice

In fact, we have tests defined for the same here https://github.com/ansible-collections/cisco.nxos/blob/main/tests/unit/modules/network/nxos/test_nxos_vrf_af.py#L1101-L1122

I tried it with a virtual N9K that's running NX-OS 9.3.6. With N7K, the command set should be:

- vrf context voice
- address-family ipv4 unicast
- route-target import auto
- route-target export auto

Could you please share the output for show version | grep "NXOS:" and show inventory?

alexanderdeca commented 2 years ago

hi @NilashishC :

switch# show version | grep "NXOS:" NXOS: version 9.3(8) switch# show inventory NAME: "Chassis", DESCR: "Nexus9000 C93180YC-EX chassis" PID: N9K-C93180YC-EX , VID: V04 , SN:

NAME: "Slot 1", DESCR: "48x10/25G + 6x40/100G Ethernet Module" PID: N9K-C93180YC-EX , VID: V04 , SN:

NAME: "Power Supply 1", DESCR: "Nexus9000 C93180YC-EX chassis Power Supply" PID: NXA-PAC-650W-PE , VID: V04 , SN:

NAME: "Power Supply 2", DESCR: "Nexus9000 C93180YC-EX chassis Power Supply" PID: NXA-PAC-650W-PE , VID: V04 , SN:

NAME: "Fan 1", DESCR: "Nexus9000 C93180YC-EX chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V01 , SN: N/A

NAME: "Fan 2", DESCR: "Nexus9000 C93180YC-EX chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V01 , SN: N/A

NAME: "Fan 3", DESCR: "Nexus9000 C93180YC-EX chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V01 , SN: N/A

NAME: "Fan 4", DESCR: "Nexus9000 C93180YC-EX chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V01 , SN: N/A

NilashishC commented 2 years ago

@alexanderdeca We still haven't been able to reproduce this problem on multiple chassis x NX-OS versions. Hence, we would require the existing running config from the appliance where the task you share above fails. Would you be able to provide that so that we can debug this further?

alexanderdeca commented 2 years ago

Hi @NilashishC

can you send me an email alexander@deca-consulting.be so I can transfer the file to you.

thanks

Alexander