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

Commit

Permalink
Change Global model bool field to str
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrajewski committed Mar 6, 2024
1 parent 0161490 commit a6d405b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ServicesIp(BaseModel):
serialization_alias="servicesGlobalServicesIpLldp",
validation_alias="servicesGlobalServicesIpLldp",
)
source_intrf: Union[Variable, Global[bool], Default[None]] = Field(
source_intrf: Union[Variable, Global[str], Default[None]] = Field(
default=Default[None](value=None),
serialization_alias="servicesGlobalServicesIpSourceIntrf",
validation_alias="servicesGlobalServicesIpSourceIntrf",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from copy import deepcopy

from catalystwan.api.configuration_groups.parcel import as_variable
from catalystwan.models.configuration.feature_profile.sdwan.system import GlobalParcel


Expand All @@ -15,13 +12,9 @@ def create_parcel(name: str, description: str, template_values: dict) -> GlobalP
Returns:
GlobalParcel: A GlobalParcel object with the provided template values.
"""
values = deepcopy(template_values)
if source_intrf := values.get("source_intrf"):
values["source_intrf"] = as_variable(source_intrf.value)

parcel_values = {
"parcel_name": name,
"parcel_description": description,
"services_global": {"services_ip": {key: value for key, value in values.items()}},
"services_global": {"services_ip": {key: value for key, value in template_values.items()}},
}
return GlobalParcel(**parcel_values) # type: ignore

0 comments on commit a6d405b

Please sign in to comment.