diff --git a/catalystwan/models/configuration/feature_profile/common.py b/catalystwan/models/configuration/feature_profile/common.py index c050af63..a9d1c1a1 100644 --- a/catalystwan/models/configuration/feature_profile/common.py +++ b/catalystwan/models/configuration/feature_profile/common.py @@ -236,7 +236,7 @@ def set_to_dhcp( class NextHopContainer(BaseModel): - next_hop: List[NextHop] = Field(default=[], serialization_alias="nextHop", validation_alias="nextHop") + next_hop: List[NextHop] = Field(default_factory=list, serialization_alias="nextHop", validation_alias="nextHop") class Ipv6StaticRouteNull0(BaseModel): @@ -687,7 +687,7 @@ class MultilinkControllerTxExList(BaseModel): ) channel_group: List[ChannelGroup] = Field( - default=[], + default_factory=list, validation_alias="channelGroup", serialization_alias="channelGroup", description="Channel Group List", diff --git a/catalystwan/models/configuration/feature_profile/sdwan/acl/ipv6acl.py b/catalystwan/models/configuration/feature_profile/sdwan/acl/ipv6acl.py index b674e24e..9553d994 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/acl/ipv6acl.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/acl/ipv6acl.py @@ -320,7 +320,7 @@ class Ipv6AclParcel(_ParcelBase): default=Default[Literal["drop"]](value="drop"), validation_alias=AliasPath("data", "defaultAction") ) sequences: List[Sequence] = Field( - default=[], validation_alias=AliasPath("data", "sequences"), description="Access Control List" + default_factory=list, validation_alias=AliasPath("data", "sequences"), description="Access Control List" ) def set_default_action(self, action: AcceptDropActionType): diff --git a/catalystwan/models/configuration/feature_profile/sdwan/application_priority/traffic_policy.py b/catalystwan/models/configuration/feature_profile/sdwan/application_priority/traffic_policy.py index 25c4571b..5e8c86e9 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/application_priority/traffic_policy.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/application_priority/traffic_policy.py @@ -550,13 +550,13 @@ def from_params( ) -> "SlaClassAction": action = SlaClassAction() action.sla_class = [] - if sla_name is not None: + if sla_name: action.sla_class.append(SlaClass(sla_name=RefIdItem.from_uuid(sla_name))) if preferred_color: action.sla_class.append(SlaClass(preferred_color=Global[List[TLOCColor]](value=preferred_color))) - if preferred_color_group is not None: + if preferred_color_group: action.sla_class.append(SlaClass(preferred_color_group=RefIdItem.from_uuid(preferred_color_group))) - if preferred_remote_color is not None: + if preferred_remote_color: action.sla_class.append( SlaClass(preferred_remote_color=Global[List[TLOCColor]](value=preferred_remote_color)) ) @@ -1069,7 +1069,7 @@ class TrafficPolicyParcel(_ParcelBase): default=None, validation_alias=AliasPath("data", "dataDefaultAction") ) has_cor_via_sig: Optional[Global[bool]] = Field(default=None, validation_alias=AliasPath("data", "hasCorViaSig")) - sequences: List[Sequence] = Field(default=[], validation_alias=AliasPath("data", "sequences")) + sequences: List[Sequence] = Field(default_factory=list, validation_alias=AliasPath("data", "sequences")) simple_flow: Optional[Global[bool]] = Field(default=None, validation_alias=AliasPath("data", "simpleFlow")) target: TrafficPolicyTarget = Field(validation_alias=AliasPath("data", "target")) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/ngfirewall.py b/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/ngfirewall.py index 9522ffd9..a93554f2 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/ngfirewall.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/ngfirewall.py @@ -834,7 +834,7 @@ class NgFirewallSequence(BaseModel): ) match: Match actions: List[Union[LogAction, AipAction]] = Field( - default=[], validation_alias="actions", min_length=0, max_length=2, serialization_alias="actions" + default_factory=list, validation_alias="actions", min_length=0, max_length=2, serialization_alias="actions" ) disable_sequence: Global[bool] = Field( default=Global[bool](value=False), diff --git a/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/policy.py b/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/policy.py index 4e94377c..cfa6086a 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/policy.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/embedded_security/policy.py @@ -151,7 +151,7 @@ class PolicyParcel(_ParcelBase): description="Set the parcel description", ) assembly: List[Union[NgFirewallContainer, SslDecryption, AdvancedInspectionProfile]] = Field( - default=[], validation_alias=AliasPath("data", "assembly") + default_factory=list, validation_alias=AliasPath("data", "assembly") ) settings: Optional[PolicySettings] = Field(default=None, validation_alias=AliasPath("data", "settings")) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/app_probe.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/app_probe.py index e91a89b4..04566ebe 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/app_probe.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/app_probe.py @@ -17,7 +17,7 @@ class AppProbeMapItem(BaseModel): class AppProbeEntry(BaseModel): model_config = ConfigDict(populate_by_name=True) - map: List[AppProbeMapItem] = Field(default=[]) + map: List[AppProbeMapItem] = Field(default_factory=list) forwarding_class: Union[Global[str], RefIdItem] = Field( validation_alias="forwardingClass", serialization_alias="forwardingClass", @@ -28,7 +28,7 @@ class AppProbeEntry(BaseModel): class AppProbeParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["app-probe"] = Field(default="app-probe", exclude=True) - entries: List[AppProbeEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[AppProbeEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def _insert_entry(self, entry: AppProbeEntry) -> None: if self.entries: diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/application_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/application_list.py index f828ec30..41c246d9 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/application_list.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/application_list.py @@ -21,7 +21,7 @@ class ApplicationListParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["app-list"] = Field(default="app-list", exclude=True) entries: List[Union[ApplicationListEntry, ApplicationFamilyListEntry]] = Field( - default=[], validation_alias=AliasPath("data", "entries") + default_factory=list, validation_alias=AliasPath("data", "entries") ) def add_application(self, application: str): diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/as_path.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/as_path.py index aff86429..155e82e2 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/as_path.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/as_path.py @@ -16,7 +16,7 @@ class AsPathParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["as-path"] = Field(default="as-path", exclude=True) as_path_list_num: Global[int] = Field(validation_alias=AliasPath("data", "asPathListNum")) - entries: List[AsPathEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[AsPathEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_as_path(self, as_path: str): self.entries.append(AsPathEntry(as_path=as_global(as_path))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/color_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/color_list.py index d0a10eb8..cbae3939 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/color_list.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/color_list.py @@ -15,7 +15,7 @@ class ColorEntry(BaseModel): class ColorParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["color"] = Field(default="color", exclude=True) - entries: List[ColorEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[ColorEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_color(self, color: TLOCColor): self.entries.append(ColorEntry(color=as_global(color, TLOCColor))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/extended_community.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/extended_community.py index 7d9bde21..127a026f 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/extended_community.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/extended_community.py @@ -20,7 +20,7 @@ def from_string(cls, entry: str): class ExtendedCommunityParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["ext-community"] = Field(default="ext-community", exclude=True) - entries: List[ExtendedCommunityEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[ExtendedCommunityEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_site_of_origin_community(self, ip_address: IPv4Address, port: int): entry = f"soo {ip_address}:{port}" diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/fowarding_class.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/fowarding_class.py index 12d7b66e..787317ec 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/fowarding_class.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/fowarding_class.py @@ -20,7 +20,7 @@ def check_burst(cls, queue: Global): class FowardingClassParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["class"] = Field(default="class", exclude=True) - entries: List[FowardingClassQueueEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[FowardingClassQueueEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_queue(self, queue: int): self.entries.append(FowardingClassQueueEntry(queue=as_global(str(queue)))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_data_prefix.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_data_prefix.py index 3a1e2f7f..9e15671e 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_data_prefix.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_data_prefix.py @@ -17,7 +17,7 @@ class IPv6DataPrefixEntry(BaseModel): class IPv6DataPrefixParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["data-ipv6-prefix"] = Field(default="data-ipv6-prefix", exclude=True) - entries: List[IPv6DataPrefixEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[IPv6DataPrefixEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_prefix(self, ipv6_network: IPv6Interface): self.entries.append( diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_prefix_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_prefix_list.py index 11c2298f..9af65eb8 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_prefix_list.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/ipv6_prefix_list.py @@ -25,7 +25,7 @@ class IPv6PrefixListEntry(BaseModel): class IPv6PrefixListParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["ipv6-prefix"] = Field(default="ipv6-prefix", exclude=True) - entries: List[IPv6PrefixListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[IPv6PrefixListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_prefix(self, ipv6_network: IPv6Interface, ge: Optional[int] = None, le: Optional[int] = None): self.entries.append( diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py index cfa57cd0..daef268b 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/mirror.py @@ -18,7 +18,7 @@ class MirrorParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["mirror"] = Field(default="mirror", exclude=True) entries: List[MirrorEntry] = Field( - default=[], validation_alias=AliasPath("data", "entries"), min_length=1, max_length=1 + default_factory=list, validation_alias=AliasPath("data", "entries"), min_length=1, max_length=1 ) @classmethod diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/policer.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/policer.py index 0c8df036..d9ce714f 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/policer.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/policer.py @@ -30,7 +30,7 @@ def check_rate(cls, rate_str: Global): class PolicerParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["policer"] = Field(default="policer", exclude=True) - entries: List[PolicerEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[PolicerEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_entry(self, burst: int, exceed: PolicerExceedAction, rate: int): self.entries.append( diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefered_group_color.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefered_group_color.py index 23cb5981..9fd7ba65 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefered_group_color.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/prefered_group_color.py @@ -54,7 +54,7 @@ def remove_empty_preferences(cls, value): class PreferredColorGroupParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["preferred-color-group"] = Field(default="preferred-color-group", exclude=True) - entries: List[PreferredColorGroupEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[PreferredColorGroupEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_primary(self, color_preference: List[TLOCColor], path_preference: PathPreference): self.entries.append( diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/sla_class.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/sla_class.py index c13956bc..1e9a79c6 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/sla_class.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/sla_class.py @@ -95,7 +95,7 @@ class SLAClassListEntry(BaseModel): class SLAClassParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["sla-class"] = Field(default="sla-class", exclude=True) - entries: List[SLAClassListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[SLAClassListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_entry( self, diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/standard_community.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/standard_community.py index 7d5ac497..0b84d4c1 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/standard_community.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/standard_community.py @@ -18,7 +18,7 @@ class StandardCommunityEntry(BaseModel): class StandardCommunityParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["standard-community"] = Field(default="standard-community", exclude=True) - entries: List[StandardCommunityEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[StandardCommunityEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def _add_community(self, standard_community: str): self.entries.append(StandardCommunityEntry(standard_community=as_global(standard_community))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/tloc_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/tloc_list.py index 6eaa6756..8d6c5333 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/tloc_list.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/policy/tloc_list.py @@ -29,7 +29,7 @@ def ensure_correct_preference_value(cls, v: Global): class TlocParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["tloc"] = Field(default="tloc", exclude=True) - entries: List[TlocEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[TlocEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_entry( self, tloc: IPv4Address, color: TLOCColor, encapsulation: EncapType, preference: Optional[str] = None diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/application_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/application_list.py index 571e36de..f7ae1eba 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/application_list.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/application_list.py @@ -21,7 +21,7 @@ class SecurityApplicationListParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-localapp"] = Field(default="security-localapp", exclude=True) entries: List[Union[SecurityApplicationFamilyListEntry, SecurityApplicationListEntry]] = Field( - default=[], validation_alias=AliasPath("data", "entries") + default_factory=list, validation_alias=AliasPath("data", "entries") ) def add_application(self, application: str): diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/data_prefix.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/data_prefix.py index 70e82ad1..17ffe44d 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/data_prefix.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/data_prefix.py @@ -16,7 +16,7 @@ class SecurityDataPrefixEntry(BaseModel): class SecurityDataPrefixParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-data-ip-prefix"] = Field(default="security-data-ip-prefix", exclude=True) - entries: List[SecurityDataPrefixEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[SecurityDataPrefixEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_prefix(self, ip_prefix: IPv4Network): self.entries.append(SecurityDataPrefixEntry(ip_prefix=as_global(ip_prefix))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/fqdn.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/fqdn.py index c6901716..bce46b3f 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/fqdn.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/fqdn.py @@ -17,7 +17,7 @@ class FQDNListEntry(BaseModel): class FQDNDomainParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-fqdn"] = Field(default="security-fqdn", exclude=True) - entries: List[FQDNListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[FQDNListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def from_fqdns(self, fqdns: List[str]): for fqdn in fqdns: diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/geolocation_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/geolocation_list.py index 36e0c318..ccf3153c 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/geolocation_list.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/geolocation_list.py @@ -23,7 +23,7 @@ def check_country_xor_continent(self): class GeoLocationListParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-geolocation"] = Field(default="security-geolocation", exclude=True) - entries: List[GeoLocationListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[GeoLocationListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_country(self, country: str): self.entries.append(GeoLocationListEntry(country=as_global(country))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/ips_signature.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/ips_signature.py index 2a3d2d02..82d5e2e9 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/ips_signature.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/ips_signature.py @@ -32,7 +32,7 @@ def check_signature_id(cls, signature_id: Global): class IPSSignatureParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-ipssignature"] = Field(default="security-ipssignature", exclude=True) - entries: List[IPSSignatureListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[IPSSignatureListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_signature(self, signature: str): generator_id, signature_id = signature.split(":") diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/local_domain.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/local_domain.py index c7c9c134..b686edc3 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/local_domain.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/local_domain.py @@ -17,7 +17,7 @@ class LocalDomainListEntry(BaseModel): class LocalDomainParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-localdomain"] = Field(default="security-localdomain", exclude=True) - entries: List[LocalDomainListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[LocalDomainListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def from_local_domains(self, domains: List[str]): for domain in domains: diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/protocol_list.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/protocol_list.py index 6ec39b4b..28ad06a9 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/protocol_list.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/protocol_list.py @@ -15,7 +15,7 @@ class ProtocolListEntry(BaseModel): class ProtocolListParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-protocolname"] = Field(default="security-protocolname", exclude=True) - entries: List[ProtocolListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[ProtocolListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_protocol(self, protocol: str): self.entries.append(ProtocolListEntry(protocol=as_global(protocol))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/security_port.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/security_port.py index 13c2d6fd..970bdfb4 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/security_port.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/security_port.py @@ -31,7 +31,7 @@ def check_port(cls, port: Global[str]): class SecurityPortParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-port"] = Field(default="security-port", exclude=True) - entries: List[SecurityPortListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[SecurityPortListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def _add_port(self, port: str): self.entries.append(SecurityPortListEntry(port=as_global(port))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/url.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/url.py index c518ce3b..5704738d 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/url.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/url.py @@ -16,7 +16,7 @@ class URLParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-urllist"] = Field(default="security-urllist", exclude=True) type: Literal["urlallowed", "urlblocked"] - entries: List[BaseURLListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[BaseURLListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_url(self, pattern: str): self.entries.append(BaseURLListEntry(pattern=as_global(pattern))) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/zone.py b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/zone.py index a824348d..b7427035 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/zone.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/policy_object/security/zone.py @@ -27,7 +27,7 @@ def check_vpn_xor_interface(self): class SecurityZoneListParcel(_ParcelBase): model_config = ConfigDict(populate_by_name=True) type_: Literal["security-zone"] = Field(default="security-zone", exclude=True) - entries: List[SecurityZoneListEntry] = Field(default=[], validation_alias=AliasPath("data", "entries")) + entries: List[SecurityZoneListEntry] = Field(default_factory=list, validation_alias=AliasPath("data", "entries")) def add_interface(self, interface: InterfaceStr): self.entries.append( diff --git a/catalystwan/models/configuration/feature_profile/sdwan/service/route_policy.py b/catalystwan/models/configuration/feature_profile/sdwan/service/route_policy.py index cdcd9450..14783843 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/service/route_policy.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/service/route_policy.py @@ -400,7 +400,7 @@ class RoutePolicyParcel(_ParcelBase): description="Default Action", ) sequences: List[RoutePolicySequence] = Field( - default=[], validation_alias=AliasPath("data", "sequences"), description="Route Policy List" + default_factory=list, validation_alias=AliasPath("data", "sequences"), description="Route Policy List" ) def set_default_action(self, default_action: AcceptRejectActionType): diff --git a/catalystwan/models/configuration/feature_profile/sdwan/system/device_access.py b/catalystwan/models/configuration/feature_profile/sdwan/system/device_access.py index 1fa19137..114512bf 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/system/device_access.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/system/device_access.py @@ -133,7 +133,7 @@ class DeviceAccessIPv4Parcel(_ParcelBase): default=Default[AcceptDropActionType](value="drop"), validation_alias=AliasPath("data", "defaultAction") ) sequences: List[Sequence] = Field( - default=[], validation_alias=AliasPath("data", "sequences"), description="Device Access Control List" + default_factory=list, validation_alias=AliasPath("data", "sequences"), description="Device Access Control List" ) def set_default_action(self, default_action: AcceptDropActionType) -> None: diff --git a/catalystwan/models/configuration/feature_profile/sdwan/system/device_access_ipv6.py b/catalystwan/models/configuration/feature_profile/sdwan/system/device_access_ipv6.py index 22085fc0..4bb5b1f3 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/system/device_access_ipv6.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/system/device_access_ipv6.py @@ -133,7 +133,7 @@ class DeviceAccessIPv6Parcel(_ParcelBase): default=Default[AcceptDropActionType](value="drop"), validation_alias=AliasPath("data", "defaultAction") ) sequences: List[Sequence] = Field( - default=[], validation_alias=AliasPath("data", "sequences"), description="Device Access Control List" + default_factory=list, validation_alias=AliasPath("data", "sequences"), description="Device Access Control List" ) def set_default_action(self, default_action: AcceptDropActionType) -> None: diff --git a/catalystwan/models/configuration/feature_profile/sdwan/system/logging_parcel.py b/catalystwan/models/configuration/feature_profile/sdwan/system/logging_parcel.py index b525817d..1332b399 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/system/logging_parcel.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/system/logging_parcel.py @@ -78,9 +78,11 @@ class LoggingParcel(_ParcelBase): populate_by_name=True, ) disk: Disk = Field(default_factory=Disk, validation_alias=AliasPath("data", "disk")) - tls_profile: Optional[List[TlsProfile]] = Field(default=[], validation_alias=AliasPath("data", "tlsProfile")) - server: Optional[List[Server]] = Field(default=[], validation_alias=AliasPath("data", "server")) - ipv6_server: Optional[List[Server]] = Field(default=[], validation_alias=AliasPath("data", "ipv6Server")) + tls_profile: Optional[List[TlsProfile]] = Field( + default_factory=list, validation_alias=AliasPath("data", "tlsProfile") + ) + server: Optional[List[Server]] = Field(default_factory=list, validation_alias=AliasPath("data", "server")) + ipv6_server: Optional[List[Server]] = Field(default_factory=list, validation_alias=AliasPath("data", "ipv6Server")) def set_disk(self, enable: bool, disk_file_size: int = 10, disk_file_rotate: int = 10): self.disk.disk_enable = as_global(enable) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/system/ntp.py b/catalystwan/models/configuration/feature_profile/sdwan/system/ntp.py index 07119d16..467c0f7d 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/system/ntp.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/system/ntp.py @@ -58,7 +58,7 @@ class Authentication(BaseModel): populate_by_name=True, ) authentication_keys: List[AuthenticationVariable] = Field( - default=[], + default_factory=list, serialization_alias="authenticationKeys", validation_alias="authenticationKeys", description="Set MD5 authentication key", @@ -94,7 +94,7 @@ class NtpParcel(_ParcelBase): populate_by_name=True, ) server: List[ServerItem] = Field( - default=[], validation_alias=AliasPath("data", "server"), description="Configure NTP servers" + default_factory=list, validation_alias=AliasPath("data", "server"), description="Configure NTP servers" ) authentication: Authentication = Field( default_factory=Authentication, validation_alias=AliasPath("data", "authentication") # type: ignore diff --git a/catalystwan/models/configuration/feature_profile/sdwan/system/security.py b/catalystwan/models/configuration/feature_profile/sdwan/system/security.py index 8ab95b15..24dba26e 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/system/security.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/system/security.py @@ -172,6 +172,8 @@ class SecurityParcel(_ParcelBase): description="Enable or disable IPsec pairwise-keying", ) keychain: List[KeychainItem] = Field( - default=[], validation_alias=AliasPath("data", "keychain"), description="Configure a Keychain" + default_factory=list, validation_alias=AliasPath("data", "keychain"), description="Configure a Keychain" + ) + key: List[KeyItem] = Field( + default_factory=list, validation_alias=AliasPath("data", "key"), description="Configure a Key" ) - key: List[KeyItem] = Field(default=[], validation_alias=AliasPath("data", "key"), description="Configure a Key") diff --git a/catalystwan/models/configuration/feature_profile/sdwan/system/snmp.py b/catalystwan/models/configuration/feature_profile/sdwan/system/snmp.py index dbefda36..fb3bd6ad 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/system/snmp.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/system/snmp.py @@ -154,19 +154,19 @@ class SNMPParcel(_ParcelBase): description="Set the physical location of this managed node", ) view: List[ViewItem] = Field( - default=[], validation_alias=AliasPath("data", "view"), description="Configure a view record" + default_factory=list, validation_alias=AliasPath("data", "view"), description="Configure a view record" ) community: List[CommunityItem] = Field( - default=[], validation_alias=AliasPath("data", "community"), description="Configure SNMP community" + default_factory=list, validation_alias=AliasPath("data", "community"), description="Configure SNMP community" ) group: List[GroupItem] = Field( - default=[], validation_alias=AliasPath("data", "group"), description="Configure an SNMP group" + default_factory=list, validation_alias=AliasPath("data", "group"), description="Configure an SNMP group" ) user: List[UserItem] = Field( - default=[], validation_alias=AliasPath("data", "user"), description="Configure an SNMP user" + default_factory=list, validation_alias=AliasPath("data", "user"), description="Configure an SNMP user" ) target: List[TargetItem] = Field( - default=[], + default_factory=list, validation_alias=AliasPath("data", "target"), description="Configure SNMP server to receive SNMP traps", ) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/topology/hubspoke.py b/catalystwan/models/configuration/feature_profile/sdwan/topology/hubspoke.py index 14a8e5ce..a7b92018 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/topology/hubspoke.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/topology/hubspoke.py @@ -45,7 +45,7 @@ class HubSpokeParcel(_ParcelBase): type_: Literal["hubspoke"] = Field(default="hubspoke", exclude=True) target: Target = Field(default=Target(), validation_alias=AliasPath("data", "target")) selected_hubs: Global[List[str]] = Field(default=as_global([]), validation_alias=AliasPath("data", "selectedHubs")) - spokes: List[Spoke] = Field(default=[], validation_alias=AliasPath("data", "spokes")) + spokes: List[Spoke] = Field(default_factory=list, validation_alias=AliasPath("data", "spokes")) def add_spoke(self, name: str, spoke_sites: List[str]) -> Spoke: spoke = Spoke.create(name=name, spoke_sites=spoke_sites) diff --git a/catalystwan/models/configuration/feature_profile/sdwan/transport/wan/interface/multilink.py b/catalystwan/models/configuration/feature_profile/sdwan/transport/wan/interface/multilink.py index f8b91abb..80fd5dfb 100644 --- a/catalystwan/models/configuration/feature_profile/sdwan/transport/wan/interface/multilink.py +++ b/catalystwan/models/configuration/feature_profile/sdwan/transport/wan/interface/multilink.py @@ -65,7 +65,7 @@ class InterfaceMultilinkParcel(_ParcelBase): default=None, validation_alias=AliasPath("data", "controlConnections") ) controller_tx_ex_list: List[MultilinkControllerTxExList] = Field( - default=[], validation_alias=AliasPath("data", "controllerTxExList") + default_factory=list, validation_alias=AliasPath("data", "controllerTxExList") ) controller_type: Global[MultilinkControllerType] = Field( default=Global[MultilinkControllerType](value="T1/E1"), validation_alias=AliasPath("data", "controllerType") diff --git a/catalystwan/models/policy/centralized.py b/catalystwan/models/policy/centralized.py index afb5589c..e8a09a43 100644 --- a/catalystwan/models/policy/centralized.py +++ b/catalystwan/models/policy/centralized.py @@ -41,7 +41,7 @@ class DataApplicationEntry(BaseModel): site_lists: Optional[List[UUID]] = Field( default=None, serialization_alias="siteLists", validation_alias="siteLists" ) - vpn_lists: List[UUID] = Field(default=[], serialization_alias="vpnLists", validation_alias="vpnLists") + vpn_lists: List[UUID] = Field(default_factory=list, serialization_alias="vpnLists", validation_alias="vpnLists") region_ids: Optional[List[str]] = Field(default=None, serialization_alias="regionIds", validation_alias="regionIds") region_lists: Optional[List[UUID]] = Field( default=None, serialization_alias="regionLists", validation_alias="regionLists" @@ -199,7 +199,7 @@ class VpnMembershipGroupPolicyItem(AssemblyItemBase): class CentralizedPolicyDefinition(PolicyDefinition): model_config = ConfigDict(populate_by_name=True) region_role_assembly: List = Field( - default=[], serialization_alias="regionRoleAssembly", validation_alias="regionRoleAssembly" + default_factory=list, serialization_alias="regionRoleAssembly", validation_alias="regionRoleAssembly" ) assembly: List[AnyAssemblyItem] = [] model_config = ConfigDict(populate_by_name=True) diff --git a/catalystwan/models/policy/definition/amp.py b/catalystwan/models/policy/definition/amp.py index d9f5eaba..21ee6b1b 100644 --- a/catalystwan/models/policy/definition/amp.py +++ b/catalystwan/models/policy/definition/amp.py @@ -35,7 +35,7 @@ class AdvancedMalwareProtectionDefinition(BaseModel): default=False, validation_alias="fileAnalysisEnabled", serialization_alias="fileAnalysisEnabled" ) file_analysis_file_types: List[FileAnalysisFileTypes] = Field( - default=[], validation_alias="fileAnalysisFileTypes", serialization_alias="fileAnalysisFileTypes" + default_factory=list, validation_alias="fileAnalysisFileTypes", serialization_alias="fileAnalysisFileTypes" ) file_analysis_alert: AlertsLogLevel = Field( default="", validation_alias="fileAnalysisAlert", serialization_alias="fileAnalysisAlert" @@ -43,7 +43,9 @@ class AdvancedMalwareProtectionDefinition(BaseModel): file_analysis_cloud_server: FileAnalysisServer = Field( default="", validation_alias="fileAnalysisCloudServer", serialization_alias="fileAnalysisCloudServer" ) - target_vpns: List[VpnId] = Field(default=[], validation_alias="targetVpns", serialization_alias="targetVpns") + target_vpns: List[VpnId] = Field( + default_factory=list, validation_alias="targetVpns", serialization_alias="targetVpns" + ) class AdvancedMalwareProtectionPolicy(PolicyDefinitionBase): diff --git a/catalystwan/models/policy/definition/app_route.py b/catalystwan/models/policy/definition/app_route.py index 509587b0..6baed5f0 100644 --- a/catalystwan/models/policy/definition/app_route.py +++ b/catalystwan/models/policy/definition/app_route.py @@ -175,11 +175,11 @@ def associate_sla_class_action( preferred_color_group: Optional[UUID] = None, ) -> None: if preferred_color is not None: - action = SlaClassAction().from_params( + action = SlaClassAction.from_params( sla_class=sla_class, not_met_action=not_met_action, preferred_color=preferred_color ) elif preferred_color_group is not None: - action = SlaClassAction().from_params( + action = SlaClassAction.from_params( sla_class=sla_class, not_met_action=not_met_action, preferred_color_group=preferred_color_group ) else: @@ -204,10 +204,7 @@ class AppRoutePolicy(AppRoutePolicyHeader, DefinitionWithSequencesCommonBase): model_config = ConfigDict(populate_by_name=True) def set_default_action(self, sla_class: Optional[UUID]) -> None: - if sla_class is not None: - self.default_action = AppRouteDefaultAction(ref=sla_class) - else: - self.default_action = None + self.default_action = AppRouteDefaultAction(ref=sla_class) if sla_class else None def add_sequence( self, diff --git a/catalystwan/models/policy/definition/hub_and_spoke.py b/catalystwan/models/policy/definition/hub_and_spoke.py index 75689c19..750bbc6f 100644 --- a/catalystwan/models/policy/definition/hub_and_spoke.py +++ b/catalystwan/models/policy/definition/hub_and_spoke.py @@ -16,9 +16,11 @@ class Hub(BaseModel): model_config = ConfigDict(populate_by_name=True) site_list: UUID = Field(validation_alias="siteList", serialization_alias="siteList") preference: Optional[str] = None - prefix_lists: List[UUID] = Field(default=[], validation_alias="prefixLists", serialization_alias="prefixLists") + prefix_lists: List[UUID] = Field( + default_factory=list, validation_alias="prefixLists", serialization_alias="prefixLists" + ) ipv6_prefix_lists: List[UUID] = Field( - default=[], validation_alias="ipv6PrefixLists", serialization_alias="ipv6PrefixLists" + default_factory=list, validation_alias="ipv6PrefixLists", serialization_alias="ipv6PrefixLists" ) @@ -43,7 +45,7 @@ class HubAndSpokePolicyDefinition(BaseModel): model_config = ConfigDict(populate_by_name=True) vpn_list: UUID = Field(validation_alias="vpnList", serialization_alias="vpnList") sub_definitions: List[HubAndSpokePolicySubDefinition] = Field( - default=[], validation_alias="subDefinitions", serialization_alias="subDefinitions" + default_factory=list, validation_alias="subDefinitions", serialization_alias="subDefinitions" ) diff --git a/catalystwan/models/policy/definition/intrusion_prevention.py b/catalystwan/models/policy/definition/intrusion_prevention.py index d1b78619..62c03ffe 100644 --- a/catalystwan/models/policy/definition/intrusion_prevention.py +++ b/catalystwan/models/policy/definition/intrusion_prevention.py @@ -25,8 +25,10 @@ class IntrusionPreventionDefinition(BaseModel): default=None, validation_alias="signatureWhiteList", serialization_alias="signatureWhiteList" ) log_level: Optional[LogLevel] = Field(default="error", validation_alias="logLevel", serialization_alias="logLevel") - logging: List[str] = Field(default=[]) - target_vpns: List[VpnId] = Field(default=[], validation_alias="targetVpns", serialization_alias="targetVpns") + logging: List[str] = Field(default_factory=list) + target_vpns: List[VpnId] = Field( + default_factory=list, validation_alias="targetVpns", serialization_alias="targetVpns" + ) custom_signature: bool = Field( default=False, validation_alias="customSignature", serialization_alias="customSignature" ) diff --git a/catalystwan/models/policy/definition/ssl_decryption_utd_profile.py b/catalystwan/models/policy/definition/ssl_decryption_utd_profile.py index 6fb6e41d..46dff5bc 100644 --- a/catalystwan/models/policy/definition/ssl_decryption_utd_profile.py +++ b/catalystwan/models/policy/definition/ssl_decryption_utd_profile.py @@ -19,14 +19,14 @@ class SslDecryptionUtdProfileDefinition(BaseModel): model_config = ConfigDict(populate_by_name=True) decrypt_categories: List[WebCategory] = Field( - default=[], validation_alias="decryptCategories", serialization_alias="decryptCategories" + default_factory=list, validation_alias="decryptCategories", serialization_alias="decryptCategories" ) never_decrypt_categories: List[WebCategory] = Field( - default=[], validation_alias="neverDecryptCategories", serialization_alias="neverDecryptCategories" + default_factory=list, validation_alias="neverDecryptCategories", serialization_alias="neverDecryptCategories" ) skip_decrypt_categories: List[WebCategory] = Field( - default=[], validation_alias="skipDecryptCategories", serialization_alias="skipDecryptCategories" + default_factory=list, validation_alias="skipDecryptCategories", serialization_alias="skipDecryptCategories" ) reputation: bool = False @@ -36,10 +36,10 @@ class SslDecryptionUtdProfileDefinition(BaseModel): ) filtered_url_white_list: List[URLAllowListInfo] = Field( - default=[], validation_alias="filteredUrlWhiteList", serialization_alias="filteredUrlWhiteList" + default_factory=list, validation_alias="filteredUrlWhiteList", serialization_alias="filteredUrlWhiteList" ) filtered_url_black_list: List[URLBlockListInfo] = Field( - default=[], validation_alias="filteredUrlBlackList", serialization_alias="filteredUrlBlackList" + default_factory=list, validation_alias="filteredUrlBlackList", serialization_alias="filteredUrlBlackList" ) url_white_list: Optional[Reference] = Field( diff --git a/catalystwan/models/policy/definition/url_filtering.py b/catalystwan/models/policy/definition/url_filtering.py index 40576f67..d033030b 100644 --- a/catalystwan/models/policy/definition/url_filtering.py +++ b/catalystwan/models/policy/definition/url_filtering.py @@ -38,10 +38,14 @@ class UrlFilteringDefinition(BaseModel): block_page_contents: str = Field( default=BLOCK_PAGE_CONTENT_HEADER, validation_alias="blockPageContents", serialization_alias="blockPageContents" ) - logging: List[str] = Field(default=[]) + logging: List[str] = Field(default_factory=list) enable_alerts: bool = Field(validation_alias="enableAlerts", serialization_alias="enableAlerts") - alerts: Set[UrlFilteringAlerts] = Field(default=[], validation_alias="alerts", serialization_alias="alerts") - target_vpns: List[VpnId] = Field(default=[], validation_alias="targetVpns", serialization_alias="targetVpns") + alerts: Set[UrlFilteringAlerts] = Field( + default_factory=list, validation_alias="alerts", serialization_alias="alerts" + ) + target_vpns: List[VpnId] = Field( + default_factory=list, validation_alias="targetVpns", serialization_alias="targetVpns" + ) @field_validator("url_black_list", "url_white_list", mode="before") @classmethod diff --git a/catalystwan/models/policy/localized.py b/catalystwan/models/policy/localized.py index 791cb6c8..e2ae7c53 100644 --- a/catalystwan/models/policy/localized.py +++ b/catalystwan/models/policy/localized.py @@ -143,7 +143,7 @@ class LocalizedPolicyInfo(PolicyInfo, LocalizedPolicy): class LocalizedPolicyEditResponse(BaseModel): master_templates_affected: List[str] = Field( - default=[], serialization_alias="masterTemplatesAffected", validation_alias="masterTemplatesAffected" + default_factory=list, serialization_alias="masterTemplatesAffected", validation_alias="masterTemplatesAffected" ) diff --git a/catalystwan/models/policy/policy_definition.py b/catalystwan/models/policy/policy_definition.py index 2cd31405..b9766a0c 100644 --- a/catalystwan/models/policy/policy_definition.py +++ b/catalystwan/models/policy/policy_definition.py @@ -1025,7 +1025,7 @@ class SlaNotMet(BaseModel): class SlaClassAction(BaseModel): type: Literal["slaClass"] = "slaClass" - parameter: List[SlaClassActionParam] = Field(default=[]) + parameter: List[SlaClassActionParam] = Field(default_factory=list) @overload @staticmethod @@ -1051,11 +1051,11 @@ def from_params( ) -> "SlaClassAction": action = SlaClassAction() action.parameter.append(SlaName(ref=sla_class)) - if not_met_action is not None: + if not_met_action: action.parameter.append(SlaNotMet(field=not_met_action)) - if preferred_color is not None: + if preferred_color: action.parameter.append(SlaPreferredColor(value=preferred_color)) - if preferred_color_group is not None: + if preferred_color_group: action.parameter.append(SlaPreferredColorGroup(ref=preferred_color_group)) return action @@ -1461,7 +1461,7 @@ class PolicyDefinitionGetResponse(PolicyDefinitionInfo): class PolicyDefinitionEditResponse(BaseModel): master_templates_affected: List[str] = Field( - default=[], serialization_alias="masterTemplatesAffected", validation_alias="masterTemplatesAffected" + default_factory=list, serialization_alias="masterTemplatesAffected", validation_alias="masterTemplatesAffected" ) diff --git a/catalystwan/models/policy/security.py b/catalystwan/models/policy/security.py index 9a3635b7..6d6cf9f1 100644 --- a/catalystwan/models/policy/security.py +++ b/catalystwan/models/policy/security.py @@ -215,7 +215,7 @@ class SecurityPolicyRoot(RootModel): class SecurityPolicyEditResponse(BaseModel): master_templates_affected: List[str] = Field( - default=[], serialization_alias="masterTemplatesAffected", validation_alias="masterTemplatesAffected" + default_factory=list, serialization_alias="masterTemplatesAffected", validation_alias="masterTemplatesAffected" )