Skip to content

Commit

Permalink
Better ZD support in get_ap_groups
Browse files Browse the repository at this point in the history
  • Loading branch information
ms264556 committed Jul 23, 2023
1 parent d75e1ad commit 68f9d75
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions aioruckus/ruckusapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,43 @@ async def get_ap_groups(self) -> List:
ConfigItem.APGROUP_LIST, ["apgroup", "radio", "model", "port", "ap", "wlansvc"]
)
for ap_group in ap_groups:
if "members" not in ap_group or ap_group["members"] is None or "ap" not in ap_group["members"] or ap_group["members"]["ap"] is None:
# replace ap links with ap objects
if (
"members" not in ap_group or ap_group["members"] is None or
"ap" not in ap_group["members"] or ap_group["members"]["ap"] is None
):
ap_group["ap"] = []
else:
ap_group["ap"] = [
deepcopy(ap_map[ap["id"]])
for ap in ap_group["members"]["ap"]
]
ap_group.pop("members", None)
# replace Unleashed wlangroup links with wlangroup objects
if "wlangroup" in ap_group:
if ap_group["wlangroup"] is None or "wlansvc" not in ap_group["wlangroup"] or ap_group["wlangroup"]["wlansvc"] is None:
if (
ap_group["wlangroup"] is None or "wlansvc" not in ap_group["wlangroup"] or
ap_group["wlangroup"]["wlansvc"] is None
):
ap_group["wlansvc"] = []
else:
ap_group["wlansvc"] = [
deepcopy(wlang_map[wlang["id"]])
for wlang in ap_group["wlangroup"]["wlansvc"]
]
del ap_group["wlangroup"]
# replace ZoneDirector wlangroup links with wlangroup objects
if (
"ap-property" in ap_group and ap_group["ap-property"] is not None and
"radio" in ap_group["ap-property"] and ap_group["ap-property"]["radio"] is not None
):
for radio in ap_group["ap-property"]["radio"]:
if "wlangroup-id" in radio:
if radio["wlangroup-id"] in wlang_map:
# wlangroup-id will be '*' if we're inheriting from System Default
radio["wlangroup"] = deepcopy(wlang_map[radio["wlangroup-id"]])
del radio["wlangroup-id"]

return ap_groups

async def get_wlans(self) -> List[dict]:
Expand Down

0 comments on commit 68f9d75

Please sign in to comment.