centralcli 5.2.2__tar.gz → 5.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {centralcli-5.2.2 → centralcli-5.4.0}/PKG-INFO +1 -1
  2. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cache.py +1 -1
  3. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/central.py +76 -66
  4. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cleaner.py +179 -79
  5. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cli.py +3 -1
  6. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clibatch.py +14 -3
  7. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clicommon.py +90 -89
  8. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishow.py +89 -54
  9. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowaudit.py +5 -4
  10. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowospf.py +24 -37
  11. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowoverlay.py +12 -13
  12. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliupgrade.py +5 -3
  13. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/constants.py +8 -25
  14. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/logger.py +15 -14
  15. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/objects.py +6 -14
  16. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/render.py +3 -3
  17. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/response.py +36 -18
  18. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/strings.py +0 -15
  19. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/utils.py +27 -1
  20. {centralcli-5.2.2 → centralcli-5.4.0}/pyproject.toml +1 -1
  21. {centralcli-5.2.2 → centralcli-5.4.0}/LICENSE +0 -0
  22. {centralcli-5.2.2 → centralcli-5.4.0}/README.md +0 -0
  23. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/__init__.py +0 -0
  24. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/boilerplate/README.md +0 -0
  25. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/boilerplate/allcalls.py +0 -0
  26. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/caas.py +0 -0
  27. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliadd.py +0 -0
  28. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliassign.py +0 -0
  29. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clicaas.py +0 -0
  30. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliclone.py +0 -0
  31. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clidel.py +0 -0
  32. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clidelfirmware.py +0 -0
  33. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliexport.py +0 -0
  34. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clikick.py +0 -0
  35. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clioptions.py +0 -0
  36. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clirefresh.py +0 -0
  37. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clirename.py +0 -0
  38. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliset.py +0 -0
  39. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clisetfirmware.py +0 -0
  40. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowbranch.py +0 -0
  41. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowcloudauth.py +0 -0
  42. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowfirmware.py +0 -0
  43. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowmpsk.py +0 -0
  44. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowtshoot.py +0 -0
  45. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clishowwids.py +0 -0
  46. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clitest.py +0 -0
  47. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/clitshoot.py +0 -0
  48. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliunassign.py +0 -0
  49. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/cliupdate.py +0 -0
  50. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/config.py +0 -0
  51. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/exceptions.py +0 -0
  52. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/models.py +0 -0
  53. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/setup.py +0 -0
  54. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/static/favicon.ico +0 -0
  55. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/vscodeargs.py +0 -0
  56. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/wh2snow.py +0 -0
  57. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/wh_proxy.py +0 -0
  58. {centralcli-5.2.2 → centralcli-5.4.0}/centralcli/wh_proxy_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: centralcli
3
- Version: 5.2.2
3
+ Version: 5.4.0
4
4
  Summary: A CLI for interacting with Aruba Central (Cloud Management Platform). Facilitates bulk imports, exports, reporting. A handy tool if you have devices managed by Aruba Central.
5
5
  Home-page: https://github.com/Pack3tL0ss/central-api-cli
6
6
  License: MIT
@@ -1086,7 +1086,7 @@ class Cache:
1086
1086
  err_console.print(":warning: Invalid config")
1087
1087
  return
1088
1088
 
1089
- match = self.get_dev_identifier(incomplete, device_type="gw", completion=True)
1089
+ match = self.get_dev_identifier(incomplete, dev_type="gw", completion=True)
1090
1090
 
1091
1091
  out = []
1092
1092
  if match:
@@ -252,10 +252,10 @@ class CentralApi(Session):
252
252
  cluster_id: str = None,
253
253
  band: str = None,
254
254
  mac: str = None,
255
- # sort_by: str = None,
255
+ client_status: constants.ClientStatus = "CONNECTED",
256
+ past: str = "3H",
256
257
  offset: int = 0,
257
258
  limit: int = 1000,
258
- # **kwargs,
259
259
  ) -> Response:
