Documentation

SwitchAPI

Switch ArubaOS API

Tags
link

Aruba ressource downloader, you can find API documentation in the product page.

Table of Contents

$cache  : array<string|int, mixed>
$config  : Config
$token  : string
$cache  : mixed
$config  : Config
$token  : mixed
__construct()  : mixed
Constructor takes care of checking and registering switch's data and login to the API
__destruct()  : mixed
Destructor takes care of logout
blinkLedLocator()  : Return
Turn on or off the locator LED. If no duration is set, default to 30 minutes.
cli()  : mixed
Execute a CLI command.
createVlan()  : bool
Create a VLAN on the switch.
deleteVlan()  : bool
Delete a VLAN on the switch.
disablePoePort()  : bool
Disable POE on a port.
disablePort()  : bool
Disable a port.
enablePoePort()  : bool
Enable POE on a port.
enablePort()  : bool
Enable a port.
getMacAddressInfo()  : mixed
Get infos about a MAC address.
getMacTable()  : Return
Get MAC table of the switch.
getMacTablePort()  : Return
Get MAC table of a port.
getPortsPOEStatus()  : array<string|int, mixed>
Get all ports POE status.
getPortsStatus()  : array<string|int, mixed>
Get all ports status.
getRunningConfig()  : mixed
Get runnning configuration.
getTVlanPort()  : mixed
Get the tagged vlan for one port.
getUVlanPort()  : mixed
Get the untagged vlan for one port.
getVlanPorts()  : mixed
Get list of ports for one vlan.
getVlans()  : mixed
Get all VLANs on the switch.
getVlansPort()  : mixed
Get list of vlans affected to one port.
getVlansPorts()  : mixed
Get list of vlans/ports association.
isPortEnabled()  : bool
Check if a port is enabled.
isPortUp()  : bool
Check if a port is up.
portPoeStatus()  : Return
Check if a port is POE enabled.
restartPoePort()  : bool
Restart POE on a port.
restartPort()  : bool
Disable a port 5sec and re-enable it. Be careful when disabling links between switchs or firewalls .
setTVlanPort()  : bool
Set tagged VLAN(s) on port.
setUVlanPort()  : bool
Set untagged VLAN on port.
updateVlan()  : bool
Update a VLAN on the switch.
curlRequest()  : mixed
Method to request the switch's API
login()  : bool
Login in the switch.
logout()  : mixed
Logout

Properties

$cache

public array<string|int, mixed> $cache

Variable use to cache information.

$token

public string $token

Authentication token kept in cache.

Methods

__construct()

Constructor takes care of checking and registering switch's data and login to the API

public __construct(Config $config) : mixed
Parameters
$config : Config

Object containing all necessary configuration.

Return values
mixed

__destruct()

Destructor takes care of logout

public __destruct() : mixed
Return values
mixed

blinkLedLocator()

Turn on or off the locator LED. If no duration is set, default to 30 minutes.

public blinkLedLocator(int $mode[, int $duration = 30 ]) : Return
Parameters
$mode : int

0 : off, 1 : on, 2 : blink.

$duration : int = 30

Duration of the mode wanted in minutes.

Return values
Return

the configuration if successful, FALSE if it failed.

cli()

Execute a CLI command.

public cli(string $command) : mixed
Parameters
$command : string

A Aruba OS valid CLI command.

Return values
mixed

Return decoded response if success or FALSE on fail.

createVlan()

Create a VLAN on the switch.

public createVlan(int $vlan, string $name) : bool
Parameters
$vlan : int

VLAN id.

$name : string

VLAN name.

Return values
bool

Return TRUE if successful, FALSE if it failed.

deleteVlan()

Delete a VLAN on the switch.

public deleteVlan(int $vlan) : bool
Parameters
$vlan : int

VLAN id.

Return values
bool

Return TRUE if successful, FALSE if it failed.

disablePoePort()

Disable POE on a port.

public disablePoePort(string $port) : bool
Parameters
$port : string

Port id.

Return values
bool

Return the TRUE if successful, FALSE if it failed.

disablePort()

Disable a port.

public disablePort(string $port) : bool
Parameters
$port : string

Port id.

Return values
bool

Return the TRUE if successful, FALSE if it failed.

enablePoePort()

Enable POE on a port.

public enablePoePort(string $port) : bool
Parameters
$port : string

Port id.

Return values
bool

Return the TRUE if successful, FALSE if it failed.

enablePort()

Enable a port.

public enablePort(string $port) : bool
Parameters
$port : string

Port id.

Return values
bool

Return the TRUE if successful, FALSE if it failed.

getMacAddressInfo()

Get infos about a MAC address.

public getMacAddressInfo( $mac) : mixed
Parameters
$mac :

= MAC address format 123456-789abc.

Return values
mixed

Return the object if successful, FALSE if it failed.

getMacTable()

Get MAC table of the switch.

public getMacTable() : Return
Return values
Return

an array of objects if successful, FALSE if it failed.

getMacTablePort()

Get MAC table of a port.

public getMacTablePort(string $port) : Return
Parameters
$port : string

Port id.

Return values
Return

an array of objects if successful, FALSE if it failed.

getPortsPOEStatus()

Get all ports POE status.

