Developer

 View Only
last person joined: yesterday 

Expand all | Collapse all

How to get VLAN members with Aruba SDK

This thread has been viewed 20 times
  • 1.  How to get VLAN members with Aruba SDK

    EMPLOYEE
    Posted Sep 26, 2023 08:30 AM

    Hi,

    Using the Aruba SDK pyaoscx version 2.4.1
    Need support to get the VLAN members with help of sdk.

    Switch model and firmware:  8325 & GL.10.10.0001P

    Regards,

    Manik



  • 2.  RE: How to get VLAN members with Aruba SDK

    EMPLOYEE
    Posted Oct 11, 2023 06:32 AM

    Hi,

    Waiting for response.

    Need help to get the VLAN interface members(tagged, untagged) with help of Aruba SDK pyaoscx version 2.4.1




  • 3.  RE: How to get VLAN members with Aruba SDK

    EMPLOYEE
    Posted Oct 11, 2023 08:44 PM

    Hi Manik,

    Just for clarification, are you looking for a full python script or code snippet that would get all ports on a switch that is a member of a particular VLAN?  Or are you asking how to use the pyaoscx VLAN object?  Did you want it printed out as a list?




  • 4.  RE: How to get VLAN members with Aruba SDK

    EMPLOYEE
    Posted Oct 12, 2023 12:59 AM

    Hi,

    I am new to aruba SDK, yes I am looking for code snippet that would get all ports(tagged & untagged) on a switch that is a member of a particular VLAN and I want to return it as list.

    Regards,

    Manik




  • 5.  RE: How to get VLAN members with Aruba SDK

    MVP GURU
    Posted Oct 12, 2023 01:37 AM

    Hi Manik,

    You can look the workflow.py file on pyaoscx (it is for add vlan but there is also get function..

    https://github.com/aruba/pyaoscx/blob/master/workflows/workflow.py

    You can also look PowerArubaCX (a powershell module) where there is Get function to vlan and interface  => https://github.com/PowerAruba/PowerArubaCX#interface



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

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

    PowerArubaCL: Powershell Module to use Aruba Central

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

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



  • 6.  RE: How to get VLAN members with Aruba SDK

    EMPLOYEE
    Posted Oct 30, 2023 02:04 PM

    Hi Manik,

    There are a few different ways to go about getting this information.  Here's a snippet of code I made that searches for the interfaces with the VLAN 999 trunk applied to them.  This can be done for access if you change the attribute being searched for "applied_vlan_trunks".

    vlan = '999'
        vlan_interface_list = []
        port_1_1_1 = Interface(s, "1/1/1")
        port_1_1_1.get()
        int_details = port_1_1_1.get_facts(s)
        print("VLAN TO FIND: {0}".format(vlan))
        for interface in int_details:
            if int_details[interface]["applied_vlan_trunks"]:
                print("CURRENT INT: {0}, CURRENT VLANS: {1}".format(interface,int_details[interface]["applied_vlan_trunks"]))
                if vlan in int_details[interface]["applied_vlan_trunks"]:
                    vlan_interface_list.append(interface)
        print(vlan_interface_list)