Developer

 View Only
last person joined: 3 days ago 

Expand all | Collapse all

aoscx_vlan slow loop

This thread has been viewed 26 times
  • 1.  aoscx_vlan slow loop

    Posted Feb 16, 2021 10:09 AM
    Hi all,

    I have been working with the AOS-CX role for a while and decided to see if I could improve the speed of administration of  VLANs with aoscx_vlan.  Currently I am have them all in a vars file like:

    vlans:
      - {vlanid'4'vlanname'vlan0004'vlanadminstate'up'vlanstate'create'}
      - {vlanid'8'vlanname'vlan0008'vlanadminstate'up'vlanstate'create'}
      ....
      - {vlanid: '399', vlanname: 'vlan4000', vlanstate: 'delete'}
      - {vlanid: '4000', vlanname: 'vlan4000', vlanadminstate: 'up', vlanstate: 'create'}

    and the task is:

      - name: Create VLANs
        aoscx_vlan:
          vlan_id"{{ item.vlanid }}"
          name"{{ item.vlanname }}"
          admin_state"{{ item.vlanadminstate | default(omit)  }}"
          state"{{ item.vlanstate }}"
        loop"{{ vlans | flatten (levels=1) }}"


    My vars file has about 80 vlans defined and takes about 50 seconds per switch to run. Not terrible, but you can see where this will be a bottleneck once getting past a handful of switches.

    I did a bit of research and found a few Ansible config changes to try, it saved about 1 second off the time. Found other suggestions that were module specific which the aoscx_vlan module does not support, aggregate (eos module), src + jinja template (nxos module). 


    Any suggestions to improve this workflow?


    ------------------------------
    Don Rhodes
    ------------------------------


  • 2.  RE: aoscx_vlan slow loop

    MVP GURU
    Posted Feb 16, 2021 10:48 AM
    Hi Don,

    I think, it is better to ask directly on Ansible AOS CX github

    What latency do you have to the switch ? (on the same LAN ?)
    do you have look log to see what it is make ?

    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 3.  RE: aoscx_vlan slow loop

    Posted Feb 22, 2021 07:16 AM
    Typical latency is ~0.4ms.  For a log, are you talking about a -vvvv output or a log from the switch?

    ------------------------------
    Don Rhodes
    ------------------------------



  • 4.  RE: aoscx_vlan slow loop

    MVP GURU
    Posted Jun 09, 2021 04:26 PM
    Yes,

    I think there is a also some timer on the switch when you add a vlan...
    (and i think it is not yet possible to add multiple vlan on the same time/POST API request)

    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 5.  RE: aoscx_vlan slow loop

    Posted Jun 07, 2021 10:43 AM
    for (Iterator<String> i = someIterable.iterator(); i.hasNext();) {
    String item = i.next();
    System.out.println(item);
    }
    Note that if you need to use i.remove(); in your loop, or access the actual iterator in some way, you cannot use the for ( : ) idiom, since the actual iterator is merely inferred.

    As was noted by Denis Bueno, this code works for any object that implements the Iterable interface.


    Prepaid Gift Balance

    ------------------------------
    Henke Michel
    ------------------------------