ansible-collections / dellemc.enterprise_sonic

Ansible Network Collection for Enterprise SONiC Distribution by Dell Technologies
GNU General Public License v3.0
42 stars 60 forks source link

[BUG]: Interface naming standard-extended is not supported by the sonic_system module #312

Closed MatthewHannonDell closed 6 months ago

MatthewHannonDell commented 10 months ago

Bug Description

When trying to use the sonic_system module with a system that has interface naming standard extended the following error is encountered: "msg": "value of interface_naming must be one of: standard, native, got: standard-ext found in config"

Product Name

Dell Enterprise SONiC

Component or Module Name

sonic_system

DellEMC Enterprise SONiC Ansible Collection Version

dellemc.enterprise_sonic 2.2.0

SONiC Software Version

4.1.0-Enterprise_Base

Configuration

N/A (No output)

Steps to Reproduce

Configure a system with interface-naming standard-extended via the sonic-cli and try to leverage the ansible sonic_system module

Expected Behavior

Interface naming should support standard, native, and standard-ext

Actual Behavior

When attempting to change the interface naming state we get the error: "msg": "value of interface_naming must be one of: standard, native, got: standard-ext found in config"

Logs

fatal: [S5212F-1]: FAILED! => { "changed": false, "invocation": { "module_args": { "config": { "anycast_address": null, "hostname": "sonic", "interface_naming": "standard-ext" }, "state": "merged" } }, "msg": "value of interface_naming must be one of: standard, native, got: standard-ext found in config" } fatal: [S5212F-2]: FAILED! => { "changed": false, "invocation": { "module_args": { "config": { "anycast_address": null, "hostname": "sonic", "interface_naming": "standard-ext" }, "state": "merged" } }, "msg": "value of interface_naming must be one of: standard, native, got: standard-ext found in config" }

Screenshots

No response

Additional Information

No response

p3rdu commented 7 months ago

Hi

The same bug seems to apply to dellemc.enterprise_sonic.sonic_l2_interfaces module as well. I'm unable to create configuration and the error mentions standard-ext naming scheme.

The task

---
- name: Interface configuration play
  hosts: all
  connection: httpapi
  gather_facts: no
  collections:
    - dellemc.enterprise_sonic
  tasks:
    - name: Configures switch port of interfaces
      dellemc.enterprise_sonic.sonic_l2_interfaces:
        config:
          - name: "Eth1/1"
            access:
              vlan: 123
            trunk:
              allowed_vlans:
                - vlan: 999

And result

fatal: [dc-leaf1]: FAILED! => {
    "changed": false,
    "code": 400,
    "invocation": {
        "module_args": {
            "config": [
                {
                    "access": {
                        "vlan": 123
                    },
                    "name": "Eth1/1",
                    "trunk": {
                        "allowed_vlans": [
                            {
                                "vlan": "999"
                            }
                        ]
                    }
                }
            ],
            "state": "merged"
        }
    },
    "msg": "Interface naming mode configured on switch standard-ext, Eth1/1 is not valid"
}
BrianForget commented 7 months ago

It looks like the options are set in the "ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.system.system" That is viewable at https://github.com/ansible-collections/dellemc.enterprise_sonic/blob/main/plugins/modules/sonic_system.py

I suspect that by changing line number 53 standard-extended mode would be accepted. But my only concern is that the option does require a reboot to take effect. So perhaps an initial playbook that includes setting the interface-naming mode along with a save and reboot would be needed.

suggested change to line 53: from: 'choices': ['standard', 'native'], to: 'choices': ['standard', 'native', 'standard-ext'],

toreanderson commented 7 months ago

I'm getting a similar error from dellemc.enterprise_sonic.sonic_bgp_neighbors:

TASK [sonic : Configure BGP neighbors]
fatal: [s1]: FAILED! => {"changed": false, "code": 400, "msg": "Interface naming mode configured on switch standard-ext, Eth1/44 is not valid"}
fatal: [s2]: FAILED! => {"changed": false, "code": 400, "msg": "Interface naming mode configured on switch standard-ext, Eth1/44 is not valid"}

The dict being passed as config is as follows:

  - bgp_as: 65000
    peer_group:
      - name: CORE
        remote_as:
          peer_type: external
        capability:
          extended_nexthop: false
        address_family:
          afis:
            - afi: ipv4
              safi: unicast
              activate: true
            - afi: ipv6
              safi: unicast
              activate: true
            - afi: l2vpn
              safi: evpn
              activate: true
    neighbors:
      - neighbor: Eth1/44
        peer_group: CORE
      - neighbor: Eth1/45
        peer_group: CORE
      - neighbor: Eth1/46
        peer_group: CORE
      - neighbor: Eth1/47
        peer_group: CORE
      - neighbor: Eth1/48
        peer_group: CORE

The interface naming mode is set to standard-extended and I can configure these BGP neighbors manually without any issues:

s2(config-router-bgp-neighbor)# do show interface-naming 
Interface naming mode is standard-extended
s2(config-router-bgp-neighbor)# do show running-configuration bgp neighbor vrf default
!
neighbor interface Eth1/44
 peer-group CORE
!
neighbor interface Eth1/45
 peer-group CORE
!
neighbor interface Eth1/46
 peer-group CORE
!
neighbor interface Eth1/47
 peer-group CORE
!
neighbor interface Eth1/48
 peer-group CORE
kerry-meyer commented 6 months ago

This issue has been fixed with the merging of:

Add support for standard_extended interface-naming mode