|

[Aruba DevNet Lecture 2] Escape Excel Hell! Organize Your Equipment Assets in 3 Seconds with Python

⏱️ Estimated reading time: Approx. 8 minutes (8 min read)

past Lecture 1In , we succeeded in obtaining an 'Access Token' that opens the door to the Aruba Central API.
If you haven't seen it yet, I recommend watching Lecture 1 first!

Today we will use that token for real ‘'Money and time'’ Let's get to work.
This is the eternal homework of network administrators: asset management (Inventory).

“Team Leader: Please compile an Excel spreadsheet with a list of all APs currently in operation, including serial numbers and license expiration dates. Within 30 minutes.”

Are you going to check and copy and paste everything one by one in the Aruba Central dashboard?
If you have the Python script I'm going to show you today, just press Enter once. Before even taking a sip of coffee An Excel file is created in no time.


1. Today's goal

  • target: Get information on all devices (APs, switches, gateways) registered in Aruba Central
  • process: After selecting only the information I need (name, model name, serial, IP, status)
  • result: Neat .xlsx Save as an Excel file.

In this process we PandasWe will be using a very powerful Python library called .
It's a tool used by data analysts who work with Excel, but it's also very useful for network engineers like us.

2. Warm-up: Finding APIs in the Developer Hub

Before coding Aruba Developer HubI guess I'll have to figure out which API to use?

The API we will use is Network Monitoring In the category List Devicesno see.

  • API Endpoint: /network-monitoring/v1alpha1/devices

“Why v1alpha1?”

As Aruba Central evolved into New Central, its APIs also began to take on a more standardized structure.
v1alpha1is the endpoint that most quickly reflects the latest network monitoring capabilities.

existing v2 It is faster than API and fully integrated with future microservices architecture based on AOS 10.

  • Method: GET
  • function: Returns a list of registered devices with their status and details.

3. [Practice] Saving New Central Data to Excel with Python

In this exercise, we will learn about the standard Excel analysis Pandas Use the library.

[Preparation]

Bash
pip install requests pandas openpyxl

[New Central-specific Python script]

Python
import requests
import pandas as PD
from datetime import datetime

# 1. New Central Access Information
Enter the token issued in # Lesson 1 and your region address.
ACCESS_TOKEN = ""YOUR_ACCESS_TOKEN""
BASE_URL = ""https://de1.api.central.arubanetworks.com""
API_PATH = ""/network-monitoring/v1alpha1/devices""

print(f""🚀 Start calling the New Central API: {BASE_URL}""")

try:
    # 2. Data Request
    response = requests.get(f"""{BASE_URL}{API_PATH}""", headers=headers)
    
    if response.status_code == 200:
        raw_data = response.json()
        # New Central v1alpha1 usually contains a list of equipment in the 'items' key.
        devices = raw_data.get(''items'', [])
        print(f""✅ Total {len(devices)}"We have received your equipment data."")
        
        # 3. Data processing (desired column mapping)
        device_list = []
        for dev in devices:
            device_list.append({
                ""Equipment Name"": dev.get(""deviceName""),
                ""cereals"": dev.get(""serialNumber""),
                ""model"": dev.get(""model""),
                ""IP address"": dev.get(""ipv4""),
                ""situation"": dev.get(""status""),
                ""site"": dev.get(""siteName""),
                ""MAC address"": dev.get(""macAddress"")
            })
            
        # 4. Saving Excel files using Pandas
        df = pd.DataFrame(device_list)
        filename = f""NewCentral_Inventory_{datetime.now().strftime(''%Y%m%d')}.xlsx""
        df.to_excel(filename, index=False)
        print(f""🎉 File saving complete: {filename}""")
        
    else:
        print(f""❌ Failure (code {response.status_code}): {response.text}""")

except Exception as e:
    print(f""❌ An error occurred: {e}""")

If the script runs successfully, an Excel file will be extracted with the following message.

[Aruba DevNet 2강] 엑셀 지옥 탈출! 파이썬으로 3초 만에 장비 자산 현황 정리하기 - image 2

4. In conclusion

Today we're extracting data from a modern environment called New Central.
Now, instead of manually organized Excel spreadsheets on your desk, A complete list of assets generated by the codeThere will be a place for it.

next 3rd lectureBased on the data collected in this way, AnsibleLet's dive into the world of 'real automation' by pushing settings to actual equipment (CX switches) using !

Similar Posts

  • [ACP-DC Training #3] Data Center Technology

    ⏱️ Estimated reading time: Approx. 14 minutes (14 min read) Last time, we discussed the robust hardware products of data centers. While physical equipment such as servers, storage, and switches are important, what truly makes a data center 'smart' is likely the various technologies running on top of this hardware. Simply put, data center technology refers to the various… configured on switches

  • [ACSA Education #13] Hierarchical Model

    ⏱️ Estimated reading time: Approx. 4 minutes (4 min read) When designing networks, hierarchical design is frequently discussed. In English, it is referred to as a Hierarchical Model. Let's take a look at why this is necessary. A hierarchical model provides the network in a modular form. Ultimately, this simplifies the design and even provides for future infrastructure expansion… .

  • [ACP-DC Training #15] EVPN (Ethernet VPN)

    ⏱️ Estimated read time: Approx. 18 minutes (18 min read) Layer 3 fabric has become the standard topology commonly used in large-scale data centers because it provides low-latency communication within three hops between any hosts. Ethernet VPN (EVPN) combines protocols such as VXLAN and MP-BGP to create dynamic EVPN tunnels between switches…

  • [Monitoring with Icinga Part 1] Basic Integration with Icinga 2 – SNMP & REST API

    ⏱️ Estimated Reading Time: Approx. 6 minutes (6 min read) 1. Introduction: Infrastructure Monitoring, Why Icinga 2? When operating enterprise networks and infrastructure, Zabbix is by far the most familiar open-source monitoring tool to engineers in Korea. Thanks to its intuitive web GUI, various default templates, and an all-in-one environment consisting of a single package, numerous enterprise…

  • Setting up a simulator lab with EVE-NG

    ⏱️ Estimated read time: Approx. 4 minutes (4 min read) To use the Aruba AOS-CX simulator, you first need to install an emulator such as EVE-NG. If you haven't installed it yet, you can install it as a virtual machine using a hypervisor like VMware or Hyper-V. Please refer to the previous post for instructions on how to install it on Hyper-V. Once you have successfully installed EVE-NG, it is time to set up the virtual lab…

  • [ACSA Training #33] Routing

    ⏱️ Estimated read time: Approx. 10 minutes (10 min read) Since a switch is a Layer 2 device, its ports can only execute Layer 2 functions and protocols, such as becoming a member of each VLAN (member port) or transmitting frames. When an endpoint terminal is connected to a port used as a Layer 2 interface, based on the destination Layer 2 MAC address…