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 5d83689a..25c4571b 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 @@ -538,6 +538,36 @@ class SlaClassAction(BaseModel): default=None, validation_alias="slaClass", serialization_alias="slaClass", description="slaClass" ) + @staticmethod + def from_params( + sla_name: Optional[UUID] = None, + preferred_color: Optional[List[TLOCColor]] = None, + preferred_color_group: Optional[UUID] = None, + preferred_remote_color: Optional[List[TLOCColor]] = None, + remote_color_restrict: Optional[bool] = None, + strict: Optional[bool] = None, + fallback_to_best_path: Optional[bool] = None, + ) -> "SlaClassAction": + action = SlaClassAction() + action.sla_class = [] + if sla_name is not None: + 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: + action.sla_class.append(SlaClass(preferred_color_group=RefIdItem.from_uuid(preferred_color_group))) + if preferred_remote_color is not None: + action.sla_class.append( + SlaClass(preferred_remote_color=Global[List[TLOCColor]](value=preferred_remote_color)) + ) + if remote_color_restrict is not None: + action.sla_class.append(SlaClass(remote_color_restrict=Global[bool](value=remote_color_restrict))) + if strict is not None: + action.sla_class.append(SlaClass(strict=Global[bool](value=strict))) + if fallback_to_best_path is not None: + action.sla_class.append(SlaClass(fallback_to_best_path=Global[bool](value=fallback_to_best_path))) + return action + class BackupSlaPreferredColorAction(BaseModel): model_config = ConfigDict(populate_by_name=True, extra="forbid") @@ -952,8 +982,10 @@ def associate_appqoe_optimization_action( action = AppqoeOptimizationAction(appqoe_optimization=appqoe_optimization) self._insert_action(action) - def associate_backup_sla_preferred_color_action(self) -> None: - pass # TODO + def associate_backup_sla_preferred_color_action(self, tloc_colors: List[TLOCColor]) -> None: + self._insert_action( + BackupSlaPreferredColorAction(backup_sla_preferred_color=Global[List[TLOCColor]](value=tloc_colors)) + ) def associate_cflowd_action(self, cflowd: bool) -> None: self._insert_action(CflowdAction(cflowd=as_global(cflowd))) @@ -962,7 +994,7 @@ def associate_cloud_probe_action(self) -> None: pass # TODO def associate_cloud_saas_action(self) -> None: - pass # TODO + self._insert_action(CloudSaasAction(cloud_saas=as_global(True))) def associate_count_action(self, count: str) -> None: self._insert_action(CountAction(count=as_global(count))) @@ -1006,8 +1038,26 @@ def associate_set_action(self) -> None: def associate_sig_action(self) -> None: self._insert_action(SigAction(sig=as_global(True))) - def associate_sla_class_action(self) -> None: - pass # TODO + def associate_sla_class_action( + self, + sla_name: Optional[UUID] = None, + preferred_color: Optional[List[TLOCColor]] = None, + preferred_color_group: Optional[UUID] = None, + preferred_remote_color: Optional[List[TLOCColor]] = None, + remote_color_restrict: Optional[bool] = None, + strict: Optional[bool] = None, + fallback_to_best_path: Optional[bool] = None, + ) -> None: + action = SlaClassAction.from_params( + sla_name=sla_name, + preferred_color=preferred_color, + preferred_color_group=preferred_color_group, + preferred_remote_color=preferred_remote_color, + remote_color_restrict=remote_color_restrict, + strict=strict, + fallback_to_best_path=fallback_to_best_path, + ) + self._insert_action(action) def associate_sse_action(self) -> None: pass # TODO