public getPortsPOEStatus() : array<string|int, mixed>
Return values
array<string|int, mixed>

Return an array of objects. Values of port_poe_stats can be :

  • If POE is disable : PPDS_DISABLE.
  • If POE is enable but not delivering : PPDS_SEARCHING.
  • If POE is enable and delivering : PPDS_DELIVERING.
  • If POE has problem or is failing : PPDS_FAULT, PPDS_TEST, PPDS_OTHER_FAULT.

getPortsStatus()

Get all ports status.

public getPortsStatus() : array<string|int, mixed>
Return values
array<string|int, mixed>

Return an array of objects.

getRunningConfig()

Get runnning configuration.

public getRunningConfig() : mixed
Return values
mixed

Return the configuration if successful, FALSE if it failed.

getTVlanPort()

Get the tagged vlan for one port.

public getTVlanPort(string $port) : mixed
Parameters
$port : string

Port id.

Return values
mixed

Return the port association object info list if successful, FALSE if it failed.

getUVlanPort()

Get the untagged vlan for one port.

public getUVlanPort(string $port) : mixed
Parameters
$port : string

Port id.

Return values
mixed

Return the port association object info if successful, FALSE if it failed.

getVlanPorts()

Get list of ports for one vlan.

public getVlanPorts(int $vlan) : mixed
Parameters
$vlan : int

VLAN id.

Return values
mixed

Return the list as an array of objects if successful, FALSE if it failed.

getVlans()

Get all VLANs on the switch.

public getVlans() : mixed
Return values
mixed

Return the list as an array of objects if successful, FALSE if it failed.

getVlansPort()

Get list of vlans affected to one port.

public getVlansPort(string $port) : mixed
Parameters
$port : string

Port id.

Return values
mixed

Return the list as an array of objects if successful, FALSE if it failed.

getVlansPorts()

Get list of vlans/ports association.

public getVlansPorts() : mixed
Return values
mixed

Return the list as an array of objects if successful, FALSE if it failed.

isPortEnabled()

Check if a port is enabled.

public isPortEnabled(string $port) : bool
Parameters
$port : string

Port id.

Return values
bool

Return TRUE if the port is enabled, FALSE if not.

isPortUp()

Check if a port is up.

public isPortUp(string $port) : bool
Parameters
$port : string

Port id.

Return values
bool

Return TRUE if the port is up, FALSE if not.

portPoeStatus()

Check if a port is POE enabled.

public portPoeStatus(string $port) : Return
Parameters
$port : string

Port id.

Return values
Return

the object. Values of port_poe_stats can be :

  • If POE is disable : PPDS_DISABLE.
  • If POE is enable but not delivering : PPDS_SEARCHING.
  • If POE is enable and delivering : PPDS_DELIVERING.
  • If POE has problem or is failing : PPDS_FAULT, PPDS_TEST, PPDS_OTHER_FAULT.

restartPoePort()

Restart POE on a port.

public restartPoePort(string $port) : bool
Parameters
$port : string

Port id.

Return values
bool

Return the TRUE if successful, FALSE if it failed.

restartPort()

Disable a port 5sec and re-enable it. Be careful when disabling links between switchs or firewalls .

public restartPort(string $port) : bool

..

Parameters
$port : string

Port id.

Return values
bool

Return the TRUE if successful, FALSE if it failed.

setTVlanPort()

Set tagged VLAN(s) on port.

public setTVlanPort(array<string|int, mixed> $vlans, string $port) : bool
Parameters
$vlans : array<string|int, mixed>

[VLAN ids].

$port : string

Port id.

Tags
link
https://community.arubanetworks.com/t5/Wired-Intelligent-Edge-Campus/Removing-default-VLAN-from-REST-not-working/td-p/674880
Return values
bool

Return the TRUE if successful, FALSE if it failed. Working but be careful ongoing forum post about not being able to remove tagged vlan if it's the default vlan (1). More info :

setUVlanPort()

Set untagged VLAN on port.

public setUVlanPort(int $vlan, string $port) : bool
Parameters
$vlan : int

VLAN id.

$port : string

Port id.

Return values
bool

Return the TRUE if successful, FALSE if it failed.

updateVlan()

Update a VLAN on the switch.

public updateVlan(int $vlan, string $name) : bool
Parameters
$vlan : int

VLAN id.

$name : string

VLAN name.

Return values
bool

Return TRUE if successful, FALSE if it failed.

curlRequest()

Method to request the switch's API

private curlRequest(string $method, string $endpoint[, string $data = NULL ][, int $timeout = NULL ]) : mixed
Parameters
$method : string

HTTP method (e.g. 'GET', 'POST', 'PUT', 'DELETE' ...).

$endpoint : string

API endpoint without the 2 first element ('rest' and API version '/rest/vX'), e.g. /login-sessions.

$data : string = NULL

Data to be passed in the request body as a JSON document (e.g. '{"userName":"api","password":"api"}').

$timeout : int = NULL
Return values
mixed

Return switch's response as a PHP array if any or TRUE on success without response.

login()

Login in the switch.

private login() : bool
Return values
bool

Return TRUE if successful or throw Exception if fails.

logout()

Logout

private logout() : mixed
Return values
mixed

Search results