netbox-community / pynetbox

Python API client library for Netbox.
Apache License 2.0
561 stars 168 forks source link

Can't create a tunnel termination via the API #631

Closed Edward033 closed 1 week ago

Edward033 commented 1 month ago

pynetbox version

7.3.4

NetBox version

3.7.0

Python version

3.9

Steps to Reproduce

netbox_api_object = pynetbox.api(netbox_url, token=netbox_token) ##Create an API object netbox_api_object.vpn.tunnel_terminations.create(tunnel=1,termination_type=5,role='hub',device='router-test',tags=[1])

*** pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'termination_type': ["Invalid value. Specify a content type as '.'."]}

I managed to create the tunnel termination via the front end without any issues:

role: "peer" tags: [] tunnel: 1 created: "2024-07-25T20:11:29.411Z" outside_ip: null custom_fields: {} termination_id: 67847 termination_type: 5

Expected Behavior

The script should execute without any issues or errors.

Observed Behavior

*** pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'termination_type': ["Invalid value. Specify a content type as '.'."]}

markkuleinio commented 1 month ago

Not a bug in pynetbox.

termination_type="dcim.interface"

Edward033 commented 1 month ago

Thanks! Understood. Sorry if this error is not related to pynetbox either. I'll try to hit the Netbox API directly to confirm.

(Pdb) netbox_api_object.vpn.tunnel_terminations.create(tunnel=1,termination_type="dcim.interface",role='hub') *** pynetbox.core.query.RequestError: The request failed with code 500 Internal Server Error: {'error': "'NoneType' object has no attribute '_meta'", 'exception': 'AttributeError', 'netbox_version': '3.7.0', 'python_version': '3.8.17'}

On Fri, Jul 26, 2024 at 7:43 AM Markku Leiniö @.***> wrote:

Not a bug in pynetbox.

termination_type="dcim.interface"

— Reply to this email directly, view it on GitHub https://github.com/netbox-community/pynetbox/issues/631#issuecomment-2252585935, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTVX3HNGRIVOWID3KUUHLLZOIY75AVCNFSM6AAAAABLPJLTQSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJSGU4DKOJTGU . You are receiving this because you authored the thread.Message ID: @.***>

-- Edward Alvarez.

arthanson commented 1 week ago

Closing as it appears not to be a pynetbox issue