Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #17954 - Handle CircuitTerminations in Cable Bulk Import #17995

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

jsenecal
Copy link
Contributor

Fixes: #17954

Add Support for Bulk Importing Cables Connected to Circuits

This pull request enhances the bulk import functionality for cables by allowing users to specify circuits as termination points on either side of a cable. Previously, only devices could be specified for cable terminations during bulk import which didn't allow for Cables to be connected to Circuit Terminations properly.

Key Changes:

  • Added Fields for Circuit Terminations:

    • Introduced side_a_circuit and side_b_circuit fields in the CableImportForm within dcim/forms/bulk_import.py.
    • These fields are optional and conditional, allowing users to specify a Circuit ID (cid) as a termination point.
  • Updated CableImportForm Validation Logic:

    • Modified the _clean_side method in CableImportForm to handle cases where a circuit is specified instead of a device.
    • Added validation to ensure that both a device and a circuit cannot be specified simultaneously for the same side.
    • Ensured that the termination object is correctly retrieved based on whether a device or circuit is provided.
    • Added checks to prevent connecting to a circuit termination that is already connected to a Provider Network.
  • Enhanced Bulk Import Template:

    • Updated bulk_import.html to display a "Conditional" tag for fields that are conditionally required, improving user experience during the import process.
  • Extended CSV Field Functionality:

    • Modified CSVModelChoiceField in utilities/forms/fields/csv.py to accept a conditional parameter.
    • This parameter is used to indicate fields that are conditionally required based on other form fields.

Benefits:

  • Improved Flexibility: Users can now bulk import cables that connect directly to circuits, not just devices.
  • Enhanced User Experience: Clearer form validation messages and template indicators help prevent import errors.
  • Increased Efficiency: Streamlines the process of importing large numbers of cables connected to circuits.

Usage Notes:

  • When importing, specify either a device or a circuit for each side of the cable—not both.
  • Ensure that the circuit terminations are not already connected to a Provider Network to avoid validation errors.

@jsenecal jsenecal force-pushed the 17954_cable_bulk_import_circuit_terminations branch from 48b1c7b to 2721455 Compare November 12, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cable bulk import when importing circuit terminations
1 participant