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

UX2 config push #527

Merged
merged 5 commits into from
Mar 18, 2024
Merged

UX2 config push #527

merged 5 commits into from
Mar 18, 2024

Conversation

jpkrajewski
Copy link
Collaborator

@jpkrajewski jpkrajewski commented Mar 17, 2024

Pull Request summary:

  • Successfully pushed System and Other profiles, encompassing all associated parcels. This ensures comprehensive coverage of all parcels linked to these profiles during the push process.
  • Implemented a Pusher class responsible for pushing UX2Config and creating a corresponding Rollback class, enabling seamless reversion of changes when needed.
  • Introduced a ConfigRevert class for reverting configuration changes.
  • Implemented a factory for parcel pushing strategy to provide flexibility and maintainability.
  • Created a factory for API classes to manage different API endpoints efficiently.
  • Refactored methods to use more descriptive names: "get" became "get_parcels", "delete" became "delete_parcel", "update" became "update_parcel", and "post" became "post_parcel".
  • Update the type of subelements to a Set: We've observed UUID duplication issues where a Device Template includes multiple fields populated with the same feature template. This resulted in the same UUID being added to a list multiple times, causing errors when attempting to push the same parcel, leading to HTTP errors. By changing the type of subelements to a Set, we ensure that each UUID is unique within the list, resolving the duplication problem and preventing further HTTP errors during parcel pushing.

Video - Device Templates (ux1) migrated to Configuration Groups (ux2)

Recording.mp4

Test-script:

import logging
from catalystwan.session import create_manager_session
from catalystwan.workflows.config_migration import collect_ux1_config, push_ux2_config, rollback_ux2_config, transform

logging.basicConfig(
    filename="test.log",
    level=logging.DEBUG,
    format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)
logger = logging.getLogger(__name__)
with create_manager_session(
    url="host", username="admin", password="password", port=443, logger=logger
) as session:

    config = collect_ux1_config(session)
    config2 = transform(config)
    rollback = push_ux2_config(session, config2)
    input("Press enter to continue...")
    rollback_ux2_config(session, rollback)

Checklist:

  • Make sure to run pre-commit before committing changes
  • Make sure all checks have passed
  • PR description is clear and comprehensive
  • Mentioned the issue that this PR solves (if applicable)
  • Make sure you test the changes

…t class. Create factory for parcel pushing strategy. Create factory for api classes
@jpkrajewski jpkrajewski requested a review from a user March 17, 2024 22:42
@ghost ghost requested a review from brdw87 March 18, 2024 08:45
parcel_map: Dict[UUID, TransformedParcel]


class UX2ConfigRollback:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a dataclass ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to Dataclass


config_pusher = UX2ConfigPusher(session, config)
rollback = config_pusher.push()
# for config_group in config.config_groups:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this commented code already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed commented code.

@jpkrajewski jpkrajewski requested a review from sbasan March 18, 2024 09:27
@jpkrajewski jpkrajewski merged commit 968a2f8 into dev-uxmt Mar 18, 2024
10 checks passed
@jpkrajewski jpkrajewski deleted the dev/uxmt/push branch March 18, 2024 10:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants