centralcli package
centralcli.central module
- class centralcli.central.CentralApi(account_name: str = 'central_info')
Bases:
Session
- DevType
alias of
Literal
[‘IAP’, ‘HP’, ‘CONTROLLER’]
- async add_devices(mac_address: str = None, serial_num: str = None, group: str = None, part_num: str = None, license: Union[str, List[str]] = None, device_list: List[Dict[str, str]] = None) Union[Response, List[Response]]
Add device(s) using Mac and Serial number (part_num also required for CoP) Will also pre-assign device to group if provided
Either mac_address and serial_num or device_list (which should contain a dict with mac serial) are required. // Used by add device and batch add devices //
- Parameters
mac_address (str, optional) – MAC address of device to be added
serial_num (str, optional) – Serial number of device to be added
group (str, optional) – Add device to pre-provisioned group (additional API call is made)
site (int, optional) – – Not implemented – Site ID
part_num (str, optional) – Part Number is required for Central On Prem.
license (str|List(str), optional) – The subscription license(s) to assign.
device_list (List[Dict[str, str]], optional) – List of dicts with mac, serial for each device and optionally group, part_num, license,
- Returns
CentralAPI Response object
- Return type
- async add_template(name: str, group: str, template: Union[Path, str, bytes], device_type: DevTypes = 'ap', version: str = 'ALL', model: str = 'ALL') Response
Create new template.
- Parameters
name (str) – Name of template.
group (str) – Name of the group for which the template is to be created.
template (Union[Path, str, bytes]) – Template File or encoded template content. For sw (AOS-Switch) device_type, the template text should include the following commands to maintain connection with central. 1. aruba-central enable. 2. aruba-central url https://<URL | IP>/ws.
device_type (str) – Device type of the template. Valid Values: ap, sw, cx, gw Defaults to ap.
version (str) – Firmware version property of template. Example: ALL, 6.5.4 etc.
model (str) – Model property of template. For sw (AOS-Switch) device_type, part number (J number) can be used for the model parameter. Example: 2920, J9727A, etc.
- Returns
CentralAPI Response object
- Return type
- async add_visitor(portal_id: str, name: str, password: str = None, *, company_name: str = None, phone: str | None = None, email: str | None = None, valid_forever: bool = False, valid_days: int = 3, valid_hours: int = 0, valid_minutes: int = 0, notify: bool | None = None, notify_to: centralcli.constants.NotifyToArgs | None = None, is_enabled: bool = True) Response
Create a new guest visitor of a portal.
- Parameters
portal_id (str) – Portal ID of the splash page
name (str) – Visitor account name
password (str) – Password
company_name (str) – Company name of the visitor
phone (str) – Phone number of the visitor; Format [+CountryCode][PhoneNumber]
email (str) – Email address of the visitor
valid_forever (bool) – Visitor account will not expire when this is set to true
valid_days (int) – Account validity in days
valid_hours (int) – Account validity in hours
valid_minutes (int) – Account validity in minutes
notify (bool) – Flag to notify the password via email or number
notify_to (str) – Notify to email or phone. Defualt is phone when it is provided otherwise email. Valid Values: email, phone
is_enabled (bool) – Enable or disable the visitor account
id (#) – NA for visitor post/put method. ID of the visitor
status (#) – This field provides status of the account. Returns true when enabled and
fields. (# not expired. NA for visitor post/put method. This is optional) –
created_at (#) – This field indicates the created date timestamp value. It is generated
field. (# while creating visitor. NA for visitor post/put method. This is optional) –
expire_at (#) – This field indicates expiry time timestamp value. It is generated based
is (# on the valid_till value and created_at time. NA for visitor post/put method. This) –
field (# optional) –
- Returns
CentralAPI Response object
- Return type
- async add_webhook(name: str, urls: List[str]) Response
Add / update Webhook.
- Parameters
name (str) – name of the webhook
urls (List[str]) – List of webhook urls
- Returns
CentralAPI Response object
- Return type
- async archive_devices(serials: List[str]) Response
Archive devices using Serial list.
- Parameters
serials (List[str]) – serials
- Returns
CentralAPI Response object
- Return type
- async assign_devices_to_group(group: str, serial_nums: Union[List[str], str]) Response
Assign devices to pre-provisioned group.
// Used indirectly by add device (when group option provided) //
- Parameters
group (str) – Group name
serials (List[str]|str) – Device serial number or list of device serial numbers.
- Returns
CentralAPI Response object
- Return type
- async assign_label_to_devices(label_id: int, device_type: GenericDevTypes, serial_nums: Union[str, List[str]]) Response
Associate Label to a list of devices.
- Parameters
label_id (int) – Label ID
device_type (str) – Device type. Valid Values: ap, gw, switch
serial_nums (str | List[str]) – List of device serial numbers of the devices to which the label has to be un/associated with. A maximum of 5000 device serials are allowed at once.
- Returns
CentralAPI Response object
- Return type
- async assign_licenses(serials: Union[str, List[str]], services: Union[str, List[str]]) Response
Assign subscription to a device.
// Used indirectly by add device when –license <license> is provided and batch add devices with license //
- Parameters
serials (str | List[str]) – List of serial number of device.
services (str | List[str]) – List of service names. Call services/config API to get the list of valid service names.
- Returns
CentralAPI Response object
- Return type
- async central_acknowledge_notifications(NoName: List[str] = None) Response
Acknowledge Notifications by ID List / All.
- Parameters
NoName (List[str], optional) – Acknowledge notifications
- Returns
CentralAPI Response object
- Return type
- async central_get_notification_config(search: str = None, sort: str = '-created_ts', offset: int = 0, limit: int = 500) Response
List Configuration/Settings for alerts that result in notification.
- Parameters
search (str, optional) – term used to search in name, category of the alert
sort (str, optional) – Sort parameter may be one of +created_ts, -created_ts, Default is ‘-created_ts’ Valid Values: -created_ts, +created_ts
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async check_image_available(device_type: str, firmware_version: str) Response
Firmware Version.
- Parameters
device_type (str) – Specify one of “IAP/MAS/HP/CONTROLLER”
firmware_version (str) – firmware version
- Returns
CentralAPI Response object
- Return type
- async clear_ts_session(serial: str, session_id: int) Response
Clear Troubleshooting Session and output for device.
- Parameters
serial (str) – Serial of device
session_id (int) – Unique ID for each troubleshooting session
- Returns
CentralAPI Response object
- Return type
- async clone_group(clone_group: str, new_group: str, upgrade_aos10: bool = False) Response
Clone and create new group.
- Parameters
clone_group (str) – Group to be cloned.
new_group (str) – Name of group to be created based on clone.
upgrade_aos10 (bool) – Set True to Update the new cloned group to AOS10.
- Returns
CentralAPI Response object
- Return type
- async configuration_clean_up_and_update_wlan_v2(group_name_or_guid: str, wlan_name: str, essid: str, type: str, hide_ssid: bool, vlan: str, zone: str, wpa_passphrase: str, wpa_passphrase_changed: bool, is_locked: bool, captive_profile_name: str, bandwidth_limit_up: str, bandwidth_limit_down: str, bandwidth_limit_peruser_up: str, bandwidth_limit_peruser_down: str, access_rules: list) Response
Update an existing WLAN and clean up unsupported fields.
- Parameters
group_name_or_guid (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
wlan_name (str) – Name of WLAN selected. Example:wlan_1.
essid (str) – essid
type (str) – type Valid Values: employee, guest
hide_ssid (bool) – hide_ssid
vlan (str) – vlan
zone (str) – zone
wpa_passphrase (str) – wpa_passphrase
wpa_passphrase_changed (bool) – wpa_passphrase_changed
is_locked (bool) – is_locked
captive_profile_name (str) – captive_profile_name
bandwidth_limit_up (str) – bandwidth_limit_up
bandwidth_limit_down (str) – bandwidth_limit_down
bandwidth_limit_peruser_up (str) – bandwidth_limit_peruser_up
bandwidth_limit_peruser_down (str) – bandwidth_limit_peruser_down
access_rules (list) – access_rules
- Returns
CentralAPI Response object
- Return type
- async configuration_update_wlan_v2(group_name_or_guid: str, wlan_name: str, essid: str, type: str, hide_ssid: bool, vlan: str, zone: str, wpa_passphrase: str, wpa_passphrase_changed: bool, is_locked: bool, captive_profile_name: str, bandwidth_limit_up: str, bandwidth_limit_down: str, bandwidth_limit_peruser_up: str, bandwidth_limit_peruser_down: str, access_rules: list) Response
Update an existing WLAN.
- Parameters
group_name_or_guid (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
wlan_name (str) – Name of WLAN selected. Example:wlan_1.
essid (str) – essid
type (str) – type Valid Values: employee, guest
hide_ssid (bool) – hide_ssid
vlan (str) – vlan
zone (str) – zone
wpa_passphrase (str) – wpa_passphrase
wpa_passphrase_changed (bool) – wpa_passphrase_changed
is_locked (bool) – is_locked
captive_profile_name (str) – captive_profile_name
bandwidth_limit_up (str) – bandwidth_limit_up
bandwidth_limit_down (str) – bandwidth_limit_down
bandwidth_limit_peruser_up (str) – bandwidth_limit_peruser_up
bandwidth_limit_peruser_down (str) – bandwidth_limit_peruser_down
access_rules (list) – access_rules
- Returns
CentralAPI Response object
- Return type
- async cop_delete_device_from_inventory(devices: List[str] = None) Response
Delete devices using Serial number. Only applies to CoP deployments.
- Parameters
devices (list, optional) – List of devices to be deleted from GreenLake inventory. Only applies to CoP
- Returns
CentralAPI Response object
- Return type
- async create_group(group: str, allowed_types: Union[AllDevTypes, List[AllDevTypes]] = ['ap', 'gw', 'cx', 'sw'], wired_tg: bool = False, wlan_tg: bool = False, aos10: bool = False, microbranch: bool = False, gw_role: GatewayRole = 'branch', monitor_only_sw: bool = False, monitor_only_cx: bool = False) Response
Create new group with specified properties. v3
// Used by add group batch add group //
- Parameters
group (str) – Group Name
allowed_types (str, List[str]) – Allowed Device Types in the group. Tabs for devices not allowed won’t display in UI. valid values “ap”, “gw”, “cx”, “sw”, “switch” (“switch” is generic, will enable both cx and sw)
wired_tg (bool, optional) – Set to true if wired(Switch) configuration in a group is managed using templates.
wlan_tg (bool, optional) – Set to true if wireless(IAP, Gateways) configuration in a group is managed using templates.
aos10 – (bool): if True use AOS10 architecture for the access points and gateways in the group. default False (Instant)
microbranch (bool) – True to enable Microbranch network role for APs is applicable only for AOS10 architecture.
gw_role (GatewayRole) – Gateway role valid values “branch”, “vpnc”, “wlan” (“wlan” only valid on AOS10 group) Default: “branch”
monitor_only_sw – Monitor only ArubaOS-SW switches, applies to UI group only
monitor_only_cx – Monitor only ArubaOS-CX switches, applies to UI group only
- Returns
CentralAPI Response object
- Return type
- async create_label(label_name: str, category_id: int = 1) Response
Create Label.
- Parameters
label_name (str) – Label name
category_id (int, optional) – Label category ID defaults to 1 1 = default label category, 2 = site
- Returns
CentralAPI Response object
- Return type
- async create_site(site_name: str = None, address: str = None, city: str = None, state: str = None, country: str = None, zipcode: str = None, latitude: int = None, longitude: int = None, site_list: List[Dict[str, Union[str, dict]]] = None) Response
Create Site
Either address information or GeoLocation information is required. For Geolocation attributes all attributes are required. Or a List[dict] with multiple sites to be added containing either ‘site_address’ or ‘geolocation’ attributes for each site.
- Parameters
site_name (str, optional) – Site Name. Defaults to None.
address (str, optional) – Address. Defaults to None.
city (str, optional) – City. Defaults to None.
state (str, optional) – State. Defaults to None.
country (str, optional) – Country Name. Defaults to None.
zipcode (str, optional) – Zipcode. Defaults to None.
latitude (int, optional) – Latitude (in the range of -90 and 90). Defaults to None.
longitude (int, optional) – Longitude (in the range of -100 and 180). Defaults to None.
site_list (List[Dict[str, Union[str, dict]]], optional) – A list of sites to be created. Defaults to None.
- Returns
CentralAPI Response object
- Return type
- async create_wlan(group: str, wlan_name: str, wpa_passphrase: str, vlan: str = '', type: WlanType = 'employee', essid: str = None, zone: str = '', captive_profile_name: str = '', bandwidth_limit_up: str = '', bandwidth_limit_down: str = '', bandwidth_limit_peruser_up: str = '', bandwidth_limit_peruser_down: str = '', access_rules: list = [{'action': 'allow', 'eport': 'any', 'ipaddr': 'any', 'match': 'match', 'netmask': 'any', 'protocol': 'any', 'service_name': '', 'service_type': 'network', 'sport': 'any', 'throttle_downstream': '', 'throttle_upstream': ''}], is_locked: bool = False, hide_ssid: bool = False) Response
Create a new WLAN (SSID).
- Parameters
group (str) – Aruba Central Group name or swarm guid
wlan_name (str) – Name of the WLAN/Network
wpa_passphrase (str) – WPA passphrase
vlan (str) – Client VLAN name or id. Defaults to “” (Native AP VLAN).
type (WlanType, optional) – Valid: [‘employee’, ‘guest’]. Defaults to “employee”.
essid (str, optional) – SSID. Defaults to None (essid = wlan_name).
zone (str, optional) – AP Zone SSID will broadcast on. Defaults to “” (Broadcast on all APs).
captive_profile_name (str, optional) – Captive Portal Profile. Defaults to “” (No CP Profile).
bandwidth_limit_up (str, optional) – [description]. Defaults to “” (No BW Limit Up).
bandwidth_limit_down (str, optional) – [description]. Defaults to “” (No BW Limit Down).
bandwidth_limit_peruser_up (str, optional) – [description]. Defaults to “” (No per user BW Limit Up).
bandwidth_limit_peruser_down (str, optional) – [description]. Defaults to “” (No per user BW Limit Down).
access_rules (list, optional) – [description]. Default: unrestricted.
is_locked (bool, optional) – [description]. Defaults to False.
hide_ssid (bool, optional) – [description]. Defaults to False.
wpa_passphrase_changed (bool, optional) – indicates passphrase has changed. Defaults to True.
- Returns
[description]
- Return type
- async delete_ap(serial: str) Response
Delete AP.
- Parameters
serial (str) – Serial Number of AP to be deleted
- Returns
CentralAPI Response object
- Return type
- async delete_certificate(certificate: str) Response
Delete existing certificate.
- Parameters
certificate (str) – Name of the certificate to delete.
- Returns
CentralAPI Response object
- Return type
- async delete_firmware_compliance(device_type: DevTypes, group: str = None) Response
Clear Firmware Compliance Version.
// Used by delete firmware compliance [ap|gw|sw|cx] [group] //
- Parameters
device_type (str) – Specify one of “ap|gw|sw|cx”
group (str, optional) – Group name. Defaults to None (Global Compliance)
- Returns
CentralAPI Response object
- Return type
- async delete_gateway(serial: str) Response
Delete Gateway.
- Parameters
serial (str) – Serial Number of Gateway to be deleted
- Returns
CentralAPI Response object
- Return type
- async delete_group(group: str) Response
Delete existing group.
- Parameters
group (str) – Name of the group that needs to be deleted.
- Returns
CentralAPI Response object
- Return type
- async delete_label(label_id: int) Response
Delete Label.
- Parameters
label_id (int) – Label ID
- Returns
CentralAPI Response object
- Return type
- async delete_site(site_id: Union[int, List[int]]) Response
Delete Site.
- Parameters
site_id (int|List[int]) – Either the site_id or a list of site_ids to be deleted.
- Returns
CentralAPI Response object
- Return type
- async delete_stack(stack_id: str) Response
Delete Switch Stack.
- Parameters
stack_id (str) – Filter by Switch stack_id
- Returns
CentralAPI Response object
- Return type
- async delete_switch(serial: str) Response
Delete Switch.
- Parameters
serial (str) – Serial number of switch to be deleted
- Returns
CentralAPI Response object
- Return type
- async delete_template(group: str, template: str) Response
Delete existing template.
- Parameters
group (str) – Name of the group for which the template is to be deleted.
template (str) – Name of the template to be deleted.
- Returns
CentralAPI Response object
- Return type
- async delete_webhook(wid: str) Response
Delete Webhooks.
- Parameters
wid (str) – id of the webhook
- Returns
CentralAPI Response object
- Return type
- async delete_wlan(group: str, wlan_name: str) Response
Delete an existing WLAN.
- Parameters
group (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
wlan_name (str) – Name of WLAN to be deleted. Example:wlan_1.
- Returns
CentralAPI Response object
- Return type
- async disable_auto_subscribe(services: Union[List[str], str]) Response
Standalone Customer API: Disable auto licensing for given services.
- Parameters
services (List[str]) – list of services e.g. [‘pa’, ‘ucc’, foundation_ap, advanced_switch_6200, foundation_70XX etc …]. Check /platform/licensing/v1/services/config API response to know the list of supported services.
- Returns
CentralAPI Response object
- Return type
- async do_multi_group_snapshot(backup_name: str, include_groups: Union[list, List[str]] = None, exclude_groups: Union[list, List[str]] = None, do_not_delete: bool = False) Response
“Create new configuration backup for multiple groups.”
Either include_groups or exclude_groups should be provided, but not both.
- Parameters
backup_name (str) – Name of Backup
include_groups (Union[list, List[str]], optional) – Groups to include in Backup. Defaults to None.
exclude_groups (Union[list, List[str]], optional) – Groups to Exclude in Backup. Defaults to None.
do_not_delete (bool, optional) – Flag to represent if the snapshot can be deleted automatically by system when creating new snapshot or not. Defaults to False.
- Returns
Response Object
- Return type
- async enable_auto_subscribe(services: Union[List[str], str]) Response
Standalone Customer API: Assign licenses to all devices and enable auto subscribe for given services.
- Parameters
services (List[str]) – list of services e.g. [‘pa’, ‘ucc’, foundation_ap, advanced_switch_6200, foundation_70XX etc …]. Check /platform/licensing/v1/services/config API response to know the list of supported services.
- Returns
CentralAPI Response object
- Return type
- async get_alerts(customer_id: str = None, group: str = None, label: str = None, serial: str = None, site: str = None, from_ts: int = None, to_ts: int = None, severity: str = None, type: str = None, search: str = None, ack: bool = None, fields: str = None, offset: int = 0, limit: int = 1000) Response
[central] List Notifications/Alerts. Returns 1 day by default.
- Parameters
customer_id (str, optional) – MSP user can filter notifications based on customer id
group (str, optional) – Used to filter the notification types based on group name
label (str, optional) – Used to filter the notification types based on Label name
serial (str, optional) – Used to filter the result based on serial number of the device
site (str, optional) – Used to filter the notification types based on Site name
from_ts (int, optional) – 1)start of duration within which alerts are raised 2)described using Unix Epoch time in seconds Default 30 days (max 90)
to_ts (int, optional) – 1)end of duration within which alerts are raised 2)described using Unix Epoch time in seconds
severity (str, optional) – Used to filter the notification types based on severity
type (str, optional) – Used to filter the notification types based on notification type name
search (str, optional) – term used to search in name, category of the alert
calculate_total (bool, optional) – Whether to count total items in the response
ack (bool, optional) – Filter acknowledged or unacknowledged notifications. When query parameter is not specified, both acknowledged and unacknowledged notifications are included
fields (str, optional) – Comma separated list of fields to be returned
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 500.
- Returns
CentralAPI Response object
- Return type
- async get_all_clients(group: str = None, swarm_id: str = None, label: str = None, network: str = None, site: str = None, serial: str = None, os_type: str = None, stack_id: str = None, cluster_id: str = None, band: str = None, offset: int = 0, limit: int = 1000) Response
Get All clients
// Used indirectly by show clients //
- Parameters
group (str, optional) – Return clients connected to devices in a given group. Defaults to None.
swarm_id (str, optional) – Return clients connected to swarm by swarm_id. Defaults to None.
label (str, optional) – Return clients connected to device with provided label. Defaults to None.
network (str, optional) – Return clients for given network (SSID). Defaults to None.
site (str, optional) – Return clients in a particular site. Defaults to None.
serial (str, optional) – Return clients connected to the device with given serial. Defaults to None.
os_type (str, optional) – Return clients with provided os_type. Defaults to None.
stack_id (str, optional) – Return clients connected to stack with provided id. Defaults to None.
cluster_id (str, optional) – Return clients connected to cluster with provided id. Defaults to None.
band (str, optional) – Return (WLAN) clients connected to provided band. Defaults to None.
sort_by (FIXME) – Sort Output on provided key field. Defaults to None.
offset (int, optional) – API offset. Defaults to 0.
limit (int, optional) – API record limit. Defaults to 1000, Max 1000.
- Returns
CentralCli.Response object
- Return type
- async get_all_devicesv2(**kwargs) Response
Get all devices from Aruba Central
- Returns
CentralAPI Response object
raw attribute has all keys returned for the devices, the output attribute includes only keys common across all device types in central.
- Return type
- async get_all_templates(groups: List[dict] = None, **params) Response
Get data for all defined templates from Aruba Central
- Parameters
groups (List[dict], optional) – List of group dictionaries (If provided additional API calls to get group names for all template groups are not performed). Defaults to None.
- Returns
centralcli Response Object
- Return type
- async get_all_templates_in_group(group: str, name: str = None, device_type: Literal['ap', 'sw', 'cx', 'gw'] = None, version: str = None, model: str = None) Response
- async get_all_webhooks() Response
List all defined webhooks.
- Returns
CentralAPI Response object
- Return type
- async get_ap_config(group_swarmid: str, version: str = None) Response
Get AP Group Level configuration for UI group.
// Used by show config <AP MAC for AOS10 AP> //
- Parameters
group_swarmid (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
version (str, optional) – Version of AP.
- Returns
CentralAPI Response object
- Return type
- async get_ap_lldp_neighbor(device_serial: str) Response
Get neighbor details reported by AP via LLDP.
- Parameters
device_serial (str) – Device serial number.
- Returns
CentralAPI Response object
- Return type
- async get_ap_settings(serial_number: str) Response
Get an existing ap settings.
// Used indirectly (update_ap_settings) by batch rename AP //
- Parameters
serial_number (str) – AP serial number.
- Returns
CentralAPI Response object
- Return type
- async get_archived_devices(offset: int = 0, limit: int = 100) Response
Get Archived devices from device inventory.
// Used by show archived //
- Parameters
offset (int, optional) – offset or page number Defaults to 0.
limit (int, optional) – Number of devices to get Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_audit_logs(log_id: str = None, username: str = None, start_time: int = None, end_time: int = None, description: str = None, target: str = None, classification: str = None, customer_name: str = None, ip_address: str = None, app_id: str = None, offset: int = 0, limit: int = 100, count: int = None) Response
Get all audit logs.
- Parameters
log_id (str, optional) – The id of the log to return details for. Defaults to None.
username (str, optional) – Filter audit logs by User Name
start_time (int, optional) – Filter audit logs by Time Range. Start time of the audit logs should be provided in epoch seconds
end_time (int, optional) – Filter audit logs by Time Range. End time of the audit logs should be provided in epoch seconds
description (str, optional) – Filter audit logs by Description
target (str, optional) – Filter audit logs by target (serial number).
classification (str, optional) – Filter audit logs by Classification
customer_name (str, optional) – Filter audit logs by Customer Name
ip_address (str, optional) – Filter audit logs by IP Address
app_id (str, optional) – Filter audit logs by app_id
offset (int, optional) – Number of items to be skipped before returning the data. Default to 0.
limit (int, optional) – Maximum number of audit events to be returned max: 100 Defaults to 100.
count – Only return <count> results.
- Returns
CentralAPI Response object
- Return type
- async get_audit_logs_events(group_name: str = None, device_id: str = None, classification: str = None, start_time: int = None, end_time: int = None, offset: int = 0, limit: int = 100) Response
Get all audit events for all groups.
- Parameters
group_name (str, optional) – Filter audit events by Group Name
device_id (str, optional) – Filter audit events by Target / Device ID. Device ID for AP is VC Name and Serial Number for Switches
classification (str, optional) – Filter audit events by classification
start_time (int, optional) – Filter audit logs by Time Range. Start time of the audit logs should be provided in epoch seconds
end_time (int, optional) – Filter audit logs by Time Range. End time of the audit logs should be provided in epoch seconds
offset (int, optional) – Number of items to be skipped before returning the data, useful for pagination Defaults to 0.
limit (int, optional) – Maximum number of audit events to be returned Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_auto_subscribe() Response
Get the services which have auto subscribe enabled.
- Returns
CentralAPI Response object
- Return type
- async get_brach_health(name: str = None, column: int = None, reverse: bool = False, filters: dict = {}, offset: int = 0, limit: int = 100) Response
Get data for all sites.
- Parameters
name (str, optional) – site / label name or part of its name
column (int, optional) – Column to sort on
reverse (bool, optional) – Sort in reverse order: Valid Values: asc, desc * asc - Ascending, from A to Z. * desc - Descending, from Z to A.
filters (str, optional) – Site thresholds Valid Values: gt (Greater than), lt (Less than), gte (Greater than or equal to), lte (Less than or equal to) * All properties of a site can be used as filter parameters with a threshold * The range filters can be combined with the column names with “__” # noqa * For eg. /site?device_down__gt=0 - Lists all sites that have more than 1 device in down state # noqa * For eg. /site?wan_uplinks_down__lt=1 - Lists all sites that have less than 1 wan in down state # noqa * For eg. /site?device_up__gt=1&device_up__lt=10 - Lists all sites that have 1-10 devices up # noqa
offset (int, optional) – pagination start index Defaults to 0.
limit (int, optional) – pagination size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_bssids(group: str = None, swarm_id: str = None, label: str = None, site: str = None, serial: str = None, macaddr: str = None, cluster_id: str = None, calculate_total: bool = None, sort: str = None, offset: int = 0, limit: int = 1000) Response
List BSSIDs.
- Parameters
group (str, optional) – Filter by group name
swarm_id (str, optional) – Filter by Swarm ID
label (str, optional) – Filter by Label name
site (str, optional) – Filter by Site name
serial (str, optional) – Filter by AP serial number
macaddr (str, optional) – Filter by AP MAC address
cluster_id (str, optional) – Filter by Mobility Controller serial number
calculate_total (bool, optional) – Whether to calculate total APs
sort (str, optional) – Sort parameter may be one of +serial, -serial, +macaddr,-macaddr, +swarm_id, -swarm_id.Default is ‘+serial’
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 1000.
- Returns
CentralAPI Response object
- Return type
- async get_certificates(q: str = None, offset: int = 0, limit: int = 20, callback: callable = None, callback_kwargs: dict = None) Response
Get Certificates details.
- Parameters
q (str, optional) – Search for a particular certificate by its name, md5 hash or sha1_hash
offset (int, optional) – Number of items to be skipped before returning the data, useful for pagination. Defaults to 0.
limit (int, optional) – Maximum number of records to be returned. Defaults to 20, Max 20.
- Returns
CentralAPI Response object
- Return type
- async get_client_details(mac: Mac, dev_type: str = None, **kwargs) Response
Get Wired/Wireless Client Details.
- async get_client_roaming_history(macaddr: str, calculate_total: bool = None, from_timestamp: int = None, to_timestamp: int = None, offset: int = 0, limit: int = 100) Response
Wireless Client Mobility Trail.
- Parameters
macaddr (str) – MAC address of the Wireless Client to be queried
calculate_total (bool, optional) – Whether to calculate total transitions
from_timestamp (int, optional) – Need information from this timestamp. Timestamp is epoch in seconds. Default is current timestamp minus 3 hours
to_timestamp (int, optional) – Need information to this timestamp. Timestamp is epoch in seconds. Default is current timestamp
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 1000, max is 1000.
- Returns
CentralAPI Response object
- Return type
- async get_clients(*args: Tuple[str], group: str = None, swarm_id: str = None, label: str = None, network: str = None, site: str = None, serial: str = None, os_type: str = None, stack_id: str = None, cluster_id: str = None, band: str = None, mac: str = None, offset: int = 0, limit: int = 1000) Response
Get Clients details.
- Parameters
group (str, optional) – Filter by Group. Defaults to None.
swarm_id (str, optional) – Filter by swarm. Defaults to None.
label (str, optional) – Filter by label. Defaults to None.
network (str, optional) – Filter by WLAN SSID. Defaults to None.
site (str, optional) – Filter by site. Defaults to None.
serial (str, optional) – Filter by connected device serial. Defaults to None.
os_type (str, optional) – Filter by client OS type. Defaults to None.
stack_id (str, optional) – Filter by Stack ID. Defaults to None.
cluster_id (str, optional) – Filter by Cluster ID. Defaults to None.
band (str, optional) – Filter by band. Defaults to None.
mac (str, optional) – Filter by client MAC. Defaults to None.
offset (int, optional) – API Paging offset. Defaults to 0.
limit (int, optional) – API record limit per request. Defaults to 1000 Max 1000.
- Returns
CentralAPI Response Object
- Return type
- async get_controller_vlans(serial: str) Response
Get Mobility Controllers VLAN details.
- Parameters
serial (str) – Serial number of mobility controller to be queried
- Returns
CentralAPI Response object
- Return type
- async get_default_group() Response
Get default group.
- Returns
CentralAPI Response object
- Return type
- async get_denylist_clients(serial: str) Response
Get all denylist client mac address in device.
- Parameters
serial (str) – Device id of virtual controller (AOS8 IAP) or serial of AOS10 ap. Example:14b3743c01f8080bfa07ca053ef1e895df9c0680fe5a17bfd5
- Returns
CentralAPI Response object
- Return type
- async get_dev_details(dev_type: Literal['switches', 'aps', 'gateways'], serial: str) Response
Return Details for a given device
// Used by show device[s] <device iden> //
- Parameters
dev_type (str) – Device Type Valid Values: “gateways”, “aps”, “switches”
serial (str) – Serial number of Device
- Returns
CentralAPI Response object
- Return type
- async get_device_configuration(device_serial: str) Response
Get last known running configuration for a device.
// Used by show run <DEVICE-IDEN> //
- Parameters
device_serial (str) – Serial number of the device.
- Returns
CentralAPI Response object
- Return type
- async get_device_inventory(sku_type: str = 'all', offset: int = 0, limit: int = 1000) Response
Get devices from device inventory.
- Parameters
sku_type (str, optional) – all/iap/switch/controller/gateway/vgw/cap/boc/all_ap/all_controller/others Defaults to all.
offset (int, optional) – offset or page number Defaults to 0.
limit (int, optional) – Number of devices to get Defaults to 1000.
- Returns
CentralAPI Response object
- Return type
- async get_device_ip_routes(serial_num: str, api: str = 'V1', offset: int = 0, limit: int = 100) Response
Get routes for a device.
- Parameters
serial_num (str) – Device serial number
api (str, optional) – API version (V0|V1), Defaults to V1.
offset (str, optional) – Pagination offset.
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_devices(dev_type: Literal['switches', 'aps', 'gateways'], group: str = None, label: str = None, stack_id: str = None, swarm_id: str = None, serial: str = None, status: str = None, fields: list = None, show_resource_details: bool = False, cluster_id: str = None, model: str = None, calculate_client_count: bool = False, calculate_ssid_count: bool = False, macaddr: str = None, public_ip_address: str = None, site: str = None, limit: int = 1000, offset: int = 0) Response
Get Devices from Aruba Central API Gateway
// Used by show <”aps”|”gateways”|”switches”> //
- Parameters
dev_type (Literal["switches", "aps", "gateways") – Type of devices to get.
group (str, optional) – Filter on specific group. Defaults to None.
label (str, optional) – Filter by label. Defaults to None.
stack_id (str, optional) – Return switch with specific stack_id. Defaults to None.
swarm_id (str, optional) – Return APs with a specific swarm_id. Defaults to None.
serial (str, optional) – Return the device with serial number. Defaults to None.
status (str, optional) – Filter by status. Defaults to None.
fields (list, optional) – Return specific fields for device. Defaults to None.
show_resource_details (bool, optional) – Show resource utilization. Defaults to False.
cluster_id (str, optional) – Return gateways with a specific cluster_id. Defaults to None.
model (str, optional) – Filter by device model. Defaults to None.
calculate_client_count (bool, optional) – Calculate client count for each device. Defaults to False.
calculate_ssid_count (bool, optional) – Calculate SSID count for each AP. Defaults to False.
macaddr (str, optional) – Return device with specific MAC (fuzzy match). Defaults to None.
public_ip_address (str, optional) – Filter devices by Public IP. Defaults to None.
site (str, optional) – Filter by site. Defaults to None.
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Max is 1000 Defaults to 500.
- Returns
CentralAPI Response object
- Return type
- async get_dhcp_clients(serial_num: str, reservation: bool = True, offset: int = 0, limit: int = 100) Response
Get DHCP Client information from Gateway.
- Parameters
serial_num (str) – Serial number of mobility controller to be queried
reservation (bool, optional) – Flag to turn on/off listing DHCP reservations(if any). Defaults to True
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. max 1000 Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_dhcp_server(serial_num: str) Response
Get DHCP Server details from Gateway.
- Parameters
serial_num (str) – Serial number of mobility controller to be queried
- Returns
CentralAPI Response object
- Return type
- async get_dirty_diff(group: str, offset: int = 0, limit: int = 20) Response
Get dirty diff.
- Parameters
group (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
offset (int, optional) – Number of items to be skipped before returning the data, useful for pagination. Defaults to 0.
limit (int, optional) – Maximum number of group config_mode records to be returned. Max: 20, Defaults to 20.
- Returns
CentralAPI Response object
- Return type
- async get_events(group: str = None, swarm_id: str = None, label: str = None, from_ts: int = None, to_ts: int = None, macaddr: str = None, bssid: str = None, device_mac: str = None, hostname: str = None, device_type: str = None, sort: str = '-timestamp', site: str = None, serial: str = None, level: str = None, event_description: str = None, event_type: str = None, fields: str = None, calculate_total: bool = None, offset: int = 0, limit: int = 1000) Response
List Events. v2
- Parameters
group (str, optional) – Filter by group name
swarm_id (str, optional) – Filter by Swarm ID
label (str, optional) – Filter by Label name
from_ts (int, optional) – Need information from this timestamp. Timestamp is epoch in seconds. Default is current timestamp minus 3 hours
to_ts (int, optional) – Need information to this timestamp. Timestamp is epoch in seconds. Default is current timestamp
macaddr (str, optional) – Filter by client MAC address
bssid (str, optional) – Filter by bssid
device_mac (str, optional) – Filter by device_mac
hostname (str, optional) – Filter by hostname
device_type (str, optional) – Filter by device type. Valid Values: ACCESS POINT, SWITCH, GATEWAY, CLIENT
sort (str, optional) – Sort by desc/asc using -timestamp/+timestamp. Default is ‘-timestamp’ Valid Values: -timestamp, +timestamp
site (str, optional) – Filter by site name
serial (str, optional) – Filter by switch serial number
level (str, optional) – Filter by event level
event_description (str, optional) – Filter by event description
event_type (str, optional) – Filter by event type
fields (str, optional) – Comma separated list of fields to be returned. Valid fields are number, level
calculate_total (bool, optional) – Whether to calculate total events
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 1000.
- Returns
CentralAPI Response object
- Return type
- async get_firmware_compliance(device_type: DevTypes, group: str = None) Response
Get Firmware Compliance Version.
// Used by show firmware compliance [ap|gw|sw|cx] [group-name] //
- Parameters
device_type (str) – Specify one of “ap|gw|sw|sx”
group (str, optional) – Group name
- Returns
CentralAPI Response object
- Return type
- async get_full_wlan_list(group_name_or_guid_or_serial_number: str) Response
Get WLAN list/details by (UI) group.
- Parameters
group_name_or_guid_or_serial_number (str) – Group name of the group or guid of the swarm or serial number of 10x AP. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f or CNF7JSS9L1.
- Returns
CentralAPI Response object
- Return type
- async get_fw_version_list(device_type: str = None, swarm_id: str = None, serial: str = None) Response
List Firmware Version.
- Parameters
device_type (str, optional) – Specify one of “IAP/MAS/HP/CONTROLLER/CX”
swarm_id (str, optional) – Swarm ID
serial (str, optional) – Serial of device
- Returns
CentralAPI Response object
- Return type
- async get_gateway_ports(serial: str) Response
Gateway Ports Details.
- Parameters
serial (str) – Serial number of Gateway to be queried
- Returns
CentralAPI Response object
- Return type
- async get_gateway_vlans(serial: str) Response
Get gateway VLAN details.
- Parameters
serial (str) – Serial number of gateway to be queried
- Returns
CentralAPI Response object
- Return type
- async get_gateways_by_group(group)
- async get_group_for_dev_by_serial(serial_num)
- async get_groups_properties(groups: Union[str, List[str]] = None) Response
Get properties set for groups.
// Used by show groups when -v flag is provided //
- Parameters
groups (List[str], optional) – Group list to fetch properties. Will fetch all if no groups provided. Maximum 20 comma separated group names allowed.
- Returns
CentralAPI Response object
- Return type
- async get_gw_tunnels(serial: str, timerange: str = '1M', limit: int = 250, offset: int = 0) Response
Get gateway Uplink tunnel details.
Used by wh_proxy, currently not used by a command will be in show gateway tunnels
- Parameters
serial (str) – Serial number of mobility controller to be queried
timerange (str) – Time range for tunnel stats information. 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months.
limit (int, optional) – Pagination limit. Max: 1000 Defaults to 250.
offset (int, optional) – Pagination offset Defaults to 0.
- Returns
CentralAPI Response object
- Return type
- async get_labels(calculate_total: bool = None, reverse: bool = False, offset: int = 0, limit: int = 100) Response
List Labels.
- Parameters
calculate_total (bool, optional) – Whether to calculate total Labels
reverse (bool, optional) – List labels in reverse alphabetical order. Defaults to False
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_ospf_area(device: str, marker: str = None, limit: int = 100) Response
List OSPF Area Information.
- Parameters
device (str) – Device serial number
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_ospf_database(device: str, marker: str = None, limit: int = 100) Response
List OSPF Link State Database Information.
- Parameters
device (str) – Device serial number
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_ospf_interface(device: str, marker: str = None, limit: int = 100) Response
List OSPF Interface Information.
- Parameters
device (str) – Device serial number
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_ospf_neighbor(device: str, marker: str = None, limit: int = 100) Response
List OSPF neighbor Information.
- Parameters
device (str) – Device serial number
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_overlay_connection(device: str, marker: str = None, limit: int = 100) Response
Get information about overlay control connection.
- Parameters
device (str) – Device serial number
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_overlay_interfaces(device: str, marker: str = None, limit: int = 100) Response
List of overlay interfaces (tunnels).
- Parameters
device (str) – Device serial number
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_overlay_routes_advertised(device: str, marker: str = None, limit: int = 100) Response
List of advertised routes to overlay.
- Parameters
device (str) – Device serial number
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_overlay_routes_learned(device: str, *, best: bool = False, marker: str = None, limit: int = 100) Response
List of learned routes from overlay.
- Parameters
device (str) – Device serial number
best (bool) – Return only best / preferred routes
marker (str, optional) – Opaque handle to fetch next page
limit (int, optional) – page size Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_per_ap_config(serial: str) Response
Get per AP setting.
- Parameters
serial (str) – Serial Number of AP
- Returns
CentralAPI Response object
- Return type
- async get_portals(sort: str = '+name', offset: int = 0, limit: int = 100) Response
Get all portals with limited data.
- Parameters
sort (str, optional) –
is for ascending and - for descending order , sorts by name for now
Valid Values: +name, -name
offset (int, optional) – Starting index of element for a paginated query Defaults to 0.
limit (int, optional) – Number of items required per query Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_sdwan_dps_policy_compliance(time_frame: str = 'last_week', order: str = 'best') Response
- async get_site_details(site_id)
- async get_site_vlans(site_id: int, search: str = None, offset: int = 0, limit: int = 100) Response
Get vlan list of a site.
- Parameters
site_id (int) – Site ID.
search (str, optional) – search.
offset (int, optional) – offset. Defaults to 0.
limit (int, optional) – limit Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_sku_types()
- async get_snapshots_by_group(group: str)
- async get_subscription_stats(license_type: str = 'all', service: str = None, app_only_stats: bool = None) Response
Get subscription stats.
- Parameters
license_type (str, optional) –
Supports basic/special/all. special - will fetch the statistics of special central services like pa, ucc, clarity etc. basic - will fetch the statistics of device management service licenses. all - will fetch both of these license types.
Also supports multi tier license types such foundation_ap, advanced_switch_6300, foundation_70XX etc.
service (str, optional) – Service type: pa/pa,clarity,foundation_ap, advanced_switch_6300, foundation_70XX etc.
app_only_stats (bool, optional) – If value is True, stats only for the current application returned rather than global stats
- Returns
CentralAPI Response object
- Return type
- async get_subscriptions(license_type: str = None, offset: int = 0, limit: int = 1000) Response
Get user subscription keys.
- Parameters
license_type (str, optional) – Supports Basic, Service Token and Multi Tier licensing types as well
offset (int, optional) – offset or page number Defaults to 0.
limit (int, optional) – Number of subscriptions to get Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_swarm_details(swarm_id: str) Response
Swarm Details.
- Parameters
swarm_id (str) – Swarm ID
- Returns
CentralAPI Response object
- Return type
- async get_swarms(group: str = None, status: str = None, public_ip_address: str = None, fields: str = None, calculate_total: bool = None, sort: str = None, swarm_name: str = None, offset: int = 0, limit: int = 100) Response
List Swarms.
- Parameters
group (str, optional) – Filter by group name
status (str, optional) – Filter by Swarm status
public_ip_address (str, optional) – Filter by public ip address
fields (str, optional) – Comma separated list of fields to be returned Valid fields are: status, ip_address, public_ip_address, firmware_version
calculate_total (bool, optional) – Whether to calculate total Swarms
sort (str, optional) – Sort parameter may be one of +swarm_id, -swarm_id
swarm_name (str, optional) – Filter by swarm name
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_switch_poe_details(serial: str, port: str = None, aos_sw: bool = False) Response
Get switch poe info.
- Parameters
serial (str) – Switch serial
port (str, optional) – Filter by switch port
aos_sw (bool, optional) – Device is ArubaOS-Switch. Defaults to False
- Returns
CentralAPI Response object
- Return type
- async get_switch_ports(serial: str, slot: str = None, aos_sw: bool = False) Response
Switch Ports Details.
- Parameters
serial (str) – Serial number of switch to be queried
slot (str, optional) – Slot name of the ports to be queried {For chassis type switches only}.
aos_sw (bool, optional) – Device is ArubaOS-Switch. Defaults to False
- Returns
CentralAPI Response object
- Return type
- async get_switch_stacks(hostname: str = None, group: str = None, offset: int = 0, limit: int = 100) Response
List Switch Stacks.
- Parameters
hostname (str, optional) – Filter by stack hostname
group (str, optional) – Filter by group name
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_switch_vlans(iden: str, stack: bool = False, name: str = None, pvid: int = None, tagged_port: str = None, untagged_port: str = None, is_jumbo_enabled: bool = None, is_voice_enabled: bool = None, is_igmp_enabled: bool = None, type: str = None, primary_vlan_id: int = None, status: str = None, sort: str = None, calculate_total: bool = None, aos_sw: bool = False, offset: int = 0, limit: int = 500) Response
Get vlan info for switch (CX and SW).
- Parameters
iden (str) – Serial Number of Stack ID, Identifies the dev to return VLANs from.
stack (bool, optional) – Set to True for stack. Default: False
name (str, optional) – Filter by vlan name
id (int, optional) – Filter by vlan id
tagged_port (str, optional) – Filter by tagged port name
untagged_port (str, optional) – Filter by untagged port name
is_jumbo_enabled (bool, optional) – Filter by jumbo enabled
is_voice_enabled (bool, optional) – Filter by voice enabled
is_igmp_enabled (bool, optional) – Filter by igmp enabled
type (str, optional) – Type of the vlan to be queried
primary_vlan_id (int, optional) – Primary Vlan Id of the vlan to be queried”
status (str, optional) – Filter by status of VLAN. Status can be Up/Down
sort (str, optional) – Sort parameter may be one of +name, -name
calculate_total (bool, optional) – Whether to calculate total vlans
aos_sw (bool, optional) – Device is ArubaOS-Switch. Defaults to False
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 500.
- Returns
CentralAPI Response object
- Return type
- async get_task_status(task_id: str) Response
Status.
- Parameters
task_id (str) – Unique task id to get response of command
- Returns
CentralAPI Response object
- Return type
- async get_template_details_for_device(device_serial: str, details: bool = False) Response
Get configuration details for a device (only for template groups).
- Parameters
device_serial (str) – Serial number of the device.
details (bool, optional) – Usually pass false to get only the summary of a device’s configuration status. Pass true only if detailed response of a device’s configuration status is required. Passing true might result in slower API response and performance effect comparatively.
- Returns
CentralAPI Response object
- Return type
- async get_topo_for_site(site_id: int) Response
Get topology details of a site.
- Parameters
site_id (int) – Site ID.
- Returns
CentralAPI Response object
- Return type
- async get_ts_commands(device_type: Literal['iap', 'mas', 'switch', 'controller', 'cx']) Response
List Troubleshooting Commands.
- Parameters
device_type (str) – Specify one of “IAP” for swarm, “MAS” for MAS switches, “SWITCH” for aruba switches,”CX” for CX switches, “CONTROLLER” for controllers respectively.
- Returns
CentralAPI Response object
- Return type
- async get_ts_output(serial: str, session_id: int) Response
Get Troubleshooting Output.
- Parameters
serial (str) – Serial of device
session_id (int) – Unique ID for troubleshooting session
- Returns
CentralAPI Response object
- Return type
- async get_ts_session_id(serial: str) Response
Get Troubleshooting Session ID for a device.
- Parameters
serial (str) – Serial of device
- Returns
CentralAPI Response object
- Return type
- async get_upgrade_status(swarm_id: str = None, serial: str = None) Response
Get firmware upgrade status.
// Used by show upgrade [device-iden] //
- Parameters
swarm_id (str, optional) – Swarm ID
serial (str, optional) – Serial of device
- Returns
CentralAPI Response object
- Return type
- async get_uplink_info_by_gw(serial_num, timerange: str = '3H')
- async get_uplink_tunnel_stats_by_gw(serial_num)
- async get_valid_subscription_names(service_category: str = None, device_type: str = None) Response
Get Valid subscription names from Central.
- Parameters
service_category (str, optional) – Service category - dm/network
device_type (str, optional) – Device Type - iap/cap/switch/boc/controller
- Returns
CentralAPI Response object
- Return type
- async get_vc_firmware(swarm_id: str = None, group: str = None, offset: int = 0, limit: int = 100) Response
List Firmware Details of Swarms.
- Parameters
swarm_id – (str, optional): Providing swarm_id results in details for that swarm.
group (str, optional) – Group name
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Max is 1000 Defaults to 100.
filter (Providing swarm_id is effectively a) –
detail. (it provides no additional) –
- Returns
CentralAPI Response object
- Return type
- async get_visitors(portal_id: str, sort: str = '+name', filter_by: str = None, filter_value: str = None, offset: int = 0, limit: int = 100) Response
Get all visitors created against a portal.
- Parameters
portal_id (str) – Portal ID of the splash page
sort (str, optional) –
is for ascending and - for descending order , sorts by name for
now Valid Values: +name, -name
filter_by (str, optional) – filter by email or name Valid Values: name, email
filter_value (str, optional) – filter value
offset (int, optional) – Starting index of element for a paginated query Defaults to 0.
limit (int, optional) – Number of items required per query Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async get_vlan_info_by_gw(serial_num)
- async get_wired_clients(group: str = None, swarm_id: str = None, label: str = None, site: str = None, serial: str = None, cluster_id: str = None, stack_id: str = None, fields: str = None, calculate_total: bool = True, offset: int = 0, limit: int = 1000) Response
List Wired Clients.
- Parameters
group (str, optional) – Filter by group name
swarm_id (str, optional) – Filter by Swarm ID
label (str, optional) – Filter by Label name
site (str, optional) – Filter by Site name
serial (str, optional) – Filter by Switch or AP serial number
cluster_id (str, optional) – Filter by Mobility Controller serial number
stack_id (str, optional) – Filter by Switch stack_id
fields (str, optional) – Comma separated list of fields to be returned. Valid fields are name, ip_address, username, associated_device, group_name, interface_mac, vlan
calculate_total (bool, optional) – Whether to calculate total wired Clients
sort (FIXME) – Field to sort on. Defaults to mac
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default 1000, max 1000.
- Returns
CentralAPI Response object
- Return type
- async get_wireless_clients(group: str = None, swarm_id: str = None, label: str = None, site: str = None, network: str = None, serial: str = None, os_type: str = None, cluster_id: str = None, band: str = None, fields: str = None, calculate_total: bool = True, offset: int = 0, limit: int = 1000) Response
List Wireless Clients.
- Parameters
group (str, optional) – Filter by group name
swarm_id (str, optional) – Filter by Swarm ID
label (str, optional) – Filter by Label name
site (str, optional) – Filter by Site name
network (str, optional) – Filter by network name
serial (str, optional) – Filter by AP serial number
os_type (str, optional) – Filter by client os type
cluster_id (str, optional) – Filter by Mobility Controller serial number
band (str, optional) – Filter by band. Value can be either “2.4” or “5”
fields (str, optional) – Comma separated list of fields to be returned. Valid fields are name, ip_address, username, os_type, connection, associated_device, group_name, swarm_id, network, radio_mac, manufacturer, vlan, encryption_method, radio_number, speed, usage, health, labels, site, signal_strength, signal_db, snr
calculate_total (bool, optional) – Whether to calculate total wireless Clients
sort (str, optional) – Sort parameter may be one of +macaddr, -macaddr. Default is ‘+macaddr’
offset (int, optional) – Pagination offset Defaults to 0.
limit (int, optional) – Pagination limit. Default is 1000, max 1000.
- Returns
CentralAPI Response object
- Return type
- async get_wlan(group: str, wlan_name: str) Response
Get the information of an existing WLAN.
- Parameters
group (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
wlan_name (str) – Name of WLAN selected. Example:wlan_1.
- Returns
CentralAPI Response object
- Return type
- async get_wlans(name: str = None, group: str = None, swarm_id: str = None, label: str = None, site: str = None, calculate_client_count: bool = None, sort_by: str = None) Response
List all WLANs (SSIDs).
- Parameters
group (str, optional) – Filter by group name
swarm_id (str, optional) – Filter by Swarm ID
label (str, optional) – Filter by Label name
site (str, optional) – Filter by Site name
calculate_client_count (bool, optional) – Whether to calculate client count per SSID
sort_by (str, optional) – Sort parameter may be one of +essid, -essid. Default is ‘+essid’
- Returns
CentralAPI Response object
- Return type
- async kick_users(serial_num: str = None, kick_all: bool = False, mac: str = None, ssid: str = None) Response
- async move_devices_to_group(group: str, serial_nums: Union[str, List[str]], *, cx_retain_config: bool = True) Response
Move devices to a group.
- Parameters
group (str) – Group Name to move device to.
serials (List[str]) – Serial numbers of devices to be added to group.
- Returns
CentralAPI Response object
- Return type
- async move_devices_to_site(site_id: int, serial_nums: Union[str, List[str]], device_type: Literal['ap', 'cx', 'sw', 'switch', 'gw']) Response
Associate list of devices to a site.
- Parameters
site_id (int) – Site ID
device_type (str) – Device type. Valid Values: ap, cx, sw, switch, gw cx and sw are the same as the more generic switch.
serial_nums (List[str]) – List of device serial numbers of the devices to which the site has to be un/associated with. A maximum of 5000 device serials are allowed at once.
- Returns
CentralAPI Response object
- Return type
- async preprovision_device_to_group(group_name: str, serial_nums: Union[List[str], str], tenant_id: str = None) Response
Pre Provision a group to the device.
- Parameters
device_id (List[str]) – device_id
group_name (str) – Group name
tenant_id (str) – Tenant id, (only applicable with MSP mode)
- Returns
CentralAPI Response object
- Return type
- async refresh_webhook_token(wid: str) Response
Refresh the webhook token.
- Parameters
wid (str) – id of the webhook
- Returns
CentralAPI Response object
- Return type
- async remove_devices_from_site(site_id: int, serial_nums: List[str], device_type: Literal['ap', 'cx', 'sw', 'switch', 'gw']) Response
Remove a list of devices from a site.
- Parameters
site_id (int) – Site ID
device_type (str) – Device type. Valid Values: ap, cx, sw, switch, gw cx and sw are the same as the more generic switch.
serial_nums (List[str]) – List of device serial numbers of the devices to which the site has to be un/associated with. A maximum of 5000 device serials are allowed at once.
- Returns
CentralAPI Response object
- Return type
- async remove_label_from_devices(label_id: int, device_type: str, serial_nums: List[str]) Response
unassign a label from a list of devices.
- Parameters
label_id (int) – Label ID
device_type (str) – Device type. One of ap, gw, switch
serial_nums (str | List[str]) – List of device serial numbers of the devices to which the label has to be un/associated with. A maximum of 5000 device serials are allowed at once.
- Returns
CentralAPI Response object
- Return type
- async replace_ap_config(group_name_or_guid: str, clis: List[str]) Response
Replace AP Group Level configuration for UI group.
Send AP configuration in CLI format as a list of strings where each item in the list is a line from the config. Requires all lines of the config, not a partial update.
- Parameters
group_name_or_guid (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
clis (List[str]) – Whole configuration List in CLI format.
- Returns
CentralAPI Response object
- Return type
- async replace_per_ap_config(serial: str, clis: List[str]) Response
Replace per AP setting.
- Parameters
serial (str) – Serial Number of AP
clis (List[str]) – All per AP setting List in CLI format Must provide all per AP settings, not partial
- Returns
CentralAPI Response object
- Return type
- async reset_overlay_connection(device: str) Response
Reset overlay control connection.
- Parameters
device (str) – Device serial number
- Returns
CentralAPI Response object
- Return type
- async send_bounce_command_to_device(serial: str, command: str, port: str) Response
Bounce interface or POE (power-over-ethernet) on switch port. Valid only for Aruba Switches.
- Parameters
serial (str) – Serial of device
command (str) – Command mentioned in the description that is to be executed
port (str) – Specify interface port in the format of port number for devices of type HPPC Switch or slot/chassis/port for CX Switch
- Returns
CentralAPI Response object
- Return type
- async send_command_to_device(serial: str, command: Literal['reboot', 'blink_led_on', 'blink_led_off', 'blink_led', 'erase_configuration', 'save_configuration', 'halt', 'config_sync'], duration: int = None) Response
Generic commands for device.
- Supported Commands (str):
reboot: supported by IAP/Controllers/MAS Switches/Aruba Switches
blink_led_on: Use this command to enable the LED display, supported by IAP/Aruba Switches
blink_led_off: Use this command to enable the LED display, supported by IAP/Aruba Switches
blink_led: Use this command to blink LED display, Supported on Aruba Switches
erase_configuration : Factory default the switch. Supported on Aruba Switches
save_configuration: Saves the running config. supported by IAP/Aruba Switches
halt : This command performs a shutdown of the device, supported by Controllers alone.
config_sync : This commands performs full refresh of the device config, supported by Controllers alone
- Parameters
serial (str) – Serial of device
command (str) – Command to be executed
duration (int, Optional) – Number of seconds to blink_led only applies to blink_led and blink_led_on
- Returns
CentralAPI Response object
- Return type
- async send_command_to_swarm(swarm_id: str, command: Literal['reboot_swarm', 'erase_configuration']) Response
Generic commands for swarm.
- Parameters
swarm_id (str) – Swarm ID of device
command (str) – Command mentioned in the description that is to be executed valid: ‘reboot_swarm’, ‘erase_configuration’
- Returns
CentralAPI Response object
- Return type
- async send_speed_test(serial: str, host: str = 'ndt-iupui-mlab1-den04.mlab-oti.measurement-lab.org', options: str = None) Response
Speed Test.
- Parameters
serial (str) – Serial of device
host (str, Optional) – Speed-Test server IP address, Defaults to server in Central Indiana.
options (str) – Formatted string of optional arguments
- Returns
CentralAPI Response object
- Return type
- async set_firmware_compliance(device_type: DevTypes, group: str, version: str, compliance_scheduled_at: int, reboot: bool = True, allow_unsupported_version: bool = False) Response
Set Firmware Compliance version (for group/device-type).
- Parameters
device_type (str) – Specify one of “ap|sw|cx|gw”
group (str) – Group name
firmware_compliance_version (str) – Firmware compliance version for specific device_type.
compliance_scheduled_at (int) – Firmware compliance will be schedule at, compliance_scheduled_at - current time. compliance_scheduled_at is epoch in seconds and default value is current time.
reboot (bool) – Use True for auto reboot after successful firmware download. Default value is False. Applicable only on MAS, aruba switches, CX switches, and controller since IAP reboots automatically after firmware download.
allow_unsupported_version (bool) – Use True to set unsupported version as firmware compliance version for specific device_type. Default is False.
- Returns
CentralAPI Response object
- Return type
- async start_ts_session(serial: str, dev_type: str, commands: Union[int, list, dict]) Response
Start Troubleshooting Session.
- Parameters
serial (str) – Serial of device
dev_type (str) – Specify one of “IAP/SWITCH/CX/MAS/CONTROLLER” for IAPs, Aruba switches, CX Switches, MAS switches and controllers respectively.
commands (int, List[int | dict], dict) – a single command_id, or a List of command_ids (For commands with no arguments) OR a dict {command_id: {argument1_name: argument1_value, argument2_name: argument2_value}}
- Returns
CentralAPI Response object
- Return type
- static strip_none(_dict: Optional[dict]) Optional[dict]
strip all keys from a dict where value is NoneType
- async test_webhook(wid: str) Response
Test for webhook notification.
- Parameters
wid (str) – id of the webhook
- Returns
CentralAPI Response object
- Return type
- async unarchive_devices(serials: List[str]) Response
Unarchive devices using Serial list.
- Parameters
serials (List[str]) – serials
- Returns
CentralAPI Response object
- Return type
- async unassign_licenses(serials: Union[str, List[str]], services: Union[str, List[str]]) Response
Unassign subscription(s) from device(s).
- Parameters
serials (str | List[str]) – List of serial number of device.
services (str | List[str]) – List of service names. Call services/config API to get the list of valid service names.
- Returns
CentralAPI Response object
- Return type
- async update_ap_settings(serial_number: str, hostname: str, ip_address: str = None, zonename: str = None, achannel: str = None, atxpower: str = None, gchannel: str = None, gtxpower: str = None, dot11a_radio_disable: bool = None, dot11g_radio_disable: bool = None, usb_port_disable: bool = None) Response
Update an existing ap settings.
// Used by batch rename aps and rename ap //
- Parameters
serial_number (str, optional) – AP Serial Number
hostname (str) – hostname
ip_address (str, optional) – ip_address Default (DHCP)
zonename (str, optional) – zonename. Default “” (No Zone)
achannel (str, optional) – achannel
atxpower (str, optional) – atxpower
gchannel (str, optional) – gchannel
gtxpower (str, optional) – gtxpower
dot11a_radio_disable (bool, optional) – dot11a_radio_disable
dot11g_radio_disable (bool, optional) – dot11g_radio_disable
usb_port_disable (bool, optional) – usb_port_disable
- Returns
CentralAPI Response object
- Return type
- async update_ap_system_config(group_swarmid: str, dns_server: str = None, ntp_server: List[str] = None, username: str = None, password: str = None) Response
Update system config.
All params are required by Aruba Central
- Parameters
group_swarmid (str) – Group name of the group or guid of the swarm. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.
dns_server (str) – DNS server IPs or domain name
ntp_server (List[str]) – List of ntp server, Example: [“192.168.1.1”, “127.0.0.0”, “xxx.com”]. IPs or domain name.
username (str) – username
password (str) – password
- Returns
CentralAPI Response object
- Return type
- async update_cx_properties(*, serial: str = None, group: str = None, name: str = None, contact: str = None, location: str = None, timezone: Literal['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Bahia_Banderas', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Creston', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Nelson', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/Kralendijk', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Lower_Princes', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Metlakatla', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Beulah', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Punta_Arenas', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/Sitka', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Macquarie', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Atyrau', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Barnaul', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Chita', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Famagusta', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Hebron', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Katmandu', 'Asia/Khandyga', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qostanay', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Tomsk', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Ust-Nera', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yangon', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/North', 'Australia/NSW', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'Canada/Atlantic', 'Canada/Central', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'CET', 'Chile/Continental', 'Chile/EasterIsland', 'CST6CDT', 'Cuba', 'EET', 'Egypt', 'Eire', 'EST', 'EST5EDT', 'Etc/GMT', 'Etc/GMT+0', 'Etc/GMT+1', 'Etc/GMT+10', 'Etc/GMT+11', 'Etc/GMT+12', 'Etc/GMT+2', 'Etc/GMT+3', 'Etc/GMT+4', 'Etc/GMT+5', 'Etc/GMT+6', 'Etc/GMT+7', 'Etc/GMT+8', 'Etc/GMT+9', 'Etc/GMT-0', 'Etc/GMT-1', 'Etc/GMT-10', 'Etc/GMT-11', 'Etc/GMT-12', 'Etc/GMT-13', 'Etc/GMT-14', 'Etc/GMT-2', 'Etc/GMT-3', 'Etc/GMT-4', 'Etc/GMT-5', 'Etc/GMT-6', 'Etc/GMT-7', 'Etc/GMT-8', 'Etc/GMT-9', 'Etc/GMT0', 'Etc/Greenwich', 'Etc/UCT', 'Etc/Universal', 'Etc/UTC', 'Etc/Zulu', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Astrakhan', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Busingen', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Kirov', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Saratov', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Ulyanovsk', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'Factory', 'GB', 'GB-Eire', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'Greenwich', 'Hongkong', 'HST', 'Iceland', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Iran', 'Israel', 'Jamaica', 'Japan', 'Kwajalein', 'Libya', 'MET', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'MST', 'MST7MDT', 'Navajo', 'NZ', 'NZ-CHAT', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Bougainville', 'Pacific/Chatham', 'Pacific/Chuuk', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Pohnpei', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'Poland', 'Portugal', 'PRC', 'PST8PDT', 'ROC', 'ROK', 'Singapore', 'Turkey', 'UCT', 'Universal', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Samoa', 'UTC', 'W-SU', 'WET', 'Zulu'] = None, mgmt_vrf: bool = None, dns_servers: List[str] = [], ntp_servers: List[str] = [], admin_user: str = None, admin_pass: str = None) Response
Update Properties (ArubaOS-CX).
- Parameters
serial (str, optional) – Device serial number. Mandatory for device level configuration. 1 and only 1 of serial or group are required
group (str, optional) – Group name. Mandatory for group level configuration. 1 and only 1 of serial or group are required
name (str) – Only configurable at device-level.
contact (str) – Pattern: “^[^”?]*$”
location (str) – Pattern: “^[^”?]*$”
timezone (str) – timezone Valid Values: use tz database format like “America/Chicago”
mgmt_vrf (bool) – Use mgmt VRF, indicates VRF for dns_servers and ntp_servers, if False or not provided default VRF is used.
dns_servers (List[str]) – ipv4/ipv6 address
ntp_servers (List[str]) – ipv4/ipv6 address
admin_user (str) – local admin user
admin_pass (str) – local admin password
- Returns
CentralAPI Response object
- Return type
- async update_device_template_variables(device_serial: str, device_mac: str, var_dict: dict) Response
Update template variables for a device.
- Parameters
device_serial (str) – Serial number of the device.
total (int) – total
_sys_serial (str) – _sys_serial
_sys_lan_mac (str) – _sys_lan_mac
var_dict (dict) – dict with variables to be updated
- Returns
CentralAPI Response object
- Return type
- async update_existing_template(group: str, name: str, template: Path = None, payload: str = None, device_type: str = None, version: str = None, model: str = None) Response
Update existing template.
- Parameters
group (str) – Name of the group for which the template is to be updated.
name (str) – Name of template.
device_type (str, optional) – Device type of the template. Valid Values: ap, sw (ArubaOS-SW), cx (ArubaOS-CX), gw (controllers/gateways)
version (str, optional) – Firmware version property of template. Example: ALL, 6.5.4 etc.
model (str, optional) – Model property of template. For ‘ArubaSwitch’ device_type, part number (J number) can be used for the model. Example: 2920, J9727A etc.
template (Union[Path, str], optional) – Template text. For ‘ArubaSwitch’ device_type, the template text should include the following commands to maintain connection with central. 1. aruba-central enable. 2. aruba-central url https://<URL | IP>/ws.
payload (str, optional) – json representation of the required params.
- Returns
CentralAPI Response object
- Return type
- async update_group_name(group: str, new_group: str) Response
Update group name for the given group.
- Parameters
group (str) – Group for which name need to be updated.
new_group (str) – The new name of the group.
- Returns
CentralAPI Response object
- Return type
- async update_group_properties(group: str, allowed_types: Union[AllDevTypes, List[AllDevTypes]] = None, wired_tg: bool = None, wlan_tg: bool = None, aos10: bool = None, microbranch: bool = None, gw_role: GatewayRole = None, monitor_only_sw: bool = None, monitor_only_cx: bool = None) Response
Update properties for the given group.
// Used by update group //
The update of persona and configuration mode set for existing device types is not permitted.
Can update from standard AP to MicroBranch, but can’t go back
Can update to AOS10, but can’t go back
Can Add Allowed Device Types, but can’t remove.
Can Add Allowed Switch Types, but can’t remove.
Can only change mon_only_sw and wired_tg when adding switches (cx, sw) to allowed_device_types
- Parameters
group (str) – Group Name
allowed_types (str, List[str]) – Allowed Device Types in the group. Tabs for devices not allowed won’t display in UI. valid values “ap”, “gw”, “cx”, “sw”, “switch” (“switch” is generic, will enable both cx and sw)
wired_tg (bool, optional) – Set to true if wired(Switch) configuration in a group is managed using templates.
wlan_tg (bool, optional) – Set to true if wireless(IAP, Gateways) configuration in a group is managed using templates.
aos10 – (bool): if True use AOS10 architecture for the access points and gateways in the group. default False (Instant)
microbranch (bool) – True to enable Microbranch network role for APs is applicable only for AOS10 architecture.
gw_role (GatewayRole) – Gateway role valid values “branch”, “vpnc”, “wlan” (“wlan” only valid on AOS10 group)
monitor_only_sw – Monitor only ArubaOS-SW switches, applies to UI group only
monitor_only_cx – Monitor only ArubaOS-CX switches, applies to UI group only (Future capability)
- Returns
CentralAPI Response object
- Return type
- async update_site(site_id: int, site_name: str, address: str = None, city: str = None, state: str = None, zipcode: str = None, country: str = None, latitude: str = None, longitude: str = None) Response
Update Site.
Provide geo-loc or address details, not both. Can provide both in subsequent calls, but apigw does not allow both in same call.
// Used by cencli update site [name|id|address] OR –lat <lat> –lon <lon> //
- Parameters
site_id (int) – Site ID
site_name (str) – Site Name
address (str) – Address
city (str) – City Name
state (str) – State Name
zipcode (str) – Zipcode
country (str) – Country Name
latitude (str) – Latitude (in the range of -90 and 90)
longitude (str) – Longitude (in the range of -180 and 180)
- Returns
CentralAPI Response object
- Return type
- async update_ssh_creds(device_serial: str, username: str, password: str) Response
Set Username, password required for establishing SSH connection to switch.
This method only applies to switches
- Parameters
device_serial (str) – Serial number of the switch.
username (str) – SSH username
password (str) – SSH password
- Returns
CentralAPI Response object Successful Response body (Response.output): “Success”
- Return type
- async update_webhook(wid: str, name: str, urls: List[str]) Response
Update webhook settings.
- Parameters
wid (str) – id of the webhook
name (str) – name of the webhook
urls (List[str]) – List of webhook urls
- Returns
CentralAPI Response object
- Return type
- async upgrade_firmware(scheduled_at: int = None, swarm_id: str = None, serial: str = None, group: str = None, device_type: Literal['IAP', 'MAS', 'HP', 'CONTROLLER'] = None, firmware_version: str = None, model: str = None, reboot: bool = False) Response
Initiate firmware upgrade on device(s).
You can only specify one of device_type, swarm_id or serial parameters
// Used by upgrade [device|group|swarm] //
- Parameters
scheduled_at (int, optional) – When to schedule upgrade (epoch seconds). Defaults to None (Now).
swarm_id (str, optional) – Upgrade a specific swarm by id. Defaults to None.
serial (str, optional) – Upgrade a specific device by serial. Defaults to None.
group (str, optional) – Upgrade devices belonging to group. Defaults to None.
device_type (str["IAP"|"MAS"|"HP"|"CONTROLLER"]) – Type of device to upgrade. Defaults to None.
firmware_version (str, optional) – Version to upgrade to. Defaults to None(recommended version).
model (str, optional) – To initiate upgrade at group level for specific model family. Applicable only for Aruba switches. Defaults to None.
reboot (bool, optional) – Automatically reboot device after firmware download. Defaults to False.
- Returns
CentralAPI Response object
- Return type
- async upload_certificate(passphrase: str = '', cert_file: Union[str, Path] = None, cert_name: str = None, cert_format: Literal['PEM', 'DER', 'PKCS12'] = None, cert_data: str = None, server_cert: bool = False, ca_cert: bool = False, crl: bool = False, int_ca_cert: bool = False, ocsp_resp_cert: bool = False, ocsp_signer_cert: bool = False, ssh_pub_key: bool = False) Response
Upload a certificate.
- Parameters
passphrase (str) – passphrase
cert_file (Path|str, optional) – Cert file to upload, if file is provided cert_name and cert_format will be derived from file name / extension, unless those params are also provided.
cert_name (str, optional) – The name of the certificate.
cert_format (Literal["PEM", "DER", "PKCS12"], optional) – cert_format Valid Values: PEM, DER, PKCS12
cert_data (str, optional) – Certificate content encoded in base64 for all format certificates.
server_cert (bool, optional) – Set to True if cert is a server certificate. Defaults to False.
ca_cert (bool, optional) – Set to True if cert is a CA Certificate. Defaults to False.
crl (bool, optional) – Set to True if data is a certificate revocation list. Defaults to False.
int_ca_cert (bool, optional) – Set to True if certificate is an intermediate CA cert. Defaults to False.
ocsp_resp_cert (bool, optional) – Set to True if certificate is an OCSP responder cert. Defaults to False.
ocsp_signer_cert (bool, optional) – Set to True if certificate is an OCSP signer cert. Defaults to False.
ssh_pub_key (bool, optional) – Set to True if certificate is an SSH Pub key. Defaults to False. ssh_pub_key needs to be in PEM format, ssh-rsa is not supported.
- Raises
ValueError – Raised if invalid combination of arguments is provided.
- Returns
CentralAPI Response object
- Return type
- async verify_device_addition(serial_num: str = None, mac_address: str = None, device_list: List[Dict[Literal['mac_address', 'serial_num'], str]] = []) Response
Verify Device Addition
- Parameters
serial_num (str, optional) – Serial Number of device to verify. Defaults to None.
mac_address (str, optional) – Mac Address of device to verify. Defaults to None.
device_list (List[Dict[Literal[, optional) – device_list list of dicts with “serial_num” and “mac_address” for each device to verify. Defaults to None.
Must provide serial_num and mac_address for each device either via keyword argument or list.
- Returns
CentralAPI Response object
- Return type
- async wids_get_all(group: List[str] = None, label: List[str] = None, site: List[str] = None, start: int = None, end: int = None, swarm_id: str = None, from_timestamp: int = None, to_timestamp: int = None, offset: int = 0, limit: int = 100) Response
List all wids classifications.
- Parameters
group (List[str], optional) – List of group names
label (List[str], optional) – List of label names
site (List[str], optional) – List of site names
start (int, optional) – Need information from this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp minus 3 hours
end (int, optional) – Need information to this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp
swarm_id (str, optional) – Filter by Swarm ID
from_timestamp (int, optional) – This parameter supercedes start parameter. Need information from this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp minus 3 hours
to_timestamp (int, optional) – This parameter supercedes end parameter. Need information to this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp
offset (int, optional) – Pagination offset (default = 0) Defaults to 0.
limit (int, optional) – pagination size (default = 100) Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async wids_get_interfering_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, start: int = None, end: int = None, swarm_id: str = None, from_timestamp: int = None, to_timestamp: int = None, offset: int = 0, limit: int = 100) Response
List Interfering APs.
- Parameters
group (List[str], optional) – List of group names
label (List[str], optional) – List of label names
site (List[str], optional) – List of site names
start (int, optional) – Need information from this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp minus 3 hours
end (int, optional) – Need information to this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp
swarm_id (str, optional) – Filter by Swarm ID
from_timestamp (int, optional) – This parameter supercedes start parameter. Need information from this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp minus 3 hours
to_timestamp (int, optional) – This parameter supercedes end parameter. Need information to this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp
offset (int, optional) – Pagination offset (default = 0) Defaults to 0.
limit (int, optional) – pagination size (default = 100) Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async wids_get_neighbor_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, start: int = None, end: int = None, swarm_id: str = None, from_timestamp: int = None, to_timestamp: int = None, offset: int = 0, limit: int = 100) Response
List neighbor APs.
- Parameters
group (List[str], optional) – List of group names
label (List[str], optional) – List of label names
site (List[str], optional) – List of site names
start (int, optional) – Need information from this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp minus 3 hours
end (int, optional) – Need information to this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp
swarm_id (str, optional) – Filter by Swarm ID
from_timestamp (int, optional) – This parameter supercedes start parameter. Need information from this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp minus 3 hours
to_timestamp (int, optional) – This parameter supercedes end parameter. Need information to this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp
offset (int, optional) – Pagination offset (default = 0) Defaults to 0.
limit (int, optional) – pagination size (default = 100) Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async wids_get_rogue_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, start: int = None, end: int = None, swarm_id: str = None, from_timestamp: int = None, to_timestamp: int = None, offset: int = 0, limit: int = 100) Response
List Rogue APs.
- Parameters
group (List[str], optional) – List of group names
label (List[str], optional) – List of label names
site (List[str], optional) – List of site names
start (int, optional) – Need information from this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp minus 3 hours
end (int, optional) – Need information to this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp
swarm_id (str, optional) – Filter by Swarm ID
from_timestamp (int, optional) – This parameter supercedes start parameter. Need information from this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp minus 3 hours
to_timestamp (int, optional) – This parameter supercedes end parameter. Need information to this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp
offset (int, optional) – Pagination offset (default = 0) Defaults to 0.
limit (int, optional) – pagination size (default = 100) Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- async wids_get_suspect_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, start: int = None, end: int = None, swarm_id: str = None, from_timestamp: int = None, to_timestamp: int = None, offset: int = 0, limit: int = 100) Response
List suspect APs.
- Parameters
group (List[str], optional) – List of group names
label (List[str], optional) – List of label names
site (List[str], optional) – List of site names
start (int, optional) – Need information from this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp minus 3 hours
end (int, optional) – Need information to this timestamp. Timestamp is epoch in milliseconds. Default is current timestamp
swarm_id (str, optional) – Filter by Swarm ID
from_timestamp (int, optional) – This parameter supercedes start parameter. Need information from this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp minus 3 hours
to_timestamp (int, optional) – This parameter supercedes end parameter. Need information to this timestamp. Timestamp is epoch in seconds. Default is current UTC timestamp
offset (int, optional) – Pagination offset (default = 0) Defaults to 0.
limit (int, optional) – pagination size (default = 100) Defaults to 100.
- Returns
CentralAPI Response object
- Return type
- class centralcli.central.WlanType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- employee = 'employee'
- guest = 'guest'
- centralcli.central.get_conn_from_file(account_name, logger: ~centralcli.logger.MyLogger = <centralcli.logger.MyLogger object>)
Creates an instance of class`pycentral.ArubaCentralBase` based on config file.
- provided in the YAML/JSON config file:
keyword central_info: A dict containing arguments as accepted by class`pycentral.ArubaCentralBase`
keyword ssl_verify: A boolean when set to True, the python client validates Aruba Central’s SSL certs.
keyword token_store: Optional. Defaults to None.
- Parameters
account_name (str) – Account name defined in the config file.
logger (MyLogger, optional) – log method. Defaults to log.
- Returns
- An instance of class:pycentral.ArubaCentralBase,
Used to manage Auth and Tokens.
- Return type
[pycentral.ArubaCentralBase]
- centralcli.central.multipartify(data, parent_key=None, formatter: callable = None) dict
- centralcli.central.silence_event_loop_closed(func)
centralcli.caas module
- class centralcli.caas.BuildCLI(central=None, data: dict = None)
Bases:
object
Build equivalent cli commands for caas API from bulk-edit.csv import file
- build_cmds(data: dict = None, file: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/central-api-cli/checkouts/latest/config/bulkedit.csv')) list
- static get_bulkedit_data(filename: Path)
- class centralcli.caas.CaasAPI(central=None, data: dict = None, file: Path = None)
Bases:
BuildCLI
- async send_commands(group_dev: str, cli_cmds: list = None)
- centralcli.caas.eval_caas_response(resp) None
centralcli.cache module
- class centralcli.cache.Cache(central: CentralApi = None, data: Union[List[dict], dict] = None, refresh: bool = False)
Bases:
object
- property LicenseTypes: LicenseTypes
- static account_completion(ctx: Context, args: List[str], incomplete: str)
- property all: dict
- check_fresh(refresh: bool = False, site_db: bool = False, dev_db: bool = False, inv_db: bool = False, template_db: bool = False, group_db: bool = False, label_db: bool = False, license_db: bool = False) List[Response]
- client_completion(incomplete: str, args: List[str] = None)
- property clients: list
- completion(incomplete: str, args: List[str])
- dev_ap_completion(incomplete: str, args: List[str] = None)
Completion for argument where only APs are valid.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI. Defaults to None.
- dev_ap_gw_completion(incomplete: str, args: List[str] = None)
Device completion that returns only ap and gw.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI. Defaults to None.
- dev_client_completion(incomplete: str, args: List[str] = [])
Completion for client output.
Returns only devices that apply based on filter provided in command, defaults to clients on both APs and switches (wires/wireless), but returns applicable devices if “wireless” or “wired” filter is used.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI.
- dev_completion(incomplete: str, args: List[str] = None)
- dev_gw_completion(incomplete: str, args: List[str] = None)
Completion for device idens where only gateways are valid.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI. Defaults to None.
- Yields
tuple – name and help_text for the device
- dev_gw_switch_site_completion(incomplete: str, args: List[str] = None)
- dev_kwarg_completion(ctx: Context, incomplete: str, args: List[str] = None)
Completion for commands that allow a list of devices followed by group/site.
i.e. cencli move dev1 dev2 dev3 site site_name group group_name
- Parameters
ctx (typer.Context) – Provided automatically by typer
incomplete (str) – The incomplete word for autocompletion
args (List[str], optional) – The prev args passed into the command.
- Yields
tuple – matching completion string, help text
- dev_site_completion(incomplete: str, args: List[str] = None)
- dev_switch_ap_completion(incomplete: str, args: List[str] = [])
Device completion for returning matches that are either switch or AP
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI.
- dev_switch_completion(incomplete: str, args: List[str] = [])
Device completion for returning matches that are either switch or AP
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI.
- dev_switch_gw_completion(incomplete: str, args: List[str] = None)
Device completion that returns only switches and gateways.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI. Defaults to None.
- dev_template_completion(incomplete: str, args: List[str] = None)
- property device_types: Set[str]
- property devices: list
- property devices_by_serial: dict
- event_completion(incomplete: str, args: List[str] = None)
- property event_ids: list
- property events: list
- get_client_identifier(query_str: str, retry: bool = True, completion: bool = False, exit_on_fail: bool = False, silent: bool = False) Union[Client, List[Client]]
Allows Case insensitive client match
- get_dev_identifier(query_str: Union[str, Iterable[str]], dev_type: Union[GenericDevTypes, List[GenericDevTypes]] = None, retry: bool = True, completion: bool = False, silent: bool = False, include_inventory: bool = False, exit_on_fail: bool = True) Optional[Union[CentralObject, List[CentralObject]]]
- get_devices_with_inventory(no_refresh=False) List[Response]
Returns List of Response objects with data from Inventory and Monitoring
- Parameters
no_refresh (bool, optional) –
Used currently cached data, skip refresh of cache. Defaults to False.
Refresh will only occur if cache was not updated during this session. Setting no_refresh to True means it will not occur regardless.
- Returns
- Response objects where output is list of dicts with
data from Inventory and Monitoring.
- Return type
List[Response]
- get_event_identifier(query: str) str
- get_group_identifier(query_str: str, ret_field: str = 'name', retry: bool = True, multi_ok: bool = False, completion: bool = False, silent: bool = False) List[CentralObject]
Allows Case insensitive group match
- async get_hooks_by_serial(serial)
- get_identifier(qry_str: str, qry_funcs: Sequence[str], device_type: Union[str, List[str]] = None, group: str = None, all: bool = False, completion: bool = False) Union[CentralObject, List[CentralObject]]
Get Identifier when iden type could be one of multiple types. i.e. device or group
- Parameters
qry_str (str) – The query string provided by user.
qry_funcs (Sequence[str]) – Sequence of strings “dev”, “group”, “site”, “template”
device_type (Union[str, List[str]], optional) – Restrict matches to specific dev type(s). Defaults to None.
group (str, optional) – applies to get_template_identifier, Only match if template is in this group. Defaults to None.
all (bool, optional) – For use in completion, adds keyword “all” to valid completion.
completion (bool, optional) – If function is being called for AutoCompletion purposes. Defaults to False. When called for completion it will fail silently and will return multiple when multiple matches are found.
- Raises
typer.Exit – If not ran for completion, and there is no match, exit with code 1.
- Returns
CentralObject or list[CentralObject, …]
- get_label_identifier(query_str: str, retry: bool = True, completion: bool = False, silent: bool = False) CentralObject
Allows Case insensitive label match
- get_log_identifier(query: str) str
- get_site_identifier(query_str: Union[str, List[str], tuple], retry: bool = True, completion: bool = False, silent: bool = False) CentralObject
- get_template_identifier(query_str: str, ret_field: str = 'name', group: str = None, retry: bool = True, multi_ok: bool = False, completion: bool = False, silent: bool = False) CentralObject
Allows case insensitive template match by template name
- group_completion(incomplete: str, args: List[str] = [])
- group_dev_ap_gw_completion(incomplete: str, args: List[str] = None) List[tuple[str, str]]
Completion for argument that can be either group or device.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI. Defaults to None.
- group_dev_gw_completion(incomplete: str, args: List[str] = None)
Completion for argument that can be either group or a gateway.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI. Defaults to None.
- property group_names: list
- property groups: list
- handle_multi_match(match: Union[List[CentralObject], List[Client]], query_str: str = None, query_type: str = 'device') List[Dict[str, Any]]
- property hook_active: list
- property hook_config: list
- property hook_data: list
- insert(data: Union[List[dict], dict]) bool
- property inventory: list
- property inventory_by_serial: dict
- label_completion(incomplete: str, args: List[str] = None)
- property label_names: list
- property labels: list
- property license_names: list
- property licenses: List[str]
- property logs: list
- method_test_completion(incomplete: str, args: List[str] = [])
- null_completion(incomplete: str, args: List[str] = None)
- remove_completion(incomplete: str, args: List[str])
- send_cmds_completion(incomplete: str, args: List[str] = None)
Completion for argument that can be either group, site, or a gateway or keyword “commands”.
- Parameters
incomplete (str) – The last partial or full command before completion invoked.
args (List[str], optional) – The previous arguments/commands on CLI. Defaults to None.
- site_completion(incomplete: str, args: List[str] = None)
- property sites: list
- smg_kw_completion(ctx: Context, incomplete: str, args: List[str] = [])
- template_completion(incomplete: str, args: List[str] = None)
- property templates: list
- async update_client_db(*args, truncate: bool = False, **kwargs) Response
Update client DB
This is only updates when the user does a show clients
It returns the raw data from the API with whatever filters were provided by the user then updates the db with the data returned
Past users are always retained, unless truncate=True
- async update_dev_db(data: Union[str, List[str], List[dict]] = None, remove: bool = False) Union[List[int], Response]
Update Device Database (local cache).
- Parameters
data (Union[str, List[str]], List[dict] optional) – serial number or list of serials numbers to add or remove. Defaults to None.
remove (bool, optional) – Determines if update is to add or remove from cache. Defaults to False (add devices).
- Raises
ValueError – if provided data is of wrong type or does not appear to be a serial number
- Returns
- returns Response object from inventory api call if no data was provided for add/remove.
If adding/removing (providing serials) returns None. Logs errors if any occur during db update.
- Return type
Union[Response, None]
- update_event_db(log_data: List[Dict[str, Any]]) bool
- async update_group_db(data: Union[list, dict] = None, remove: bool = False) Union[List[int], Response]
- update_hook_config_db(data: List[Dict[str, Any]], remove: bool = False) bool
- async update_hook_data_db(data: List[Dict[str, Any]]) bool
- async update_inv_db(data: Union[str, List[str]] = None, *, remove: bool = False, dev_type: str = 'all', sub: bool = None) Union[List[int], Response]
Update Inventory Database (local cache).
- Parameters
data (Union[str, List[str]], optional) – serial number or list of serials numbers to add or remove. Defaults to None.
remove (bool, optional) – Determines if update is to add or remove from cache. Defaults to False.
dev_type (str, optional) – all/iap/switch/controller/gateway/vgw/cap/boc/all_ap/all_controller/others
sub (str, optional) – whether or not to filter return by subscribed / not subscribed. Defaults to None (no filter)
- Raises
ValueError – if provided data is of wrong type or does not appear to be a serial number
- Returns
- returns Response object from inventory api call if no data was provided for add/remove.
If adding/removing (providing serials) returns None. Logs errors if any occur during db update.
- Return type
Union[Response, None]
- async update_label_db(data: Union[list, dict] = None, remove: bool = False) Union[List[int], Response]
- async update_license_db() Response
Update License DB
License DB stores the valid license names accepted by GreenLake/Central
- Returns
CentralAPI Response Object
- Return type
- update_log_db(log_data: List[Dict[str, Any]]) bool
- async update_site_db(data: Union[list, dict] = None, remove: bool = False) Union[List[int], Response]
- async update_template_db()
- class centralcli.cache.CacheResponses(dev: Response = None, inv: Response = None, site: Response = None, template: Response = None, group: Response = None, label: Response = None)
Bases:
object
- property dev
- property group
- property inv
- property label
- property site
- property template
- class centralcli.cache.CentralObject(db: Literal['dev', 'site', 'template', 'group', 'label'], data: Union[list, Dict[str, Any]])
Bases:
object
- property generic_type
- property help_text
- property rich_help_text
- property summary_text
- centralcli.cache.get_cencli_devtype(dev_type: str) str
Convert device type returned by API to consistent cencli types
- Parameters
dev_type (str) – device type provided by API response
- Returns
One of [“ap”, “sw”, “cx”, “gw”]
- Return type
str
centralcli.cleaner module
Collection of functions used to clean output from Aruba Central API into a consistent structure.
- centralcli.cleaner.epoch_convert(func)
- centralcli.cleaner.get_alerts(data: List[dict]) List[dict]
- centralcli.cleaner.get_all_groups(data: List[dict]) list
groups cleaner formats data for cache
- Parameters
data (List[ dict, ]) – api response output from get_all_groups
- Returns
reformatted Data with keys/headers changed
- Return type
list
- centralcli.cleaner.get_all_webhooks(data: List[dict]) List[dict]
- centralcli.cleaner.get_audit_logs(data: List[dict], cache_update_func: callable = None) List[dict]
- centralcli.cleaner.get_branch_health(data: list, down: bool = False, wan_down: bool = False) list
- centralcli.cleaner.get_certificates(data: Dict[str, Any]) List[Dict[str, Any]]
- centralcli.cleaner.get_client_roaming_history(data: List[dict]) List[dict]
- centralcli.cleaner.get_clients(data: List[dict], verbose: bool = False, cache: callable = None, filters: List[str] = None, **kwargs) list
Remove all columns that are NA for all clients in the list
- centralcli.cleaner.get_device_inventory(data: List[dict], sub: bool = None) List[dict]
- centralcli.cleaner.get_devices(data: Union[List[dict], dict], sort: str = None) Union[List[dict], dict]
- centralcli.cleaner.get_dhcp(data: List[Dict[str, Any]]) List[Dict[str, Any]]
- centralcli.cleaner.get_event_logs(data: List[dict], cache_update_func: callable = None) List[dict]
- centralcli.cleaner.get_full_wlan_list(data: Union[List[dict], str, Dict], verbosity: int = 0) List[dict]
- centralcli.cleaner.get_fw_version_list(data: List[dict], format: str = 'rich') List[dict]
- centralcli.cleaner.get_labels(data: Union[List[dict], Dict]) list
- centralcli.cleaner.get_lldp_neighbor(data: List[Dict[str, str]]) List[Dict[str, str]]
- centralcli.cleaner.get_ospf_interface(data: Union[List[dict], dict]) Union[List[dict], dict]
- centralcli.cleaner.get_ospf_neighbor(data: Union[List[dict], dict]) Union[List[dict], dict]
- centralcli.cleaner.get_overlay_interfaces(data: Union[List[dict], dict]) Union[List[dict], dict]
- centralcli.cleaner.get_overlay_routes(data: Union[List[dict], dict], format: str = 'rich', simplify: bool = True) Union[List[dict], dict]
- centralcli.cleaner.get_portals(data: List[dict]) List[dict]
- centralcli.cleaner.get_subscriptions(data: List[dict]) List[dict]
- centralcli.cleaner.get_template_details_for_device(data: str) dict
Convert form-data response to dict
- Parameters
data (str) – string data with summary and optionally running config
- Returns
dict with summary(dict), running config(str) and central side config(str).
- Return type
dict
- centralcli.cleaner.get_vlans(data: List[Dict[str, Any]]) List[Dict[str, Any]]
- centralcli.cleaner.get_wlans(data: List[dict]) List[dict]
- centralcli.cleaner.parse_caas_response(data: Union[dict, List[dict]]) List[str]
Parses Response Object from caas API updates output attribute
- centralcli.cleaner.pre_clean(data: dict) dict
- centralcli.cleaner.routes(data: List[Dict[str, Any]]) List[Dict[str, Any]]
- centralcli.cleaner.short_key(key: str) str
- centralcli.cleaner.short_value(key: str, value: Any)
- centralcli.cleaner.show_groups(data: List[dict]) List[dict]
- centralcli.cleaner.show_interfaces(data: Union[List[dict], dict]) Union[List[dict], dict]
- centralcli.cleaner.show_ts_commands(data: Union[List[dict], dict]) Union[List[dict], dict]
- centralcli.cleaner.simple_kv_formatter(data: List) List
Default simple formatter
runs all key/values through _short_key, _short_value
- Parameters
data (List) – Data typically a list of dicts
- Returns
Formatted data
- Return type
List
- centralcli.cleaner.sites(data: Union[List[dict], dict]) Union[List[dict], dict]
- centralcli.cleaner.sort_result_keys(data: List[dict], order: List[str] = None) List[dict]
- centralcli.cleaner.strip_no_value(data: List[dict] | Dict[dict]) List[dict] | Dict[dict]
strip out any columns that have no value in any row
Accepts either List of dicts, or a Dict where the value for each key is a dict
- centralcli.cleaner.strip_outer_keys(data: dict) Union[list, dict]
strip unnecessary wrapping key from API response payload
- Parameters
data (dict) – The response payload (aiohttp.Response.json())
- Returns
typically list of dicts
- Return type
Union[list, dict]
- centralcli.cleaner.wids(data: List[Dict[str, Any]]) List[Dict[str, Any]]
centralcli.config module
- class centralcli.config.ClusterName(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- internal = 'internal'
- prod1 = 'prod1'
- prod2 = 'prod2'
- prod4 = 'prod4'
- class centralcli.config.Config(base_dir: Path = None)
Bases:
object
- property cache_file
- first_run() str
Method to collect configuration from user when no config file exists.
- Returns
- The contents of the config file (yaml.safe_dump) or None if
user chooses to bypass.
- Return type
str|None
- get(key: str, default: Any = None) Any
- get_account_from_args() str
Determine account to use based on arguments & last_account file.
Method does no harm / triggers no errors. Any errors are handled in account_name_callback after cli is loaded. We need to determine the account during init to load the cache for auto completion.
- Returns
The account to use based on –account -d flags and last_account file.
- Return type
str
- static get_file_data(import_file: Path, text_ok: bool = False, model: Any = None) Union[dict, list]
Returns dict from yaml/json/csv or list of lines from file when text_ok=True.
- Parameters
import_file (Path) – import file.
text_ok (bool, optional) – When file extension is not one of yaml/yml/json/csv/tsv… parse file as text and return list of lines. Defaults to False.
model (Any, optional) – Pydantic Model to return, dict from import is passed into model for validation.
- Raises
UserWarning – Raises UserWarning when text_ok is False (default) and extension is not in [‘.yaml’, ‘.yml’, ‘.json’, ‘.csv’, ‘.tsv’, ‘.dbf’]
UserWarning – Raises UserWarning when a failure occurs when parsing the file, passes on the underlying exception.
- Returns
- Normally dict, list when text_ok and file extension not in
[‘.yaml’, ‘.yml’, ‘.json’, ‘.csv’, ‘.tsv’, ‘.dbf’].
- Return type
Union[dict, list]
- property is_cop
- property last_command_file
- property tok_file: Path
- property token_store
- property tokens
- property valid
- property wh_port
- class centralcli.config.SafeLineLoader(stream)
Bases:
SafeLoader
Loader class that keeps track of line numbers.
- compose_node(parent: Node, index: int) Node
Annotate a node with the first line it was seen.
- class centralcli.config.ServiceNow(*, id: str, url: HttpUrl, port: int = None, incident_path: str, refresh_path: str = 'oauth_token.do', assignment_group: str, client_id: str, client_secret: str, token: SnowTokens = None, tok_file: Path = None)
Bases:
BaseModel
- assignment_group: str
- base_url: HttpUrl
- client_id: str
- client_secret: str
- id: str
- incident_path: str
- property incident_url: URL
- port: int
- refresh_path: str
- property refresh_url: URL
- tok_file: Path
- token: SnowTokens
- class centralcli.config.SnowTokens(*, config: Token, cache: Optional[Token] = None)
Bases:
BaseModel
- class centralcli.config.Token(*, access_token: str, refresh_token: str)
Bases:
BaseModel
- access: str
- refresh: str
- class centralcli.config.WebHook(*, token: Optional[str] = None, port: Optional[int] = 9443)
Bases:
BaseModel
- port: Optional[int]
- token: Optional[str]
- centralcli.config.abort()
- centralcli.config.ask(prompt: str = '', *, console: Optional[Console] = None, password: bool = False, choices: Optional[List[str]] = None, show_default: bool = True, show_choices: bool = True) str
wrapper function for rich.Prompt().ask()
Handles KeyBoardInterrupt, EoFError, and exits if user inputs “abort”
- centralcli.config.get_cluster_url(cluster: ClusterName) str
- centralcli.config.load_yaml(fname: Path) Union[List, Dict, str]
Load a YAML file.
- centralcli.config.parse_yaml(content: Union[str, TextIO]) Union[List, Dict, str]
Load a YAML file.
centralcli.constants module
- class centralcli.constants.AlertSeverity(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- critical = 'critical'
- info = 'info'
- major = 'major'
- minor = 'minor'
- warning = 'warning'
- class centralcli.constants.AlertTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- client = 'client'
- device = 'device'
- ids = 'ids'
- user = 'user'
- class centralcli.constants.AllDevTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- cx = 'cx'
- gw = 'gw'
- sw = 'sw'
- switch = 'switch'
- class centralcli.constants.ArgToWhat
Bases:
object
- class centralcli.constants.BatchAddArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- devices = 'devices'
- groups = 'groups'
- labels = 'labels'
- sites = 'sites'
- class centralcli.constants.BatchApArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- rename = 'rename'
- class centralcli.constants.BatchDelArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- devices = 'devices'
- groups = 'groups'
- labels = 'labels'
- sites = 'sites'
- class centralcli.constants.BatchRenameArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- aps = 'aps'
- groups = 'groups'
- sites = 'sites'
- class centralcli.constants.BlinkArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- off = 'off'
- on = 'on'
- class centralcli.constants.BounceArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- interface = 'interface'
- poe = 'poe'
- class centralcli.constants.CacheArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- clients = 'clients'
- devices = 'devices'
- events = 'events'
- groups = 'groups'
- hook_active = 'hook_active'
- hook_config = 'hook_config'
- hook_data = 'hook_data'
- inventory = 'inventory'
- labels = 'labels'
- licenses = 'licenses'
- logs = 'logs'
- sites = 'sites'
- templates = 'templates'
- class centralcli.constants.CertFormat(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- DER = 'DER'
- PEM = 'PEM'
- PKCS12 = 'PKCS12'
- class centralcli.constants.CertTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- CA_CERT = 'CA_CERT'
- CRL = 'CRL'
- INTERMEDIATE_CA = 'INTERMEDIATE_CA'
- OCSP_RESPONDER_CERT = 'OCSP_RESPONDER_CERT'
- OCSP_SIGNER_CERT = 'OCSP_SIGNER_CERT'
- PUBLIC_CERT = 'PUBLIC_CERT'
- SERVER_CERT = 'SERVER_CERT'
- class centralcli.constants.ClientArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- all = 'all'
- denylisted = 'denylisted'
- device = 'device'
- mac = 'mac'
- wired = 'wired'
- wireless = 'wireless'
- class centralcli.constants.DeleteArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- cert = 'cert'
- certificate = 'certificate'
- site = 'site'
- class centralcli.constants.DevTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- cx = 'cx'
- gw = 'gw'
- sw = 'sw'
- class centralcli.constants.DhcpArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- clients = 'clients'
- server = 'server'
- class centralcli.constants.EnableDisableArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- auto_sub = 'auto-sub'
- class centralcli.constants.EventDevTypeArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- client = 'client'
- gw = 'gw'
- switch = 'switch'
- class centralcli.constants.GatewayRole(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- branch = 'branch'
- vpnc = 'vpnc'
- wlan = 'wlan'
- class centralcli.constants.GenericDevTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- gw = 'gw'
- switch = 'switch'
- class centralcli.constants.IdenMetaVars
Bases:
object
- class centralcli.constants.KickArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- all = 'all'
- mac = 'mac'
- wlan = 'wlan'
- class centralcli.constants.LibToAPI
Bases:
object
Convert device type stored in Cache to type required by the different API methods
TODO Working toward a consistent set of device_types, needs review, goal is to have all API methods in CentralApi use a consistent set of device type values. i.e. ‘ap’, ‘switch’, ‘gw’ (‘controller’ appears to be the same as gw). Then use this callable object to convert appropriate device type to whatever random value is required by the API method.
- property valid: list
- property valid_str: list
- class centralcli.constants.LibToGenericPlural
Bases:
object
- class centralcli.constants.LicenseTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- advance_70xx = 'advance-70xx'
- advance_72xx = 'advance-72xx'
- advance_90xx_sec = 'advance-90xx-sec'
- advance_base_7005 = 'advance-base-7005'
- advanced_ap = 'advanced-ap'
- advanced_switch_6100 = 'advanced-switch-6100'
- advanced_switch_6200 = 'advanced-switch-6200'
- advanced_switch_6300 = 'advanced-switch-6300'
- advanced_switch_6400 = 'advanced-switch-6400'
- advanced_switch_8400 = 'advanced-switch-8400'
- dm = 'dm'
- foundation_70xx = 'foundation-70xx'
- foundation_72xx = 'foundation-72xx'
- foundation_90xx_sec = 'foundation-90xx-sec'
- foundation_ap = 'foundation-ap'
- foundation_base_7005 = 'foundation-base-7005'
- foundation_base_90xx_sec = 'foundation-base-90xx-sec'
- foundation_switch_6100 = 'foundation-switch-6100'
- foundation_switch_6200 = 'foundation-switch-6200'
- foundation_switch_6300 = 'foundation-switch-6300'
- foundation_switch_6400 = 'foundation-switch-6400'
- foundation_switch_8400 = 'foundation-switch-8400'
- foundation_wlan_gw = 'foundation-wlan-gw'
- vgw2g = 'vgw2g'
- vgw4g = 'vgw4g'
- vgw500m = 'vgw500m'
- class centralcli.constants.LogAppArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- account_setting = 'account_setting'
- nms = 'nms'
- class centralcli.constants.LogSortBy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- app = 'app'
- description = 'description'
- id = 'id'
- ip = 'ip'
- target = 'target'
- time = 'time'
- user = 'user'
- class centralcli.constants.NotifyToArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- email = 'email'
- phone = 'phone'
- class centralcli.constants.RefreshWhat(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- cache = 'cache'
- token = 'token'
- tokens = 'tokens'
- class centralcli.constants.RemoveArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- site = 'site'
- class centralcli.constants.ResetArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- overlay = 'overlay'
- class centralcli.constants.SendCmdArg2(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- commands = 'commands'
- class centralcli.constants.SendCmdArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- all = 'all'
- device = 'device'
- file = 'file'
- group = 'group'
- site = 'site'
- class centralcli.constants.SendConfigDevIdens(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- gw = 'gw'
- class centralcli.constants.ShowArg2(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- all = 'all'
- ap = 'ap'
- aps = 'aps'
- certs = 'certs'
- clients = 'clients'
- device = 'device'
- devices = 'devices'
- gateway = 'gateway'
- gateways = 'gateways'
- group = 'group'
- groups = 'groups'
- sites = 'sites'
- switch = 'switch'
- switches = 'switches'
- template = 'template'
- templates = 'templates'
- variables = 'variables'
- class centralcli.constants.ShowArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- all = 'all'
- ap = 'ap'
- aps = 'aps'
- cache = 'cache'
- certs = 'certs'
- clients = 'clients'
- device = 'device'
- devices = 'devices'
- gateway = 'gateway'
- gateways = 'gateways'
- group = 'group'
- groups = 'groups'
- log = 'log'
- logs = 'logs'
- site = 'site'
- sites = 'sites'
- switch = 'switch'
- switches = 'switches'
- template = 'template'
- templates = 'templates'
- variables = 'variables'
- class centralcli.constants.ShowHookProxyArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- logs = 'logs'
- pid = 'pid'
- port = 'port'
- class centralcli.constants.ShowInventoryArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- all = 'all'
- ap = 'ap'
- cx = 'cx'
- gw = 'gw'
- sw = 'sw'
- switch = 'switch'
- vgw = 'vgw'
- class centralcli.constants.SiteStates(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- AK = 'Alaska'
- AL = 'Alabama'
- AR = 'Arkansas'
- AS = 'American Samoa'
- AZ = 'Arizona'
- Alabama = 'Alabama'
- Alaska = 'Alaska'
- American_Samoa = 'American Samoa'
- Arizona = 'Arizona'
- Arkansas = 'Arkansas'
- CA = 'California'
- CO = 'Colorado'
- CT = 'Connecticut'
- California = 'California'
- Colorado = 'Colorado'
- Connecticut = 'Connecticut'
- DC = 'District of Columbia'
- DE = 'Delaware'
- Delaware = 'Delaware'
- District_of_Columbia = 'District of Columbia'
- FL = 'Florida'
- Florida = 'Florida'
- GA = 'Georgia'
- GU = 'Guam'
- Georgia = 'Georgia'
- Guam = 'Guam'
- HI = 'Hawaii'
- Hawaii = 'Hawaii'
- IA = 'Iowa'
- ID = 'Idaho'
- IL = 'Illinois'
- IN = 'Indiana'
- Idaho = 'Idaho'
- Illinois = 'Illinois'
- Indiana = 'Indiana'
- Iowa = 'Iowa'
- KS = 'Kansas'
- KY = 'Kentucky'
- Kansas = 'Kansas'
- Kentucky = 'Kentucky'
- LA = 'Louisiana'
- Louisiana = 'Louisiana'
- MA = 'Massachusetts'
- MD = 'Maryland'
- ME = 'Maine'
- MI = 'Michigan'
- MN = 'Minnesota'
- MO = 'Missouri'
- MP = 'Northern Mariana Islands'
- MS = 'Mississippi'
- MT = 'Montana'
- Maine = 'Maine'
- Maryland = 'Maryland'
- Massachusetts = 'Massachusetts'
- Michigan = 'Michigan'
- Minnesota = 'Minnesota'
- Mississippi = 'Mississippi'
- Missouri = 'Missouri'
- Montana = 'Montana'
- NC = 'North Carolina'
- ND = 'North Dakota'
- NE = 'Nebraska'
- NH = 'New Hampshire'
- NJ = 'New Jersey'
- NM = 'New Mexico'
- NV = 'Nevada'
- NY = 'New York'
- Nebraska = 'Nebraska'
- Nevada = 'Nevada'
- New_Hampshire = 'New Hampshire'
- New_Jersey = 'New Jersey'
- New_Mexico = 'New Mexico'
- New_York = 'New York'
- North_Carolina = 'North Carolina'
- North_Dakota = 'North Dakota'
- Northern_Mariana_Islands = 'Northern Mariana Islands'
- OH = 'Ohio'
- OK = 'Oklahoma'
- OR = 'Oregon'
- Ohio = 'Ohio'
- Oklahoma = 'Oklahoma'
- Oregon = 'Oregon'
- PA = 'Pennsylvania'
- PR = 'Puerto Rico'
- Pennsylvania = 'Pennsylvania'
- Puerto_Rico = 'Puerto Rico'
- RI = 'Rhode Island'
- Rhode_Island = 'Rhode Island'
- SC = 'South Carolina'
- SD = 'South Dakota'
- South_Carolina = 'South Carolina'
- South_Dakota = 'South Dakota'
- TN = 'Tennessee'
- TX = 'Texas'
- Tennessee = 'Tennessee'
- Texas = 'Texas'
- UM = 'United States Minor Outlying Islands'
- US_Virgin_Islands = 'U.S. Virgin Islands'
- UT = 'Utah'
- United_States_Minor_Outlying_Islands = 'United States Minor Outlying Islands'
- Utah = 'Utah'
- VA = 'Virginia'
- VI = 'U.S. Virgin Islands'
- VT = 'Vermont'
- Vermont = 'Vermont'
- Virginia = 'Virginia'
- WA = 'Washington'
- WI = 'Wisconsin'
- WV = 'West Virginia'
- WY = 'Wyoming'
- Washington = 'Washington'
- West_Virginia = 'West Virginia'
- Wisconsin = 'Wisconsin'
- Wyoming = 'Wyoming'
- class centralcli.constants.SortAlertOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- acknowledged = 'acknowledged'
- description = 'description'
- severity = 'severity'
- time = 'time'
- type = 'type'
- class centralcli.constants.SortCertOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- expiration = 'expiration'
- expired = 'expired'
- md5_checksum = 'md5_checksum'
- name = 'name'
- sha1_checksum = 'sha1_checksum'
- type = 'type'
- class centralcli.constants.SortClientOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- connected_device = 'connected_device'
- dot11 = 'dot11'
- group = 'group'
- ip = 'ip'
- last_connected = 'last_connected'
- mac = 'mac'
- name = 'name'
- network = 'network'
- role = 'role'
- site = 'site'
- vlan = 'vlan'
- class centralcli.constants.SortDevOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- ap_ip = 'ap_ip'
- ap_port = 'ap_port'
- ap_serial = 'ap_serial'
- group = 'group'
- healthy = 'healthy'
- ip = 'ip'
- labels = 'labels'
- mac = 'mac'
- model = 'model'
- name = 'name'
- serial = 'serial'
- site = 'site'
- status = 'status'
- switch = 'switch'
- switch_ip = 'switch_ip'
- switch_port = 'switch_port'
- switch_serial = 'switch_serial'
- tagged_vlans = 'tagged_vlans'
- type = 'type'
- untagged_vlan = 'untagged_vlan'
- uptime = 'uptime'
- version = 'version'
- class centralcli.constants.SortInventoryOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- mac = 'mac'
- model = 'model'
- serial = 'serial'
- services = 'services'
- sku = 'sku'
- type = 'type'
- class centralcli.constants.SortOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- mac_asc = '+mac'
- mac_des = '-mac'
- name_asc = '+name'
- name_des = '-name'
- serial_asc = '+serial'
- serial_des = '-serial'
- class centralcli.constants.SortOspfAreaOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- area = 'area'
- area_type = 'area_type'
- default_cost = 'default_cost'
- interface_count = 'interface_count'
- spf_run_count = 'spf_run_count'
- summary_enable = 'summary_enable'
- class centralcli.constants.SortOspfDatabaseOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- age = 'age'
- area = 'area'
- checksum = 'checksum'
- link_count = 'link_count'
- ls_id = 'ls_id'
- lsa_type = 'lsa_type'
- route_tag = 'route_tag'
- router_id = 'router_id'
- seq_no = 'seq_no'
- class centralcli.constants.SortOspfInterfaceOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- BDR_IP = 'BDR_IP'
- BDR_rtr_id = 'BDR_rtr_id'
- DR_IP = 'DR_IP'
- DR_rtr_id = 'DR_rtr_id'
- area = 'area'
- auth = 'auth'
- cost = 'cost'
- dead_interval = 'dead_interval'
- hello_interval = 'hello_interval'
- ip = 'ip'
- name = 'name'
- nbrs = 'nbrs'
- oper_state = 'oper_state'
- priority = 'priority'
- rexmt_interval = 'rexmt_interval'
- state = 'state'
- type = 'type'
- class centralcli.constants.SortOspfNeighborOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- area = 'area'
- dead_timer = 'dead_timer'
- interface_name = 'interface_name'
- interface_state = 'interface_state'
- ip = 'ip'
- neighbor_state = 'neighbor_state'
- options = 'options'
- priority = 'priority'
- rexmt_timer = 'rexmt_timer'
- router_id = 'router_id'
- class centralcli.constants.SortOverlayInterfaceOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- endpoint = 'endpoint'
- name = 'name'
- routes = 'routes'
- state = 'state'
- uptime = 'uptime'
- class centralcli.constants.SortRouteOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- best = 'best'
- destination = 'destination'
- flags = 'flags'
- interface = 'interface'
- learn_time = 'learn_time'
- metric = 'metric'
- nexthop = 'nexthop'
- protocol = 'protocol'
- class centralcli.constants.SortSiteOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- address = 'address'
- associated_devices = 'associated_devices'
- city = 'city'
- country = 'country'
- id = 'id'
- name = 'name'
- state = 'state'
- zipcode = 'zipcode'
- class centralcli.constants.SortSubscriptionOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- end_date = 'end_date'
- key = 'key'
- name = 'name'
- network = 'network'
- sku = 'sku'
- start_date = 'start_date'
- status = 'status'
- type = 'type'
- class centralcli.constants.SortTemplateOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- device_type = 'device_type'
- group = 'group'
- model = 'model'
- name = 'name'
- template_hash = 'template_hash'
- version = 'version'
- class centralcli.constants.SortTsCmdOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- category = 'category'
- command_id = 'id'
- class centralcli.constants.SortVlanOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- igmp = 'igmp'
- jumbo = 'jumbo'
- mgmt = 'mgmt'
- name = 'name'
- oper_state_reason = 'oper_state_reason'
- pvid = 'pvid'
- status = 'status'
- tagged = 'tagged'
- untagged = 'untagged'
- voice = 'voice'
- class centralcli.constants.SortWebHookOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- name = 'name'
- retry_policy = 'retry-policy'
- token = 'token'
- token_created = 'token-created'
- updated = 'updated'
- urls = 'urls'
- wid = 'wid'
- class centralcli.constants.SortWlanOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- access_type = 'access_type'
- clients = 'clients'
- enabled = 'enabled'
- group = 'group'
- mac_auth = 'mac_auth'
- rf_band = 'rf_band'
- security = 'security'
- ssid = 'ssid'
- type = 'type'
- class centralcli.constants.StartArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- hook2snow = 'hook2snow'
- hook_proxy = 'hook-proxy'
- class centralcli.constants.StatusOptions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- DOWN = 'DOWN'
- Down = 'Down'
- UP = 'UP'
- Up = 'Up'
- down = 'down'
- up = 'up'
- class centralcli.constants.SubscriptionArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- auto = 'auto'
- details = 'details'
- names = 'names'
- stats = 'stats'
- class centralcli.constants.TSDevTypes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- cx = 'cx'
- gateway = 'gateway'
- gw = 'gw'
- mas = 'mas'
- sw = 'sw'
- switch = 'switch'
- class centralcli.constants.TemplateLevel1(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- add = 'add'
- delete = 'delete'
- update = 'update'
- class centralcli.constants.TunnelTimeRange(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- one_day = '1D'
- one_month = '1M'
- one_week = '1W'
- three_hours = '3H'
- three_months = '3M'
- class centralcli.constants.UpgradeArgs(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
str
,Enum
- ap = 'ap'
- gateway = 'gateway'
- switch = 'switch'
- class centralcli.constants.WhatToPretty
Bases:
object
- centralcli.constants.do_load_pycentral() bool
Determine if provided command requires pycentral load
Allows command to complete even if config has yet to be configured. Useful for first run commands and auto docs.
- Returns
True or False indicating if pycentral needs to be instantiated for command to complete.
- Return type
bool
- centralcli.constants.get_cencli_devtype(dev_type: str) str
Convert device type returned by API to consistent cencli types
- Parameters
dev_type (str) – device type provided by API response
- Returns
One of [“ap”, “sw”, “cx”, “gw”]
- Return type
str
centralcli.exceptions module
- exception centralcli.exceptions.ArubaCentralException
Bases:
Exception
- exception centralcli.exceptions.CentralCliException
Bases:
Exception
- exception centralcli.exceptions.DevException
Bases:
ArubaCentralException
- exception centralcli.exceptions.ImportException
Bases:
CentralCliException
- exception centralcli.exceptions.IncidentException
Bases:
ServiceNowException
- exception centralcli.exceptions.MissingFieldException
Bases:
CentralCliException
- exception centralcli.exceptions.RefreshFailedException
Bases:
ServiceNowException
- exception centralcli.exceptions.ServiceNowException
Bases:
Exception
- exception centralcli.exceptions.TimeoutException
Bases:
ArubaCentralException
centralcli.logger module
- class centralcli.logger.MyLogger(log_file: Union[str, Path], debug: bool = False, show: bool = False, verbose: bool = False)
Bases:
object
- property DEBUG
render log messages queued for display in output caption
- critical(msgs: Union[list, str], log: bool = True, show: bool = None, caption: bool = False, *args, **kwargs) None
- debug(msgs: Union[list, str], log: bool = True, show: bool = None, caption: bool = False, *args, **kwargs) None
- debugv(msgs: Union[list, str], log: bool = True, show: bool = None, *args, **kwargs) None
more verbose debugging - primarily to get json dumps, set via debugv: True in config
- error(msgs: Union[list, str], log: bool = True, show: bool = None, caption: bool = False, *args, **kwargs) None
- exception(msgs: Union[list, str], log: bool = True, show: bool = None, caption: bool = False, *args, **kwargs) None
- fatal(msgs: Union[list, str], log: bool = True, show: bool = None, caption: bool = False, *args, **kwargs) None
- follow()
generator function that yields new lines in log file
- get_logger() Logger
Return custom log object.
- info(msgs: Union[list, str], log: bool = True, show: bool = None, caption: bool = False, *args, **kwargs) None
- property level_name
- log_print(msgs, log: bool = False, show: bool = False, caption: bool = False, level: str = 'info', *args, **kwargs)
- print_file()
- setLevel(level)
- show(msgs: Union[list, str], log: bool = False, show: bool = True, *args, **kwargs) None
- warning(msgs: Union[list, str], log: bool = True, show: bool = None, caption: bool = False, *args, **kwargs) None
centralcli.response module
- class centralcli.response.BatchRequest(func: callable, args: Any = (), **kwargs: dict)
Bases:
object
- class centralcli.response.LoggedRequests(url: str, method: str = 'GET')
Bases:
object
- update(response: ClientResponse)
- class centralcli.response.RateLimit(resp: ClientResponse = None)
Bases:
object
- property near_day
- property near_sec
- property text
- class centralcli.response.Response(response: ClientResponse = None, url: Union[URL, str] = '', ok: bool = None, error: str = None, output: Any = {}, raw: Any = {}, status_code: int = None, elapsed: Union[int, float] = 0, rl_str: str = None)
Bases:
object
wrapper ClientResponse object
Assigns commonly evaluated attributes regardless of API execution result
- The following attributes will always be available:
ok (bool): indicates success/failure of aiohttp.ClientSession.request()
output (Any): The content returned from the response (outer keys removed)
raw (Any): The original un-cleaned response from the API request
error (str): Error message indicating the nature of a failed response
status (int): http status code returned from response
- Create instance by providing at minimum one of the following parameters:
response (ClientResponse): all other parameters ignored if providing response
- error (str): ok, output, status set to logical default if not provided
OK / __bool__ is False if error is provided and ok is not.
- output (Any): ok, error, status set to logical default if not provided
OK / __bool__ is True if output provided with no error or ok arg.
- get(key: Union[int, str], default: Any = None)
- keys() list
- property status_code: int
Make attributes used for status code for both aiohttp and requests valid.
- class centralcli.response.Session(auth: ArubaCentralBase = None, aio_session: ClientSession = None, silent: bool = True)
Bases:
object
- MAX_TOKENS = 6
- RATE = 1
- property aio_session
- async api_call(url: str, data: dict = None, json_data: Union[dict, list] = None, method: str = 'GET', headers: dict = {}, params: dict = {}, callback: callable = None, callback_kwargs: Any = {}, count: int = None, **kwargs: Any) Response
Perform API calls and handle paging
- Parameters
url (str) – The API Endpoint URL
data (dict, optional) – Data passed to aiohttp.ClientSession. Defaults to None.
json_data (Union[dict, list], optional) – passed to aiohttp.ClientSession. Defaults to None.
method (str, optional) – Request Method (POST, GET, PUT,…). Defaults to “GET”.
headers (dict, optional) – headers dict passed to aiohttp.ClientSession. Defaults to {}.
params (dict, optional) – url parameters passed to aiohttp.ClientSession. Defaults to {}.
callback (callable, optional) – DEPRECATED callback to be performed on result prior to return. Defaults to None.
callback_kwargs (Any, optional) – DEPRECATED kwargs to pass to the callback. Defaults to {}.
count (int, optional) – upper limit on # of records to return (used to return last ‘count’ audit logs). Defaults to None.
- Returns
CentralAPI Response object
- Return type
- batch_request(api_calls: List[BatchRequest], continue_on_fail: bool = False, retry_failed: bool = False) List[Response]
non async to async wrapper for multiple parallel API calls
First entry is ran alone, if successful the remaining calls are made in parallel.
- Parameters
api_calls (List[BatchRequest]) – List of BatchRequest objects.
continue_on_fail (bool, optional) – Continue with subsequent requests if first request fails. defaults to False. Only the first request is validated for success.
retry_failed (bool, optional) – Retry failed requests some return codes result in retry regardless. Defaults to False
- Returns
List of centralcli.response.Response objects.
- Return type
List[Response]
- async delete(url, params: dict = {}, payload: dict = None, json_data: Union[dict, list] = None, headers: dict = None, **kwargs) Response
- async exec_api_call(url: str, data: dict = None, json_data: Union[dict, list] = None, method: str = 'GET', headers: dict = {}, params: dict = {}, **kwargs) Response
- get_token_from_user() dict
Handle invalid or expired tokens
For prod cluster it leverages ArubaCentralBase.handleTokenExpiry() For internal cluster it extends functionality to support user input copy paste of Download Token dict from Aruba Central GUI.
- Returns
access and refresh tokens extracted from user provided json
- Return type
dict
- async handle_pagination(res: Response, paged_raw: Optional[Union[Dict, List]] = None, paged_output: Optional[Union[Dict, List]] = None) Tuple
- async patch(url, params: dict = {}, payload: dict = None, json_data: Union[dict, list] = None, headers: dict = None, **kwargs) Response
- async static pause(start: float) None
- async post(url, params: dict = {}, payload: dict = None, json_data: Union[dict, list] = None, headers: dict = None, **kwargs) Response
- async put(url, params: dict = {}, payload: dict = None, json_data: Union[dict, list] = None, headers: dict = None, **kwargs) Response
- refresh_token(token_data: dict = None) None
- centralcli.response.get_multiline_input(prompt: str = None, print_func: callable = <function print>, return_type: str = None, **kwargs) Union[List[str], dict, str]
centralcli.utils module
- class centralcli.utils.Convert(mac, fuzzy: bool = False)
Bases:
object
- class centralcli.utils.Utils
Bases:
object
- static ask(prompt: str = '', *, console: Optional[Console] = None, password: bool = False, choices: Optional[List[str]] = None, show_default: bool = True, show_choices: bool = True, default: Any = Ellipsis) str
wrapper function for rich.Prompt().ask()
Handles KeyBoardInterrupt, EoFError, and exits if user inputs “abort”
- static chunker(seq, size)
- static color(text: Union[str, bool, List[str]], color_str: str = 'bright_green', italic: bool = None, bold: bool = None, blink: bool = None) str
Helper method to wrap text in rich formatting tags
Applies standard default formatting.
- Parameters
text (str|bool|list) – The text to be formmated. If a bool is provided it is converted to string and italics applied. If list of strings is provided it is converted to str and formatted.
color_str (str optional) – Text is formatted with this color. Default: bright_green
italic (bool) – Wheather to apply italic to text. Default False if str is provided for text True if bool is provided.
bold (bool) – Wheather to apply bold to text. Default None/False
blink (bool) – Wheather to blink the text. Default None/False
- static do_pretty(key: str, value: str) str
Apply coloring to tty output
Applies color to certain columns/values prior to formatting
- static generate_template(template_file: Union[Path, str], var_file: Optional[Union[Path, str]]) str
Generate configuration files based on j2 templates and provided variables
- static get_multiline_input(prompt: str = None, print_func: callable = <built-in function print>, return_type: str = 'str', abort_str: str = 'exit', **kwargs) Union[List[str], dict, str]
- static is_reachable(host: str, port: Union[str, list], timeout: int = 3, silent: bool = False)
- static isserial(serial: Union[str, List[str]]) bool
Validate the provided str or list of strings appears to be a serial number.
Serial validation checks that the first 2 characters of the serial are letters, all charachters are alpha-numeric, and that there are 9 or more characters.
- Parameters
serial (Union[str, List[str]]) – single serial number of list of serial numbers
- Returns
True if all provided strings appear to be serial numbers False if not.
- Return type
bool
- json_print(obj)
- listify(var)
- output(outdata: Union[List[str], Dict[str, Any]], tablefmt: str = 'rich', title: str = None, caption: str = None, account: str = None, config=None, set_width_cols: dict = None, full_cols: Union[List[str], str] = [], fold_cols: Union[List[str], str] = [], ok_status: Union[int, List[int], Tuple[int, str], List[Tuple[int, str]]] = None) str
- static spinner(spin_txt: str, function: callable, url: str = None, *args, name: str = None, spinner: str = 'dots', debug: bool = False, **kwargs) Any
- static strip_none(data: Optional[Union[dict, list]], strip_empty_obj: bool = False) Any
strip all keys from a list or dict where value is NoneType
- Parameters
data (Union[dict, list, None]) – The iterable object to have all items/keys where value is None
strip_empty_obj (bool) – If True will strip keys that have empty objects as well as NoneType for value.
- Returns
(Any) Return same type that is provided to method as first argument. If dict is provided it returns modified dict.
- tty = <centralcli.utils.Utils.TTY object>
- static unique(_list: list, sort: bool = False) list
- static unlistify(data: Any)
Remove unnecessary outer lists.
- Returns
[] = ‘’ [‘single_item’] = ‘single item’ [[item1], [item2], …] = [item1, item2, …]
- user_input_bool(question)
Ask User Y/N Question require Y/N answer
Error and re-prompt if user’s response is not valid Appends ‘? (y/n): ‘ to question/prompt provided
- Params:
question (str): The Question to ask
- Returns
Users Response yes=True
- Return type
answer (bool)
- valid_file(filepath)
- static validate_config(data: str) List[str]
Validator for resulting config after j2 conversion
- Parameters
data (str) – str representing the final configuration.
- Raises
typer.Exit – If masked creds found
- Returns
Original list of str with each line rstrip.