260
260
  """Get Clients details.
261
261
 
@@ -271,6 +271,10 @@ class CentralApi(Session):
271
271
  cluster_id (str, optional): Filter by Cluster ID. Defaults to None.
272
272
  band (str, optional): Filter by band. Defaults to None.
273
273
  mac (str, optional): Filter by client MAC. Defaults to None.
274
+ client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional): Return clients that are
275
+ connected, or clients that have failed to connect. Defaults to CONNECTED.
276
+ past: (str, optional): Time-range to show client details for. Format:
277
+ 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H
274
278
  offset (int, optional): API Paging offset. Defaults to 0.
275
279
  limit (int, optional): API record limit per request. Defaults to 1000 Max 1000.
276
280
 
@@ -284,8 +288,8 @@ class CentralApi(Session):
284
288
  "site": site,
285
289
  "serial": serial,
286
290
  "cluster_id": cluster_id,
287
- # 'fields': fields,
288
- # 'sort_by': sort_by,
291
+ "client_status": client_status,
292
+ "past": past,
289
293
  "offset": offset,
290
294
  "limit": limit,
291
295
  }
@@ -348,10 +352,10 @@ class CentralApi(Session):
348
352
  stack_id: str = None,
349
353
  cluster_id: str = None,
350
354
  band: str = None,
351
- # sort_by: str = None,
355
+ client_status: constants.ClientStatus = "CONNECTED",
356
+ past: str = "3H",
352
357
  offset: int = 0,
353
358
  limit: int = 1000,
354
- # **kwargs,
355
359
  ) -> Response:
356
360
  """Get All clients
357
361
 
@@ -369,7 +373,10 @@ class CentralApi(Session):
369
373
  stack_id (str, optional): Return clients connected to stack with provided id. Defaults to None.
370
374
  cluster_id (str, optional): Return clients connected to cluster with provided id. Defaults to None.
371
375
  band (str, optional): Return (WLAN) clients connected to provided band. Defaults to None.
372
- FIXME sort_by (str, optional): Sort Output on provided key field. Defaults to None.
376
+ client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional): Return clients that are
377
+ connected, or clients that have failed to connect. Defaults to CONNECTED.
378
+ past: (str, optional): Time-range to show client details for where
379
+ 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H
373
380
  offset (int, optional): API offset. Defaults to 0.
374
381
  limit (int, optional): API record limit. Defaults to 1000, Max 1000.
375
382
 
@@ -383,8 +390,8 @@ class CentralApi(Session):
383
390
  "site": site,
384
391
  "serial": serial,
385
392
  "cluster_id": cluster_id,
386
- # 'fields': fields,
387
- # 'sort_by': sort_by,
393
+ "client_status": client_status,
394
+ "past": past,
388
395
  "offset": offset,
389
396
  "limit": limit,
390
397
  "calculate_total": True
@@ -392,20 +399,15 @@ class CentralApi(Session):
392
399
  wlan_only_params = {"network": network, "os_type": os_type, "band": band}
393
400
  wired_only_params = {"stack_id": stack_id}
394
401
 
395
- # resp = await self.get_wireless_clients(**{**params, **wlan_only_params},) # **kwargs)
396
- # if resp.ok:
397
- # wlan_resp = resp
398
- # wired_resp = await self.get_wired_clients(**{**params, **wired_only_params}) # **kwargs)
399
- # if wired_resp.ok:
400
- # resp.output = wlan_resp.output + wired_resp.output
401
-
402
402
  reqs = [
403
403
  self.BatchRequest(self.get_wireless_clients, **{**params, **wlan_only_params}),
404
404
  self.BatchRequest(self.get_wired_clients, **{**params, **wired_only_params})
405
405
  ]
406
+
406
407
  # FIXME if wireless clients call passes but wired fails there is no indication in cencli show clients output
408
+ # TODO need Response to have an attribute that stores failed calls so cli commands can display output of passed calls and details on errors (when some calls fail)
407
409
  resp = await self._batch_request(reqs)
408
- if len(resp) == 2: # and all(x.ok for x in resp):
410
+ if len(resp) == 2:
409
411
  out = []
410
412
  for r in resp:
411
413
  if r.ok:
@@ -417,45 +419,9 @@ class CentralApi(Session):
417
419
  resp = resp[1] if resp[1].ok else resp[0]
418
420
  resp.output = out
