-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement linking of IP Adresses to newly created device. #73
Implement linking of IP Adresses to newly created device. #73
Conversation
Currently we do not get a valid JSON response body when the creation is successful. We need to investigate if this issue is on our end or on theirs.
Problems with this workaround:
Edit: The problem seems to be with us as running it manually: curl -X POST https://demo.netbox.dev/api/dcim/interfaces/ \
-H "Authorization: Token $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Nazara-Test", "device": 112, "type": "1000base-t"}' \
-o ~/Documents/test.txt Returns what appears to be a valid JSON: {
"id":2494,
"url":"https://demo.netbox.dev/api/dcim/interfaces/2494/",
"display":"Nazara0",
"device":{
"id":112,"url":"https://demo.netbox.dev/api/dcim/devices/112/",
"display":"CISCO",
"name":"CISCO"
},
"vdcs":[],
"module":null,
"name":"Nazara0",
"label":"",
"type":
{
"value":"1000base-t",
"label":"1000BASE-T (1GE)"
},
"enabled":true,
"parent":null,
"bridge":null,
"lag":null,
"mtu":null,
"mac_address":null,
"speed":null,
"duplex":null,
"wwn":null,
"mgmt_only":false,
"description":"",
"mode":null,
"rf_role":null,
"rf_channel":null,
"poe_mode":null,
"poe_type":null,
"rf_channel_frequency":null,
"rf_channel_width":null,
"tx_power":null,
"untagged_vlan":null,
"tagged_vlans":[],
"mark_connected":false,
"cable":null,
"cable_end":"",
"wireless_link":null,
"link_peers":[],
"link_peers_type":null,
"wireless_lans":[],
"vrf":null,
"l2vpn_termination":null,
"connected_endpoints":null,
"connected_endpoints_type":null,
"connected_endpoints_reachable":null,
"tags":[],
"custom_fields":{},
"created":"2024-04-25T11:55:29.998975Z",
"last_updated":"2024-04-25T11:55:29.999015Z",
"count_ipaddresses":0,
"count_fhrp_groups":0,
"_occupied":false
} This does not make sense though as we use Edit Edit: It looks like according to netbox's code this should be nullable. Meaning their spec is wrong...
|
29600fa
to
2dd45d8
Compare
d17e7de
to
f4ff496
Compare
0d6e9be
to
e65a530
Compare
104b47a
to
719c54e
Compare
0ede402
to
216cb16
Compare
e60b1ad
to
216cb16
Compare
efa3958
to
89c5b1e
Compare
After further investigation, it definitely looks like this is a problem on NetBox's end. This leads to several conclusions:
Backend bug hunting must also be conducted as we cannot be sure this problem is fixed with NetBox |
add contigency function to search if the interface was created regardless of parsing errors of the response
751b299
to
df2053e
Compare
a623400
to
74cc0b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The fine details can be fixed later. :)
What does this PR change?
Currently we can only create devices without the IP address fields being set.
This PR aims to fix that. For this, after device creation, we need to create an Interface for the device, create an IP address object and then PATCH the device with the ID of its primary IP address linked to one of its devices.
As references serve these threads:
netbox-community/netbox#8746
netbox-community/netbox#8837
Tick the applicable box:
Links
Fixes: #69
Documentation