Skip to content

Commit 02b36e8

Browse files
committed
Update workflows
1 parent efb4767 commit 02b36e8

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[project]
22
name = "catalystwan_workflows"
3-
version = "0.0.1"
3+
version = "0.0.2"
44
description = "Workflows for Cisco Catalyst WAN SDK for Python"
55
requires-python = ">= 3.8"
66
dependencies = [
7-
"catalystwan-core== 2.0.0a0",
7+
"catalystwan-core== 2.0.0a1",
88
]

packages/catalystwan-workflows/src/catalystwan/workflows/admin_tech_workflow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def bulk_collect(
7171
if device_ips is None:
7272
device_ips = []
7373

74-
for device in self.client.device.list_all_devices(
74+
for device in self.client.device.get(
7575
site_id=str(site_id) if site_id else None
7676
):
7777
if device.device_id in device_ips or not device_ips:
@@ -131,7 +131,7 @@ def generate(
131131
tech_filter=tech_filter,
132132
)
133133
logger.info(f"Generating admin-tech for device: {device_ip} ...")
134-
response = self.client.device.tools.admintech.create_admin_tech(payload)
134+
response = self.client.device.tools.admintech.post(payload)
135135
filename = ""
136136
if isinstance(response, Mapping):
137137
filename = response.get("fileName", "")
@@ -141,7 +141,7 @@ def generate(
141141
def download(self, filename: str, download_dir: Path = Path.cwd()) -> Path:
142142
download_path = download_dir / filename
143143
logger.info(f"Downloading admin-tech to: {download_path} ...")
144-
bytes = self.client.device.tools.admintech.download.download_admin_tech_file(
144+
bytes = self.client.device.tools.admintech.download.get(
145145
filename=filename, timeout=(4.0, None)
146146
)
147147
with open(download_path, "wb") as file:
@@ -150,7 +150,7 @@ def download(self, filename: str, download_dir: Path = Path.cwd()) -> Path:
150150
return download_path
151151

152152
def list(self) -> List[Info]:
153-
response = self.client.device.tools.admintechs.list_admin_techs()
153+
response = self.client.device.tools.admintechs.get()
154154
return [Info(**asdict(r)) for r in response]
155155

156156
def wait_for_generated_token_ids(self) -> None:

packages/catalystwan-workflows/src/catalystwan/workflows/alarms_workflow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def query(self) -> Type[QuerySpec]:
3030

3131
def get(self, query: Optional[QuerySpec] = None):
3232
if self.client.api_version in ["20.15", "20.16"]:
33-
endpoint = self.client.alarms.post_raw_alarm_data
33+
endpoint = self.client.alarms.post
3434
else:
35-
endpoint = self.client.alarms.get_raw_alarm_data
35+
endpoint = self.client.alarms.get
3636

3737
payload = Query(query=query)
3838
response = endpoint(payload=serialize(payload, to_json=True))
@@ -53,7 +53,7 @@ def get_alarms(self, from_time: Optional[int] = None, active: bool = True):
5353
value=[str(from_time)],
5454
operator="last_n_hours",
5555
)
56-
return self.get(query_spec=query_spec)
56+
return self.get(query=query_spec)
5757

5858
@overload
5959
def clear(self, uuid: Optional[UUID]) -> List[ClearedAlarm]: ...
@@ -77,7 +77,7 @@ def clear(
7777
cleared_alarms: List[ClearedAlarm] = []
7878
for id in ids:
7979
if self.client.api_version in ["20.15", "20.16"]:
80-
response = api.clear_stale_alarm(payload={"alarm_uuid": str(id)})
80+
response = api.post(payload={"alarm_uuid": str(id)})
8181
cleared_alarms.append(
8282
ClearedAlarm(
8383
alarm_uuid=response.get("alarm_uuid"),
@@ -86,7 +86,7 @@ def clear(
8686
)
8787
else:
8888
payload_model = api.m.AlarmsClearBody
89-
response = api.clear_stale_alarm(payload=payload_model(alarm_uuid=str(id)))
89+
response = api.post(payload=payload_model(alarm_uuid=str(id)))
9090
cleared_alarms.append(
9191
ClearedAlarm(alarm_uuid=response[0].alarm_uuid, cleared=response[0].cleared)
9292
)

packages/catalystwan-workflows/src/catalystwan/workflows/device_workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ def __init__(self, client: ApiClient):
5050

5151
def get_devices_info(self, rediscover: bool = False) -> List[Device]:
5252
if rediscover:
53-
self.client.device.action.rediscoverall.re_discover_all_device()
53+
self.client.device.action.rediscoverall.post()
5454

55-
devices = self.client.device.list_all_devices()
55+
devices = self.client.device.get()
5656
device_ids = [device.device_id for device in devices]
5757
devices_info: List[Device] = []
5858
for i in range(0, len(device_ids), self.PARAMS_LIMIT):
59-
response = self.client.device.system.info.create_device_info_list(
59+
response = self.client.device.system.info.get(
6060
device_id=device_ids[i : i + self.PARAMS_LIMIT]
6161
)
6262
devices_info.extend([deserialize(Device, **data) for data in response])

0 commit comments

Comments
 (0)