ansible-collections / dellemc.enterprise_sonic

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

sonic_l2_interfaces error "code": -32603, #94

Closed ldurbanredhat closed 2 years ago

ldurbanredhat commented 2 years ago
SUMMARY

I'm running ansible automation platform 2.0 using automation controller 4.0. I'm trying to use the dellemc.enterprise collection and the dellemc.enterprise_sonic.sonic_l2_interfaces and it is not assigning ports to existing vlan

ISSUE TYPE
COMPONENT NAME

dellemc.enterprise_sonic.sonic_l2_interfaces

ANSIBLE VERSION

ansible [core 2.12.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
  jinja version = 2.10.3
  libyaml = True
COLLECTION VERSION
Name                       Version       Shadowed  Type       Path                                                                              
 0│ansible.builtin            2.12.5.post0  False     contained  /usr/local/lib/python3.8/site-packages/ansible                                    
 1│ansible.controller         4.2.0         False     contained  /usr/share/ansible/collections/ansible_collections/ansible/controller             
 2│ansible.netcommon          3.0.1         False     contained  /usr/share/ansible/collections/ansible_collections/ansible/netcommon              
 3│ansible.posix              1.4.0         False     contained  /usr/share/ansible/collections/ansible_collections/ansible/posix                  
 4│ansible.utils              2.6.1         False     contained  /usr/share/ansible/collections/ansible_collections/ansible/utils                  
 5│community.general          5.1.0         False     contained  /usr/share/ansible/collections/ansible_collections/community/general              
 6│community.vmware           2.6.0         False     contained  /usr/share/ansible/collections/ansible_collections/community/vmware               
 7│dellemc.enterprise_sonic   1.1.0         False     contained  /usr/share/ansible/collections/ansible_collections/dellemc/enterprise_sonic       
 8│dellemc.openmanage         5.4.0         False     contained  /usr/share/ansible/collections/ansible_collections/dellemc/openmanage             
 9│dellemc.os10               1.1.1         False     contained  /usr/share/ansible/collections/ansible_collections/dellemc/os10                   
10│dellemc.powerflex          1.2.0         False     contained  /usr/share/ansible/collections/ansible_collections/dellemc/powerflex              
11│redhat.rhel_idm            1.7.0         False     contained  /usr/share/ansible/collections/ansible_collections/redhat/rhel_idm
CONFIGURATION
OS / ENVIRONMENT

z9100-02# show version

Software Version : '4.0.0-Enterprise_Advanced' Product : Enterprise SONiC Distribution by Dell Technologies Distribution : '10.12' Kernel : '4.19.0-9-2-amd64' Config DB Version : version_4_0_1 Build Commit : 'cfcae285b' Build Date : Fri Apr 22 23:39:23 UTC 2022 Built By : Platform : x86_64-dell_z9100_c2538-r0 HwSKU : Force10-Z9100-C32 ASIC : broadcom Hardware Version : A00 Serial Number : Uptime : 14:37:52 up 27 days, 1:26, 1 user, load average: 2.31, 1.99, 1.77 Mfg : DELL

STEPS TO REPRODUCE
---
# host_vars file
hostname: z9100-01
ansible_network_os: dellemc.enterprise_sonic.sonic

# Additional parameters for connection type httpapi:
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false

---
# playbook
- name: Dell VLAN Management Demo
  hosts: dell_demo
  gather_facts: false
  connection: httpapi

  collections:
    - dellemc.enterprise_sonic

  tasks:
- name: Configure switch port of interfaces
  dellemc.enterprise_sonic.sonic_l2_interfaces:
    config:
     - name: Eth1/1/1
       access:
         vlan: 12
       trunk:
         allowed_vlans:
            - vlan: 13
            - vlan: 14
    state: merged
EXPECTED RESULTS
Before state:

do show Vlan Q: A - Access (Untagged), T - Tagged NUM Status Q Ports 10 Inactive 11 Inactive 12 Inactive A Eth1/4 13 Inactive T Eth1/4 14 Inactive A Eth1/5 15 Inactive T Eth1/5

Run Playbook:

- name: Configure switch port of interfaces
  dellemc.enterprise_sonic.sonic_l2_interfaces:
    config:
     - name: Eth1/1/1
       access:
         vlan: 12
       trunk:
         allowed_vlans:
            - vlan: 13
            - vlan: 14
    state: merged
After state:

do show Vlan Q: A - Access (Untagged), T - Tagged NUM Status Q Ports 10 Inactive 11 Inactive 12 Inactive A Eth1/1/1 A Eth1/4 13 Inactive T Eth1/1/1 T Eth1/4 14 Inactive A Eth1/1/1 A Eth1/5 15 Inactive T Eth1/5

ACTUAL RESULTS

{ "code": -32603, "msg": "{'ietf-restconf:errors': {'error': [{'error-type': 'protocol', 'error-tag': 'invalid-value', 'error-message': 'Not Found'}]}, 'code': 404, 'request_data': {'path': 'data/openconfig-interfaces:interfaces/interface=Eth1%2f1/1/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config', 'method': 'PATCH'}}", "exception": " File \"/usr/share/ansible/collections/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/config/l2_interfaces/l2_interfaces.py\", line 103, in execute_module\n edit_config(self._module, to_request(self._module, requests))\n File \"/usr/share/ansible/collections/ansible_collections/dellemc/enterprise_sonic/plugins/module_utils/network/sonic/sonic.py\", line 140, in edit_config\n return connection.edit_config(commands)\n File \"/usr/local/lib/python3.8/site-packages/ansible/module_utils/connection.py\", line 200, in rpc\n raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)\n", "invocation": { "module_args": { "config": [ { "name": "Eth1/1/1", "access": { "vlan": 42 }, "trunk": { "allowed_vlans": [ { "vlan": 10 } ] } } ], "state": "merged" } }, "_ansible_no_log": false, "changed": false

tperrindell commented 2 years ago

I think the issue relies in the naming of the interface : Eth1%2f1/1

This seems to indicate that the fact that this interface was subdivided with a breakout mode, but the code seems to be looking for the last slash in the Interface name, and then translates the first one in the ascii code for it "%2f", and that might be causing the issue here.

@kerry-meyer Any idea if that can be quick fixed?

Thanks,

kerry-meyer commented 2 years ago

It looks like the problem cause is that one of the currently "released" versions of our collection (which handle only SONiC "3.x" images) was being run against a SONiC 4.0 image.

Although our initial release for support of SONiC 4.0 has not yet been published, the current (latest) version of our collection on the "main" branch of the Dell SONiC Enterprise Ansible repo should work for this case.

Please let us know if you would like additional details on cloning/installing this version of our collection on the server from which you are running this playbook.

tperrindell commented 2 years ago

Hello Kerry

Unfortunately it is sourced from the main branch of the git and not from Galaxy.

Thanks for your help

Sent from my phone, sorry for any typo


From: Kerry Meyer @.> Sent: Thursday, June 16, 2022 7:50:54 PM To: ansible-collections/dellemc.enterprise_sonic @.> Cc: Perrin, Thibaut @.>; Comment @.> Subject: Re: [ansible-collections/dellemc.enterprise_sonic] sonic_l2_interfaces error "code": -32603, (Issue #94)

[EXTERNAL EMAIL]

It looks like the problem cause is that one of the currently "released" versions of our collection (which handle only SONiC "3.x" images) was being run against a SONiC 4.0 image.

Although our initial release for support of SONiC 4.0 has not yet been published, the current (latest) version of our collection on the "main" branch of the Dell SONiC Enterprise Ansible repo should work for this case.

Please let us know if you would like additional details on cloning/installing this version of our collection on the server from which you are running this playbook.

— Reply to this email directly, view it on GitHub [github.com]https://urldefense.com/v3/__https://github.com/ansible-collections/dellemc.enterprise_sonic/issues/94*issuecomment-1157965187__;Iw!!LpKI!kwbGMNyK2mgomPdCDgnz4lfYG3kJ8zJrxoLbzTR4h3NFSeJqRfnc3Drc-LSkQrckKZp4zWscvKSujUolIQy0d62BAAQ$, or unsubscribe [github.com]https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AYVDNKVE5RED3DTJUI2F7PLVPNSP5ANCNFSM5YYB55UA__;!!LpKI!kwbGMNyK2mgomPdCDgnz4lfYG3kJ8zJrxoLbzTR4h3NFSeJqRfnc3Drc-LSkQrckKZp4zWscvKSujUolIQy0BmO2WyI$. You are receiving this because you commented.Message ID: @.***>

Dell S.A, Siège Social 1 rond point Benjamin Franklin 34000 Montpellier. Capital 1,782,769 Euros, 351 528 229 RCS Montpellier –APE 4651Z -TVA Intracommunautaire FR 20 351 528 229, SIRET 351 528 229 00088 Vat Number : FR 20351528229 (France) / IT00001709997 (Italy) / ESN0012622G (Spain)

Internal Use - Confidential

kerry-meyer commented 2 years ago

Okay. I have re-read your description of the problem more carefully and I understand that it may be a failure in or collection code to correctly transform the last "slash" in the interface name in port breakout mode.

We will look into this problem and will send a response soon.