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

Cannot import or clone a Cable #11210

Closed
Qwiko opened this issue Dec 16, 2022 · 22 comments · Fixed by #11231
Closed

Cannot import or clone a Cable #11210

Qwiko opened this issue Dec 16, 2022 · 22 comments · Fixed by #11231
Assignees
Labels
status: accepted This issue has been accepted for implementation topic: cabling type: bug A confirmed report of unexpected behavior in the application

Comments

@Qwiko
Copy link

Qwiko commented Dec 16, 2022

NetBox version

v3.4.0

Python version

3.9

Steps to Reproduce

  1. Import Cables
  2. Add data to import a cable
  3. Click Import

Expected Behavior

A cable should be created.

Observed Behavior

A ValueError was raised.
Creating a cable through the UI is done successfully.
Using the API creates the same error as importing.

<class 'ValueError'>

'Cable' instance needs to have a primary key value before this relationship can be used.

Python version: 3.9.2
NetBox version: 3.4.0

There seems to also be an issue with Cloning a Cable:
When you click Clone on a Cable you recieve this error:

<class 'AttributeError'>

'str' object has no attribute 'label'

Python version: 3.9.2
NetBox version: 3.4.0
@Qwiko Qwiko added the type: bug A confirmed report of unexpected behavior in the application label Dec 16, 2022
@Qwiko
Copy link
Author

Qwiko commented Dec 16, 2022

If you provide the id for a cable it is updated correctly. This error is only when trying to import new cable objects.

@kkthxbye-code
Copy link
Contributor

Add data to import a cable

Please provide all the steps required to replicate the issue, including example CSV data.

Using the API creates the same error as importing.

Please provide replication steps for the API error also.

There seems to also be an issue with Cloning a Cable:

This should probably be split out in a seperate bug report as they are unlikely to be related. I'm not even sure why it is possible to clone a cable as no fields are cloned and we don't provide a default "Add cable" option like most other models.

@kkthxbye-code kkthxbye-code added the status: revisions needed This issue requires additional information to be actionable label Dec 16, 2022
@kkthxbye-code
Copy link
Contributor

kkthxbye-code commented Dec 16, 2022

For reference I just tried importing the following cable and it worked without issue on 3.4.0:

side_a_device,side_a_type,side_a_name,side_b_device,side_b_type,side_b_name
dmi01-yonkers-sw01,dcim.interface,GigabitEthernet1/0/6,dmi01-yonkers-sw01,dcim.interface,GigabitEthernet1/0/7

If I try to import the same cable again or I try to import a cable that connects to an occupied interface I get the same error as you. This would indicate that there might be some missing validation, but I'm not sure if this is new in 3.4 or not.

I could not replicate it in the API.

@Qwiko Qwiko closed this as completed Dec 16, 2022
@Qwiko Qwiko reopened this Dec 16, 2022
@jordanrvillarreal
Copy link

I'm seeing similar behavior. It feels like there are certain errors that aren't being caught. While trying to bulk create if I had a bad interface type or name it would create the same primary key error but when I had included additional data in the cable color I received a specific error saying I provided 7 characters but it was only expecting 6.

@kkthxbye-code kkthxbye-code added status: accepted This issue has been accepted for implementation and removed status: revisions needed This issue requires additional information to be actionable labels Dec 19, 2022
@kkthxbye-code kkthxbye-code self-assigned this Dec 19, 2022
@MasterWigu
Copy link

I'm also seeing similar behavior. When creating new cables using the import feature (using a json snippet), it shows the same 'Cable' instance needs to have a primary key value before this relationship can be used.. I can also confirm that the cables I'm adding have only the required fields set.

@sc68cal

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@kkthxbye-code

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@kkthxbye-code

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@kkthxbye-code

This comment was marked as off-topic.

@DanSheps

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

@kkthxbye-code

This comment was marked as off-topic.

@DanSheps

This comment was marked as off-topic.

@sc68cal

This comment was marked as off-topic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation topic: cabling type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
7 participants