CiscoDevNet / ansible-dcnm

Apache License 2.0
45 stars 33 forks source link

dcnm_network requires ports attribute when attaching to switch #80

Open gve-vse-tim opened 3 years ago

gve-vse-tim commented 3 years ago

Community Note

Ansible Version and collection version

Ansible 2.10.5 DCNM Collection 1.1.1

DCNM version

Affected module(s)

Ansible Playbook

    - name: Create a Network and Attach to Switches
      dcnm_network:
        fabric: multisite_domain_fabric
        state: replaced
        config:
          - net_name: VLAN10
            vrf_name: VXLAN_OVERLAY
            vlan_id: 10
            gw_ip_subnet: '192.168.10.1/24'
            net_id: 30000
            deploy: true
            attach:
              - ip_address: 10.60.66.131

Debug Output

TASK [Create a Network and Attach to Switches]
*******************************************************************
fatal: [dcpod_dcnm]: FAILED! => {"changed": false, "msg": "Invalid parameters in playbook: ports : Required parameter not found"}

Expected Behavior

The VLAN (and SVI) should be configured on the switch specified without any errors and without the requirement to assign it to a port.

Actual Behavior

The DCNM module has specified that ports is a mandatory attribute for attaching the network to a switch. This behavior does not match the DCNM GUI behavior.

It's also a case of DRY (don't repeat yourself) in that you have to define allowed VLANs on trunk or access VLANs when configuring portchannel, VPC, or other trunk interfaces. So, customers (and myself) prefer defining VLAN members on the actual interfaces and not on the networks.

praveenramoorthy commented 3 years ago

@gve-vse-tim Thanks for raising this SR. Port is a mandatory attribute, but you can have an empty list for that attribute.

    - name: Create a Network and Attach to Switches
      dcnm_network:
        fabric: multisite_domain_fabric
        state: replaced
        config:
          - net_name: VLAN10
            vrf_name: VXLAN_OVERLAY
            vlan_id: 10
            gw_ip_subnet: '192.168.10.1/24'
            net_id: 30000
            deploy: true
            attach:
              - ip_address: 10.60.66.131
                ports: []

This should help.

mikewiebe commented 3 years ago

@gve-vse-tim As @praveenramoorthy suggested you can leave the ports: setting empty but we will make a change to the module so that the ports: setting is NOT mandatory.