419
421
  resp.raw = raw
420
- # TODO need Response to have an attribute that stores failed calls so cli commands can display output of passed calls and details on errors (when some calls fail)
421
-
422
- return resp
423
-
424
- async def get_client_roaming_history(
425
- self,
426
- macaddr: str,
427
- calculate_total: bool = None,
428
- from_timestamp: int = None,
429
- to_timestamp: int = None,
430
- offset: int = 0,
431
- limit: int = 100,
432
- ) -> Response:
433
- """Wireless Client Mobility Trail.
434
-
435
- Args:
436
- macaddr (str): MAC address of the Wireless Client to be queried
437
- calculate_total (bool, optional): Whether to calculate total transitions
438
- from_timestamp (int, optional): Need information from this timestamp. Timestamp is epoch
439
- in seconds. Default is current timestamp minus 3 hours
440
- to_timestamp (int, optional): Need information to this timestamp. Timestamp is epoch in
441
- seconds. Default is current timestamp
442
- offset (int, optional): Pagination offset Defaults to 0.
443
- limit (int, optional): Pagination limit. Default is 1000, max is 1000.
444
-
445
- Returns:
446
- Response: CentralAPI Response object
447
- """
448
- url = f"/monitoring/v1/clients/wireless/{macaddr}/mobility_trail"
449
-
450
- params = {
451
- 'calculate_total': calculate_total,
452
- 'from_timestamp': from_timestamp,
453
- 'to_timestamp': to_timestamp,
454
- 'offset': offset,
455
- 'limit': limit
456
- }
422
+ return resp
457
423
 
458
- return await self.get(url, params=params)
424
+ return resp[-1]
459
425
 
460
426
  async def get_wireless_clients(
461
427
  self,
@@ -470,10 +436,10 @@ class CentralApi(Session):
470
436
  band: str = None,
471
437
  fields: str = None,
472
438
  calculate_total: bool = True,
473
- # sort_by: str = None,
439
+ client_status: constants.ClientStatus = "CONNECTED",
440
+ past: str = "3H",
474
441
  offset: int = 0,
475
442
  limit: int = 1000,
476
- # **kwargs,
477
443
  ) -> Response:
478
444
  """List Wireless Clients.
479
445
 
@@ -492,8 +458,10 @@ class CentralApi(Session):
492
458
  swarm_id, network, radio_mac, manufacturer, vlan, encryption_method, radio_number,
493
459
  speed, usage, health, labels, site, signal_strength, signal_db, snr
494
460
  calculate_total (bool, optional): Whether to calculate total wireless Clients
495
- sort (str, optional): Sort parameter may be one of +macaddr, -macaddr. Default is
496
- '+macaddr'
461
+ client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional): Return clients that are
462
+ connected, or clients that have failed to connect. Defaults to CONNECTED.
463
+ past: (str, optional): Time-range to show client details for where
464
+ 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H
497
465
  offset (int, optional): Pagination offset Defaults to 0.
498
466
  limit (int, optional): Pagination limit. Default is 1000, max 1000.
499
467
 
@@ -514,7 +482,8 @@ class CentralApi(Session):
514
482
  "band": band,
515
483
  "fields": fields,
516
484
  "calculate_total": str(calculate_total).lower(),
517
- # 'sort': sort_by,
485
+ "client_status": client_status,
486
+ "timerange": past,
518
487
  "offset": offset,
519
488
  "limit": limit,
520
489
  }
@@ -532,10 +501,10 @@ class CentralApi(Session):
532
501
  stack_id: str = None,
533
502
  fields: str = None,
534
503
  calculate_total: bool = True,
535
- # sort_by: str = None,
504
+ client_status: constants.ClientStatus = "CONNECTED",
505
+ past: str = "3H",
536
506
  offset: int = 0,
537
507
  limit: int = 1000,
538
- # **kwargs,
539
508
  ) -> Response:
540
509
  """List Wired Clients.
541
510
 
@@ -550,6 +519,10 @@ class CentralApi(Session):
550
519
  fields (str, optional): Comma separated list of fields to be returned. Valid fields are
551
520
  name, ip_address, username, associated_device, group_name, interface_mac, vlan
