centralcli package

centralcli.classic.api.configuration module

class centralcli.classic.api.configuration.ConfigAPI(session: Session)

Bases: object

async add_template(name: str, group: str, template: Path | str | bytes, device_type: Literal['ap', 'cx', 'sw', 'gw', 'sdwan'] = 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 (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:

Response

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:

Response

async create_device_template_variables(serial: str, mac: str, var_dict: dict) Response

Create template variables for a device.

Parameters:
  • serial (str) – Serial number of the device.

  • mac (str) – MAC address of the device.

  • var_dict (dict) – dict with variables to be updated

Returns:

CentralAPI Response object

Return type:

Response

async create_group(group: str, allowed_types: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] = ['ap', 'gw', 'cx', 'sw'], wired_tg: bool = False, wlan_tg: bool = False, aos10: bool = False, microbranch: bool = False, gw_role: Literal['branch', 'vpnc', 'wlan'] = None, monitor_only_sw: bool = False, monitor_only_cx: bool = False, cnx: bool = False) Response

Create new group with specified properties. v3

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”, “sdwan” (“switch” is generic, will enable both cx and sw) When sdwan (EdgeConnect SD-WAN) is allowed, it has to be the only type allowed.

  • 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) Defaults to None. Results in “branch” unless “sdwan” is in allowed_types otherwise “vpnc”.

  • 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

  • cnx (bool, optional) – Make group compatible with cnx (New Central)

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

async delete_certificate(certificate: str) Response

Delete existing certificate.

Parameters:

certificate (str) – Name of the certificate to delete.

Returns:

CentralAPI Response object

Return type:

Response

async delete_device_template_variables(serial: str) Response

Delete all of the template variables for a device.

Parameters:

serial (str) – Serial number of the device.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

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:

Response

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:

Response

