Unable to create BGP Session object using pynetbox, when peer_group is supplied in the args
See original GitHub issueNetBox version 2.11.2
Describe the bug Unable to create BGP Session object using pynetbox, when peer_group is supplied in the args.
To Reproduce nb_staging in the output below is my instance of pynetbox.api
In [943]: object_dict
Out[943]:
{'import_policies': [51, 66, 18],
'export_policies': [60, 18],
'description': 'LEVEL3',
'peer_group': 8,
'local_address': {'address': '4.71.253.6/30'},
'remote_address': {'address': '4.71.253.5/30'},
'local_as': {'number': 12345},
'remote_as': {'number': 3356},
'name': '3356_TRANSIT_LEVEL3_mydevice',
'device': {'name': 'mydevice'}}
In [944]: nb_staging.plugins.bgp.session.create(object_dict)
RequestError Traceback (most recent call last)
<ipython-input-944-5e86e2d8ef9b> in <module>()
----> 1 nb_staging.plugins.bgp.session.create(object_dict)
/netbox_dev/nsot-ipython.runfiles/__main__/pip/pynetbox/pynetbox-cpython-38/lib/pynetbox/core/endpoint.py in create(self, *args, **kwargs)
302 """
303
--> 304 req = Request(
305 base=self.url,
306 token=self.token,
/netbox_dev/nsot-ipython.runfiles/__main__/pip/pynetbox/pynetbox-cpython-38/lib/pynetbox/core/query.py in post(self, data)
385 :Returns: Dict containing the response from NetBox's API.
386 """
--> 387 return self._make_call(verb="post", data=data)
388
389 def delete(self):
/netbox_dev/nsot-ipython.runfiles/__main__/pip/pynetbox/pynetbox-cpython-38/lib/pynetbox/core/query.py in _make_call(self, verb, url_override, add_par
ams, data)
280 raise ContentError(req)
281 else:
--> 282 raise RequestError(req)
283
284 def concurrent_get(self, ret, page_size, page_offsets):
RequestError: The request failed with code 500 Internal Server Error: {'error': "argument of type 'BGPPeerGroup' is not iterable", 'exception': 'TypeError', 'netbox_
version': '2.11.2', 'python_version': '3.8.8+'}
Expected behavior The BGP Session object gets created
Screenshots n/a - the traceback above should be sufficient.
Additional context
I have also tried changing
object_dict['peer_group'] = {'name': 'TRANSIT'}
but I still get the same error. Neither referencing related object by a dictionary of attributes nor by its ID seem to work.
If I remove the ‘peer_group’ key from object_dict altogether, the BGP session object gets created successfully. However, thats not what I would like. I’d like to relate the session to a peer group.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Issues · k01ek/netbox-bgp - GitHub
NetBox plugin for BGP related objects documentation - Issues · k01ek/netbox-bgp. ... BGP session pynetbox Update method errors with error 400 when specific ......
Read more >Response — pynetbox 7.0.1.dev4+g74ae7e8 documentation
Creates an object from a NetBox response passed as values . Nested dicts that represent other endpoints are also turned into Record objects....
Read more >NetBox plugin for BGP related objects documentation | PythonRepo
Describe the bug Unable to create BGP Session object using pynetbox, when peer_group is supplied in the args. To Reproduce nb_staging in the...
Read more >Timeout and Self-signed CA Handling in Pynetbox 5.x
Api instance. Actually, it is not just a timeout value but you can instantiate a full requests.Session() object to customize the HTTP calls....
Read more >Ansible - Network Automation Cookbook - dl1.newoutlook.it
establish the SSH session with the network device. Ansible_password: This parameter specifies the password that Ansible will use.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry guys, I was on vacation. Will update it soon.
yeah, I’m doing the same for the time being. Can’t wait for it to get rolled into the master branch