552
521
  calculate_total (bool, optional): Whether to calculate total wired Clients
522
+ client_status (Literal["FAILED_TO_CONNECT", "CONNECTED"], optional): Return clients that are
523
+ connected, or clients that have failed to connect. Defaults to CONNECTED.
524
+ past: (str, optional): Time-range to show client details for where
525
+ 3H = 3 Hours, 1D = 1 Day, 1W = 1 Week, 1M = 1Month, 3M = 3Months. Defaults to 3H
553
526
  FIXME sort (str, optional): Field to sort on. Defaults to mac
554
527
  offset (int, optional): Pagination offset Defaults to 0.
555
528
  limit (int, optional): Pagination limit. Default 1000, max 1000.
@@ -569,7 +542,8 @@ class CentralApi(Session):
569
542
  "stack_id": stack_id,
570
543
  "fields": fields,
571
544
  "calculate_total": str(calculate_total).lower(),
572
- # 'sort': sort_by,
545
+ "client_status": client_status,
546
+ "timerange": past,
573
547
  "offset": offset,
574
548
  "limit": limit,
575
549
  }
@@ -620,6 +594,42 @@ class CentralApi(Session):
620
594
  url = f"/monitoring/v1/clients/{dev_type}/{mac.url}"
621
595
  return await self.get(url,) # callback=cleaner.get_clients, **kwargs)
622
596
 
597
+ async def get_client_roaming_history(
598
+ self,
599
+ macaddr: str,
600
+ calculate_total: bool = None,
601
+ from_timestamp: int = None,
602
+ to_timestamp: int = None,
603
+ offset: int = 0,
604
+ limit: int = 100,
605
+ ) -> Response:
606
+ """Wireless Client Mobility Trail.
607
+
608
+ Args:
609
+ macaddr (str): MAC address of the Wireless Client to be queried
610
+ calculate_total (bool, optional): Whether to calculate total transitions
611
+ from_timestamp (int, optional): Need information from this timestamp. Timestamp is epoch
612
+ in seconds. Default is current timestamp minus 3 hours
613
+ to_timestamp (int, optional): Need information to this timestamp. Timestamp is epoch in
614
+ seconds. Default is current timestamp
615
+ offset (int, optional): Pagination offset Defaults to 0.
616
+ limit (int, optional): Pagination limit. Default is 1000, max is 1000.
617
+
618
+ Returns:
619
+ Response: CentralAPI Response object
620
+ """
621
+ url = f"/monitoring/v1/clients/wireless/{macaddr}/mobility_trail"
622
+
623
+ params = {
624
+ 'calculate_total': calculate_total,
625
+ 'from_timestamp': from_timestamp,
626
+ 'to_timestamp': to_timestamp,
627
+ 'offset': offset,
628
+ 'limit': limit
629
+ }
630
+
631
+ return await self.get(url, params=params)
632
+
623
633
  async def get_certificates(
624
634
  self, q: str = None, offset: int = 0, limit: int = 20, callback: callable = None, callback_kwargs: dict = None
625
635
  ) -> Response:
@@ -4041,7 +4051,7 @@ class CentralApi(Session):
4041
4051
  self,
4042
4052
  serial_num: str,
4043
4053
  api: str = "V1",
4044
- offset: int = 0,
4054
+ marker: str = None,
4045
4055
  limit: int = 100
4046
4056
  ) -> Response:
4047
4057
  """Get routes for a device.
@@ -4049,7 +4059,7 @@ class CentralApi(Session):
4049
4059
  Args:
4050
4060
  serial_num (str): Device serial number
4051
4061
  api (str, optional): API version (V0|V1), Defaults to V1.
4052
- offset (str, optional): Pagination offset.
4062
+ marker (str, optional): Pagination offset.
4053
4063
  limit (int, optional): page size Defaults to 100.
4054
4064
 
4055
4065
  Returns:
@@ -4060,7 +4070,7 @@ class CentralApi(Session):
4060
4070
  params = {
4061
4071
  'device': serial_num,
4062
4072
  'api': api,
4063
- 'marker': offset,
4073
+ 'marker': marker,
4064
4074
  'limit': limit
4065
4075
  }
4066
4076