async do_multi_group_snapshot(backup_name: str, include_groups: List[str] = None, exclude_groups: 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 (List[str], optional) – Groups to include in Backup. Defaults to None.

  • exclude_groups (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:

Response

async get_all_groups() Response

Get properties and template info for all groups

This method will first call configuration/v2/groups to get a list of group names.

It then combines the responses from /configuration/v2/groups/template_info and /configuration/v1/groups/properties to get the template details (template_group or not) and properties for each group.

The template_info and properties endpoints both allow 20 groups per request. Multiple requests will be performed async if there are more than 20 groups.

Raises:

CentralCliException – Raised when validation of combined responses fails.

Returns:

centralcli Response Object

Return type:

Response

async get_all_templates(groups: List[dict] | List[str] = None, template: str = None, device_type: Literal['ap', 'cx', 'sw', 'gw', 'sdwan'] = None, version: str = None, model: str = None, query: str = None) Response

Get data for all defined templates from Aruba Central

Parameters:
  • groups (List[dict] | List[str], optional) – List of groups. If provided additional API calls to get group names for all template groups are not performed). If a list of str (group names) is provided all are queried for templates If a list of dicts is provided: It should look like: [{“name”: “group_name”, “wired_tg”: True, “wlan_tg”: False}] Defaults to None.

  • template (str, optional) – Filter on provided name as template.

  • device_type (Literal['ap', 'gw', 'cx', 'sw'], optional) – Filter on device_type. Valid Values: ap|gw|cx|sw.

  • version (str, optional) – Filter on version property of template. Example: ALL, 6.5.4 etc.

  • model (str, optional) – Filter on model property of template. For ‘ArubaSwitch’ device_type, part number (J number) can be used for the model parameter. Example: ALL, 2920, J9727A etc.

  • query (str, optional) – Search for template OR version OR model, query will be ignored if any of filter parameters are provided.

Returns:

centralcli Response Object

Return type:

Response

async get_all_templates_in_group(group: str, name: str = None, device_type: Literal['ap', 'cx', 'sw', 'gw', 'sdwan'] = None, version: str = None, model: str = None, query: str = None, offset: int = 0, limit: int = 20) Response

Get all templates in group.

Parameters:
  • group (str) – Name of the group for which the templates are being queried.

  • template (str, optional) – Filter on provided name as template.

  • device_type (Literal['ap', 'gw', 'cx', 'sw'], optional) – Filter on device_type. Valid Values: ap|gw|cx|sw.

  • version (str, optional) – Filter on version property of template. Example: ALL, 6.5.4 etc.

  • model (str, optional) – Filter on model property of template. For ‘ArubaSwitch’ device_type, part number (J number) can be used for the model parameter. Example: ALL, 2920, J9727A etc.

  • query (str, optional) – Search for template OR version OR model, query will be ignored if any of filter parameters are provided.

  • 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 template records to be returned. Max 20. Defaults to 20.

Returns:

CentralAPI Response object

Return type:

Response

async get_ap_config(iden: str, version: str = None) Response

Get AP Group Level configuration for UI group.

// Used by show config <AP MAC for AOS10 AP> //

Parameters:
  • iden (str, optional) – Group name swarm id or serial # (AOS10 AP). Example: Retail or 6a5d123b1b77c828a085f04f… or USF7JSS9L1.

  • version (str, optional) – Version of AP.

Returns:

CentralAPI Response object

Return type:

Response

async get_ap_settings(serial: str) Response

Get an existing ap settings.

This returns a JSON and does not support all settings. Recommended to use ap_settings_cli

Parameters:

serial (str) – AP serial number.

Returns:

CentralAPI Response object

Return type:

Response

async get_ap_system_config(scope: str) Response

Get System Config.

Parameters:

scope (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:

Response

async get_certificates(q: str = None, offset: int = 0, limit: int = 20) 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:

Response

async get_default_group() Response

Get default group.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

async get_device_configuration(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:

Response

async get_dirty_diff(group: str, offset: int = 0, limit: int = 20) Response

Get AP dirty diff (config items not pushed) by group.

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:

Response

async get_full_wlan_list(scope: str) Response

Get WLAN list/details by (UI) group.

Parameters:

scope (str) – Provide one of group name, swarm id, or serial number. Example: Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f or CNF7JSS9L1.

Returns:

CentralAPI Response object

Return type:

Response

async get_group_names() Response

Get a listing of all group names defined in Aruba Central

Returns:

CentralAPI Respose object

output attribute will be List[str]

Return type:

Response

async get_groups_properties(groups: 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:

Response

async get_groups_template_status(groups: List[str] | str = None) Response

Get template group status for provided groups or all if none are provided. (if it is a template group or not)

Will return response from /configuration/v2/groups/template_info endpoint. If no groups are provided /configuration/v2/groups is first called to get a list of all group names.

Parameters:

groups (List[str] | str, optional) – A single group or list of groups. Defaults to None (all groups).

Returns:

centralcli Response Object

Return type:

Response

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:

Response

async get_snapshots_by_group(group: str)
async get_swarm_config(swarm_id: str) Response

Get an existing swarm config.

Parameters:

swarm_id (str) – swarm_id (guid) of the SWARM. Example: 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.

Returns:

CentralAPI Response object

Return type:

Response

async get_template(group: str, template: str) Response

Get template text for a template in group.

Parameters:
  • group (str) – Name of the group for which the templates are being queried.

  • template (str) – Name of template.

Returns:

CentralAPI Response object

Return type:

Response

async get_template_details_for_device(serial: str, details: bool = False) Response

Get configuration details for a device (only for template groups).

Parameters:
  • 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:

Response

async get_variables(serial: str = None, offset: int = 0, limit: int = 20) Response

Get template variables for a device or all devices

Parameters:
  • serial (str) – Serial number of the device, If None provided all templates for all devices will be fetched. Defaults to None.

  • 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. Max allowed is 20. Defaults to 20.

offset and limit are ignored if serial is provided.

Returns:

CentralAPI Response object

Return type:

Response

async get_variablised_template(serial: str) Response

Get variablised template for an Aruba Switch.

Parameters:

serial (str) – Serial number of the device.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

async move_devices_to_group(group: str, serials: str | List[str], *, cx_retain_config: bool = False) Response

Move devices to a group.

Parameters:
  • group (str) – Group Name to move device to.

  • serials (str | List[str]) – Serial numbers of devices to be added to group.

  • cx_retain_config (bool, optional) – whether or not to retain the existing config on a CX switch (as device level override) during move. defaults to False.

Returns:

CentralAPI Response object

Return type:

Response

async preprovision_device_to_group(group: str, serials: str | List[str], tenant_id: str = None) Response

Pre Provision devices to group.

Parameters:
  • group (str) – Group name

  • serials (str | List[str]) – serial numbers

  • tenant_id (str) – Tenant id, (only applicable with MSP mode)

Returns:

CentralAPI Response object

Return type:

Response

async replace_ap_config(iden: str, clis: List[str]) Response

Replace AP Group or device 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:
  • iden (str) – Group name swarm id or serial # (AOS10 AP) Example: Retail or 6a5d123b1b77c828a085f04f… or USF7JSS9L1.

  • clis (List[str]) – Whole configuration List in CLI format.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

async replace_swarm_config(swarm_id: str, name: str, ip_address: str, timezone: Literal['none', 'International-Date-Line-West', 'Coordinated-Universal-Time-11', 'Hawaii', 'Alaska', 'Baja-California', 'Pacific-Time', 'Arizona', 'Chihuahua', 'La-Paz', 'Mazatlan', 'Mountain-Time', 'Central-America', 'Central-Time', 'Guadalajara', 'Mexico-City', 'Monterrey', 'Saskatchewan', 'Bogota', 'Lima', 'Quito', 'Eastern-Time', 'Indiana(East)', 'Caracas', 'Asuncion', 'Atlantic-Time(Canada)', 'Cuiaba', 'Georgetown', 'Manaus', 'San-Juan', 'Santiago', 'Newfoundland', 'Brasilia', 'Buenos-Aires', 'Cayenne', 'Fortaleza', 'Greenland', 'Montevideo', 'Salvador', 'Coordinated-Universal-Time-02', 'Mid-Atlantic', 'Azores', 'Cape-Verde-Is', 'Casablanca', 'Coordinated-Universal-Time', 'Dublin', 'Edinburgh', 'Lisbon', 'London', 'Monrovia', 'Reykjavik', 'Amsterdam', 'Berlin', 'Bern', 'Rome', 'Stockholm', 'Vienna', 'Belgrade', 'Bratislava', 'Budapest', 'Ljubljana', 'Prague', 'Brussels', 'Copenhagen', 'Madrid', 'Paris', 'Sarajevo', 'Skopje', 'Warsaw', 'Zagreb', 'West-Central-Africa', 'Windhoek', 'Amman', 'Athens', 'Bucharest', 'Beirut', 'Cairo', 'Damascus', 'East-Europe', 'Harare', 'Pretoria', 'Helsinki', 'Istanbul', 'Kyiv', 'Riga', 'Sofia', 'Tallinn', 'Vilnius', 'Jerusalem', 'Baghdad', 'Minsk', 'Kuwait', 'Riyadh', 'Nairobi', 'Tehran', 'Abu-Dhabi', 'Muscat', 'Baku', 'Moscow', 'St.Petersburg', 'Volgograd', 'Port-Louis', 'Tbilisi', 'Yerevan', 'Kabul', 'Islamabad', 'Karachi', 'Tashkent', 'Chennai', 'Kolkata', 'Mumbai', 'New-Delhi', 'Sri-Jayawardenepura', 'Kathmandu', 'Astana', 'Dhaka', 'Ekaterinburg', 'Yangon', 'Bangkok', 'Hanoi', 'Jakarta', 'Novosibirsk', 'Beijing', 'Chongqing', 'HongKong', 'Krasnoyarsk', 'Kuala-Lumpur', 'Perth', 'Singapore', 'Taipei', 'Urumqi', 'Ulaanbaatar', 'Irkutsk', 'Osaka', 'Sapporo', 'Tokyo', 'Seoul', 'Adelaide', 'Darwin', 'Brisbane', 'Canberra', 'Melbourne', 'Sydney', 'Guam', 'Port-Moresby', 'Hobart', 'Yakutsk', 'Solomon-Is.', 'New-Caledonia', 'Vladivostok', 'Auckland', 'Wellington', 'Coordinated-Universal-Time+12', 'Fiji', 'Magadan', 'Nukualofa', 'Samoa'], tz_offset_hr: int, tz_offset_min: int) Response

Update (replace) an existing swarm config. All values are required.

Parameters:
  • swarm_id (str) – swarm_id (guid) of Swarm. Example:6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f.

  • name (str) – The name of the Virtual Controller

  • ip_address (str) – ip_address

  • timezone (str) – timezone name.

  • tz_offset_hr (int) – timezone offset hours from UTC. Range value is -12 to 14.

  • tz_offset_min (int) – timezone offset mins from UTC. Range value is 0 to 60.

Returns:

CentralAPI Response object

Return type:

Response

async update_ap_altitude(iden: str = None, altitude: int | float = None, as_dict: Dict[str, int | float] = None) List[Response]

Set or Update gps ap-altitude at group or device level for APs (UI group).

Pulls existing config and adds or updates provided ap-altitude. Performs 2 API calls per AP.

Multiple APs can be provided using as_dict.

Parameters:
  • iden (str, optional) – Group name swarm id or serial # (AOS10 AP). Example: Retail or 6a5d123b1b77c828a085f04f… or USF7JSS9L1.

  • altitude (int | float, optional) – The AP installation height represented as meters from the ground. Note: Despite the CLI command being ap-altitude, it is not from sea level, it’s from the ground.

  • as_dict – (Dict[str, int | float], optional): A dict providing ap serial numbers and altitudes. i.e.: {“AP1serial”: ap1_altitude, AP2serial: ap2_altitude …}

Returns:

Returns a List of Response objects.

Return type:

List[Response]

async update_ap_banner(iden: str | list[str] = None, banner: str = None, as_dict: dict[str, str] = None) List[Response]

Set or Update ap motd banner at group or device level for APs (UI group).

Pulls existing config and adds or updates provided banner. Performs 2 API calls per AP.

If banner is the same, multiple APs/groups can be processed by sending a list for iden parameter. If banners are unique for each iden, multiple APs/Groups can be processed via as_dict parameter.

Parameters:
  • iden (str | list[str], optional) – Group name swarm id or serial # (AOS10 AP) or list of the same. Example: Retail or 6a5d123b1b77c828a085f04f… or USF7JSS9L1 or [‘USF7JSS9L1’, ‘USF7JSS9L2’].

  • banner (str, optional) – The banner text to be added at the AP or group level. Note: Despite the CLI command being ap-altitude, it is not from sea level, it’s from the ground.

  • as_dict – (dict[str, str], optional): A dict providing ap serial numbers and altitudes. i.e.: {“AP1serial”: “banner text”, “AP2serial”: “banner text” …}

Returns:

Returns a List of Response objects.

Return type:

List[Response]

async update_ap_settings(serial: str, hostname: str = None, 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.

Parameters:
  • serial (str) – AP Serial Number

  • hostname (str, optional) – 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:

Response

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:

Response

async update_device_template_variables(serial: str, mac: str, var_dict: dict, *, replace: bool = False) Response

Update template variables for a device.

Parameters:
  • serial (str) – Serial number of the device.

  • mac (str) – MAC address of the device.

  • var_dict (dict) – dict with variables to be updated

  • replace – (bool, optional): Replace all existing variables for the device with the payload provided defaults to False.

Returns:

CentralAPI Response object

Return type:

Response

async update_existing_template(group: str, name: str, payload: str = None, template: Path | str | bytes = None, device_type: Literal['ap', 'cx', 'sw', 'gw', 'sdwan'] = 'ap', version: str = 'ALL', model: str = 'ALL') 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) Defaults to “ap”

  • version (str, optional) – Firmware version property of template. Example: ALL, 6.5.4 etc. Defaults to “ALL”.

  • 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. Defaults to “ALL”.

  • template (Path | str | bytes, 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) – template data passed as str. One of template or payload is required.

Returns:

CentralAPI Response object

Return type:

Response

async update_group_cp_cert(group: str | List[str] = None, cp_cert_md5: str = None, as_dict: Dict[str, str] = None) List[Response]

Update cp-cert-checksum at group level for APs (UI group).

Pulls existing config andupdates with provided cp-cert-checksum. Performs 2 API calls per AP.

Multiple APs can be provided using as_dict.

Parameters:
  • group (str | List[str], optional) – Group name, must be an AP group.

  • cp_cert_md5 (str | float, optional) – The Captive Portal Certificate md5 checksum.

  • as_dict – (Dict[str, int | float], optional): A dict providing group names and cp cert md5 checksums i.e.: {“ap-group1”: cp-cert-md5-checksum-goes-here, ap-group2: cp-cert-md5-checksum-goes-here …} if the checksums are all the same just use group and and cp_cert_md5 arguments as group can take a list.

Returns:

Returns a List of Response objects.

Return type:

List[Response]

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:

Response

async update_group_properties(group: str, allowed_types: 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

Returns:

CentralAPI Response object

Return type:

Response

async update_per_ap_settings(serial: str = None, hostname: str = None, ip: str = None, mask: str = None, gateway: str = None, dns: str | List[str] = None, domain: str = None, swarm_mode: str = None, radio_24_mode: str = None, radio_5_mode: str = None, radio_6_mode: str = None, radio_24_disable: bool = None, radio_5_disable: bool = None, radio_6_disable: bool = None, uplink_vlan: int = None, zone: str = None, dynamic_ant_mode: DynamicAntenna = None, flex_dual_exclude: RadioType = None, ant_24_gain: int = None, ant_5_gain: int = None, ant_6_gain: int = None, as_dict: Dict[str, Dict[str | int | List[str] | bool | DynamicAntenna | RadioType]] = None) List[Response]

Update per AP settings (AP ENV)

This method performs 2 API calls, the first to pull the existing config, the second to update the config based on the updates provided.

model is needed if disabling 2.4 or 5Ghz radios to determine if AP uses old format: dot11g-radio-disable or newer: radio-1-disable Sending the wrong one has no impact, sending both results in Central showing unsynchronized

as_list can be provided with params for multiple APs.

async update_wlan(scope: str, wlan_name: str, essid: str = None, type: str = None, hide_ssid: bool = None, vlan: str = None, zone: str = None, wpa_passphrase: str = None, is_locked: bool = None, captive_profile_name: str = None, bandwidth_limit_up: str = None, bandwidth_limit_down: str = None, bandwidth_limit_peruser_up: str = None, bandwidth_limit_peruser_down: str = None, access_rules: list = None) Response

Update an existing WLAN and clean up unsupported fields.

Parameters:
  • scope (str) – Group name of the group or guid of the swarm or serial number of 10x AP. Example:Group_1 or 6a5d123b01f9441806244ea6e023fab5841b77c828a085f04f or CNF7JSS9L1.

  • 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:

Response

async upload_certificate(passphrase: str = '', cert_file: str | Path = None, cert_name: str = None, cert_format: CertFormat = 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:

Response

centralcli.classic.api.monitoring module

class centralcli.classic.api.monitoring.MonitoringAPI(session: Session)

Bases: object

async delete_ap(serial: str) Response

Delete AP.

Parameters:

serial (str) – Serial Number of AP to be deleted

Returns:

CentralAPI Response object

Return type:

Response

async delete_gateway(serial: str) Response

Delete Gateway.

Parameters:

serial (str) – Serial Number of Gateway to be deleted

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

async delete_switch(serial: str) Response

Delete Switch.

Parameters:

serial (str) – Serial number of switch to be deleted

Returns:

CentralAPI Response object

Return type:

Response

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, client_status: Literal['FAILED_TO_CONNECT', 'CONNECTED'] = 'CONNECTED', past: str = '3H', offset: int = 0, limit: int = 1000) Response

Get All 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.

  • client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional) – Return clients that are connected, or clients that have failed to connect. Defaults to CONNECTED.

  • past – (str, optional): Time-range to show client details for where 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H

  • 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:

Response

async get_all_devices(dev_types: Literal['ap', 'gw', 'switch', 'sdwan'] | list[Literal['ap', 'gw', 'switch', 'sdwan']] = None, *, group: str = None, site: str = None, label: str = None, serial: str = None, mac: str = None, model: str = None, stack_id: str = None, swarm_id: str = None, cluster_id: str = None, public_ip_address: str = None, status: Literal['up', 'down'] = None, show_resource_details: bool = True, calculate_client_count: bool = True, calculate_ssid_count: bool = False, fields: list = None, offset: int = 0, limit: int = 1000, cache: bool = False) CombinedResponse | list[Response]

Get all devices from Aruba Central.

Parameters:
  • dev_types (Literal['ap', 'gw', 'cx', 'sw', 'sdwan', 'switch'], optional) – Device Types to fetch. Defaults to None (all types).

  • group (str, optional) – Filter by devices in a Group. Defaults to None.

  • site (str, optional) – Filter by devices in a Site. Defaults to None.

  • label (str, optional) – Filter by devices with a label assigned. Defaults to None.

  • serial (str, optional) – Filter by Serial. Defaults to None.

  • mac (str, optional) – Filter by mac. Defaults to None.

  • model (str, optional) – Filter by model. Defaults to None.

  • stack_id (str, optional) – Filter by stack id (switches). Defaults to None.

  • swarm_id (str, optional) – Filter by swarm id (APs). Defaults to None.

  • cluster_id (str, optional) – Filter by cluster id. Defaults to None.

  • public_ip_address (str, optional) – Filter by public ip. Defaults to None.

  • status (constants.DeviceStatus, optional) – Filter by status. Defaults to None.

  • show_resource_details (bool, optional) – Show device resource utilization details. Defaults to True.

  • calculate_client_count (bool, optional) – Calculate client count. Defaults to True.

  • calculate_ssid_count (bool, optional) – Calculate SSID count. Defaults to False.

  • fields (list, optional) – fields to return. Defaults to None.

  • offset (int, optional) – pagination offset. Defaults to 0.

  • limit (int, optional) – pagination limit max 1000. Defaults to 1000.

  • cache (bool, optional) – Indicates if response will be used to update cache.

Returns:

CombinedResponse object.

Return type:

CombinedResponse

async get_aps_bandwidth_usage(serial: str = None, group: str = None, site: str = None, label: str = None, swarm_id: str = None, cluster_id: str = None, band: str = None, radio_number: int = None, network: str = None, ethernet_interface_index: int = None, interval: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = None) Response

AP Bandwidth Usage.

Parameters:
  • serial (str, optional) – Filter by AP serial

  • group (str, optional) – Filter by group name

  • site (str, optional) – Filter by Site name

  • label (str, optional) – Filter by Label name

  • swarm_id (str, optional) – Filter by Swarm ID. Field supported for AP clients only

  • cluster_id (str, optional) – Filter by Mobility Controller serial number

  • band (str, optional) – Filter by band (2.4, 5 or 6). Valid only when serial parameter is specified.

  • radio_number (int, optional) – Filter by radio_number (0, 1 or 2). Valid only when serial parameter is specified.

  • network (str, optional) – Filter by network name. Valid only when serial parameter is specified.

  • ethernet_interface_index (int, optional) – Filter by ethernet interface index. Valid only when serial parameter is specified. Valid range is 0-3.

  • interval (str, optional) – Filter by interval (5minutes or 1hour or 1day or 1week). API endpoint defaults to 5minutes when no value is provided.

  • from_time (int | float | datetime, optional) – Need information from this timestamp. Timestamp is epoch in seconds. Default is current timestamp minus 3 hours

  • to_time (int | float | datetime, optional) – Need information to this timestamp. Timestamp is epoch in seconds. Default is current timestamp

Returns:

CentralAPI Response object

Return type:

Response

async get_bssids(group: str = None, swarm_id: str = None, label: str = None, site: str = None, serial: str = None, mac: str = None, cluster_id: str = 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

  • mac (str, optional) – Filter by AP MAC address

  • cluster_id (str, optional) – Filter by Mobility Controller serial number

  • 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. Max is 1000 Defaults to 1000.

Returns:

CentralAPI Response object

Return type:

Response

async get_client_details(mac: Mac) Response

Get Client Details.

Parameters:

mac (utils.Mac) – MAC address of the Wireless Client to be queried API will return results matching a partial Mac

Returns:

CentralAPI Response object

Return type:

Response

async get_client_roaming_history(mac: str, calculate_total: bool = None, from_time: int | float | datetime = None, to_time: int | float | datetime = None, offset: int = 0, limit: int = 100) Response

Wireless Client Mobility Trail.

Parameters:
  • mac (str) – MAC address of the Wireless Client to be queried

  • calculate_total (bool, optional) – Whether to calculate total transitions

  • from_time (int | float | datetime, optional) – Collect roaming history from this starting point. Default is now minus 3 hours.

  • to_time (int | float | datetime, optional) – End of time-range to collect roaming history for. Default is now.

  • 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:

Response

async get_clients(client_type: Literal['wired', 'wireless', 'all'] = None, 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, client_status: Literal['FAILED_TO_CONNECT', 'CONNECTED'] = 'CONNECTED', past: str = '3H', offset: int = 0, limit: int = 1000) Response

Get Clients details.

Parameters:
  • client_type (Literal['wired', 'wireless', 'all'], optional) – Client type to retrieve. Defaults to None. if not provided all client types will be returned, unless a filter specific to a client type is specified. i.e. providing band will result in WLAN clients.

  • 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.

  • client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional) – Return clients that are connected, or clients that have failed to connect. Defaults to CONNECTED.

  • past – (str, optional): Time-range to show client details for. Format: 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H

  • 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:

Response

async get_clients_bandwidth_usage(group: str = None, swarm_id: str = None, label: str = None, cluster_id: str = None, stack_id: str = None, serial: str = None, mac: str = None, from_time: int = None, to_time: int = None) Response

Client Bandwidth Usage.

Parameters:
  • group (str, optional) – Filter by group name

  • swarm_id (str, optional) – Filter by Swarm ID. Field supported for AP clients only

  • label (str, optional) – Filter by Label name

  • cluster_id (str, optional) – Filter by Mobility Controller serial number

  • stack_id (str, optional) – Filter by Switch stack_id

  • serial (str, optional) – Filter by switch serial

  • mac (str, optional) – Filter by Client mac

  • 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

Returns:

CentralAPI Response object

Return type:

Response

async get_cx_switch_neighbors(serial: str) Response

Get lldp device neighbor info for CX switch.

If used on AOS-SW will only return neighbors that are CX switches For a stack this will return neighbors for the individual member use get_cx_switch_stack_neighbors to get neighbors for entire stack

Parameters:

serial (str) – id of the switch

Returns:

CentralAPI Response object

Return type:

Response

async get_cx_switch_stack_neighbors(stack_id: str) Response

Get lldp device neighbor info for CX switch stack.

Parameters:

stack_id (str) – Filter by stack_id

Returns:

CentralAPI Response object

Return type:

Response

async get_dev_details(device_type: Literal['ap', 'gw', 'switch', 'sdwan'], serial: str) Response

Return Details for a given device

Parameters:
  • device_type (Literal["ap", "gw", "switch") – Type of devices to get

  • serial (str) – Serial number of Device

Returns:

CentralAPI Response object

Return type:

Response

async get_devices(device_type: Literal['ap', 'gw', 'switch', 'sdwan'], *, group: str = None, label: str = None, stack_id: str = None, swarm_id: str = None, serial: str = None, status: Literal['up', 'down'] = None, fields: list = None, show_resource_details: bool = False, cluster_id: str = None, model: str = None, calculate_client_count: bool = True, calculate_ssid_count: bool = False, mac: str = None, public_ip_address: str = None, site: str = None, offset: int = 0, limit: int = 1000) Response

Get Devices from Aruba Central API Gateway

Parameters:
  • device_type (Literal["ap", "gw", "switch") – 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.

  • mac (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:

Response

Raises:

ValueError – Raised if device_type is not valid.

async get_dhcp_clients(serial: str, reservation: bool = True, offset: int = 0, limit: int = 100) Response

Get DHCP Client information from Gateway.

Parameters:
  • serial (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:

Response

async get_dhcp_pools(serial: str) Response

Gateway DHCP Pools details.

Parameters:

serial (str) – Serial number of mobility controller to be queried

Returns:

CentralAPI Response object

Return type:

Response

async get_events(group: str = None, swarm_id: str = None, label: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = None, client_mac: str = None, bssid: str = None, device_mac: str = None, hostname: str = None, device_type: Literal['ap', 'gw', 'switch', 'client'] = None, sort: str = None, site: str = None, serial: str = None, level: str = None, event_description: str = None, event_type: str = None, fields: str = None, calculate_total: bool = True, offset: int = 0, limit: int = 1000, count: int = None) Response

Get device events

Endpoint allows a max of 10,000 records to be retrieved. The sum of offset + limit can not exceed 10,000

Parameters:
  • group (str, optional) – Filter by group name

  • swarm_id (str, optional) – Filter by Swarm ID

  • label (str, optional) – Filter by Label name

  • from_time – (int | float | datetime, optional): Start time of the event logs to retrieve. Default is current timestamp minus 3 hours.

  • to_time (int | float | datetime, optional) – End time of the event logs to retrieve. seconds. Default is current timestamp.

  • client_mac (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: ap, gw, switch, 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. Defaults to True.

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Default is 100 and max is 1000 Defaults to 1000.

  • count – Only return <count> results.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

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:

Response

async get_gw_tunnels(serial: str, timerange: TimeRange = '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:

Response

Gateway Uplink Bandwidth Usage.

Parameters:
  • serial (str) – Gateway serial

  • uplink_id (str, optional) – Filter by uplink ID.

  • interval (str, optional) – Filter by interval (5minutes or 1hour or 1day or 1week).

  • from_time (int | float | datetime, optional) – Need information from this timestamp. Timestamp is epoch in seconds. Default is current timestamp minus 3 hours

  • to_time (int | float | datetime, optional) – Need information to this timestamp. Timestamp is epoch in seconds. Default is current timestamp

Returns:

CentralAPI Response object

Return type:

Response

Gateway Uplink Details.

Parameters:
  • serial (str) – Serial number of gateway to be queried

  • timerange (str) – Time range for Uplink stats information. 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Valid Values: 3H, 1D, 1W, 1M, 3M

Returns:

CentralAPI Response object

Return type:

Response

async get_networks_bandwidth_usage(network: str, group: str = None, swarm_id: str = None, label: str = None, site: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = None) Response

WLAN Network Bandwidth usage.

Use get_wlans to fetch list of networks.

Parameters:
  • network (str) – Network name (ssid) to return usage for

  • group (str, optional) – Filter by group name

  • swarm_id (str, optional) – Filter by Swarm ID. Field supported for AP clients only

  • label (str, optional) – Filter by Label name

  • site (str, optional) – Filter by Site name

  • from_time (int | float | datetime, optional) – Need information from this timestamp. Timestamp is epoch in seconds. Default is current timestamp minus 3 hours

  • to_time (int | float | datetime, optional) – Need information to this timestamp. Timestamp is epoch in seconds. Default is current timestamp

Returns:

CentralAPI Response object

Return type:

Response

async get_swarm_details(swarm_id: str) Response

Swarm Details.

Parameters:

swarm_id (str) – Swarm ID

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

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 (CX Switch)

Returns:

CentralAPI Response object

Return type:

Response

async get_switch_ports(iden: str, slot: str = None, stack: bool = False, aos_sw: bool = False) Response

Switch Ports Details.

Parameters:
  • iden (str) – Serial number of switch to be queried or the stack_id if it’s a stack

  • slot (str, optional) – Slot name of the ports to be queried {For chassis type switches only}.

  • stack – (bool, optional) : Get details for stack vs individual switch (iden needs to be the stack_id) Defaults to False.

  • aos_sw (bool, optional) – Device is ArubaOS-Switch. Defaults to False (indicating CX switch)

Returns:

CentralAPI Response object

Return type:

Response

async get_switch_ports_bandwidth_usage(serial: str, switch_type: Literal['cx', 'sw'] = 'cx', from_time: int | float | datetime = None, to_time: int | float | datetime = None, port: str = None, show_uplink: bool = None) Response

Ports Bandwidth Usage for Switch.

Parameters:
  • serial (str) – Serial number of switch to be queried

  • switch_type – (Literal[“cx”, “sw”], optional) = switch type. Valid ‘cx’, ‘sw’. Defaults to ‘cx’

  • from (int | float | datetime, optional) – Need information from this timestamp. Timestamp is epoch in seconds. Default is current timestamp minus 3 hours

  • to (int | float | datetime, optional) – Need information to this timestamp. Timestamp is epoch in seconds. Default is current timestamp

  • port (str, optional) – Filter by Port

  • show_uplink (bool, optional) – Show usage for Uplink ports alone

Returns:

CentralAPI Response object

Return type:

Response

async get_switch_stack_details(stack_id: str) Response

Switch Stack Details.

Parameters:

stack_id (str) – Filter by Switch stack_id

Returns:

CentralAPI Response object

Return type:

Response

async get_switch_stacks(hostname: str = None, group: str = None, offset: int = 0, limit: int = 1000) 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 1000 and max is 1000.

Returns:

CentralAPI Response object

Return type:

Response

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 = True, aos_sw: bool = False, offset: int = 0, limit: int = 500) Response

Get vlan info for switch (CX and SW).

Parameters:
  • iden (str) – Serial Number or 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:

Response

async get_switch_vsx_detail(serial: str) Response

Get switch vsx info for CX switch.

Parameters:

serial (str) – Filter by switch serial

Returns:

CentralAPI Response object

Return type:

Response

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, client_status: Literal['FAILED_TO_CONNECT', 'CONNECTED'] = 'CONNECTED', past: str = '3H', 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

  • client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional) – Return clients that are connected, or clients that have failed to connect. Defaults to CONNECTED.

  • past – (str, optional): Time-range to show client details for where 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H

  • 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:

Response

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, client_status: Literal['FAILED_TO_CONNECT', 'CONNECTED'] = 'CONNECTED', past: str = '3H', 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

  • client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional) – Return clients that are connected, or clients that have failed to connect. Defaults to CONNECTED.

  • past – (str, optional): Time-range to show client details for where 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Default is 1000, max 1000.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

centralcli.classic.api.platform module

class centralcli.classic.api.platform.PlatformAPI(session: Session)

Bases: object

async add_devices(mac: str = None, serial: str = None, group: str = None, part_num: str = None, license: str | List[str] = None, subscription: str | List[str] = None, device_list: List[Dict[str, str]] = None) 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 and serial or device_list (which should contain a dict with mac serial) are required.

Parameters:
  • mac (str, optional) – MAC address of device to be added

  • serial (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) – Deprecated use subscription.

  • subscription (str|List(str), optional) – The subscription/license 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:

Response

async archive_devices(serials: List[str]) Response

Archive devices using Serial list.

Parameters:

serials (List[str]) – serials

Returns:

CentralAPI Response object

Return type:

Response

async assign_licenses(serials: str | List[str], services: 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.

Raises:

ValueError – When more the 50 serials are provided, which exceeds the max allowed by the API endpoint.

Returns:

CentralAPI Response object

Return type:

Response

async cop_delete_device_from_inventory(devices: List[str] = None) Response

Delete devices using Serial number. Only applies to CoP deployments.

Device can not be archived in CoP inventory.

Parameters:

devices (list, optional) – List of devices to be deleted from GreenLake inventory. Only applies to CoP

Returns:

CentralAPI Response object

Return type:

Response

async disable_auto_subscribe(services: 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:

Response

async enable_auto_subscribe(services: 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:

Response

async get_archived_devices(offset: int = 0, limit: int = 50) Response

Get Archived devices from device inventory.

Parameters:
  • offset (int, optional) – offset or page number Defaults to 0.

  • limit (int, optional) – Number of devices to get Defaults to 50 (which is also the max).

Returns:

CentralAPI Response object

Return type:

Response

async get_audit_logs(log_id: str = None, username: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = 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.

This API returns the first 10,000 results only.

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

  • from_time (int | float | datetime, optional) – Start time of the audit logs to retrieve.

  • to_time (int | float | datetime, optional) – End time of the audit logs to retrieve.

  • 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:

Response

async get_auto_subscribe() Response

Get the services which have auto subscribe enabled.

Returns:

CentralAPI Response object

Return type:

Response

async get_device_inventory(device_type: Literal['ap', 'gw', 'switch', 'all'] = None, offset: int = 0, limit: int = 1000) Response

Get devices from device inventory.

Parameters:
  • device_type (Literal['ap', 'gw', 'switch', 'all'], optional) – Device Type. Defaults to None = ‘all’ device types.

  • 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:

Response

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:

Response

async get_subscriptions(sub_type: str = None, device_type: constants.GenericDeviceTypes = None, offset: int = 0, limit: int = 1000) Response

Get user subscription keys.

Parameters:
  • suib_type (str, optional) – Subscription type. Supports Basic, Service Token and Multi Tier licensing types as well

  • device_type (str, optional) – Filter by device type (‘ap’, ‘gw’, or ‘switch’)

  • offset (int, optional) – offset or page number Defaults to 0.

  • limit (int, optional) – Number of subscriptions to get Defaults to 1000.

Returns:

CentralAPI Response object

Return type:

Response

async get_user_accounts(app_name: str = None, type: str = None, status: str = None, order_by: str = None, offset: int = 0, limit: int = 100) Response

List user accounts.

Parameters:
  • app_name (str, optional) – Appname nms to filter Aruba Central users, and account_setting to filter HPE GreenLake Edge to Cloud Platform (CCS) application users Valid Values: nms, account_setting

  • type (str, optional) – Filter based on system or federated user Valid Values: system, federated

  • status (str, optional) – Filter user based on status (inprogress, failed) Valid Values: inprogress, failed

  • order_by (str, optional) – Sort ordering (ascending or descending). +username signifies ascending order of username. Valid Values: +username, -username

  • offset (int, optional) – Zero based offset to start from Defaults to 0.

  • limit (int, optional) – Maximum number of items to return Defaults to 100.

Returns:

CentralAPI Response object

Return type:

Response

async get_valid_subscription_names(service_category: str = None, device_type: constants.GenericDeviceTypes = None) Response

Get Valid subscription names from Central.

Parameters:
  • service_category (str, optional) – Service category - dm/network

  • device_type (Literal['ap', 'gw', 'switch'], optional) – Device Type one of ap, gw, switch

Returns:

CentralAPI Response object

Return type:

Response

async unarchive_devices(serials: List[str]) Response

Unarchive devices using Serial list.

Parameters:

serials (List[str]) – serials

Returns:

CentralAPI Response object

Return type:

Response

async unassign_licenses(serials: str | List[str], services: 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.

Raises:

ValueError – When more the 50 serials are provided, which exceeds the max allowed by the API endpoint.

Returns:

CentralAPI Response object

Return type:

Response

async verify_device_addition(serial: str = None, mac: str = None, device_list: List[Dict[Literal['serial', 'mac'], str]] = []) Response

Verify Device Addition

Parameters:
  • serial (str, optional) – Serial Number of device to verify. Defaults to None.

  • mac (str, optional) – Mac Address of device to verify. Defaults to None.

  • device_list (List[Dict[Literal[, optional) – device_list list of dicts with “serial” and “mac” for each device to verify. Defaults to None.

Must provide serial and mac for each device either via keyword argument or list.

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.cloudauth module

class centralcli.classic.api.cloudauth.CloudAuthAPI(session: Session)

Bases: object

async add_named_mpsk(mpsk_id: str, name: str, role: str, enabled: bool = True) Response

Add a named MPSK config.

Parameters:
  • mpsk_id (str) – The MPSK configuration ID. This is the ID associated with the MPSK SSID.

  • name (str) – Name to identify the mpsk password with

  • role (str) – Aruba Role to be assigned to device connected using this MPSK password.

  • enabled (bool, optional) – Set to False to create but disable this named MPSK. Defaults to True (enabled)

Returns:

CentralAPI Response object

Return type:

Response

async delete_named_mpsk(mpsk_id: str, named_mpsk_id: str) Response

Delete a Named MPSK Config.

Parameters:
  • mpsk_id (str) – The ID associated with the MPSK SSID

  • named_mpsk_id (str) – The Named MPSK Config ID

Returns:

CentralAPI Response object

Return type:

Response

async download_mpsk_csv(ssid: str, filename: str = None, name: str = None, role: str = None, status: str = None, sort: str = None) Response

Fetch all Named MPSK as a CSV file.

Parameters:
  • ssid (str) – Configured MPSK SSID for which Named MPSKs are to be downloaded.

  • filename (str, optional) – Suggest a file name for the downloading file via content disposition header.

  • name (str, optional) – Filter by name of the named MPSK. Does a ‘contains’ match.

  • role (str, optional) – Filter by role of the named MPSK. Does an ‘equals’ match.

  • status (str, optional) – Filter by status of the named MPSK. Does an ‘equals’ match. Valid Values: enabled, disabled

  • sort (str, optional) – Sort order Valid Values: +name, -name, +role, -role, +status, -status

Returns:

CentralAPI Response object

Return type:

Response

async get_authentications(from_time: str = None, time_window: CloudAuthTimeWindow | TimeRange = None, airpass: bool = False, cursor: str = None, limit: int = 1000) Response

Fetch list of authentications using Cloud Identity or AirPass.

Parameters:
  • from_time (str, optional) – Integer value (1-90) followed by unit - one of d , h , m for day , hour , minute respectively; like 3h. This is ignored if Time Window is specified. Default to None, which results in “1h” if time_window is not provided.

  • time_window (CloudAuthTimeWindow | TimeRange, optional) – Set Time Window to include requests started in a specific time window. Valid Values: “3h”, “1d”, “1w”, “1M”, “3M”

  • airpass (bool, optional) – Set to true to fetch airpass authentications. Default is to fetch Cloud Identitiy authentications.

  • cursor (str | None, optional) – Pagination cursor. Should be None for first call. Use “cursor” in payload of previous call for subsequent calls to get the next page of results.

  • limit (int, optional) – Maximum number of authentication records to be returned. Allowed range is 1 to 1000. Defaults to 1000.

Returns:

CentralAPI Response object

Return type:

Response

async get_mpsk_networks() Response

Read all configured MPSK networks.

Returns:

CentralAPI Response object

Return type:

Response

async get_named_mpsk(mpsk_id: str, name: str = None, role: str = None, status: str = None, cursor: str = None, sort: str = None, limit: int = 100) Response

Get all named MPSK.

Parameters:
  • mpsk_id (str) – The MPSK configuration ID

  • name (str, optional) – Filter by name of the named MPSK. Does a ‘contains’ match.

  • role (str, optional) – Filter by role of the named MPSK. Does an ‘equals’ match.

  • status (str, optional) – Filter by status of the named MPSK. Does an ‘equals’ match. Valid Values: enabled, disabled

  • cursor (str, optional) – For cursor based pagination.

  • sort (str, optional) – Sort order Valid Values: +name, -name, +role, -role, +status, -status

  • limit (int, optional) – Number of items to be fetched Defaults to 100.

Returns:

CentralAPI Response object

Return type:

Response

async get_registered_macs(search: str = None, sort: str = None, filename: str = None) Response

Fetch all Mac Registrations as a CSV file.

Parameters:
  • search (str, optional) – Filter the Mac Registrations by Mac Address and Client Name. Does a ‘contains’ match.

  • sort (str, optional) – Sort order Valid Values: +name, -name, +display_name, -display_name

  • filename (str, optional) – Suggest a file name for the downloading file via content disposition header.

Returns:

CentralAPI Response object

Return type:

Response

async get_sessions(from_time: str = None, time_window: CloudAuthTimeWindow | TimeRange = None, airpass: bool = False, cursor: str = None, limit: int = 1000) Response

Fetch list of sessions using Cloud Identity or AirPass.

Parameters:
  • from_time (str, optional) – Integer value (1-90) followed by unit - one of d , h , m for day , hour , minute respectively; like 3h. This is ignored if Time Window is specified. Default to None, which results in “1h” if time_window is not provided.

  • time_window (CloudAuthTimeWindow | TimeRange, optional) – Set Time Window to include requests started in a specific time window. Valid Values: “3h”, “1d”, “1w”, “1M”, “3M”

  • airpass (bool, optional) – Set to true to fetch airpass sessions. Default is to fetch Cloud Identitiy sessions.

  • cursor (str | None, optional) – Pagination cursor. Should be None for first call. Use “cursor” in payload of previous call for subsequent calls to get the next page of results.

  • limit (int, optional) – Maximum number of authentication records to be returned. Allowed range is 1 to 1000. Defaults to 1000.

Returns:

CentralAPI Response object

Return type:

Response

async get_upload_status(upload_type: CloudAuthUploadTypes, ssid: str = None) Response

Get upload status of last file upload.

Parameters:
  • upload_type (CloudAuthUploadType) – Type of file upload Valid Values: mpsk, mac

  • ssid (str, optional) – MPSK network SSID, required if {upload_type} = ‘mpsk’

Returns:

CentralAPI Response object

Return type:

Response

async update_named_mpsk(mpsk_id: str, named_mpsk_id: str, mpsk: str = None, name: str = None, role: str = None, enabled: bool = None, reset: bool = False) Response

Partially Edit a Named MPSK Config.

Parameters:
  • mpsk_id (str) – The MPSK configuration ID

  • named_mpsk_id (str) – The Named MPSK Config ID

  • mpsk (str) – The password to be used to connect.

  • name (str) – Name to identify the mpsk password with

  • role (str) – Aruba Role to be assigned to device connected using this MPSK password.

  • enable (bool, optional) – set True to enbable the MPSK, False to disable it. Defaults to None (No change)

  • reset (bool, optional) – If true, a new MPSK password is generated for this named MPSK config.

Returns:

CentralAPI Response object

Return type:

Response

async upload(upload_type: CloudAuthUploadTypes, file: Path | str, ssid: str = None) Response

Upload file.

Parameters:
  • upload_type (CloudAuthUploadType) – Type of file upload Valid Values: mpsk, mac

  • file (Path | str) – The csv file to upload

  • ssid (str, optional) – The MPSK network (SSID), required if {upload_type} = ‘mpsk’

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.cloudauth.parse_time_window(time_window: CloudAuthTimeWindow | TimeRange) str
centralcli.classic.api.cloudauth.parse_time_window(time_window: None) None

Common helper to parse CLI time_window option and return format expected by cloud-auth

Parameters:

time_window (CloudAuthTimeWindow | TimeRange | None) – time_window TimeRange enum or str like 3M where M=Months, w=weeks, d=days, h=hours, m=minutes. Valid windows: “3h”, “1d”, “1w”, “1M”, “3M”

Returns:

returns time window in format required by cloud-auth API endpoints.

Return type:

str

Raises:

ValueError if time window is invalid.

centralcli.classic.api.guest module

class centralcli.classic.api.guest.GuestAPI(session: Session)

Bases: object

async add_guest(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: 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:

Response

async delete_guest(portal_id: str, guest_id: str) Response

Delete guest visitor account.

Parameters:
  • portal_id (str) – Portal ID of the splash page

  • guest_id (str) – ID of Guest associated with the portal

Returns:

CentralAPI Response object

Return type:

Response

async delete_portal_profile(portal_id: str) Response

Delete guest portal profile.

Parameters:

portal_id (str) – Portal ID of the splash page

Returns:

CentralAPI Response object

Return type:

Response

async get_guest_summary(ssids: list[str] | str, days: int = 28) Response

Get summary statistics.

Parameters:
  • ssid (str) – A comma separated list of SSIDs for which session data is required

  • days (optional, int) – Num of days for which session data is required Valid Values: 1, 7, 28 Default: 28

Raises:

ValueError – If days is not valid (1, 7, 28).

Returns:

CentralAPI Response object

Return type:

Response

async get_guests(portal_id: str, sort: str = '+name', filter_by: str = None, filter_value: str = None, offset: int = 0, limit: int = 100) Response

Get all guests created against a portal.

Parameters:
  • portal_id (str) – Portal ID of the splash page

  • sort (str, optional) –

    • is for ascending and - for descending order, Valid Values: ‘+name’, ‘-name’. Defaults to +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:

Response

async get_portal_profile(portal_id: str) Response

Get guest portal profile.

Parameters:

portal_id (str) – Portal ID of the splash page

Returns:

CentralAPI Response object

Return type:

Response

async get_portals(sort: str = None, offset: int = 0, limit: int = 100) Response

Get all portals with limited data.

Parameters:
  • sort (str, optional) – + is for ascending and - for descending order, Valid Values: name prepended with + or - i.e. +name. Defaults to None. Which results in use of API default +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:

Response

async update_guest(portal_id: str, visitor_id: str, name: str, company_name: str = None, phone: str = None, email: str = None, is_enabled: bool = None, valid_till_no_limit: bool = None, valid_till_days: int = None, valid_till_hours: int = None, valid_till_minutes: int = None, notify: bool = None, notify_to: Literal['email', 'phone'] = None, password: str = None) Response

Update guest visitor account.

All options need to be provided, this replaces current data for the guest.

Parameters:
  • portal_id (str) – Portal ID of the splash page

  • visitor_id (str) – Visitor ID of the portal

  • name (str) – Visitor account name

  • 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

  • is_enabled (bool) – Enable or disable the visitor account

  • valid_till_no_limit (bool) – Visitor account will not expire when this is set to true

  • valid_till_days (int) – Account validity in days

  • valid_till_hours (int) – Account validity in hours

  • valid_till_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

  • password (str) – Password

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.troubleshooting module

class centralcli.classic.api.troubleshooting.TroubleShootingAPI(session: Session)

Bases: object

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:

Response

async get_ts_commands(device_type: constants.DeviceTypes) Response

List Troubleshooting Commands.

Parameters:

device_type (Literal['ap', 'cx', 'sw', 'gw']) – Device Type.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

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:

Response

async start_ts_session(serial: str, device_type: constants.DeviceTypes, commands: int | dict | list[int, dict]) Response

Start Troubleshooting Session.

Parameters:
  • serial (str) – Serial of device

  • device_type (Literal['ap', 'cx', 'sw', 'gw']) – Device Type.

  • 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:

Response

centralcli.classic.api.device_management module

class centralcli.classic.api.device_management.DeviceManagementAPI(session: Session)

Bases: object

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:

Response

async kick_users(serial: str = None, *, kick_all: bool = False, mac: str = None, ssid: str = None) Response
async run_speedtest(serial: str, host: str = 'ndt-iupui-mlab1-den04.mlab-oti.measurement-lab.org', options: str = None) Response

Run speedtest from device (gateway only)

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:

Response

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:

Response

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) list[Response]

Generic commands for device.

Supported Commands (str):
  • reboot: supported by AP/gateways/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:

Response

async send_command_to_swarm(swarm_id: str, command: Literal['reboot', '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’, ‘erase_configuration’

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.routing module

class centralcli.classic.api.routing.RoutingAPI(session: Session)

Bases: object

async get_device_ip_routes(serial: str, api: str = 'V1', marker: str = None, limit: int = 100) Response

Get routes for a device.

Parameters:
  • serial (str) – Device serial number

  • api (str, optional) – API version (V0|V1), Defaults to V1.

  • marker (str, optional) – Pagination offset.

  • limit (int, optional) – page size Defaults to 100.

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

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:

Response

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:

Response

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:

Response

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:

Response

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:

Response

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:

Response

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:

Response

async reset_overlay_connection(device: str) Response

Reset overlay control connection.

Parameters:

device (str) – Device serial number

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.rapids module

class centralcli.classic.api.rapids.RapidsAPI(session: Session)

Bases: object

async wids_get_all(group: List[str] = None, label: List[str] = None, site: List[str] = None, swarm_id: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = 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

  • swarm_id (str, optional) – Filter by Swarm ID

  • from_time (int | float | datetime, optional) – Start of timerange to collect data for. Default is now minus 3 hours

  • to_time (int | float | datetime, optional) – End of timerange to collect data for. Default is current time.

  • 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:

Response

async wids_get_interfering_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, swarm_id: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = 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

  • swarm_id (str, optional) – Filter by Swarm ID

  • from_time (int | float | datetime, optional) – Start of timerange to collect data for. Default is now minus 3 hours

  • to_time (int | float | datetime, optional) – End of timerange to collect data for. Default is current time.

  • 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:

Response

async wids_get_neighbor_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, swarm_id: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = 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

  • swarm_id (str, optional) – Filter by Swarm ID

  • from_time (int | float | datetime, optional) – Start of timerange to collect data for. Default is now minus 3 hours

  • to_time (int | float | datetime, optional) – End of timerange to collect data for. Default is current time.

  • 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:

Response

async wids_get_rogue_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, swarm_id: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = 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

  • swarm_id (str, optional) – Filter by Swarm ID

  • from_time (int | float | datetime, optional) – Start of timerange to collect data for. Default is now minus 3 hours

  • to_time (int | float | datetime, optional) – End of timerange to collect data for. Default is current time.

  • 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:

Response

async wids_get_suspect_aps(group: List[str] = None, label: List[str] = None, site: List[str] = None, swarm_id: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = 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

  • swarm_id (str, optional) – Filter by Swarm ID

  • from_time (int | float | datetime, optional) – Start of timerange to collect data for. Default is now minus 3 hours

  • to_time (int | float | datetime, optional) – End of timerange to collect data for. Default is current time.

  • 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:

Response

centralcli.classic.api.central module

class centralcli.classic.api.central.CentralAPI(session: Session)

Bases: object

async add_webhook(name: str, urls: str | list[str]) Response

Add / update Webhook.

Parameters:
  • name (str) – name of the webhook

  • urls (str | list[str]) – List of webhook urls

Returns:

CentralAPI Response object

Return type:

Response

async assign_label_to_devices(label_id: int, serials: str | list[str], device_type: constants.GenericDeviceTypes) Response

Associate Label to a list of devices.

Parameters:
  • label_id (int) – Label ID

  • serials (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.

  • device_type (str) – Device type. Valid Values: ap, gw, switch

Returns:

CentralAPI Response object

Return type:

Response

async central_acknowledge_notifications(notification_ids: list[str] | str) Response

Acknowledge Notifications by List of Notification IDs.

Parameters:

NoName (list[str] | str) – Notification IDs to Acknowledge

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

async create_site(site_name: str = None, address: str = None, city: str = None, state: str = None, country: str = None, zipcode: int | str = None, latitude: float = None, longitude: float = None) Response

Create Site

Either address information or GeoLocation information (latitude, longitude) is required.

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 (int | str, optional) – Zipcode. Defaults to None.

  • latitude (float, optional) – Latitude (in the range of -90 and 90). Defaults to None.

  • longitude (float, optional) – Longitude (in the range of -100 and 180). Defaults to None.

Returns:

CentralAPI Response object

Return type:

Response

async delete_label(label_id: int) Response

Delete Label.

Parameters:

label_id (int) – Label ID

Returns:

CentralAPI Response object

Return type:

Response

async delete_site(site_ids: int | list[int]) list[Response]

Delete Site(s).

Parameters:

site_id (int|list[int]) – Either the site_id or a list of site_ids to be deleted.

Returns:

A List of CentralAPI Response objects

Return type:

list[Response]

async delete_webhook(wid: str) Response

Delete Webhooks.

Parameters:

wid (str) – id of the webhook

Returns:

CentralAPI Response object

Return type:

Response

async get_alerts(customer_id: str = None, group: str = None, label: str = None, serial: str = None, site: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = 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_time (int | float | datetime, optional) – start of duration within which alerts are raised Default now - 1 day (max 90) (API endpoint default is 30 days)

  • to_time (int | float | datetime, optional) – end of duration within which alerts are raised Default now.

  • 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:

Response

async get_all_sites(calculate_total: bool = False, sort: str = None, offset: int = 0, limit: int = 1000) Response

List Sites.

Parameters:
  • calculate_total (bool, optional) – Whether to calculate total Site Labels

  • sort (str, optional) – Sort parameter may be one of +site_name, -site_name. Default is +site_name

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 1000 Defaults to 1000 (max).

Returns:

CentralAPI Response object

Return type:

Response

async get_all_webhooks() Response

List all defined webhooks.

Returns:

CentralAPI Response object

Return type:

Response

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. Max is 1000. Defaults to 100.

Returns:

CentralAPI Response object

Return type:

Response

async 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:

Response

async get_site_details(site_id: int) Response

Site details.

Parameters:

site_id (int) – Site ID

Returns:

CentralAPI Response object

Return type:

Response

async move_devices_to_site(site_id: int, serials: str | list[str], device_type: constants.GenericDeviceTypes) Response

Associate list of devices to a site.

Parameters:
  • site_id (int) – Site ID

  • device_type (str) – Device type. Valid Values: ap, gw switch

  • serials (str | 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:

Response

async refresh_webhook_token(wid: str) Response

Refresh the webhook token.

Parameters:

wid (str) – id of the webhook

Returns:

CentralAPI Response object

Return type:

Response

async remove_devices_from_site(site_id: int, serials: str | list[str], device_type: constants.GenericDeviceTypes) Response

Remove a list of devices from a site.

Parameters:
  • site_id (int) – Site ID

  • serials (str | 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.

  • device_type (Literal['ap', 'gw', 'switch']) – Device type. Valid Values: ap, gw, switch.

Returns:

CentralAPI Response object

Return type:

Response

async remove_label_from_devices(label_id: int, serials: str | list[str], device_type: constants.GenericDeviceTypes) Response

unassign a label from a list of devices.

Parameters:
  • label_id (int) – Label ID

  • serials (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.

  • device_type (Literal['ap', 'gw', 'switch']) – Device type. Valid Values: ap, gw, switch.

Returns:

CentralAPI Response object

Return type:

Response

async test_webhook(wid: str) Response

Test for webhook notification.

Parameters:

wid (str) – id of the webhook

Returns:

CentralAPI Response object

Return type:

Response

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.

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:

Response

async update_webhook(wid: str, name: str, urls: str | list[str]) Response

Update webhook settings.

Parameters:
  • wid (str) – id of the webhook

  • name (str) – name of the webhook

  • urls (str | list[str]) – List of webhook urls

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.firmware module

class centralcli.classic.api.firmware.FirmwareAPI(session: Session)

Bases: object

async cancel_upgrade(device_type: constants.DeviceTypes = None, serial: str = None, swarm_id: str = None, group: str = None) Response

Cancel scheduled firmware upgrade.

You can only specify one of device_type, swarm_id or serial parameters

Parameters:
  • device_type (Literal['ap', 'gw', 'cx', 'sw'], optional) – Specify one of “cx|sw|ap|gw (sw = aos-sw)”

  • serial (str, optional) – Serial of device

  • swarm_id (str) – Swarm ID

  • group (str) – Specify Group Name to cancel upgrade for devices in that group

Returns:

CentralAPI Response object

Return type:

Response

async check_firmware_available(device_type: constants.DeviceTypes, firmware_version: str) Response

Firmware Version.

Parameters:
  • device_type (str) – Specify one of “cx”, “sw”, “ap”, “gw”

  • firmware_version (str) – firmware version

Returns:

CentralAPI Response object

Return type:

Response

async delete_firmware_compliance(device_type: constants.DeviceTypes, 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:

Response

async get_all_swarms_firmware_details(group: str = None, offset: int = 0, limit: int = 100) Response

List Firmware Details of all Swarms.

Parameters:
  • group (str, optional) – Group name

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Default is 20 and max is 1000 Defaults to 100.

Returns:

CentralAPI Response object

Return type:

Response

async get_device_firmware_details(serial: str) Response

Firmware Details of Device.

Parameters:

serial (str) – Serial of the device for which the firmware detail to be queried

Returns:

CentralAPI Response object

Return type:

Response

async get_device_firmware_details_by_type(device_type: Literal['mas', 'cx', 'sw', 'gw', 'ap'], group: str = None, offset: int = 0, limit: int = 500) Response

List Firmware Details by type for switches or gateways (Not valid for APs).

Parameters:
  • device_type (str) – Specify one of “mas|sw|cx|gw|ap”

  • group (str, optional) – Group name

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. max 1000, Defaults to 500.

Returns:

CentralAPI Response object

Return type:

Response

Raises:

ValueError – if device_type is not valid/supported by API endpoint.

async get_firmware_compliance(device_type: constants.DeviceTypes, 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:

Response

async get_firmware_version_list(device_type: constants.DeviceTypes = None, swarm_id: str = None, serial: str = None) Response

List Firmware Version.

Provide one and only one of the following.

Parameters:
  • device_type (str, optional) – Specify one of ap, gw, sw, cx

  • swarm_id (str, optional) – Swarm ID

  • serial (str, optional) – Serial of device

Returns:

CentralAPI Response object

Return type:

Response

async get_swarm_firmware_details(swarm_id: str) Response

Firmware Details of Swarm or AOS10 AP.

Parameters:

swarm_id (str) – Swarm ID for which the firmware detail to be queried AOS10 APs provide serial as swarm_id

Returns:

CentralAPI Response object

Return type:

Response

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:

Response

async set_firmware_compliance(device_type: constants.DeviceTypes, 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:

Response

async upgrade_firmware(scheduled_at: int | dt = None, swarm_id: str = None, serial: str = None, group: str = None, device_type: constants.DeviceTypes = None, firmware_version: str = None, model: str = None, reboot: bool = False, forced: 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 | datetime, 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 (Literal["ap", "gw", "cx", "sw"]) – 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.

  • forced (bool, optional) – Use True for forcing the upgrade of a gateway which is part of a cluster. Defaults to False.

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.visualrf module

class centralcli.classic.api.visualrf.VisualRFAPI(session: Session)

Bases: object

async get_all_campuses(offset: int = 0, limit: int = 100) Response

Get list of all campuses.

Parameters:
  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

Returns:

CentralAPI Response object

Return type:

Response

async get_ap_location(ap_id: str, offset: int = 0, limit: int = 100, units: str = 'FEET') Response

Get location of a specific access point.

ap_id is not the serial number. Use get_aps_for_floor to retrieve id.

Parameters:
  • ap_id (str) – Provide ap_id returned by /visualrf_api/v1/floor/{floor_id}/access_point_location api. Example: /visualrf_api/v1/access_point_location/201610193176__B4:5D:50:C5:DA:5A

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

  • units (str, optional) – Valid Values: ‘METERS’, ‘FEET’. Defaults to ‘FEET’

Returns:

CentralAPI Response object

Return type:

Response

async get_aps_for_floor(floor_id: str, offset: int = 0, limit: int = 100, units: str = 'FEET') Response

Get a specific floor and location of all its access points.

Parameters:
  • floor_id (str) – Provide floor_id returned by /visualrf_api/v1/building/{building_id api. Example: /visualrf_api/v1/floor/201610193176__39295d71-fac8-4837-8a91-c1798b51a2ad

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

  • units (str, optional) – Valid Values: ‘METERS’, ‘FEET’. Defaults to ‘FEET’

Returns:

CentralAPI Response object

Return type:

Response

async get_buildings_for_campus(campus_id: str, offset: int = 0, limit: int = 100) Response

Get a specific campus and its buildings.

Parameters:
  • campus_id (str) – Provide campus_id returned by /visualrf_api/v1/campus api. Example: /visualrf_api/v1/campus/201610193176__1b99400c-f5bd-4a17-9a1c-87da89941381

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

Returns:

CentralAPI Response object

Return type:

Response

async get_client_location(macaddr: str, offset: int = 0, limit: int = 100, units: str = 'FEET') Response

Get location of a specific client.

Parameters:
  • macaddr (str) – Provide a macaddr returned by /visualrf_api/v1/floor/{floor_id}/…_location api. Example: /visualrf_api/v1/client_location/ac:37:43:a9:ec:10

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

  • units (str, optional) – Valid Values: ‘METERS’, ‘FEET’. Defaults to ‘FEET’

Returns:

CentralAPI Response object

Return type:

Response

async get_clients_for_floor(floor_id: str, offset: int = 0, limit: int = 100, units: str = 'FEET') Response

Get a specific floor and location of all its clients.

Parameters:
  • floor_id (str) – Provide floor_id returned by /visualrf_api/v1/building/{building_id api. Example: /visualrf_api/v1/floor/201610193176__39295d71-fac8-4837-8a91-c1798b51a2ad

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

  • units (str, optional) – Valid Values: ‘METERS’, ‘FEET’. Defaults to ‘FEET’

Returns:

CentralAPI Response object

Return type:

Response

async get_floor_details(floor_id: str, offset: int = 0, limit: int = 100, units: str = 'FEET') Response

Get details of a specific floor.

Same as response for get_floors_for_building, for a single floor.

Parameters:
  • floor_id (str) – Provide floor_id returned by /visualrf_api/v1/building/{building_id api. Example: /visualrf_api/v1/floor/201610193176__39295d71-fac8-4837-8a91-c1798b51a2ad

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

  • units (str, optional) – Valid Values: ‘METERS’, ‘FEET’. Defaults to ‘FEET’

Returns:

CentralAPI Response object

Return type:

Response

async get_floors_for_building(building_id: str, offset: int = 0, limit: int = 100, units: str = 'FEET') Response

Get a specific building and its floors.

Parameters:
  • building_id (str) – Provide building_id returned by /visualrf_api/v1/campus/{campus_id} api. Example: /visualrf_api/v1/building/201610193176__f2267635-d1b5-4e33-be9b-2bf7dbd6f885

  • offset (int, optional) – Pagination offset Defaults to 0.

  • limit (int, optional) – Pagination limit. Max is 100 Defaults to 100 (max).

  • units (str, optional) – Valid Values: ‘METERS’, ‘FEET’. Defaults to ‘FEET’

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.topology module

class centralcli.classic.api.topology.TopologyAPI(session: Session)

Bases: object

async get_ap_lldp_neighbor(serial: str) Response

Get neighbor details reported by AP via LLDP.

Parameters:

serial (str) – Device serial number.

Returns:

CentralAPI Response object

Return type:

Response

async get_sdwan_dps_policy_compliance(time_frame: str = 'last_week', order: str = 'best') Response
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:

Response

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:

Response

centralcli.classic.api.kms module

class centralcli.classic.api.kms.KmsAPI(session: Session)

Bases: object

async kms_get_ap_state(serial: str) Response
async kms_get_client_record(mac: str) Response
async kms_get_hash() Response
async kms_get_health() Response
async kms_get_synced_aps(mac: str) Response

centralcli.classic.api.aiops module

class centralcli.classic.api.aiops.AiOpsAPI(session: Session)

Bases: object

async get_aiops_insight_details(insight_id: int, from_time: int | float | datetime = None, to_time: int | float | datetime = None) Response

Get AI Insight Details by insight id.

Parameters:
  • insight_id (int) – Insight ID

  • from_time (int | float | datetime, optional) – Start of Time Range to collect insights for.

  • to_time (int | float | datetime, optional) – End of Time Range to collect insights for. Defaults to now.

Returns:

CentralAPI Response object

Return type:

Response

async get_aiops_insights(from_time: int | float | datetime = None, to_time: int | float | datetime = None, *, site_id: int = None, client_mac: str = None, serial: str = None, device_type: Literal['ap', 'gw', 'cx', 'sw', 'switch'] = None) Response

List AI Insights.

returns global insights unless site_id, serial (and dev_type), or client_mac is provided

Parameters:
  • from_time (int | float | datetime, optional) – Start of Time Range to collect insights for.

  • to_time (int | float | datetime, optional) – End of Time Range to collect insights for. Defaults to now.

  • site_id (int, optional) – Site ID. Return insights for as specific site. Defaults to None

  • client_mac (str, optional) – Client Mac. Return insights for as specific client. Defaults to None

  • serial (str, optional) – AP Serial. Return insights for as specific device (device_type is required). Defaults to None

  • device_type (Literal['ap', 'gw', 'cx', 'sw'], optional) – required if serial number is provided. Valid Values: ap|gw|cx|sw|switch. Defaults to None

Returns:

CentralAPI Response object

Return type:

Response

centralcli.classic.api.other module

class centralcli.classic.api.other.OtherAPI(session: Session)

Bases: object

async get_audit_event_logs(log_id: str = None, group_name: str = None, device_id: str = None, classification: str = None, from_time: int | float | datetime = None, to_time: int | float | datetime = None, offset: int = 0, limit: int = 100, count: int = None) Response

Get all audit events for all groups.

This API returns the first 10,000 results only.

Parameters:
  • log_id (str, optional) – The id of the audit event log to return details for. Defaults to None.

  • 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

  • from_time (int | float | datetime, optional) – Start of Time Range to filter audit logs by.

  • to_time (int | float | datetime, optional) – End of Time Range to filter audit logs by. Defaults to now.

  • 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. Max 100.

Returns:

CentralAPI Response object

Return type:

Response

async get_branch_health(name: str = None, reverse: bool = False, offset: int = 0, limit: int = 100) Response

Get data for all sites.

Parameters:
  • name (str, optional) – site / label name or part of its name

  • reverse (bool, optional) – Sort in reverse order (sort is by device count): Valid Values: asc, desc

  • offset (int, optional) – pagination start index Defaults to 0.

  • limit (int, optional) – pagination size Defaults to 100.

Returns:

CentralAPI Response object

Return type:

Response

async get_wlan_cluster_by_group(group_name: str, ssid: str) Response

Retrieve Cluster mapping for given group/SSID.

Parameters:
  • group_name (str) – The name of the group.

  • ssid (str) – Wlan ssid name

Returns:

CentralAPI Response object

Return type:

Response

async validate_wss_key(wss_base_url: str, wss_key: str) Response

Validate wss (websocket) key

Existing wss_key should be provided. The return will either be the same key if it’s still valid, or a new valid key.

Parameters:
  • wss_base_url (str) – The websocket base url, in the form https://internal-ui.central.arubanetworks.com

  • wss_key (str) – Existing websocket key

Returns:

CentralAPI Response object

Return type:

Response

centralcli.cnx.api.glp.devices module

class centralcli.cnx.api.glp.devices.GLPDevice

Bases: TypedDict

mac: str | None
serial: str
subscription: str | None
tags: list[dict[str, str]] | None
class centralcli.cnx.api.glp.devices.GreenLakeDevicesAPI(session: Session)

Bases: object

async add_devices(devices: GLPDevice | list[GLPDevice], application_id: str | None = UNSET, region: str | None = None, tags: dict[str, str] | None = None, subscription_ids: list[str] | str | None = UNSET, location_id: str | None = None, cache: Cache = None) list[Response]
async get_devices(serial_numbers: str | list[str] | tuple[str] = None, assigned: bool = None, archived: bool = None, sort_by: str | list[str] = None, reverse: bool = None, offset: int = 0, limit: int = 2000) Response

Retrieve a list of devices managed in a workspace

Parameters:
  • serial_numbers (str | list[str] | tuple[str], optional) – Fetch results for a specific set of provided serial numbers. Defaults to None.

  • assigned (bool, optional) – Filter results, fetching only devices assigned to a service (Aruba Central) if True or only devices lacking an assignment if set to False. Defaults to None.

  • archived (bool, optional) – Filter results, fetching only archived if True or only unarchived if set to False. Defaults to None.

  • sort_by – (str | list[str], optional): Field to sort by (ascending by default). Defaults to None.

  • reverse – (bool, optional): Reverse sort order. Defaults to None.

  • offset (int, optional) – Specifies the zero-based resource offset to start the response from. Defaults to 0.

  • limit (int, optional) – Specifies the number of results to be returned. Max 2000, Defaults to 2000.

Returns:

centralcli.response.Response object

Return type:

Response

async get_progresss_of_async_ops(responses: list[Response]) list[Response]

Given a list of GLP API responses, fetch status of async operation.

For all responses that pass with 202 the “Location” header is used to fetch the status of async operation in GLP. All non 202 responses are returned as is.

Parameters:

responses (list[Response]) – list of Response objects for the original calls requiring result of async operation.

Returns:

list of response objects.

Return type:

list[Response]

async remove_devices(device_ids: list[str] | str, remove_app: bool = True) list[Response]
async update_devices(device_ids: str | list[str], subscription_ids: list[str] | str | None = UNSET, tags: dict[str, str] | None = None, application_id: str | None = UNSET, region: str | None = None, archive: bool = None) list[Response]

centralcli.cnx.api.glp.subscriptions module

class centralcli.cnx.api.glp.subscriptions.GreenLakeSubscriptionsAPI(session: Session)

Bases: object

async get_subscriptions(sub_type: LicenseTypes = None, dev_type: GenericDevTypes = None, offset: int = 0, limit: int = 200) Response

centralcli.caas module

class centralcli.caas.BuildCLI(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)
async get_config_status(serial: str) Response

Bad API endpoint. ignore this.

// – used by show config <gw> –status – //

The endpoint appears to be invalid though.

async show_config(group: str, dev_mac: str = None) Response
class centralcli.caas.CaasAPI(data: dict = None, *, file: Path = None)

Bases: BuildCLI

async send_commands(group_dev: str, cli_cmds: list = None)

centralcli.cache module

class centralcli.cache.Cache(config: Config)

Bases: object

property LicenseTypes: LicenseTypes
property all_tables: Iterator[Table]
ap_group_completion(incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]

Completion for AP groups (by name).

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the group, or

Returns None if config is invalid

property ap_groups: list[CacheGroup]
property ap_ui_groups: list[CacheGroup]
audit_log_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

Completion for audit event logs.

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Value and help_text for the event, or

Returns None if config is invalid

property cache_clients_by_mac: dict[str, Document]

All Clients by MAC connected within the last 90 days

This property is used by the cache to filter clients older than 90 days

Returns:

Client Dict keyed by MAC with any clients last connected > 90 days ago filtered out.

Return type:

Dict[str,Document]

cert_completion(ctx: Context, incomplete: str = '', args: List[str] = None)
property certs: List[Document]
property certs_by_md5: Dict[str, Dict[str, str | bool | int]]
property certs_by_name: Dict[str, CacheCert]
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, app_db: bool = False, dev_type: Literal['ap', 'gw', 'switch', 'sdwan'] = None, assigned: bool = None, archived: bool = None, serial_numbers: str | list[str] | tuple[str] | None = None) List[Response]
client_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

Completion for clients.

Parameters:
  • ctx (typer.Context) – Provided automatically by typer

  • 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:

Iterator[Tuple[str, str]]

Name and help_text for the client, or

Returns None if config is invalid

property clients: list
property clients_by_mac: dict[str, Document]
config: Config = None
dev_ap_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

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.

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

dev_ap_gw_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

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.

Yields:

Iterator[Tuple[str, str]]

Yields Tuple with completion and help text, or

Returns None if config is invalid

dev_ap_gw_sw_completion(ctx: Context, incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]

Device completion for returning matches that are ap, gw, or AOS-SW

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

dev_client_completion(ctx: Context, incomplete: str, args: List[str] = []) Iterator[Tuple[str, 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. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Tuple with completion and help text, or

Returns None if config is invalid

dev_completion(incomplete: str, args: List[str] = None)
dev_cx_completion(incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]
dev_gw_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

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:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

dev_gw_switch_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]
dev_gw_switch_site_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]
dev_kwarg_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

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:

Iterator[Tuple[str, str]]

Matching completion string, help text, or

Returns None if config is invalid

dev_sw_completion(incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]
dev_switch_ap_completion(incomplete: str, args: List[str] = []) Iterator[Tuple[str, 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.

Yields:

Iterator[Tuple[str, str]]

Yields Tuple with completion and help text, or

Returns None if config is invalid

dev_switch_completion(incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]

Device completion for returning matches that are switches (AOS-SW or CX)

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

dev_switch_gw_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

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.

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

dev_template_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]
property devices: list[Document]
property devices_by_serial: Dict[str, Document]
property event_ids: list
event_log_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

Completion for events.

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Value and help_text for the event, or

Returns None if config is invalid

property events: list
property floor_plan_aps: list[Document]
property floor_plan_aps_by_serial: dict[str, CacheFloorPlanAP]
property floor_plan_buildings: list[Document]
async format_raw_devices_for_cache(resp: Response)
fuzz_lookup(query_str: str, db: Table, field: str = 'name', group: str = None, portal_id: str = None, dev_type: list[constants.LibAllDevTypes] = None) list[Document] | None
get_audit_log_identifier(query: str) str
get_cert_identifier(query_str: str, completion: Literal[True]) list[CacheCert]
get_cert_identifier(query_str: str) CacheCert
get_cert_identifier(query_str: str, retry: Literal[False]) None | CacheCert

Get certificate info from Certificate Cache

get_client_identifier(query_str: str, completion: Literal[False]) CacheClient
get_client_identifier(query_str: str, exit_on_fail: bool = Literal[True]) CacheClient

Search for Client in DB matching on name, ip or mac

Allows partial and case insensitive match

get_combined_inv_dev_identifier(query_str: str | Iterable[str], *, serial_numbers: tuple[str] = None, dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | Iterable[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] = None, retry_inv: bool = True, retry_dev: bool = True, completion: bool = False, silent: bool = False, exit_on_fail: bool = None, exit_on_inv_fail: bool = None, exit_on_dev_fail: bool = None) CacheInvMonDevice | list[CacheInvMonDevice]

Searches both Inv Cache and Dev (Monitoring Cache) and returns a CacheInvMonDevice with attributes from both.

Parameters:
  • query_str (str | Iterable[str]) – The query string to use to lookup device details. typically serial,mac,ip,hostname.

  • serial_numbers (tuple[str], optional) – A full list of all serials that are expected to be looked up. This is used to do an efficient cache refresh only involving the serials of interest. Defaults to None.

  • dev_type (constants.LibAllDevTypes | Iterable[constants.LibAllDevTypes], optional) – Device Type of the device being looked up. Defaults to None.

  • retry_inv (bool, optional) – Determines if an API call is performed to update inventory cache if no match is found. Defaults to True.

  • retry_dev (bool, optional) – Determines if an API call is performed to update devcice/monitoring cache if no match is found. Defaults to True.

  • completion (bool, optional) – Indicates lookup is being done for shell completion (implies silent=True, retry=False, exit_on_fail=False). Defaults to False.

  • silent (bool, optional) – Impacts if messaging is displayed to stderr on failure to match, and when refresh is triggerred. Defaults to False.

  • exit_on_fail (bool, optional) – Exit if no match is found (inv or dev). Defaults to None, Effectively True if no exit_on args are bool.

  • exit_on_inv_fail (bool, optional) – Exit if no match is found in Inventory Cache. Defaults to None.

  • exit_on_dev_fail (bool, optional) – Exit if no match is found in Device/Monitoring Cache. Defaults to None.

Raises:

ValueError – Raised if exit_on_fail conflicts with exit_on_inv_fail or exit_on_dev_fail. exit_on_fail implies both exit_on_inv_fail and exit_on_dev_fail, i.e. exit_on_fail=True w/ exit_on_inv_fail=False is a conflict.

Returns:

Will normally return CacheInvMonDevice if a match is found. list[CacheInvMonDevice] if completion=True (all matches), can return None or have None in the returned list if exit_on_fail=False

Return type:

CacheInvMonDevice | list[CacheInvMonDevice]

get_dev_identifier(dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | list[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, include_inventory: bool) CacheDevice | CacheInvDevice
get_dev_identifier(dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | list[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']], swack: Literal[True]) CacheDevice
get_dev_identifier(dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | list[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']], swack_only: Literal[True]) CacheDevice
get_dev_identifier(dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'], swack_only: Literal[True]) CacheDevice
get_dev_identifier(query_str: str | Iterable[str], dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, swack: bool | None, swack_only: bool | None, retry: bool | None, completion: bool, silent: bool | None) list[CacheDevice]
get_dev_identifier(query_str: str | Iterable[str], retry: Literal[False], silent: Literal[True], exit_on_fail: Literal[False]) CacheDevice | None
get_dev_identifier(query_str: str | Iterable[str], dev_type: list[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']], completion: Literal[True]) list[CacheDevice]
get_dev_identifier(query_str: str | Iterable[str], completion: Literal[True]) list[CacheDevice]
get_dev_identifier(query_str: str | Iterable[str], dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, swack: bool | None, completion: Literal[True]) list[CacheDevice]
get_dev_identifier(query_str: str | Iterable[str], dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, swack: bool | None, swack_only: bool | None, retry: bool | None, completion: bool, silent: bool | None, exit_on_fail: Literal[False]) list[CacheDevice | None]
get_dev_identifier(completion: Literal[True]) list[CacheDevice]
get_dev_identifier(dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, retry: bool, completion: bool, silent: bool, exit_on_fail: Literal[False]) list[CacheDevice | None]
get_dev_identifier(query_str: str | Iterable[str], dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, swack: bool | None, swack_only: bool | None, retry: bool | None, completion: bool, silent: bool | None, include_inventory: bool, exit_on_fail: bool) list[CacheDevice | CacheInvDevice | None]
get_dev_identifier(query_str: str, dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']], swack: bool) CacheDevice
get_dev_identifier(query_str: str, dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']]) CacheDevice
get_dev_identifier(query_str: str, swack: bool) CacheDevice
get_dev_identifier(query_str: str, include_inventory: bool, swack: bool) CacheDevice
get_dev_identifier(query_str: str) CacheDevice
get_dev_identifier(query_str: str, silent: Literal[True], exit_on_fail: Literal[False]) CacheDevice | None
get_dev_identifier(query_str: str | Iterable[str], dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, swack: bool | None, swack_only: bool | None, retry: bool | None, silent: bool | None) CacheDevice
get_dev_identifier(query_str: str | Iterable[str], dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, swack: bool | None, swack_only: bool | None, retry: bool | None, silent: bool | None, include_inventory: Literal[True]) CacheDevice | CacheInvDevice
get_dev_identifier(query_str: str | Iterable[str], dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None, swack: bool | None, swack_only: bool | None, retry: bool | None, silent: bool | None, include_inventory: bool | None = False, exit_on_fail: bool = False) CacheDevice | CacheInvDevice | None

Get Devices from local cache, starting with most exact match, and progressively getting less exact.

If multiple matches are found user is promted to select device.

Parameters:
  • query_str (str | Iterable[str]) – The query string or list of strings to attempt to match.

  • dev_type (Literal["ap", "cx", "sw", "switch", "gw"] | List[Literal["ap", "cx", "sw", "switch", "gw"]], optional) – Limit matches to specific device type. Defaults to None (all device types).

  • swack (bool, optional) – For switches only return the conductor switch that matches. For APs only return the VC of the swarm the match belongs to. Defaults to False. Does not filter non stacks.

  • swack_only (bool, optional) – For switches only return the conductor switch that matches. For APs only return the VC of the swarm the match belongs to. Defaults to False. If True devices that lack a swack_id (swarm_id | stack_id) are filtered (even if they match).

  • retry (bool, optional) – If failure to match should result in a cache update and retry. Defaults to True.

  • completion (bool, optional) – If this is being called for tab completion (Allows multiple matches, implies retry=False, silent=True, exit_on_fail=False). Defaults to False.

  • silent (bool, optional) – Do not display errors / output, simply returns match if match is found. Defaults to False.

  • include_inventory (bool, optional) – Whether match attempt should also include Inventory DB (devices in GLCP that have yet to connect to Central). Defaults to False.

  • exit_on_fail (bool, optional) – Whether a failure to match exits the program. Defaults to True.

Raises:

typer.Exit – Exit CLI / command, occurs if there is no match unless exit_on_fail is set to False.

Returns:

if completion = True returns list[CacheDevice] containing all matches or None if there was no match.

Otherwise return will be the CacheDevice that matched. (If completion=False and multiple matches are found, user is prompted to select)

Return type:

CacheDevice | List[CacheDevice] | None

get_devices_with_inventory(no_refresh: bool = False, inv_db: bool = None, dev_db: bool = None, device_type: Literal['ap', 'gw', 'switch', 'sdwan'] = None, assigned: bool = None, archived: bool = None, status: Literal['up', 'down'] = None) List[Response] | 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. Refresh will only occur if cache was not updated during this session. Setting no_refresh to True means it will not occur regardless. Defaults to False.

  • inv_db (bool, optional) – Update inventory cache. Defaults to None.

  • dev_db (bool, optional) – Update device (monitoring) cache. Defaults to None.

  • device_type (Literal['ap', 'gw', 'switch'], optional) – Filter devices by type: Valid Types: ‘ap’, ‘gw’, ‘switch’. ‘cx’ and ‘sw’ also accepted, both will result in ‘switch’ which includes both types. Defalts to None (no Filter/All device types).

  • status (Literal 'up', 'down', optional) – Filter results by status. Inventory only devices (have never checked in, so lack status) are retained. Defaults to None.

Returns:

Response objects where output is list of dicts with

data from Inventory and Monitoring combined.

Return type:

List[Response]

get_event_log_identifier(query: str) dict

Get event log details based on identifier.

Parameters:

query (str) – The short event log id, generated anytime show logs is ran for any events that have details.

Raises:

typer.Exit – If unable to find id, or the id is not a valid type

Returns:

Dictionary containing event log details.

Return type:

dict

get_group_identifier(query_str: str, dev_type: List[Literal['ap', 'cx', 'sw', 'gw', 'sdwan']] | Literal['ap', 'cx', 'sw', 'gw', 'sdwan'] | None, completion: bool) list[CacheGroup]
get_group_identifier(query_str: str, dev_type: List[Literal['ap', 'cx', 'sw', 'gw', 'sdwan']] | Literal['ap', 'cx', 'sw', 'gw', 'sdwan'] | None = None, retry: bool | None = True, silent: bool | None = False) CacheGroup
get_group_identifier(query_str: str, dev_type: List[Literal['ap', 'cx', 'sw', 'gw', 'sdwan']] | Literal['ap', 'cx', 'sw', 'gw', 'sdwan'] | None, retry: bool | None, silent: bool | None, exit_on_fail: bool) CacheGroup | None

Allows Case insensitive group match

get_guest_identifier(query_str: str, completion: bool = True) list[CacheGuest]
get_guest_identifier(query_str: str, portal_id: str = None, retry: bool = True, completion: bool = False, silent: bool = False) CacheGuest

Get guest info from Guest Cache

async get_hooks_by_serial(serial)
get_identifier(qry_str: str, qry_funcs: Sequence[str], device_type: str | List[str] = None, swack: bool = False, swack_only: bool = False, group: str | List[str] = None, completion: bool = False) 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.

  • swack (bool, optional) – Similar to swack, but only filters member switches of stacks, but will also return any standalone switches that match. Does not filter non stacks, the way swack option does. Defaults to False.

  • swack_only (bool, optional) – Restrict matches to only the stack commanders matching query (filter member switches). Defaults to False.

  • group (str, List[str], optional) – applies to get_template_identifier, Only match if template is in provided group(s). Defaults to None.

  • 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_inv_identifier(query_str: str | Iterable[str], *, serial_numbers: tuple[str] | None = None, dev_type: Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] | Iterable[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] = None, retry: bool = True, completion: bool = False, silent: bool = False, exit_on_fail: bool = True) CacheInvDevice | list[CacheInvDevice]

Get Devices from local cache, starting with most exact match, and progressively getting less exact.

This method will serach for a match in the Inventory DB (GreenLake Inventory), then if no match is found, it will search DeviceDB (Central Monitoring/UI), which would provide the serial # to then search the Inventory DB

Parameters:
  • query_str (str | Iterable[str]) – The query string or Iterable of strings to attempt to match. Iterable will be joined with ‘ ‘ to form a single string with spaces.

  • serial_numbers (tuple[str], optional) – A full list of all serials that are expected to be looked up. This is used to do an efficient cache refresh only involving the serials of interest. Defaults to None. Note: If any of the serial numbers do not appear to be serial numbers they are ignored, resulting in a full cache update.

  • dev_type (Literal["ap", "cx", "sw", "switch", "gw"] | List[Iterable["ap", "cx", "sw", "switch", "gw"]], optional) – Limit matches to specific device type. Defaults to None (all device types).

  • retry (bool, optional) – If failure to match should result in a cache update and retry. Defaults to True.

  • completion (bool, optional) – If this is being called for tab completion (Allows multiple matches, implies retry=False, silent=True, exit_on_fail=False). Defaults to False.

  • silent (bool, optional) – Do not display errors / output, simply returns match if match is found. Defaults to False.

  • include_inventory (bool, optional) – Whether match attempt should also include Inventory DB (devices in GLCP that have yet to connect to Central). Defaults to False.

  • exit_on_fail (bool, optional) – Whether a failure to match exits the program. Defaults to True.

Raises:

typer.Exit – Will display error message and exit if no match is found (unless completion=True or exit_on_fail=False)

Returns:

if completion = True returns list[CacheInvDevice] containing all matches or None if there was no match.

Otherwise return will be the CacheInvDevice that matched. (If completion=False and multiple matches are found, user is prompted to select)

Return type:

CacheInvDevice | List[CacheInvDevice] | None

get_label_identifier(query_str: str) CacheLabel
get_label_identifier(query_str: str, retry: bool | None, completion: Literal[False] | None, silent: bool | None) CacheLabel
get_label_identifier(query_str: str, retry: bool | None, completion: Literal[True], silent: bool | None) list[CacheLabel]
get_mpsk_network_identifier(query_str: str, retry: bool = True, completion: bool = True, silent: bool = False) list[CacheMpskNetwork]
get_mpsk_network_identifier(query_str: str, retry: bool = True, completion: bool = False, silent: bool = False) CacheMpskNetwork

Allows Case insensitive ssid match

get_name_id_identifier(cache_name: Literal['dev', 'site', 'sub', 'template', 'group', 'label', 'mpsk_network', 'mpsk', 'portal'], query_str: str, retry: bool = True, completion: bool = False, silent: bool = False, end_date: datetime = None, best_match: bool = False, all_match: bool = False) CachePortal | List[CachePortal] | CacheLabel | List[CacheLabel] | CacheSub | List[CacheSub]

Fetch items from cache based on query

This is a common identifier lookup function for all stored types that use name and id as potential match fields.

DEV NOTE appears only to be used by portal and subscription currently

Parameters:
  • cache_name (Literal['dev', 'site', 'sub', 'template', 'group', 'label', 'mpsk_network', 'mpsk', 'portal']) – The cache to search

  • query_str (str) – The query string used to search the cache for a match

  • retry (bool, optional) – Refresh the cache via API and retry if no match is found. Defaults to True.

  • completion (bool, optional) – Indicates function is being called for CLI completion… effectively the equiv of retry=False, Silent=True. Defaults to False.

  • silent (bool, optional) – Set to True to squelch out all messaging normmaly displayed when no match is found, and retry is initiated. Defaults to False.

  • end_date (dt.datetime, optional) – Specific to ‘sub’ cache. Provide End Date to further narrow search in the event of multiple subscription matches. Defaults to None.

  • best_match (bool, optional) – Specific to ‘sub’ cache. Set True to return the best match in the event of multiple matches. Best match is the valid match with the most time remaining on the subscription. Defaults to False (user is prompted to select one of the matches).

  • all_match (bool, optional) – Sepcific to ‘sub’ cache. Return all matches in the event of multiple matches. Defaults to False.

Raises:

typer.Exit – Terminates program if no match is found.

Returns:

The Cache object associated with the provided cache_name.

Return type:

CachePortal | List[CachePortal] | CacheLabel | List[CacheLabel] | CacheSub | List[CacheSub]

get_portal_identifier(query_str: str, retry: bool = True, completion: bool = False, silent: bool = False) CachePortal | list[CachePortal]
get_site_identifier(query_str: str | Sequence[str], retry: bool | None, completion: bool, silent: bool | None, exit_on_fail: bool | None) list[CacheSite]
get_site_identifier(query_str: str | Sequence[str], completion: Literal[True]) list[CacheSite]
get_site_identifier(query_str: str | Sequence[str]) CacheSite
get_site_identifier(query_str: str | Sequence[str], retry: bool | None, completion: bool | None, silent: bool | None, exit_on_fail: bool) CacheSite | None
get_sub_identifier(query_str: str, retry: bool = True, completion: bool = False, silent: bool = False, end_date: datetime = None, best_match: bool = False, all_match: bool = False) CacheSub | list[CacheSub] | None

Fetch items from subscription cache based on query

Parameters:
  • query_str (str) – The query string used to search the cache for a match

  • retry (bool, optional) – Refresh the cache via API and retry if no match is found. Defaults to True.

  • completion (bool, optional) – Indicates function is being called for CLI completion… effectively the equiv of retry=False, Silent=True. Defaults to False.

  • silent (bool, optional) – Set to True to squelch out all messaging normmaly displayed when no match is found, and retry is initiated. Defaults to False.

  • end_date (dt.datetime, optional) – Specific to ‘sub’ cache. Provide End Date to further narrow search in the event of multiple subscription matches. Defaults to None.

  • best_match (bool, optional) – Specific to ‘sub’ cache. Set True to return the best match in the event of multiple matches. Best match is the valid match with the most time remaining on the subscription. Defaults to False (user is prompted to select one of the matches).

  • all_match (bool, optional) – Sepcific to ‘sub’ cache. Return all matches in the event of multiple matches. Defaults to False.

Raises:

typer.Exit – Terminates program if no match is found.

Returns:

The Cache object associated with the provided cache_name.

Return type:

CachePortal | List[CachePortal] | CacheLabel | List[CacheLabel] | CacheSub | List[CacheSub]

get_template_identifier(query_str: str, completion: Literal[True]) list[CacheTemplate]
get_template_identifier(query_str: str) CacheTemplate
get_template_identifier(query_str: str, retry: Literal[False]) CacheTemplate | None

Allows case insensitive template match by template name

group_completion(incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]

Completion for groups (by name).

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the group, or

Returns None if config is invalid

group_dev_ap_gw_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[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.

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

group_dev_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

Completion for argument that can be either group or device.

Parameters:
  • ctx (typer.Context) – The click/typer Context.

  • 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:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

group_dev_gw_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

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.

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

property group_names: list
property groups: list
property groups_by_name: dict[str, CacheGroup]
guest_completion(ctx: Context, incomplete: str = '', args: List[str] = None)
property guests: list
property guests_by_id: Dict[str, Dict[str, str | bool]]
handle_multi_match(match: 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
init(config: Config) None
property inv_device_types: set[str]
property invdev_by_id: Dict[str, CacheInvMonDevice]
property inventory: list
property inventory_by_id: Dict[str, CacheInvDevice]
property inventory_by_serial: Dict[str, Document]
is_central_license(license: str) bool
property key_tables: Iterator[Table]
label_completion(ctx: Context, incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]

Completion for labels.

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the label, or

Returns None if config is invalid

property label_names: list
property labels: list
property labels_by_name: dict[str, CacheLabel]
property license_names: list
property licenses: List[str]
property logs: list
method_test_completion(incomplete: str, args: List[str] = [])
property mon_device_types: set[str]
property mpsk: list[Document]
property mpsk_by_id: dict[str, CacheMpsk]
mpsk_network_completion(ctx: Context, incomplete: str, args: List[str] = None)
property mpsk_networks: list[Document]
property my_service: CacheService
null_completion(incomplete: str)
portal_completion(ctx: Context, incomplete: str, args: List[str] = None)
property portals: list
property portals_by_id: Dict[str, Dict[str, str | bool]]
async prep_filtered_devs_for_cache(raw_models: List[Device], dev_type: Literal['ap', 'gw', 'switch', 'sdwan'] | List[Literal['ap', 'gw', 'switch', 'sdwan']] = None, site: str = None, group: str = None) List[dict]
async refresh_cert_db(*, query: str = None) Response
async refresh_client_db(client_type: Literal['wired', 'wireless', 'all'] = None, 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, client_status: Literal['FAILED_TO_CONNECT', 'CONNECTED'] = 'CONNECTED', past: str = '3H') Response

refresh client DB

all args are passed to api.monitoring.get_clients, Local Cache is updated with any results. Local Cache retains clients connected within last 90 days by default. Configuratble via cache_client_days in the config.

It returns the raw data from the API with whatever filters were provided by the user then updates the db with the data returned

Parameters:
  • client_type (Literal['wired', 'wireless', 'all'], optional) – Client type to retrieve. Defaults to None. if not provided all client types will be returned, unless a filter specific to a client type is specified. i.e. providing band will result in WLAN clients.

  • 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.

  • client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional) – Return clients that are connected, or clients that have failed to connect. Defaults to CONNECTED.

  • past – (str, optional): Time-range to show client details for. Format: 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H

Past users are always retained, unless truncate=True

async refresh_dev_db(dev_type: Literal['ap', 'gw', 'switch', 'sdwan'] | List[Literal['ap', 'gw', 'switch', 'sdwan']] = None, group: str = None, site: str = None, label: str = None, serial: str = None, mac: str = None, model: str = None, stack_id: str = None, swarm_id: str = None, cluster_id: str = None, public_ip_address: str = None, status: Literal['up', 'down'] = None, show_resource_details: bool = True, calculate_client_count: bool = True, calculate_ssid_count: bool = False, fields: list = None, offset: int = 0, limit: int = 1000) CombinedResponse

Get all devices from Aruba Central, and refresh local cache.

Parameters:
  • dev_type (Literal['ap', 'gw', 'cx', 'sw', 'sdwan', 'switch'], optional) – Device Types to Update. Defaults to None.

  • group (str, optional) – Filter by devices in a Group. Defaults to None.

  • site (str, optional) – Filter by devices in a Site. Defaults to None.

  • label (str, optional) – Filter by devices with a label assigned. Defaults to None.

  • serial (str, optional) – Filter by Serial. Defaults to None.

  • mac (str, optional) – Filter by mac. Defaults to None.

  • model (str, optional) – Filter by model. Defaults to None.

  • stack_id (str, optional) – Filter by stack id (switches). Defaults to None.

  • swarm_id (str, optional) – Filter by swarm id (APs). Defaults to None.

  • cluster_id (str, optional) – Filter by cluster id. Defaults to None.

  • public_ip_address (str, optional) – Filter by public ip. Defaults to None.

  • status (constants.DeviceStatus, optional) – Filter by status. Defaults to None.

  • show_resource_details (bool, optional) – Show device resource utilization details. Defaults to True.

  • calculate_client_count (bool, optional) – Calculate client count. Defaults to True.

  • calculate_ssid_count (bool, optional) – Calculate SSID count. Defaults to False.

  • fields (list, optional) – fields to return. Defaults to None.

  • offset (int, optional) – pagination offset. Defaults to 0.

  • limit (int, optional) – pagination limit max 1000. Defaults to 1000.

Returns:

CombinedResponse object.

Return type:

CombinedResponse

async refresh_group_db() Response
async refresh_guest_db(portal_id: str) Response
async refresh_inv_db(dev_type: Literal['ap', 'gw', 'switch', 'bridge', 'all'] = None, serial_numbers: str | list[str] | tuple[str] | None = None, assigned: bool = None, archived: bool = None) Response

Get devices from device inventory, and Update device Cache with results.

Uses GLP API if configed, classic Central API if not.

Parameters:
  • dev_type (Literal['ap', 'gw', 'switch', 'all'], optional) – Device Type. Defaults to None = ‘all’ device types.

  • assigned (bool, optional) – filter by devices that are assigned/lack assignment to a service (Aruba Central). Defaults to None: No filter by assignment.

  • archived (bool, optional) – filter by devices that are archived/unarchived (GLP Only). Defaults to None: All devices

Returns:

CentralAPI Response object

Return type:

Response

async refresh_inv_db_classic(dev_type: Literal['ap', 'gw', 'switch', 'all'] = None) Response

Get devices from device inventory, and Update device Cache with results.

This combines the results from 2 API calls:
  • classic.api.monitoring.get_device_inventory: /platform/device_inventory/v1/devices

  • classic.api.monitoring.get_subscriptions: /platform/licensing/v1/subscriptions

Parameters:

device_type (Literal['ap', 'gw', 'switch', 'all'], optional) – Device Type. Defaults to None = ‘all’ device types.

Returns:

CentralAPI Response object

Return type:

Response

async refresh_inv_db_glp(dev_type: Literal['ap', 'gw', 'switch', 'bridge', 'all'] = None, serial_numbers: str | list[str] | tuple[str] | None = None, assigned: bool = None, archived: bool = None) Response

Get devices from device inventory, and Update device Cache with results.

This combines the results from 2 API calls:
  • classic.api.monitoring.get_device_inventory: /devices/<api version>/devices

  • classic.api.monitoring.get_subscriptions: /devices/<api version>/subscriptions

Parameters:
  • dev_type (Literal['ap', 'gw', 'switch', 'all'], optional) – Device Type. Defaults to None = ‘all’ device types.

  • serial_numbers – (str | list[str] | tuple[str], optional): For more effecient cache update. Send all suspected serial numbers and on first failure an inv update will occur just for those serials. Note: If any of the items sent do not appear to be serials, they are ignored.

  • assigned (bool, optional) – filter by devices that are assigned/lack assignment to a service (Aruba Central). Applies to GLP only. Defaults to None: No filter by assignment.

  • archived (bool, optional) – filter by devices that are archived/unarchived. Defaults to None: All devices

Returns:

CentralAPI Response object

Return type:

Response

async refresh_label_db() Response
async refresh_license_db() Response

Update License DB

License DB stores the valid license names accepted by GreenLake/Central

Returns:

CentralAPI Response Object

Return type:

Response

async refresh_mpsk_db(mpsk_id: str = None, name: str = None, role: str = None, status: MPSKStatus = None) Response
async refresh_mpsk_networks_db() Response
async refresh_portal_db() Response
async refresh_site_db(force: bool = False) Response
async refresh_sub_db(sub_type: str = None, dev_type: str = None) Response

Refresh Subscriptions Database (local cache).

Returns:

CentralAPI Response object

Return type:

Response

async refresh_svc_db() Response

Update Service DB (Aruba Central Application IDs from service catalog)

Svc DB stores the Application IDs for Aruba Central based on what is provisioned in the workspace.

Returns:

CentralAPI Response Object

Return type:

Response

async refresh_template_db() Response
remove_completion(ctx: Context, incomplete: str, args: List[str]) Iterator[Tuple[str, str]]
send_cmds_completion(ctx: Context, incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]

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 [].

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the device, or

Returns None if config is invalid

property services: list[CacheService]
property services_by_name: dict[str, CacheService]
classmethod set_config(config: Config) None
site_completion(ctx: Context, incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]

Completion for sites.

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:

Iterator[Tuple[str, str]]

Name and help_text for the site, or

Returns None if config is invalid

property sites: list
property sites_by_id: list
property sites_by_name: dict[str, CacheSite]
property size: str
smg_kw_completion(ctx: Context, incomplete: str, args: List[str] = [])
sub_completion(ctx: Context, incomplete: str = None, args: List[str] = None)
property subscriptions: list[CacheSub]
property subscriptions_by_id: Dict[str, CacheSub]
property subscriptions_by_key: Dict[str, CacheSub]
template_completion(incomplete: str, args: List[str] = None) Iterator[Tuple[str, str]]
template_group_completion(incomplete: str, args: List[str] = []) Iterator[Tuple[str, str]]

Completion for template groups (by name).

Parameters:
  • incomplete (str) – The last partial or full command before completion invoked.

  • args (List[str], optional) – The previous arguments/commands on CLI. Defaults to [].

Yields:

Iterator[Tuple[str, str]]

Name and help_text for the group, or

Returns None if config is invalid

property templates: list
property templates_by_name_group: list
async update_cert_db(data: List[Dict[str, Any]] | List[int], remove: bool = False) bool
async update_db(db: Table, data: List[Dict[str, Any]] | Dict[str, Any] = None, *, doc_ids: List[int] | int = None, truncate: bool = True) bool

Update Local Cache DB

Parameters:
  • db (Table) – TinyDB Table object to be updated.

  • data (List[Dict[str, Any]] | Dict[str, Any], optional) – Data to be added to database. Defaults to None.

  • doc_ids (List[int] | int, optional) – doc_ids to be deleted from the DB. Defaults to None.

  • truncate (bool, optional) – Existing DB data will be discarded, and all data in DB will be replaced with provided. Defaults to True.

Returns:

Bool indicating if cache update was successful.

Return type:

bool

async update_dev_db(data: List[Dict[str, Any]] | Dict[str, Any] | List[int] | int, *, remove: bool = False) bool

Update Device Database (local cache).

If data is provided it’s asumed to be a partial update. No devices will be removed from the cache unless remove=True.

Parameters:
  • data (List[Dict[str, Any]] | Dict[str, Any] | List[int] | int) – Device data to update cache with. Existing devices are retained and updated with any changes from the new data provided.

  • remove (bool, optional) – Set True to remove devices from cache, data should be a list of doc_ids (int).

Returns:

Returns bool indicating cache update success.

Return type:

bool

update_event_db(log_data: List[Dict[str, Any]]) bool
async update_floor_plan_cache(data, cache: Literal['buildings', 'floors'] = 'buildings') bool
async update_group_db(data: list | dict, remove: bool = False) bool
async update_guest_db(data: List[Dict[str, Any]] | List[int], portal_id: str = None, remove: bool = False) bool
async update_hook_data_db(data: List[Dict[str, Any]]) bool
async update_inv_db(data: List[Dict[str, Any]] | Dict[str, Any] | List[int] | int, *, remove: bool = False) bool

Update Inventory Database (local cache).

Parameters:
  • data (List[Dict[str, Any]] | Dict[str, Any] | List[int] | int,) – Data to be updated in Inventory, Existing inventory data is retained, new data is added, any changes in existing device is updated.

  • remove (bool, optional) – Determines if update is to remove from cache. Defaults to False. data should be a list of doc_ids when removing from cache.

Returns:

Returns bool indicating cache update success.

Return type:

bool

async update_label_db(data: List[Dict[str, Any]] | Dict[str, Any] | List[int], remove: bool = False) Response
update_log_db(log_data: List[Dict[str, Any]]) bool
async update_mpsk_net_db(data: List[Dict[str, Any]], remove: bool = False) bool
async update_portal_db(data: List[Dict[str, Any]] | List[int], remove: bool = False) bool
async update_site_db(data: SiteData = None, remove: bool = False) bool | None
async update_template_db(data: Dict[str, str] | List[Dict[str, str]] = None, doc_ids: int | List[int] = None, add: bool = False)
static verify_db_action(db: Table, *, expected: int, response: List[int | List[int]], remove: bool = False, elapsed: int | float = None) bool

Evaluate TinyDB Cache results (search/add/update/delete).

Verifies response from TinyDB lookup/update, logs and returns a bool indicating success/failure.

Parameters:
  • db (CacheTable) – The TinyDB Table/Cache the update/lookup was peformed on.

  • expected (int) – The number of records that were expected.

  • response (List[int | List[int]]) – The update/lookup response from TinyDB

  • remove (bool, optional) – If the operation was a delete/remove

  • elapsed (int | float, optional) – Amount of time it took to update the cache.

Returns:

Bool indicating if update was succesful.

Return type:

bool

workspace_completion(incomplete: str)
class centralcli.cache.CacheAttributes(name: Literal['dev', 'site', 'template', 'group', 'label', 'portal', 'mpsk', 'mpsk_network', 'sub'], db: Table, cache_update_func: Callable)

Bases: object

class centralcli.cache.CacheBuilding(data: Document | Dict[str, Any])

Bases: CentralObject, Text

campus_id: str
db: Table | None = None
property doc_id: int
id: str
lat: int
lon: int
name: str
classmethod set_db(db: Table, building_db: Table = None)
class centralcli.cache.CacheCert(name: str, type: CertType, expired: bool, expiration: int | float | DateTime | str, md5_checksum: str, **kwargs)

Bases: CentralObject

db: Table | None = None
property doc_id: int
property expiration: DateTime
ok() bool
classmethod set_db(db: Table)
class centralcli.cache.CacheClient(data: Document | Dict[str, Any])

Bases: CentralObject

cache: Cache | None = None
connected_name: str
connected_serial: str
db: Table | None = None
property doc_id: int
get_group() CacheGroup
get_site() CacheSite
group: str
ip: str
last_connected: int | float
mac: str
name: str
network_port: str
classmethod set_db(db: Table, cache: Cache = None)
site: str
type: ClientType
class centralcli.cache.CacheDetails(cache=<class 'centralcli.cache.Cache'>)

Bases: object

class centralcli.cache.CacheDevice(data: Document | Dict[str, Any])

Bases: CentralObject

db: Table | None = None
property doc_id: int
property generic_type
get_completion(incomplete: str, args: list[str] = None) tuple[str, str]
get_ts_session_id(exit_on_fail: bool = True) int | Response
group: str
ip: str | None
property is_aos10: bool
mac: str
model: str
name: str
serial: str
classmethod set_db(db: Table)
site: str
status: Literal['Up', 'Down'] | None
swack_id: str | None
switch_role: str | None
type: constants.DeviceTypes
version: str
class centralcli.cache.CacheFloorPlanAP(data: Document | Dict[str, Any])

Bases: CentralObject, Text

property building: CacheBuilding
building_db: Table | None = None
building_id: str
db: Table | None = None
property doc_id: int
floor_id: int
id: str
level: int | float
property location: dict[str, str]
mac: int
name: str
serial: str
classmethod set_db(db: Table, building_db: Table = None)
class centralcli.cache.CacheGroup(data: Document | Dict[str, Any])

Bases: CentralObject

allowed_types: List[constants.DeviceTypes]
aos10: bool
cnx: bool
db: Table | None = None
property doc_id: int
gw_role: constants.BranchGwRoleTypes
microbranch: bool
monitor_only_cx: bool
monitor_only_sw: bool
name: str
classmethod set_db(db: Table)
wired_tg: bool
wlan_tg: bool
class centralcli.cache.CacheGuest(data: Document | Dict[str, Any])

Bases: CentralObject

company: str
created: int
db: Table | None = None
property doc_id: int | None
email: str
enabled: bool
expires: int
id: int
name: str
phone: str
property portal
portal_id: str
classmethod set_db(db: Table, cache: Cache = None)
status: str
class centralcli.cache.CacheInvDevice(data: Document | Dict[str, Any])

Bases: CentralObject

archived: bool
assigned: bool
db: Table | None = None
property doc_id: int
property generic_type
id: str
mac: str
model: str
serial: str
services: str | None
classmethod set_db(db: Table)
sku: str
subscription_expires: int | float
subscription_key: str
type: str
class centralcli.cache.CacheInvMonDevice(inventory: CacheInvDevice, monitoring: CacheDevice = None)

Bases: CentralObject

archived: bool
property assigned: bool
property generic_type
group: str
id: str
ip: str | None
mac: str
model: str
name: str
serial: str
services: str | None
site: str
sku: str
status: Literal['Up', 'Down'] | None
subscription_expires: int | float
subscription_key: str
swack_id: str | None
switch_role: str | None
type: Literal['ap', 'cx', 'sw', 'gw', 'sdwan']
version: str
class centralcli.cache.CacheLabel(data: Document | Dict[str, Any])

Bases: CentralObject

db: Table | None = None
devices: int
property doc_id: int | None
get_completion(pfx: str = "'") tuple[str, str]
id: int
name: str
classmethod set_db(db: Table)
class centralcli.cache.CacheMpsk(data: Document | Dict[str, Any])

Bases: CentralObject

db: Table | None = None
property doc_id: int
id: int
name: str
role: str
classmethod set_db(db: Table)
ssid: str
status: Literal['enabled', 'disabled']
class centralcli.cache.CacheMpskNetwork(data: Document | Dict[str, Any])

Bases: CentralObject

cache: Cache | None = None
db: Table | None = None
property doc_id: int
id: int
name: str
classmethod set_db(db: Table, cache: Cache = None)
class centralcli.cache.CachePortal(data: Document | Dict[str, Any])

Bases: CentralObject

auth_type: str
auth_types: PortalAuthTypes
db: Table | None = None
property doc_id: int | None
static get_auth_types(auth_types: str) PortalAuthTypes
id: int
is_aruba_cert: bool
is_default: bool
is_shared: bool
name: str
reg_by_email: bool
reg_by_phone: bool
classmethod set_db(db: Table)
url: URL
class centralcli.cache.CacheResponses(dev: CombinedResponse = None, inv: Response = None, sub: Response = None, site: Response = None, template: Response = None, group: Response = None, label: Response = None, mpsk_network: Response = None, mpsk: Response = None, portal: Response = None, license: Response = None, service: Response = None, client: Response = None, guest: Response = None, cert: Response = None, device_type: List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan'] = None, serial_numbers: str | list[str] = None)

Bases: object

property cert: Response | None
clear() None

Clears response cache. Used for pytest runs.

property client: Response | None
property dev: CombinedResponse | None
property device_type: List[Literal['ap', 'cx', 'sw', 'switch', 'gw', 'sdwan']] | None
property group: Response | None
property guest: Response | None
property inv: Response | None
property label: Response | None
property license: Response | None
property mpsk: Response | None
property mpsk_network: Response | None
property portal: Response | None
property serial_numbers: list[str] | None
property service: Response | None
property site: Response | None
property sub: Response | None
property template: Response | None
update_rl(resp: Response | CombinedResponse | None) Response | CombinedResponse | None

Returns provided Response object with the RateLimit info from the most recent API call.

class centralcli.cache.CacheService(data: Document | dict[str, Any])

Bases: CentralObject, Text

db: Table | None = None
property doc_id: int
id: str
name: str
region: str
classmethod set_db(db: Table)
class centralcli.cache.CacheSite(data: Document | CacheSiteDict)

Bases: CentralObject

address: str | None
city: str | None
country: str | None
db: Table | None = None
devices: int
property doc_id: int
id: int
lat: str | None
lon: str | None
name: str
classmethod set_db(db: Table)
state: str | None
zip: str | None
class centralcli.cache.CacheSub(data: Document | Dict[str, Any])

Bases: CentralObject, Text

property api_name: str
available: int
db: Table | None = None
property doc_id: int
end_date: int
expire_string: DateTime
expired: bool
id: str
key: str
name: str
property ok: bool
qty: int
classmethod set_db(db: Table)
sku: str
start_date: int
started: bool
property status: str
property tier: SubscriptionTier
type: str
valid: bool
class centralcli.cache.CacheTemplate(data: Document | Dict[str, Any])

Bases: CentralObject

db: Table | None = None
device_type: constants.DeviceTypes
property doc_id: int | None
group: str
model: str
name: str
classmethod set_db(db: Table)
template_hash: str
version: str
class centralcli.cache.CentralObject(db: Literal['dev', 'inv', 'site', 'template', 'group', 'label', 'mpsk_network', 'mpsk', 'portal', 'cert', 'sub', 'svc'], data: Document | dict[str, Any] | list[Document | dict[str, Any]])

Bases: MutableMapping

property help_text
keys() a set-like object providing a view on D's keys
property rich_help_text
serial: str
property summary_text: str
property text: Text
class centralcli.cache.SubscriptionTier(*values)

Bases: str, Enum

ADVANCED = 'advanced'
FOUNDATION = 'foundation'
OTHER = 'other'
centralcli.cache.ensure_config(func)

Prevents exception during completion when config missing or invalid.

centralcli.cleaner module

Collection of functions used to format/clean output from Aruba Central API.

class centralcli.cleaner.FilterRows(version: str = None, group: str = None, site: str = None, status: Literal['Up', 'Down'] = None, label: str = None, public_ip: str = None)

Bases: object

__call__(data: dict[str, Any]) bool

Determine if data matches filter :returns: True if data matches any filters False if not :rtype: bool

centralcli.cleaner.cloudauth_get_namedmpsk(data: list[dict[str, Any]], verbosity: int = 0) list[dict[str, Any]]
centralcli.cleaner.cloudauth_upload_status(data: list[dict[str, Any]] | dict[str, Any]) dict[str, Any]
centralcli.cleaner.get_alerts(data: list[dict]) list[dict]
centralcli.cleaner.get_all_webhooks(data: list[dict]) list[dict]
centralcli.cleaner.get_archived_devices(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_audit_logs(data: list[dict], cache_update_func: Callable = None, verbosity: int = 0) list[dict]
centralcli.cleaner.get_branch_health(data: list, down: bool = False, wan_down: bool = False) list
centralcli.cleaner.get_bssids(data: list[dict[str, str | int]], output_format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = 'rich', band: RadioBandOptions | None = None, ssid: str = None) list[dict[str, str | int]]
centralcli.cleaner.get_certificates(data: dict[str, Any], valid: bool = None, cert_types: list[CertType] = None) list[dict[str, Any]]
centralcli.cleaner.get_client_roaming_history(data: list[dict]) list[dict]
centralcli.cleaner.get_clients(data: list[dict], verbosity: int = 0, cache: Callable = None, format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = None, **kwargs) list
centralcli.cleaner.get_denylist_clients(data: dict[str, str | list[str]]) list[dict[str, str]]
centralcli.cleaner.get_device_firmware_details(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_device_inventory(data: list[dict], sub: bool = None, key: str = None) list[dict]
centralcli.cleaner.get_devices(data: list[dict[str, Any]] | dict[str, Any], *, verbosity: int = 0, output_format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = None, version: str = None, filter_params: dict[str, str] = None) list[dict] | dict

Clean device output from Central API (Monitoring)

Parameters:
  • data (list[dict[str, Any]] | dict[str, Any]) – Response data from Central API

  • verbose (bool, optional) – Not Used yet. Defaults to True.

  • version (str, optional) – Filters output based on (firmware) version (fuzzy match) or when prefixed by ‘-’, Show all devices other than devices matching the version provided. Defaults to None.

Returns:

The cleaned data with consistent field heading, and human readable values.

Return type:

list[dict[str, Any]] | dict[str, Any]

centralcli.cleaner.get_dhcp(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_dirty_diff(data: list[dict[str, str]]) list[dict[str, str]]
centralcli.cleaner.get_event_logs(data: list[dict], cache_update_func: Callable = None) list[dict]
centralcli.cleaner.get_full_wlan_list(data: list[dict] | str | dict[str, Any], verbosity: int = 0, format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = 'rich') list[dict]
centralcli.cleaner.get_fw_version_list(data: list[dict], format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = 'rich', verbose: bool = False) list[dict]
centralcli.cleaner.get_guests(data: list[dict[str, Any]], output_format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = 'yaml') list[dict[str, Any]]
centralcli.cleaner.get_gw_tunnels(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_labels(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_lldp_neighbor(data: list[dict[str, str]]) dict[str, dict[str, str]]
centralcli.cleaner.get_ospf_interface(data: list[dict[str, Any]] | dict[str, Any]) list[dict[str, Any]]
centralcli.cleaner.get_ospf_neighbor(data: list[dict[str, Any]] | dict[str, Any]) list[dict[str, Any]]
centralcli.cleaner.get_overlay_interfaces(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_overlay_routes(data: list[dict[str, Any]] | dict[str, Any], format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = 'rich', simplify: bool = True) list[dict[str, Any]]
centralcli.cleaner.get_portal_profile(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_portals(data: list[dict]) list[dict]
centralcli.cleaner.get_subscriptions(data: list[dict], default_sort: bool = True) list[dict]
centralcli.cleaner.get_swarm_firmware_details(data: list[dict[str, Any]]) list[dict[str, Any]]
centralcli.cleaner.get_switch_poe_details(data: list[dict[str, Any]], verbosity: int = 0, powered: bool = False, aos_sw: bool = False) list[dict[str, Any]]
centralcli.cleaner.get_switch_stacks(data: list[dict[str, str]], status: StatusOptions = None, stack_ids: list[str] = None, version: str = None)
centralcli.cleaner.get_template_details_for_device(data: str, device: CacheDevice) str

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: dict | list[dict[str, Any]]) list[str]

Parses Response Object from caas API updates output attribute

class centralcli.cleaner.radio_modes(*values)

Bases: Enum

access = 0
mesh = 1
mesh_point = 2
monitor = 3
spectrum = 4
centralcli.cleaner.short_key(key: str) str
centralcli.cleaner.short_value(key: str, value: Any)
centralcli.cleaner.show_ai_insights(data: list[dict[str, str | bool | int]], severity: InsightSeverityType = None)
centralcli.cleaner.show_all_ap_lldp_neighbors_for_site(data, filter: Literal['up', 'down'] = None)
centralcli.cleaner.show_groups(data: list[dict], cleaner_format: Literal['json', 'yaml', 'csv', 'rich', 'tabulate'] = 'rich') list[dict]
centralcli.cleaner.show_interfaces(data: list[dict] | dict, verbosity: int = 0, dev_type: DevTypes = 'cx') list[dict] | dict

Clean Output of interface endpoints for each device type.

Parameters:
  • data (list[dict] | dict) – The API response payload

  • verbosity (int, optional) – verbosity, more fields displayed. Defaults to 0.

  • dev_type (DevTypes, optional) – One of ap, gw, cx, sw, switch. Defaults to “cx”.

Returns:

Cleaned API response payload with less interesting fields removed

Return type:

list[dict] | dict

centralcli.cleaner.show_radios(data: list[dict[str, str | int]], band: RadioBandOptions | None = None) list[dict[str, str | int]]
centralcli.cleaner.show_ts_commands(data: list[dict[str, Any]] | dict[str, Any]) list[dict[str, Any]]
centralcli.cleaner.simple_kv_formatter(data: list[dict[str, Any]], key_order: list[str] = None, strip_keys: list[str] = None, strip_null: bool = False, emoji_bools: bool = False, show_false: bool = True, filter: Callable = None) list[dict[str, Any]]

Default simple formatter

Parameters:
  • data (list[dict[str, Any]]) – Data to be formatted, data is returned unchanged if data is not a list.

  • key_order (list[str], optional) – List of keys in the order desired. If defined only key_order key/value pairs are returned. Defaults to None.

  • strip_keys (list[str], optional) – List of keys to be stripped from output.

  • strip_null (bool, optional) – Set True to strip keys that have no value for any items. Defaults to False.

  • emoji_bools (bool, optional) – Replace boolean values with emoji ✅ for True ❌ for False. Defaults to False.

  • show_false (bool, optional) – When emoji_bools is True. Set this to False to only show ✅ for True items, leave blank for False.

  • filter (Callable, optional) – Callable that returns a bool, if set only items in the list that return True will be included.

Returns:

Formatted data

Return type:

list[dict[str, Any]]

centralcli.cleaner.sites(data: list[dict[str, Any]] | dict[str, Any]) list[dict[str, Any]]
centralcli.cleaner.sort_interfaces(interfaces: list[dict[str, Any]], interface_key: str = 'port_number') list[dict[str, Any]]
centralcli.cleaner.sort_result_keys(data: list[dict], order: list[str] = None) list[dict]
centralcli.cleaner.strip_outer_keys(data: dict) list[dict[str, Any]] | dict[str, Any]

strip unnecessary wrapping key from API response payload

Parameters:

data (dict) – The response payload (aiohttp.Response.json())

Returns:

typically list of dicts

Return type:

list[dict[str, Any]] | dict[str, Any]

centralcli.cleaner.wids(data: list[dict[str, Any]]) list[dict[str, Any]]

centralcli.config module

class centralcli.config.CentralURLs

Bases: Mapping

property menu: str
class centralcli.config.ClusterURLs(classic: str, cnx: str)

Bases: object

class centralcli.config.Config(base_dir: Path = None, *, workspace: str = None)

Bases: object

property cache_file
property cache_file_ok
property closed_capture_file: Path
property cluster: str
property cnx_tok_file: Path | None
property export_dir: Path
first_run()

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, *, workspace_only: bool = False) Any
get_cnx_url(classic_base_url: str | None)
static get_file_data(import_file: Path, text_ok: bool = False, model: Any = None) 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]

get_last_workspace() tuple[str | None, float | None, bool | None]

Gathers contents of last_workspace returns tuple with values.

last_workspace file stores: name of last workspace, timestamp of last command, numeric bool if big (will forget) msg has been displayed.

expiration is calculated based on the value of workspace_will_forget and delta between last_command timestamp and now.

Returns:

last_workspace, timestamp of last cmd using the workspace, if initial will_forget_msg has been displayed, if workspace is expired

Return type:

tuple[None, str | None, float | bool | None, bool]

get_workspace_from_args() str

Determine account to use based on arguments & last_workspace 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 workspace to use based on –workspace –ws -d flags and last_workspace file.

Return type:

str

glp_client = None
property is_cop
property last_command_file
property new_config: str | None
set_attributes()
property tok_file: Path | None
property token_store
property tokens
update_last_workspace_file(workspace: str, last_cmd_ts: int | float = 1771038815.87, msg_shown: bool = False)
property valid
property workspace: str
property workspaces: dict[str, Any]
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.

centralcli.config.ask(prompt: str = '', *, rich_console: Console | None = None, password: bool = False, choices: list[str] | None = 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”.

centralcli.config.confirm(prompt: str = '', *, console: Console | None = None) bool

wrapper function for rich.Confirm().ask()

Handles KeyBoardInterrupt, EoFError, and exits if user inputs “abort”.

centralcli.config.load_yaml(fname: Path) List | Dict | str

Load a YAML file.

centralcli.config.parse_yaml(content: str | TextIO) List | Dict | str

Load a YAML file.

centralcli.constants module

class centralcli.constants.APDeployment(*values)

Bases: str, Enum

CLUSTER = 'Cluster'
STANDALONE = 'Standalone'
class centralcli.constants.APIAction(*values)

Bases: str, Enum

ADD = 'ADD'
REPLACE = 'REPLACE'
UPDATE = 'UPDATE'
class centralcli.constants.AlertSeverity(*values)

Bases: str, Enum

critical = 'critical'
info = 'info'
major = 'major'
minor = 'minor'
warning = 'warning'
class centralcli.constants.AlertTypes(*values)

Bases: str, Enum

client = 'client'
device = 'device'
ids = 'ids'
user = 'user'
class centralcli.constants.AllDevTypes(*values)

Bases: str, Enum

ap = 'ap'
cx = 'cx'
gw = 'gw'
sdwan = 'sdwan'
sw = 'sw'
switch = 'switch'
class centralcli.constants.ArgToWhat

Bases: object

class centralcli.constants.BandwidthInterval(*values)

Bases: str, Enum

class centralcli.constants.BatchApArgs(*values)

Bases: str, Enum

rename = 'rename'
class centralcli.constants.BatchRenameArgs(*values)

Bases: str, Enum

aps = 'aps'
class centralcli.constants.BlinkArgs(*values)

Bases: str, Enum

off = 'off'
on = 'on'
class centralcli.constants.BounceArgs(*values)

Bases: str, Enum

interface = 'interface'
poe = 'poe'
class centralcli.constants.CNXDevTypes(*values)

Bases: str, Enum

ap = 'ap'
bridge = 'bridge'
cx = 'cx'
gw = 'gw'
sdwan = 'sdwan'
sw = 'sw'
class centralcli.constants.CacheArgs(*values)

Bases: str, Enum

all = 'all'
certs = 'certs'
clients = 'clients'
devices = 'devices'
events = 'events'
floor_plan_aps = 'floor_plan_aps'
floor_plan_buildings = 'floor_plan_buildings'
groups = 'groups'
guests = 'guests'
hook_active = 'hook_active'
hook_config = 'hook_config'
hook_data = 'hook_data'
inventory = 'inventory'
labels = 'labels'
licenses = 'licenses'
logs = 'logs'
mpsk = 'mpsk'
mpsk_networks = 'mpsk_networks'
portals = 'portals'
services = 'services'
sites = 'sites'
subscriptions = 'subscriptions'
tables = 'tables'
templates = 'templates'
class centralcli.constants.CancelWhat(*values)

Bases: str, Enum

device = 'device'
group = 'group'
swarm = 'swarm'
class centralcli.constants.CertFormat(*values)

Bases: str, Enum

DER = 'DER'
PEM = 'PEM'
PKCS12 = 'PKCS12'
class centralcli.constants.CertTypes(*values)

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.CloudAuthMacSortBy(*values)

Bases: str, Enum

mac = 'mac'
name = 'name'
class centralcli.constants.CloudAuthUploadType(*values)

Bases: str, Enum

mac = 'mac'
mpsk = 'mpsk'
class centralcli.constants.ClusterName(*values)

Bases: str, Enum

ae1 = 'ae1'
au1 = 'au1'
ca1 = 'ca1'
eu1 = 'eu1'
eu2 = 'eu2'
eu3 = 'eu3'
in1 = 'in1'
internal = 'internal'
jp1 = 'jp1'
us1 = 'us1'
us2 = 'us2'
us4 = 'us4'
us5 = 'us5'
us6 = 'us6'
class centralcli.constants.DeleteArgs(*values)

Bases: str, Enum

cert = 'cert'
certificate = 'certificate'
site = 'site'
class centralcli.constants.DevTypes(*values)

Bases: str, Enum

ap = 'ap'
cx = 'cx'
gw = 'gw'
sw = 'sw'
class centralcli.constants.DeviceStatusFilter(*values)

Bases: str, Enum

OFFLINE = 'OFFLINE'
ONLINE = 'ONLINE'
class centralcli.constants.DhcpArgs(*values)

Bases: str, Enum

clients = 'clients'
pools = 'pools'
class centralcli.constants.DynamicAntMode(*values)

Bases: str, Enum

narrow = 'narrow'
wide = 'wide'
class centralcli.constants.EnableDisableArgs(*values)

Bases: str, Enum

auto_sub = 'auto-sub'
class centralcli.constants.EventDevTypeArgs(*values)

Bases: str, Enum

ap = 'ap'
client = 'client'
gw = 'gw'
switch = 'switch'
class centralcli.constants.ExportDevType(*values)

Bases: str, Enum

ap = 'ap'
cx = 'cx'
gw = 'gw'
property header
property path
sw = 'sw'
class centralcli.constants.FirmwareDeviceType(*values)

Bases: str, Enum

ap = 'ap'
cx = 'cx'
gw = 'gw'
mas = 'mas'
sw = 'sw'
switch = 'switch'
class centralcli.constants.GatewayRole(*values)

Bases: str, Enum

branch = 'branch'
vpnc = 'vpnc'
wlan = 'wlan'
class centralcli.constants.GenericDevTypes(*values)

Bases: str, Enum

ap = 'ap'
gw = 'gw'
sdwan = 'sdwan'
switch = 'switch'
class centralcli.constants.GroupDevTypes(*values)

Bases: str, Enum

ap = 'ap'
cx = 'cx'
gw = 'gw'
sdwan = 'sdwan'
sw = 'sw'
class centralcli.constants.HelpObject(*values)

Bases: str, Enum

buildings = 'buildings'
certs = 'certs'
clients = 'clients'
devices = 'devices'
floor_aps = 'floor-aps'
groups = 'groups'
guests = 'guests'
inventory = 'inventory'
invmondevs = 'invmondevs'
labels = 'labels'
mpsk_nets = 'mpsk-nets'
mpsks = 'mpsks'
portals = 'portals'
serials = 'serials'
sites = 'sites'
subs = 'subs'
templates = 'templates'
class centralcli.constants.IAPTimeZoneNames(*values)

Bases: str, Enum

abu_dhabi = 'Abu-Dhabi'
adelaide = 'Adelaide'
alaska = 'Alaska'
amman = 'Amman'
amsterdam = 'Amsterdam'
arizona = 'Arizona'
astana = 'Astana'
asuncion = 'Asuncion'
athens = 'Athens'
atlantic_time_Canada = 'Atlantic-Time(Canada)'
auckland = 'Auckland'
azores = 'Azores'
baghdad = 'Baghdad'
baja_california = 'Baja-California'
baku = 'Baku'
bangkok = 'Bangkok'
beijing = 'Beijing'
beirut = 'Beirut'
belgrade = 'Belgrade'
berlin = 'Berlin'
bern = 'Bern'
bogota = 'Bogota'
brasilia = 'Brasilia'
bratislava = 'Bratislava'
brisbane = 'Brisbane'
brussels = 'Brussels'
bucharest = 'Bucharest'
budapest = 'Budapest'
buenos_aires = 'Buenos-Aires'
cairo = 'Cairo'
canberra = 'Canberra'
cape_verde_is = 'Cape-Verde-Is'
caracas = 'Caracas'
casablanca = 'Casablanca'
cayenne = 'Cayenne'
central_america = 'Central-America'
central_time = 'Central-Time'
chennai = 'Chennai'
chihuahua = 'Chihuahua'
chongqing = 'Chongqing'
coordinated_universal_time = 'Coordinated-Universal-Time'
coordinated_universal_time_minus_11 = 'Coordinated-Universal-Time-11'
coordinated_universal_time_minus_2 = 'Coordinated-Universal-Time-02'
coordinated_universal_time_plus_12 = 'Coordinated-Universal-Time+12'
copenhagen = 'Copenhagen'
cuiaba = 'Cuiaba'
damascus = 'Damascus'
darwin = 'Darwin'
dhaka = 'Dhaka'
dublin = 'Dublin'
east_europe = 'East-Europe'
eastern_time = 'Eastern-Time'
edinburgh = 'Edinburgh'
ekaterinburg = 'Ekaterinburg'
fiji = 'Fiji'
fortaleza = 'Fortaleza'
georgetown = 'Georgetown'
greenland = 'Greenland'
guadalajara = 'Guadalajara'
guam = 'Guam'
hanoi = 'Hanoi'
harare = 'Harare'
hawaii = 'Hawaii'
helsinki = 'Helsinki'
hobart = 'Hobart'
hongKong = 'HongKong'
indiana_east = 'Indiana(East)'
international_date_line_west = 'International-Date-Line-West'
irkutsk = 'Irkutsk'
islamabad = 'Islamabad'
istanbul = 'Istanbul'
jakarta = 'Jakarta'
jerusalem = 'Jerusalem'
kabul = 'Kabul'
karachi = 'Karachi'
kathmandu = 'Kathmandu'
kolkata = 'Kolkata'
krasnoyarsk = 'Krasnoyarsk'
kuala_lumpur = 'Kuala-Lumpur'
kuwait = 'Kuwait'
kyiv = 'Kyiv'
la_paz = 'La-Paz'
lima = 'Lima'
lisbon = 'Lisbon'
ljubljana = 'Ljubljana'
london = 'London'
madrid = 'Madrid'
magadan = 'Magadan'
manaus = 'Manaus'
mazatlan = 'Mazatlan'
melbourne = 'Melbourne'
mexico_city = 'Mexico-City'
mid_atlantic = 'Mid-Atlantic'
minsk = 'Minsk'
monrovia = 'Monrovia'
monterrey = 'Monterrey'
montevideo = 'Montevideo'
moscow = 'Moscow'
mountain_time = 'Mountain-Time'
mumbai = 'Mumbai'
muscat = 'Muscat'
nairobi = 'Nairobi'
new_caledonia = 'New-Caledonia'
new_delhi = 'New-Delhi'
newfoundland = 'Newfoundland'
none = 'none'
novosibirsk = 'Novosibirsk'
nukualofa = 'Nukualofa'
osaka = 'Osaka'
pacific_time = 'Pacific-Time'
paris = 'Paris'
perth = 'Perth'
port_louis = 'Port-Louis'
port_moresby = 'Port-Moresby'
prague = 'Prague'
pretoria = 'Pretoria'
quito = 'Quito'
reykjavik = 'Reykjavik'
riga = 'Riga'
riyadh = 'Riyadh'
rome = 'Rome'
salvador = 'Salvador'
samoa = 'Samoa'
san_juan = 'San-Juan'
santiago = 'Santiago'
sapporo = 'Sapporo'
sarajevo = 'Sarajevo'
saskatchewan = 'Saskatchewan'
seoul = 'Seoul'
singapore = 'Singapore'
skopje = 'Skopje'
sofia = 'Sofia'
solomon_is = 'Solomon-Is.'
sri_jayawardenepura = 'Sri-Jayawardenepura'
st_petersburg = 'St.Petersburg'
stockholm = 'Stockholm'
sydney = 'Sydney'
taipei = 'Taipei'
tallinn = 'Tallinn'
tashkent = 'Tashkent'
tbilisi = 'Tbilisi'
tehran = 'Tehran'
tokyo = 'Tokyo'
ulaanbaatar = 'Ulaanbaatar'
urumqi = 'Urumqi'
vienna = 'Vienna'
vilnius = 'Vilnius'
vladivostok = 'Vladivostok'
volgograd = 'Volgograd'
warsaw = 'Warsaw'
wellington = 'Wellington'
west_central_africa = 'West-Central-Africa'
windhoek = 'Windhoek'
yakutsk = 'Yakutsk'
yangon = 'Yangon'
yerevan = 'Yerevan'
zagreb = 'Zagreb'
class centralcli.constants.IdenMetaVars

Bases: object

class centralcli.constants.InsightSeverity(*values)

Bases: str, Enum

hight = 'high'
low = 'low'
med = 'med'
class centralcli.constants.KickArgs(*values)

Bases: str, Enum

all = 'all'
mac = 'mac'
wlan = 'wlan'
class centralcli.constants.LLDPCapabilityTypes(*values)

Bases: Enum

Bridge = 3
Router = 5
Wlan_Access_Point = 4
unknown0 = 0
unknown1 = 1
unknown2 = 2
unknown6 = 6
unknown7 = 7
class centralcli.constants.LibToAPI

Bases: object

Convert consistent device types used by this library to the various types used by Central API endpoints

If no method str is provided converts various strings to consistent library device types.

property valid: list
property valid_generic_str: list
property valid_str: list
class centralcli.constants.LibToGenericPlural

Bases: object

class centralcli.constants.LicenseTypes(*values)

Bases: str, Enum

advance_70xx = 'advance-70xx'
advance_72xx = 'advance-72xx'
advance_90xx_sec = 'advance-90xx-sec'
advanced_91xx = 'advanced-91xx'
advanced_91xx_sec = 'advanced-91xx-sec'
advanced_92xx_sec = 'advanced-92xx-sec'
advanced_ap = 'advanced-ap'
advanced_nw_third_party = 'advanced-nw-third-party'
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_8xxx_9xxx_10xxx = 'advanced-switch-8xxx-9xxx-10xxx'
foundation_7005 = 'foundation-7005'
foundation_70xx = 'foundation-70xx'
foundation_72xx = 'foundation-72xx'
foundation_90xx_sec = 'foundation-90xx-sec'
foundation_91xx = 'foundation-91xx'
foundation_91xx_sec = 'foundation-91xx-sec'
foundation_92xx_sec = 'foundation-92xx-sec'
foundation_ap = 'foundation-ap'
foundation_base_90xx_sec = 'foundation-base-90xx-sec'
foundation_nw_third_party = 'foundation-nw-third-party'
foundation_sdflex = 'foundation-sdflex'
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'
vgw_2g = 'vgw-2g'
vgw_4g = 'vgw-4g'
vgw_500m = 'vgw-500m'
wlan_advanced_90xx_sec = 'wlan-advanced-90xx-sec'
wlan_advanced_91xx = 'wlan-advanced-91xx'
wlan_advanced_91xx_sec = 'wlan-advanced-91xx-sec'
wlan_advanced_92xx_sec = 'wlan-advanced-92xx-sec'
class centralcli.constants.LogAppArgs(*values)

Bases: str, Enum

account_setting = 'account_setting'
nms = 'nms'
class centralcli.constants.LogLevel(*values)

Bases: str, Enum

LOG_ERR = 'error'
LOG_INFO = 'info'
LOG_WARN = 'warning'
Minor = 'minor'
clear = 'clear'
negative = 'negative'
neutral = 'neutral'
normal = 'normal'
positive = 'positive'
class centralcli.constants.LogSortBy(*values)

Bases: str, Enum

app = 'app'
description = 'description'
id = 'id'
ip = 'ip'
target = 'target'
time = 'time'
user = 'user'
class centralcli.constants.MacFormat(*values)

Bases: str, Enum

CLEAN = 'CLEAN'
COLS = 'COLS'
DASHES = 'DASHES'
DOTS = 'DOTS'
OBJECT = 'OBJECT'
clean = 'clean'
cols = 'cols'
dashes = 'dashes'
dots = 'dots'
class centralcli.constants.NotifyToArgs(*values)

Bases: str, Enum

email = 'email'
phone = 'phone'
class centralcli.constants.PoEDetectionStatus(*values)

Bases: Enum

Delivering = 3
NA = 0
Searching = 2
Undefined = 1
class centralcli.constants.RadioBandOptions(*values)

Bases: str, Enum

class centralcli.constants.RadioMode(*values)

Bases: str, Enum

access = 'access'
monitor = 'monitor'
spectrum = 'spectrum'
class centralcli.constants.RefreshWhat(*values)

Bases: str, Enum

cache = 'cache'
token = 'token'
tokens = 'tokens'
class centralcli.constants.RemoveArgs(*values)

Bases: str, Enum

site = 'site'
class centralcli.constants.ResetArgs(*values)

Bases: str, Enum

overlay = 'overlay'
class centralcli.constants.SendCmdArg2(*values)

Bases: str, Enum

commands = 'commands'
class centralcli.constants.SendCmdArgs(*values)

Bases: str, Enum

all = 'all'
device = 'device'
file = 'file'
group = 'group'
site = 'site'
class centralcli.constants.ShowArg2(*values)

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(*values)

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(*values)

Bases: str, Enum

logs = 'logs'
pid = 'pid'
port = 'port'
class centralcli.constants.ShowInventoryArgs(*values)

Bases: str, Enum

all = 'all'
ap = 'ap'
gw = 'gw'
switch = 'switch'
vgw = 'vgw'
class centralcli.constants.SiteStates(*values)

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(*values)

Bases: str, Enum

acknowledged = 'acknowledged'
description = 'description'
severity = 'severity'
time = 'time'
type = 'type'
class centralcli.constants.SortArchivedOptions(*values)

Bases: str, Enum

mac = 'mac'
model = 'model'
resource_id = 'resource-id'
serial = 'serial'
sku = 'sku'
type = 'type'
class centralcli.constants.SortBSSIDOptions(*values)

Bases: str, Enum

ap = 'ap'
band = 'band'
bssid = 'bssid'
mac = 'mac'
name = 'name'
serial = 'serial'
ssid = 'ssid'
class centralcli.constants.SortCertOptions(*values)

Bases: str, Enum

expiration = 'expiration'
expired = 'expired'
md5_checksum = 'md5-checksum'
name = 'name'
sha1_checksum = 'sha1-checksum'
type = 'type'
class centralcli.constants.SortClientOptions(*values)

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(*values)

Bases: str, Enum

ap = 'ap'
ap_ip = 'ap-ip'
ap_port = 'ap-port'
ap_serial = 'ap-serial'
clients = 'clients'
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.SortDhcpOptions(*values)

Bases: str, Enum

client_name = 'client-name'
client_type = 'client-type'
free_ip = 'free-ip'
ip = 'ip'
lease_end = 'lease-end'
lease_remaining = 'lease-remaining'
lease_start = 'lease-start'
lease_time = 'lease-time'
mac = 'mac'
pool_name = 'pool-name'
pool_size = 'pool-size'
pvid = 'pvid'
subnet = 'subnet'
class centralcli.constants.SortGroupOptions(*values)

Bases: str, Enum

AOSVersion = 'gw-role'
AllowedDevTypes = 'allowed-types'
ApNetworkRole = 'aos10'
Architecture = 'microbranch'
GwNetworkRole = 'cnx'
name = 'name'
template_group = 'template-group'
class centralcli.constants.SortGuestOptions(*values)

Bases: str, Enum

created = 'created'
email = 'email'
enabled = 'enabled'
expires = 'expires'
id = 'id'
name = 'name'
phone = 'phone'
portal = 'portal'
remaining = 'remaining'
status = 'status'
class centralcli.constants.SortInsightOptions(*values)

Bases: str, Enum

category = 'category'
config_insight = 'config-insight'
impact = 'impact'
insight = 'insight'
insight_id = 'insight-id'
severity = 'severity'
class centralcli.constants.SortInventoryOptions(*values)

Bases: str, Enum

expires_in = 'expires-in'
mac = 'mac'
model = 'model'
serial = 'serial'
services = 'services'
sku = 'sku'
subscription_key = 'subscription-key'
type = 'type'
class centralcli.constants.SortLabelOptions(*values)

Bases: str, Enum

devices = 'devices'
id_ = 'id'
name = 'name'
class centralcli.constants.SortNamedMpskOptions(*values)

Bases: str, Enum

mpsk = 'mpsk'
name = 'name'
role = 'role'
status = 'status'
class centralcli.constants.SortOspfAreaOptions(*values)

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(*values)

Bases: str, Enum

age = 'age'
area = 'area'
checksum = 'checksum'
ls_id = 'ls-id'
lsa_type = 'lsa-type'
route_tag = 'route-tag'
router_id = 'router-id'
seq_no = 'seq-no'
class centralcli.constants.SortOspfInterfaceOptions(*values)

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(*values)

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(*values)

Bases: str, Enum

endpoint = 'endpoint'
name = 'name'
routes = 'routes'
state = 'state'
uptime = 'uptime'
class centralcli.constants.SortPortalOptions(*values)

Bases: str, Enum

auth = 'auth'
id = 'id'
name = 'name'
reg_by_email = 'reg-by-email'
reg_by_phone = 'reg-by-phone'
url = 'url'
class centralcli.constants.SortRouteOptions(*values)

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(*values)

Bases: str, Enum

address = 'address'
associated_devices = 'associated-devices'
city = 'city'
country = 'country'
id = 'id'
name = 'name'
state = 'state'
zipcode = 'zipcode'
class centralcli.constants.SortStackOptions(*values)

Bases: str, Enum

group = 'group'
mac = 'mac'
name = 'name'
split_policy = 'split-policy'
status = 'status'
topology = 'topology'
class centralcli.constants.SortSubscriptionOptions(*values)

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.SortSwarmOptions(*values)

Bases: str, Enum

group = 'group'
ip = 'ip'
name = 'name'
public_ip = 'public-ip'
status = 'status'
swarm_id = 'swarm-id'
version = 'version'
class centralcli.constants.SortTemplateOptions(*values)

Bases: str, Enum

device_type = 'device-type'
group = 'group'
model = 'model'
name = 'name'
template_hash = 'template-hash'
version = 'version'
class centralcli.constants.SortTsCmdOptions(*values)

Bases: str, Enum

category = 'category'
command_id = 'id'
class centralcli.constants.SortVlanOptions(*values)

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(*values)

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(*values)

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(*values)

Bases: str, Enum

hook2snow = 'hook2snow'
hook_proxy = 'hook-proxy'
class centralcli.constants.StatusOptions(*values)

Bases: str, Enum

DOWN = 'DOWN'
Down = 'Down'
UP = 'UP'
Up = 'Up'
down = 'down'
up = 'up'
class centralcli.constants.SubscriptionArgs(*values)

Bases: str, Enum

auto = 'auto'
details = 'details'
names = 'names'
stats = 'stats'
class centralcli.constants.SwitchRoles(*values)

Bases: Enum

ERR = 0
stack_conductor = 2
stack_member = 4
stack_standby = 3
stand_alone = 1
class centralcli.constants.SwitchRolesShort(*values)

Bases: Enum

ERR = 0
conductor = 2
mbr = 4
stand_alone = 1
stby = 3
class centralcli.constants.TSDevTypes(*values)

Bases: str, Enum

ap = 'ap'
cx = 'cx'
gateway = 'gateway'
gw = 'gw'
mas = 'mas'
sw = 'sw'
switch = 'switch'
class centralcli.constants.TemplateLevel1(*values)

Bases: str, Enum

add = 'add'
delete = 'delete'
update = 'update'
class centralcli.constants.TimeRange(*values)

Bases: str, Enum

class centralcli.constants.UpgradeArgs(*values)

Bases: str, Enum

ap = 'ap'
gateway = 'gateway'
switch = 'switch'
class centralcli.constants.UplinkNames(*values)

Bases: str, Enum

uplink101 = 'uplink101'
uplink102 = 'uplink102'
uplink103 = 'uplink103'
uplink104 = 'uplink104'
uplink105 = 'uplink105'
class centralcli.constants.WhatToPretty

Bases: object

class centralcli.constants.WlanType(*values)

Bases: str, Enum

employee = 'employee'
guest = 'guest'
centralcli.constants.do_load_pycentral() bool

Determine if provided command requires pycentral load and cache initialization check.

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.objects module

object Classes

class centralcli.objects.DateTime(timestamp: int | float | str, format: Literal['day-datetime', 'durwords', 'durwords-short', 'timediff', 'timediff-past', 'mdyt', 'log', 'date-string'] = 'day-datetime', tz: str = 'local', pad_hour: bool = False, round_to_minute: bool = False, format_expiration: bool = False)

Bases: object

DateTime object with a number of timestamp to string converters for various representations used by the CLI.

property date_string: str

Render date as human string like ‘Dec 10, 2019’.

Returns:

Date as string in format: ‘Dec 10, 2019’

Return type:

str

property day_datetime: str

Render date in day_datetime format

Returns:

Date as string in format: ‘Thu, May 7, 2020 3:49 AM’

Return type:

str

property durwords: str

Render elapsed time in seconds as duration string.

Returns:

Duration as string in format: ‘2 weeks 1 day 1 hour 21 minutes 2 seconds’

Return type:

str

property durwords_short: str

Render timestamp as duration in short format.

Strips off seconds and rounds to minute if Class instantiated with round_to_minutes=True

Returns:

Duration as string in format: ‘2w 1d 1h 21m 2s’ (without seconds if round_to_minute = True)

Return type:

str

property expiration: str

Render date/time in format provided during instantiation colorized to indicate how near expiration the date is.

return is colorized:
  • orange: if expiration within 6 months

  • red: if expiration within 3 months

Returns:

Potentially colorized date str.

Return type:

str

property is_expired: bool
property iso: str

Render date in ISO format

Returns:

Date as string in format: ‘2013-03-31T03:30:00+02:00’

Return type:

str

property log: str

Render date as human string in log format.

Hour is zero-padded if Class is instantiated with pad_hour=True

Returns:

Date as string in format: ‘Jan 08 7:59:00 PM’ or ‘Jan 08 07:59:00 PM’ if pad_hour=True

Return type:

str

property mdyt: str

Render date as human string like Mon day, year time AM/PM.

Hour is zero-padded if Class is instantiated with pad_hour=True

Returns:

Date as string in format: ‘May 7, 2020 3:49:24 AM’ or ‘May 7, 2020 03:49:24 AM’ if pad_hour=True

Return type:

str

normalize_epoch(timestamp: int | float | str) int | float

Normalize timestamp/epoch or iso date str to seconds.

Parameters:

timestamp (int | float | str) – timestamp/epoch is seconds or milliseconds or iso date string

Returns:

timestamp/epoch in seconds

Return type:

int | float

property timediff: str

Render duration words representing the difference between self.ts and now.

Returns:

The difference between now and the timestamp in the format: ‘47 minutes ago’.

Return type:

str

property timediff_past: str

Render past words representing the difference between self.ts and now.

Returns:

The difference between now and the timestamp in the format: ‘past 47 minutes’.

Return type:

str

class centralcli.objects.Encoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: JSONEncoder

A Custom JSON Encoder to handle custom DateTime object (and Path) during JSON serialization.

default(obj: DateTime | Path | BaseModel)

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return super().default(o)
class centralcli.objects.ShowInterfaceFilters(up: bool = False, down: bool = False, slow: bool = False, fast: bool = False)

Bases: object

__bool__() bool

Returns a bool indicating if any filters are True

property error: str
property ok: bool

Returns a bool indicating if filters are valid

property title_sfx: str

centralcli.exceptions module

exception centralcli.exceptions.ArubaCentralException

Bases: Exception

exception centralcli.exceptions.CentralCliException

Bases: Exception

exception centralcli.exceptions.ConfigNotFoundException

Bases: CentralCliException

exception centralcli.exceptions.DevException

Bases: ArubaCentralException

exception centralcli.exceptions.ImportException

Bases: CentralCliException

exception centralcli.exceptions.IncidentException

Bases: ServiceNowException

exception centralcli.exceptions.InvalidConfigException

Bases: CentralCliException

exception centralcli.exceptions.MissingFieldException

Bases: CentralCliException

exception centralcli.exceptions.MissingRequiredArgumentException

Bases: TypeError

exception centralcli.exceptions.RefreshFailedException

Bases: ServiceNowException

exception centralcli.exceptions.ServiceNowException

Bases: Exception

exception centralcli.exceptions.TimeoutException

Bases: ArubaCentralException

exception centralcli.exceptions.WorkSpaceNotFoundException

Bases: CentralCliException

centralcli.logger module

class centralcli.logger.MyLogger(log_file: str | Path, debug: bool = False, show: bool = False, verbose: bool = False, deprecation_warnings: str | list[str] = None)

Bases: object

property DEBUG: bool
property caption: None | str

render log messages queued for display in output caption.

debugv(msgs: list[str] | str, log: bool = True, show: bool = None, *args, **kwargs) None

More verbose debugging - set via debugv: True in config

follow(pytest: bool = False) None

generator function that yields new lines in log file

get_logger() Logger

Return custom log object.

inspect(msgs: str | list[str], obj: object, *, level: Literal['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET', 'critical', 'error', 'warning', 'info', 'debug', 'notset'] = 'error', title: bool = None, show: bool = False)
property level_name: str | int
log_print(msgs: str | list[str], *args, log: bool = None, show: bool = None, caption: bool = False, level: str = 'info', exc_info: bool = None, extra: bool = None, stack_info: bool = False, stacklevel: int = 1, **kwargs) None
print_file(pytest: bool = False, show_all: bool = False, unused_mocks: bool = False) None
setLevel(level)

centralcli.response module

class centralcli.response.BatchResponse(responses: list[Response], output_formatter: Callable = None, raw_formatter: Callable = None)

Bases: object

property display: Response | None
property elapsed: float
property exit_code
property failed
get_output() list[dict] | None
property last
property last_rl
property ok
property output: list[dict] | None
property passed
property raw: dict[str, Any]
class centralcli.response.CombinedResponse(responses: ~typing.List[~centralcli.response.Response], combiner_func: ~collections.abc.Callable = <function CombinedResponse.flatten_resp>)

Bases: Response

property all_ok
property failed
flatten_resp() Response
property ok
property passed
property urls: List[URL]
class centralcli.response.RateLimit(resp: ClientResponse = None)

Bases: object

property has_value: bool
property near_day: bool
property near_sec: bool
property ok: bool
property text: str
class centralcli.response.Response(response: ClientResponse = None, url: URL | str = '', ok: bool = None, error: str = None, output: list[dict[str, Any]] | dict[str, Any] | str = None, raw: dict[str, Any] = None, status_code: int = None, elapsed: int | float = None, data_key: str = None, caption: str | list[str] = None, exit_code: int = None, mock_key_append: str | None = 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

  • rl (RateLimit): Rate Limit info extracted from aiohttp.ClientResponse headers.

Create instance by providing at minimum one of the following parameters:
  • response (ClientResponse) and output(typically List[dict]): 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.

property async_failed_devices: list[str]
property async_status_url: str | None
property async_success_devices: list[str]
dump() str
property exit_code: int
get(key: int | str, default: Any = None)
property headers: Mapping
property is_already_claimed: bool

property used for glp async ops responses to determine if the failure was due to it already being claimed

During a device add tags won’t be processed if the device already exists

Returns:

indicating if the response has devices that failed due to them being already claimed/in GLP

Return type:

bool

keys() KeysView
property ok
property status_code: int

Make attributes used for status code for both aiohttp and requests valid.

property summary: dict[str, int | str | list | dict]
property table: List[Dict[str, Any]]

Returns output with only the keys that are common across all items.

Returns:

resp.output with only keys common across all items.

Return type:

List[Dict[str, Any]]

centralcli.utils module

class centralcli.utils.Convert(mac: str, fuzzy: bool = False)

Bases: object

property cols: str
property dashes: str
property dec: int
property dots: str
property url: str
class centralcli.utils.Mac(mac: str | bytes, fuzzy: bool = False)

Bases: Convert

get_range(items: int = 10, mac_format: MacFormat = MacFormat.cols)
class centralcli.utils.MacFormat(*values)

Bases: str, Enum

CLEAN = 'CLEAN'
COLS = 'COLS'
DASHES = 'DASHES'
DOTS = 'DOTS'
OBJECT = 'OBJECT'
clean = 'clean'
cols = 'cols'
dashes = 'dashes'
dots = 'dots'
class centralcli.utils.ToBool(value: Any)

Bases: object

property ok: bool
str_to_bool(value: str | None) bool | None
class centralcli.utils.Utils

Bases: object

all_keys(data: list[dict[str, Any]], with_value: Literal[False]) set[str]
all_keys(data: list[dict[str, Any]], with_value: Literal[True]) list[str]
static build_multipart_form_data(url: str | URL, method: str = 'POST', *, files: dict, params: dict[str, str] = None, base_url: str | URL = None) dict[str, bytes | dict[str, str]]
static chunker(seq: Iterable, size: int)
static clean_validation_errors(exc) str

strip off the ‘for further information … part of a pydantic ValidationError

static color(text: str | bool | List[str], color_str: str = 'bright_green', *, pad_len: int = 0, dim: bool = None, italic: bool = None, bold: bool = None, blink: bool = None, sep: str = ', ') 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. ‘random’ will pick a random color. If text is a list, it will pick a random color for each item in the list. Default: bright_green

  • pad_len (int, optional) – Number of spaces to pad each entry with. Defaults to 0.

  • italic (bool, optional) – Wheather to apply dim format to text.

  • italic – Wheather to apply italic to text. Default False if str is provided for text True if bool is provided.

  • bold (bool, optional) – Wheather to apply bold to text. Default None/False

  • blink (bool, optional) – Wheather to blink the text. Default None/False

  • sep (str, optional) – Seperator used when list of str converted to str. Defaults to ‘, ‘

static convert_bytes_to_human(size: int | float | Dict[str, int | float] | None, precision: int = 2, throughput: bool = False, speed: bool = False, return_size: Literal['B', 'KB', 'MB', 'GB', 'TB', 'PB'] = None) str | None
format_table(data: list[dict[str, Any]], key_order: list[str] = None) list[dict[str, Any]]

Given a list of dicts return a list of dicts, ensuring each dict has the same set of keys.

static generate_template(template_file: Path | str, var_file: Path | str | None = None, *, config_data: list | dict = None) str

Generate configuration files based on j2 templates and provided variables.

get_interfaces_from_range(interfaces: str | List[str]) List[str]
static get_mock_append(method: Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE'], json_data: Any, headers: CIMultiDictProxy[str] = None) str | None

mock_key is for testing w/ mock responses.

static get_multiline_input(prompt: str = None, return_type: Literal['str', 'dict', 'list'] = 'str', abort_str: str = 'EXIT', **kwargs) List[str] | dict | str
static is_resource_id(res_id: str) bool
static is_serial(serial: 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: str | list[str]) list[str]
listify(var: PrimaryDeviceTypes | list[PrimaryDeviceTypes]) list[PrimaryDeviceTypes]
listify(var: int | Sequence[int]) Sequence[int]
listify(var: dict | Sequence[dict]) Sequence[dict]
listify(var: tuple) tuple
listify(var: list) list
listify(var: list, flatten: bool) list[Any]
listify(var: None) None
static normalize_device_sub_field(data: list[dict[str, str]], *, word_sep: Literal['-', '_'] = None) list[dict[str, str]]
static older_than(ts: int | float | datetime, time_frame: int, unit: Literal['days', 'hours', 'minutes', 'seconds', 'weeks', 'months'] = 'days', tz: str = 'UTC') bool
static open_file_with_editor(filename: str | Path)
static parse_phone_number(phone_number: int | str, strict: bool = True) str
static parse_time_options(from_time: int | float | datetime = None, to_time: int | float | datetime = None, in_milliseconds: bool = False) Tuple[int | None, int | None]

parse time options (from_time, to_time) from user if any provided and return int timestamp for each.

Parameters:
  • from_time (int | float | datetime, optional) – from time. Defaults to None.

  • to_time (int | float | datetime, optional) – to time. Defaults to None.

  • in_milliseconds (bool, optional) – Convert response timestamps to milliseconds. Default is Seconds.

Returns:

returns Tuple with int timestamps for from_time and to_time or None (user didn’t use the option).

Return type:

Tuple(int | None, int | None)

static parse_var_value_list(var_value: list[str], *, source: VarValueSource = VarValueSource.TAGS) dict[str, str]
static remove_time_params(params: dict[str, Any]) dict[str, Any]
static singular_plural_sfx(items: Iterable | int, singular: str = None, plural: str = None) str
strip_no_value(data: list[dict] | dict[str, dict], aggressive: bool = False) list[dict] | dict[str, 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

Parameters:
  • data (list[dict] | dict[dict]) – data to process

  • aggressive (bool, optional) – If True will strip any key with no value, Default is to only strip if all instances of a given key have no value.

Returns:

processed data

Return type:

List[dict] | Dict[dict]

static strip_none(data: dict, strip_empty_obj: bool | None) dict
static strip_none(data: list, strip_empty_obj: bool | None) list
static strip_none(data: list) list
static strip_none(data: None, strip_empty_obj: bool | None) None

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.

summarize_data(data: list[dict[str, str | int | bool]], max: int = 12, pad: int = 2, sep: str = '\n') str

Given a list of dicts with undetermined keys/fields, return a string summarizing those values.

Parameters:
  • data (list[dict[str, str | int | bool]]) – The data to be summarized.

  • pad (int, optional) – Amount of padding to prepend to each line.

Returns:

summary of each dict, 1 line per dict.

Return type:

str

static summarize_list(items: list[str | StrEnum | CentralObject], max: int = 6, pad: int = 4, sep: str = '\n', color: str | None = 'cyan', italic: bool = False, bold: bool = False, use_enum_name: bool = False) str
static unique(_list: list, sort: bool = False) list
static unlistify(data: Any, replace_underscores: bool = True)

Remove unnecessary outer lists.

Returns:

[] = ‘’ [‘single_item’] = ‘single item’ by default ‘single_item’ if replace_underscores=False [[item1], [item2], …] = [item1, item2, …]

static update_dict(dict_to_update: Dict[str, List[Any]], key: str, value: Any) Dict[str, List[Any]]

Add key to dict or append to existing key if it already exists

TODO probably an itertools or other builtin that does this.

Parameters:
  • dict_to_update (Dict[str, list]) – The dict to update

  • key (str) – The key, will ensure value is in dict under that key, or append if already there

  • value (Any) – value to be added to list

Returns:

Orinal dict is returned updated with provided value

Return type:

Dict[str, list]

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 no commands remain after formatting.

Returns:

Original list of str with each line rstrip.

class centralcli.utils.VarValueSource(*values)

Bases: str, Enum

TAGS = 'tags'
VARIABLES = 'variables'