question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create BGP Session object using pynetbox, when peer_group is supplied in the args

See original GitHub issue

NetBox 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:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
k01ekcommented, Aug 24, 2021

Sorry guys, I was on vacation. Will update it soon.

0reactions
pspdbxcommented, Aug 5, 2021

yeah, I’m doing the same for the time being. Can’t wait for it to get rolled into the master branch

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found