Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
fix: lookup update, empty vpn list condition check (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan authored Jul 5, 2024
1 parent 2e721d6 commit 9b8a53a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ENDPOINTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**THIS FILE WAS AUTO-GENERATED DO NOT EDIT**

Generated for: catalystwan-0.33.8.dev3
Generated for: catalystwan-0.33.8.dev4

All URIs are relative to */dataservice*
HTTP request | Supported Versions | Method | Payload Type | Return Type | Tenancy Mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def assign_target(
self.target = Target(
inbound_sites=as_global(inbound_sites) if inbound_sites else None,
outbound_sites=as_global(outbound_sites) if outbound_sites else None,
vpn=as_global(vpns),
vpn=Global[List[str]](value=vpns),
)
return self.target

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ def target_vpn_convert(target_vpn: TargetVpn, vpn_id_to_map: Dict[Union[str, int

def hubspoke(in_: HubAndSpokePolicy, uuid: UUID, context: PolicyConvertContext) -> ConvertResult[HubSpokeParcel]:
target_vpns = context.lan_vpns_by_list_id[in_.definition.vpn_list]
if not target_vpns:
return ConvertResult[HubSpokeParcel](status="failed", info=["No VPNs found matching VPN list assignment"])
out = HubSpokeParcel(**_get_parcel_name_desc(in_))
out.target.vpn.value.extend(target_vpns)
for isubdef in in_.definition.sub_definitions:
Expand Down Expand Up @@ -568,10 +570,14 @@ def route(in_: RoutePolicy, uuid: UUID, context: PolicyConvertContext) -> Conver

def mesh(in_: MeshPolicy, uuid: UUID, context: PolicyConvertContext) -> ConvertResult[MeshParcel]:
target_vpns = context.lan_vpns_by_list_id[in_.definition.vpn_list]
if not target_vpns:
return ConvertResult[MeshParcel](status="failed", info=["No VPNs found matching VPN list assignment"])
mesh_sites: List[str] = []
for region in in_.definition.regions:
for site_list in region.site_lists:
mesh_sites.extend(context.sites_by_list_id[site_list])
if not mesh_sites:
return ConvertResult[MeshParcel](status="failed", info=["No Sites found matching Site list assignment"])
out = MeshParcel(**_get_parcel_name_desc(in_))
out.target.vpn.value = target_vpns
out.sites.value = mesh_sites
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def _create_topology_groups(self, default_policy_object_profile_id: Optional[UUI
try:
parcel_id = profile_api.create_parcel(profile_id, parcel).id
profile_report.add_created_parcel(parcel_name=parcel.parcel_name, parcel_uuid=parcel_id)
self._push_context.id_lookup[transformed_parcel.header.origin] = parcel_id
except ManagerHTTPError as e:
logger.error(f"Error occured during topology profile parcel creation: {e}")
profile_report.add_failed_parcel(
Expand All @@ -229,6 +230,5 @@ def _create_topology_groups(self, default_policy_object_profile_id: Optional[UUI
error_info=e.info,
request=e.request,
)
self._push_context.id_lookup[transformed_parcel.header.origin] = parcel_id
else:
logger.warning(f"Unexpected parcel type {type(parcel)}")
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "catalystwan"
version = "0.33.8dev3"
version = "0.33.8dev4"
description = "Cisco Catalyst WAN SDK for Python"
authors = ["kagorski <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 9b8a53a

Please sign in to comment.