From a5dae78ce41220887c477a55313f20b11fe7a01c Mon Sep 17 00:00:00 2001 From: sbasan Date: Fri, 22 Mar 2024 11:37:53 +0100 Subject: [PATCH] rename rollback info fields --- catalystwan/models/configuration/config_migration.py | 12 ++++++++---- .../config_migration/reverters/config_reverter.py | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/catalystwan/models/configuration/config_migration.py b/catalystwan/models/configuration/config_migration.py index 39fb7409..f238956f 100644 --- a/catalystwan/models/configuration/config_migration.py +++ b/catalystwan/models/configuration/config_migration.py @@ -112,11 +112,15 @@ class UX2Config(BaseModel): class UX2ConfigRollback(BaseModel): - config_groups_ids: List[UUID] = Field(default_factory=list) - feature_profiles_ids: List[Tuple[UUID, ProfileType]] = Field(default_factory=list) + config_group_ids: List[UUID] = Field( + default_factory=list, serialization_alias="ConfigGroupIds", validation_alias="ConfigGroupIds" + ) + feature_profile_ids: List[Tuple[UUID, ProfileType]] = Field( + default_factory=list, serialization_alias="FeatureProfileIds", validation_alias="FeatureProfileIds" + ) def add_config_group(self, config_group_id: UUID) -> None: - self.config_groups_ids.append(config_group_id) + self.config_group_ids.append(config_group_id) def add_feature_profile(self, feature_profile_id: UUID, profile_type: ProfileType) -> None: - self.feature_profiles_ids.append((feature_profile_id, profile_type)) + self.feature_profile_ids.append((feature_profile_id, profile_type)) diff --git a/catalystwan/utils/config_migration/reverters/config_reverter.py b/catalystwan/utils/config_migration/reverters/config_reverter.py index 4469fd93..808b6c07 100644 --- a/catalystwan/utils/config_migration/reverters/config_reverter.py +++ b/catalystwan/utils/config_migration/reverters/config_reverter.py @@ -11,9 +11,9 @@ def __init__(self, session) -> None: def rollback(self, rollback_config: UX2ConfigRollback) -> bool: try: - for cg_id in rollback_config.config_groups_ids: + for cg_id in rollback_config.config_group_ids: self._session.endpoints.configuration_group.delete_config_group(cg_id) - for feature_profile_id, type_ in rollback_config.feature_profiles_ids: + for feature_profile_id, type_ in rollback_config.feature_profile_ids: api = FeatureProfileAPIFactory.get_api(type_, self._session) if type_ == "policy-object": continue