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

Re-introduce Interface Assignment in Bulk Create of IPAddress #4103

Closed
bryanculver opened this issue Jul 11, 2023 · 4 comments · Fixed by #4522
Closed

Re-introduce Interface Assignment in Bulk Create of IPAddress #4103

bryanculver opened this issue Jul 11, 2023 · 4 comments · Fixed by #4522
Assignees
Labels
type: feature Introduction of new or enhanced functionality to the application
Milestone

Comments

@bryanculver
Copy link
Member

bryanculver commented Jul 11, 2023

Context: https://github.com/nautobot/nautobot/pull/3399/files#diff-48a1dfee0e6f7a73ae949d499187baf763bb0dc10bf3a40b99b462cc90211db6L687-L705

This was affected by M2M change of IP Address and Interface and the CSV changes in 2.0

See Option 3 here: #4103 (comment)

@bryanculver
Copy link
Member Author

Let's see the feasibility for 2.0, or at the very least capture it's a loss of functionality for the time being

@bryanculver bryanculver changed the title Bulk Create/Edit of IPAddress no longer allows Interface assignment (see: https://github.com/nautobot/nautobot/pull/3399/files#diff-48a1dfee0e6f7a73ae949d499187baf763bb0dc10bf3a40b99b462cc90211db6L687-L705) (investigate Serializer->CSV solution for this Re-introduce Interface Assignment in Bulk Create/Edit of IPAddress Jul 13, 2023
@bryanculver bryanculver added the type: feature Introduction of new or enhanced functionality to the application label Jul 13, 2023
@bryanculver
Copy link
Member Author

Going to pivot to solve M2M

Association via Composite Key (#3794, #3976)

Instead of

# import.csv
interface
ams01-edge-01;AMS01;Ethernet1%2F1

Have

inteface__device__location,interface__device__name,interface__name
AMS01,ams01-edge-01,Ethernet1%2F1

M2Ms in CSVs

Doesn't exist today, suggestion: comma separated in field, like tags

?

GFKs/Intermediaries in CSVs

# bulk_import_ip_address.csv
interfaces_1__device__location,interfaces_1__device__name,interfaces_1__name,interfaces_2__device__location,interfaces_2__device__name,interfaces_2__name
AMS01,ams01-edge-01,Ethernet1%2F1,AMS01,ams01-edge-02,Ethernet1%2F1

@bryanculver bryanculver changed the title Re-introduce Interface Assignment in Bulk Create/Edit of IPAddress Re-introduce Interface Assignment in Bulk Create of IPAddress Sep 12, 2023
@bryanculver
Copy link
Member Author

bryanculver commented Sep 12, 2023

@lampwins Would it be sufficient to have the assignment of IPAddress to Interfaces be a separate CSV because solving the M2M in a single file with natural keys as complex as Interface being collapsed into a single row for IPAddress is not ideal:

address parent__namespace__name status role interface_1__name interface_1__device__name interface_1_device__tenant__name interface_1__device__location__name interface_2__name interface_2__virtual_machine__name interface_2_virtual_machine__tenant__name interface_2__virtual_machine__cluster__name

Limited to just one assignment could be made but you would have further enumeration validation problems due to #1178 (note the required property of "Status" which would prevent multiple records in the same file)

address parent__namespace__name status role interface__name interface__device__name interface_device__tenant__name interface__device__location__name interface__virtual_machine__name interface_virtual_machine__tenant__name interface__virtual_machine__cluster__name
10.0.0.1 Global Active Primary eth0 ams-101-rtr-1 Nautobot Airports AMS-101      
10.0.0.2 Global Active Primary virt0       vm1001 Nautobot Airports vmcluster1

If at least it's a separate import, you solve the single assignment and multiple assignments with the same code path and would look something like: (note the omission of properties like Status):

address parent__namespace__name interface__name interface__device__name interface_device__tenant__name interface__device__location__name interface__virtual_machine__name interface_virtual_machine__tenant__name interface__virtual_machine__cluster__name
10.0.0.1 Global eth0 ams-101-rtr-1 Nautobot Airports AMS-101      
10.0.0.2 Global virt0       vm1001 Nautobot Airports vmcluster1
10.0.0.1 Global virt0       vm1001 Nautobot Airports vmcluster1 

Option 1: Single file, single row IP Address create, M2M via enumerated columns

I can bulk create IPAddresses and create as many associations to Interfaces as I desire.

Ex:

address parent__namespace__name status role interface_1__name interface_1__device__name interface_1_device__tenant__name interface_1__device__location__name interface_2__name interface_2__virtual_machine__name interface_2_virtual_machine__tenant__name interface_2__virtual_machine__cluster__name

Estimated 4 story points.

Option 2: Single file, single row IP Address create, single assignment

I can bulk create IPAddresses and create one association to Interface per IPAddress create

Ex:

address parent__namespace__name status role interface__name interface__device__name interface_device__tenant__name interface__device__location__name interface__virtual_machine__name interface_virtual_machine__tenant__name interface__virtual_machine__cluster__name

Estimated 4 story points.

Option 3: Multiple files, single row IP Address create, multiple assignments

I can bulk create IPAddresses and bulk create associations to Interfaces but must be performed in two steps with two files

Step 1: Create IPs

address parent__namespace__name status role

Step 2: Create Associations (assuming Interfaces already created as the original story assumed)

address parent__namespace__name interface__name interface__device__name interface_device__tenant__name interface__device__location__name interface__virtual_machine__name interface_virtual_machine__tenant__name interface__virtual_machine__cluster__name

Estimated 2 story points: It's essentially a bulk endpoint for #4249 which may "just work" with #3794

@bryanculver
Copy link
Member Author

We are going to go with Option 3 above as it's the most straight forward path for now. Options 1 & 2 require some design work and may prove unweildy done in a generic way.

@jathanism jathanism self-assigned this Sep 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new or enhanced functionality to the application
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants