GithubHelp home page GithubHelp logo

k01ek / netbox-bgp Goto Github PK

View Code? Open in Web Editor NEW
226.0 19.0 45.0 6.19 MB

NetBox plugin for BGP related objects documentation

License: Apache License 2.0

Makefile 1.01% Dockerfile 0.41% Python 85.21% HTML 13.37%
netbox-plugin netbox bgp

netbox-bgp's Introduction

NetBox BGP Plugin

Netbox plugin for BGP related objects documentation.

Features

This plugin provide following Models:

  • BGP Communities
  • BGP Sessions
  • Routing Policy
  • Prefix Lists

Compatibility

NetBox 3.4 >= 0.9.0
NetBox 3.5 >= 0.10.0
NetBox 3.6 >= 0.11.0
NetBox 3.7 >= 0.12.0
NetBox 4.0 >= 0.13.2

Installation

The plugin is available as a Python package in pypi and can be installed with pip

pip install netbox-bgp

Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:

PLUGINS = ['netbox_bgp']

Restart NetBox and add netbox-bgp to your local_requirements.txt

See NetBox Documentation for details

Configuration

The following options are available:

  • device_ext_page: String (default right) Device related BGP sessions table position. The following values are available:
    left, right, full_width. Set empty value for disable.
  • top_level_menu: Bool (default False) Enable top level section navigation menu for the plugin.

Screenshots

BGP Session BGP Session

BGP Sessions BGP Session Table

Community Community

Peer Group Peer Group

Routing Policy Routing Policy

Prefix List Prefix List

netbox-bgp's People

Contributors

aodix avatar benley avatar chankster avatar christianpinger avatar cruse1977 avatar harry1234eer avatar ingvaldlorentzen avatar jeremystretch avatar k01ek avatar natm avatar omri-ice avatar pl0xym0r avatar raddessi avatar rothbauer avatar volkyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netbox-bgp's Issues

Feature Request: Bulk import

It would be quite useful to have API endpoints for bulk creation, Update and deletion of all objects (Sessions, ASNs, Policies, Communites)
Related to this, it would be nice to have a CSV Bulk import in the UI as well

4 byte ASN support

Is your feature request related to a problem? Please describe.
Does the ASN value support 4 byte numbers?

Describe the solution you'd like
Would like support of 4 byte ASN values if not supported.

Describe alternatives you've considered
I don't know if there are alternatives, please let me know.

Additional context
none.

API POST: BGPSession() got an unexpected keyword argument 'custom_field_data'

Running netbox docker 2.11.2 custom build with netbox-bgp plugin.

When trying to create a new BGP session object via API the following error shows:

{
  "error": "BGPSession() got an unexpected keyword argument 'custom_field_data'",
  "exception": "TypeError",
  "netbox_version": "2.11.2",
  "python_version": "3.8.8"
}

From what I gather this might be because the API serializer BGPSessionSerializer is using CustomFieldModelSerializer while BGPSession is using ChangeLoggedModel which doesn't have the CustomFieldsMixin class.

The fix:
Either change CustomFieldModelSerializer to ValidatedModelSerializer on BGPSessionSerializer or change BGPSession from using ChangeLoggedModel to using PrimaryModel

ASN to device and vrf relationship

A small suggestion for BGP ASN model: this plugin uses tenants, but for some reason missing BGP ASN to device and BGP ASN to VRF relationship.

This might also change view on #19, since we can reuse the same ASN number in the different VRFs. for example.

What is your opinion on this?

Netbox 3.0.11 support

Please, add Netbox 3.0.10 support.

django.core.exceptions.ImproperlyConfigured: Plugin netbox_bgp requires NetBox maximum version 3.0.10.

Thank you.

P.S. It's better to make this check less strict, like 3.0.*, because new minor releases should not affect any functions.

Feature Request: Deprecate ASN model in favor of NetBox 3.1.0 ASN model

Is your feature request related to a problem? Please describe.
NetBox 3.1.0 added the new ASN model allowing you to specify multiple sites to an ASN. It would be ideal to leverage said model, and extend it in the same way you have within this BGP plugin.

Describe the solution you'd like
Deprecate the custom plugin model for ASNs and leverage the core NetBox model. The only difference between the two is that the core model allows for:

  • multiple sites per ASN
  • tenant group assignments for ASNs
  • An RIR association

IE that means no current attribute of the netbox-plugin model would be missing.

Sessions would just be linked to the NetBox core model of ASN.

Describe alternatives you've considered
Keep the two separate and continue confusion within the API and UI.

Additional context
N/A

Display Policies and Tags in the Peer Groups List page

Hello,

Thank you so much for your work on this plugin, its proving to be very useful!

Can you please add the columns on the BGP Peer Groups List page to view Tags, Import and Export Policies? The current list view only shows Name and Description.

Screen Shot 2021-06-15 at 9 24 24 AM

expose the Community in the API

Hello,

Thank you for the awesome work with this plugin! Please expose the Community model in the api. I'm using version 0.3.1 and looks like only routing_policy, asn and session are exposed in the api.

{"asn":"<uri>/api/plugins/bgp/asn/?format=json","session":"<uri>/api/plugins/bgp/session/?format=json","routing_policy":"<uri>/api/plugins/bgp/routing_policy/?format=json"}

Netbox BGP ModuleNotFoundError

Hello,

Attempting to install this plugin on a fresh install of Netbox on Ubuntu 20.04 LTS. I have Python 3.8.5 installed and have installed the plugin with pip3 after activating the netbox virtual environment:
sudo pip3 install netbox_bgp

I've added the plugin 'netbox_bgp' to the plugins list in configuration.py but when I restart the netbox service I am met with the following:

ModuleNotFoundError: No module named 'netbox_bgp'

When I attempt to reinstall netbox-bgp, pip3 says the requirement is already met:
Requirement already satisfied: netbox-bgp in /usr/local/lib/python3.8/dist-packages (0.1.0)

Am I installing this incorrectly or is there a dependency that I might be missing?

Guidance on updating to netbox 3.x

Thank you for the work on this project, I love it :)

Is your feature request related to a problem? Please describe.
I'm starting our update to netbox 3.x and we use this plugin so I would like to help upgrade it to be compatible with 3.x

The issue is that there were a lot of changes in 3.x so I would like some guidance from you about how you would like to approach it. Would you rather break backwards compatibility and only support 3.x or add a lot of duplicate code to support both 2.x and 3.x at the same time?

Describe the solution you'd like
I think the cleanest approach would be to cut off support for 2.x and have the next release only support 3.x but my opinion doesn't really matter on that, how would you like to proceed?

Describe alternatives you've considered
The plugin can determine the running version of netbox but the duplication of code will be quite a bit since many templates and classes were overhauled.

Additional context
None

Support for AS dot notation

Having the ability to support AS dot notation and not just AS Plain especially for large MPLS deployments where 90% of AS's are all in dot notation will make it simpler for junior engineers to understand instead of them having to convert the dot notation to AS plain and vice versa every time that they are working between Netbox and the CE.

Not working UI actions for non-superusers

NetBox version
3.0.10

Describe the bug
Regardless of whether specified permissions on plugin models they are don't work with non-superusers via UI.
There are hidden items in menu.

To Reproduce
Steps to reproduce the behavior:

  1. Go to admin panel -> permissions
  2. Create permissions on BGP plugin models
  3. Assign permission to non superuser
  4. Relogin to this user and try to create smth, for example sessions

Expected behavior
You can fall into the list of sessions

Screenshots
image
I suppose:
image

Additional context
Permissions work if you try to do it directly via URL: https://<your_netbox>/plugins/bgp/session/

Problem can be there: https://github.com/k01ek/netbox-bgp/blob/main/netbox_bgp/navigation.py
Pls, fix

Feature Request: Prefix & IP relationships

It would be nice to track expected prefixes and advertised prefixes on a BGP session.

As an FYI host routes cannot be added as a prefix hence why IP linkage/logic for host routes will need to be created.

Feature Request: Add fields for import and export policies

Thank you very much for creating this plugin! Just what I was looking for to address a huge gap in the Netbox core model. We use import and export policies for every peer (for compliance), but are having trouble finding a good place to store that info in Netbox (custom fields are not a good fit). Can you please update your model to include fields to store the names of import and export policies? Both import and export policies can be a list of strings , for example ['BOGONS-REJECT', 'PRIVATE-PEER-IN'] , i.e. there could be more than one policy (order matters) for both import and export.

Feature Request: IBGP Representation

It would be really helpful to create a BGP session between two devices.

Currently, one can assign the same ASN to remote and local to create an IBGP connection, though this is sub-optimal, as the BGP connection only shows up on the device it is assigned to, and not on the other one.

I propose a distiction in the session creation interface between "Remote AS (EBGP)" and "IBGP". EBGP is the functionality as it is now, but IBGP lets you select a device and an IP address associated with an interface of that device.

Site data is not returned with API for ASN's

It seems that the API for ASN's only includes the number, id and status rather than all choice fields.
I would suggest including all fields - especially important for webhooks.

ASN API Internal Server Error: duplicate key value violates unique constraint "uniqie_number"

NetBox version
2.11.3

Describe the bug
When trying to create an ASN object via API which already exists and tenant is None, the following error occurs:

IntegrityError at /api/plugins/bgp/asn/
duplicate key value violates unique constraint "uniqie_number"
DETAIL:  Key (number)=(1) already exists.


Request Method: POST
Request URL: http://0.0.0.0:8000/api/plugins/bgp/asn/
Django Version: 3.2
Python Executable: /usr/local/bin/python
Python Version: 3.7.7
...

To Reproduce
Steps to reproduce the behavior:

  1. Go to http://0.0.0.0:8000/api/docs/
  2. POST New ASN with data:
{
  "number": 1,
  "status": "active",
  "description": "string"
}
  1. Repeat step โ„–2
  2. See error

Expected behavior
API should return 400 Error: Bad Request with body:

{
  "__all__": [
    "Asn with this Number and Tenant already exists."
  ]
}

BGP Session Edit view is too slow does not work consistently

NetBox version
2.11.2

Describe the bug
After a BGP Session is created, when I try to edit it by clicking on the Edit button (which tries to take me to https:///plugins/bgp/session//edit/) the edit BGP session page takes a very long time to load, and only loads sometimes. Most of the time, the page just hangs.

To Reproduce
Steps to reproduce the behavior:

  1. Create a BGP session via the GUI
  2. Click on the BGP session created, to view Details of the Session.
  3. Click on the Edit button
  4. Observe behavior: Does the Edit session page load quickly?

Expected behavior
The Edit BGP Session page loads as quickly as the Details view of the BGP session.

Screenshots
n/a

Additional context
The problem doesn't seem to be load/database size related. This behavior is observed both in our Production env as well as in Dev env. The total number of BGP sessions is only 5, so its not about number of entries in the BGP Session table. We do however have 2000 IP Address objects in Production, and 500 IP Address objects in Dev.

BGP plugin permission configuration support

Is your feature request related to a problem? Please describe.
NetBox BGP plugin lacks permission configuration and is only available to users with superuser permissions. In our case we use group permissions to assign specific permissions to them (e.g. some users have only read only access, some do not have access to secrets etc.). While using BGP plugin it is only possible to assign all (superuser) or nothing.

Describe the solution you'd like
NetBox plugins support permission management so it should be possible to add support for that to BGP plugin.

Describe alternatives you've considered
There aren't really any other alternatives besides giving full access to users that need any access to BGP plugin.

Additional context
https://ttl255.com/developing-netbox-plugin-part-5-permissions-and-api/

NetBox v3.2 support

Hey there! I'd like to volunteer to implement support for NetBox v3.2. The first beta was recently released, and it greatly extends the plugins framework. We should be able to ensure support for NetBox v3.2 while removing a substantial amount of boilerplate/unsupported code. I did this recently for the netbox-dns plugin and it turned out very well.

If this would be helpful to you, I'll get to work shortly on a PR to adapt the current code base to the new framework. Of course it's entirely up to you whether to adopt the whole thing or implement specific changes piecemeal, but it should at least serve as a reference to hopefully minimize the work needed. Please let me know what you think!

API requires "Device" field for Sessions whereas GUI does not

NetBox version
v2.10-ldap

Describe the bug
When POST'ing via API to create a BGP Session, you need to specify a device - otherwise, you get:

{
    "device": [
        "This field is required."
    ]
}

This was not the case before. This is also not the case via GUI.

Expected behavior
The BGP Session should create without a device, as a device is not a required field.

Feature Request: Expand Peer Group optional attributes

Is your feature request related to a problem? Please describe.
It would be nice to optionally set the peer_group settings that can commonly be shared with session config.

Describe the solution you'd like
Add remote as, local as, local address, status as optional attributes. I think that is all the peer group model is missing.

Describe alternatives you've considered
Not model peer groups the same way I would configure on a device.

Additional context
Add any other context or screenshots about the feature request here.

BGP Unnumbered support

With BGP Unnumbered (RFC 5549) , peering sessions do not require a local or remote address.
Instead, BGP Unnumbered sessions are bound to an interface (point-to-point links).
This is commonly used when EVPN is deployed in a datacenter.

Here is an example of underlay config in frr:

router bgp 65300
  bgp router-id 172.30.0.1
  bgp bestpath as-path multipath-relax
  neighbor underlay peer-group
  neighbor underlay remote-as external
  neighbor underlay capability extended-nexthop
  neighbor peerlink peer-group
  neighbor peerlink remote-as internal
  neighbor peerlink.4094 interface peer-group peerlink
  neighbor swp51 interface peer-group underlay
  neighbor swp52 interface peer-group underlay
  neighbor swp53 interface peer-group underlay
  neighbor swp54 interface peer-group underlay

To accommodate BGP Unnumbered, add a Type selection to the Session: ['IPv4','Interface']
When "Interface" is selected:

  • Device selection is required
  • Local address should change to Interface selection (Multiple interfaces can be used for same session)
  • Remote Address is not needed

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

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.

Feature Request: BGP Peer Type attribute

Was happy to find this plugin, have not yet tested it. I would suggest adding a 'Peer Type' where it's one of these. Perhaps configurable choices with these as defaults, but at bare minimum:

  • Customer
  • Peer
  • Transit

This is helpful if one were to use this to automatically create peering policy configurations, which would be impossible to do without knowing the relationship of the peer.

Think localpref as an example of one attribute one would set based on peer type, which is typically higher for customer and settlement free peers than and lower for paid transit.

Expand Search fields in BGP Session List view to include addresses and Name

Hello,

The Search column in the BGP sessions list view doesn't offer a way to search by Name, Device, Remote Address, Local Address. Having these fields will help a lot when there are a lot of sessions (over 20K) and we are only interested in some of them.

Please include a way to search by: Name, Device, Remote Address, Local Address

Feature request: provider field in bgp sessions form

Is your feature request related to a problem? Please describe.
Not a problem but an useful feature for benefit from data which is already in netbox.

Describe the solution you'd like
Add an additonal field "Provider" (using Circuits / Providers as a source) on all BGP sessions forms / reports (optional, because an iBGP session will not have any provider for example)

Describe alternatives you've considered
Use Name field for provider names which is for sure not the same after touching this 400+ times including all variants of provider names.

Additional context
image

Feature Request: Route-map and prefix-list

Hi, first thanks for this project. really cool and helpful..

I was not sure what was your vision for the Routing Policies

would it be possible to add new fields to document prefix-lists (maybe based on the prefixes from IPAM module?), community , SET , and permit/deny statements in a Routing Policie object?

I think I would help having everything related to a single bgp peer session a the same place.

Not sure if its really feasible as route-map are complex objects, but I'll be happy to know you view on that.

thanks!

Bug: When installed, the plugin breaks api docs

If you install the plugin, browse to /api/docs/ you will see the api failed to load API definition file.

I am testing with NetBox docker, but I can look to reproduce with a hand install if needed.

Issue resolves when you uninstall the plugin.

I tested with 2.11.1 and 2.10.10

BGP Session API POST errors after ASNSerializer change on BGPSessionSerializer

NetBox version
v2.11.3

Describe the bug
Cannot create a new BGP Session instance via API

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://<netbox-instance>/api/docs/
  2. POST a new BGP session, examples:

Request 1

{
  "local_as": 4,
  "remote_as": 4,
  "name": "New BGP Session",
  "status": "active",
  "site": 4,
  "device": 482,
  "local_address": 13608,
  "remote_address": 13607
}

Response 1

{
  "local_as": {
    "non_field_errors": [
      "Invalid data. Expected a dictionary, but got int."
    ]
  },
  "remote_as": {
    "non_field_errors": [
      "Invalid data. Expected a dictionary, but got int."
    ]
  }
}

Request 2

{
  "local_as": {"id": 4},
  "remote_as": {"id": 4},
  "name": "New BGP Session",
  "status": "active",
  "site": 4,
  "device": 482,
  "local_address": 13608,
  "remote_address": 13607
}

Response 2

{
  "error": "Cannot assign \"OrderedDict()\": \"BGPSession.local_as\" must be a \"ASN\" instance.",
  "exception": "ValueError",
  "netbox_version": "2.11.3",
  "python_version": "3.8.10"
}

Expected behavior
A new BGP Session should have been created

Cannot get netbox-bgp running with clean netbox 3.1.0

NetBox version
What version of NetBox are you currently running?
3.1.0

Describe the bug
Once the pluging is activated , Netbox cannot start with this error :
netbox_1_866d9b5d211e | django.db.migrations.exceptions.NodeNotFoundError: Migration netbox_bgp.0020_netbox_bgp dependencies reference nonexistent parent node ('extras', '0067_customfield_min_max_values')

To Reproduce
Install Netbox docker 3.1.0 ( netbox-docker Version 1.5.1 , with postgres 14)

Additional context
I tried with uninitialized and initilialized DB ( empty)

Thanks !

Feature Request: Add tags to API endpoints

Since the GUI allows tagging, the API endpoints (such as /plugins/bgp/session/) should allow specifying tags as well. They should also be returned with GET requests.

Thanks for creating this plugin! :) Solves a much needed function in NetBox.

Display Tags for the Communities List page in the GUI

Hello,

Awesome plugin, thank you very much for your work!

Can you please include the Tags column in the List view of Communities? The available columns are Value, Description, Status and Tenant and there is no option to add a column for Tags.

I'm currently using version 0.3.1

image

Netbox 3.1.0 support

Please add support for recently released Netbox 3.1.0

Tried to manualy increase max version to 3.1.0, but
it is not enough to work. It seem something changed in classes,
manage.py update leads to this traceback:

...
  File "/usr/lib/python3.8/site-packages/netbox_bgp/urls.py", line 5, in <module>
    from .views import (
  File "/usr/lib/python3.8/site-packages/netbox_bgp/views.py", line 11, in <module>
    from .forms import (
  File "/usr/lib/python3.8/site-packages/netbox_bgp/forms.py", line 71, in <module>
    class ASNFilterForm(BootstrapMixin, CustomFieldModelForm):
  File "/usr/lib/python3.8/site-packages/django/forms/models.py", line 226, in __new__
    new_class = super().__new__(mcs, name, bases, attrs)
  File "/usr/lib/python3.8/site-packages/django/forms/forms.py", line 31, in __new__
    new_class = super().__new__(mcs, name, bases, attrs)
  File "/usr/lib/python3.8/site-packages/django/forms/widgets.py", line 191, in __new__
    new_class = super().__new__(mcs, name, bases, attrs)
TypeError: Cannot create a consistent method resolution
order (MRO) for bases BootstrapMixin, CustomFieldModelForm

Support version 2.11.7

Hi,

Thank you for the great product. Could you please test and update to support the current netbox release = 2.11.7?

django.core.exceptions.ImproperlyConfigured: Plugin netbox_bgp requires NetBox maximum version 2.11.6.

Thank you.

v3.0-beta1 version support

Hi,

Today 3.0beta1 has been released and it has many new features and UI.
Please, update you plugin to support this version.

Thank you.

Error import TagFilter from utilities.filters

Hi,
I found this error when trying to enable netbox-bgp

Netbox version v2.11.4-dev

Steps to reproduce the behavior:

  1. cd /opt/netbox
  2. source venv/bin/activate
  3. cd /opt/netbox/netbox
  4. run ./manage.py runserver 0.0.0.0:8000 --insecure

Error log:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/management/base.py", line 419, in check
    all_issues = checks.run_checks(
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/checks/registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/urls/resolvers.py", line 412, in check
    for pattern in self.url_patterns:
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/urls/resolvers.py", line 598, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/django/urls/resolvers.py", line 591, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/netbox/netbox/netbox/urls.py", line 8, in <module>
    from extras.plugins.urls import plugin_admin_patterns, plugin_patterns, plugin_api_patterns
  File "/opt/netbox/netbox/extras/plugins/urls.py", line 35, in <module>
    urlpatterns = import_object(f"{plugin_path}.api.urls.urlpatterns")
  File "/opt/netbox/netbox/extras/plugins/utils.py", line 31, in import_object
    spec.loader.exec_module(module)
  File "/opt/netbox/venv/lib64/python3.8/site-packages/netbox_bgp/api/urls.py", line 3, in <module>
    from .views import ASNViewSet, BGPSessionViewSet, RoutingPolicyViewSet
  File "/opt/netbox/venv/lib64/python3.8/site-packages/netbox_bgp/api/views.py", line 5, in <module>
    from netbox_bgp.filters import ASNFilterSet, BGPSessionFilterSet, RoutingPolicyFilterSet
  File "/opt/netbox/venv/lib64/python3.8/site-packages/netbox_bgp/filters.py", line 4, in <module>
    from utilities.filters import TagFilter
ImportError: cannot import name 'TagFilter' from 'utilities.filters' (/opt/netbox/netbox/utilities/filters.py)

Temporary fix:

Change line number 4 in the netbox_bgp/filters.py
from utilities.filters import TagFilter
to
from extras.filters import TagFilter

And rerun the server:

./manage.py runserver 0.0.0.0:8000 --insecure
Performing system checks...

System check identified no issues (0 silenced).

You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): netbox_bgp.
Run 'python manage.py migrate' to apply them.
May 09, 2021 - 18:19:50
Django version 3.2.2, using settings 'netbox.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

Thank you

Support for new Netbox version 2.11.10

NetBox version
v2.11.10

Describe the bug
The class config in __init__.py lists a max_version of 2.11.9. This causes the upgrade of the plugin to fail.

To Reproduce
Steps to reproduce the behavior:

  1. Have plugin 'netbox_bgp' enabled in the plugin configuration in configuration.py file
  2. Attempt to update Netbox to 2.11.10
  3. Results in error:
...
  File "/opt/netbox/netbox/netbox/settings.py", line 617, in <module>
    plugin_config.validate(PLUGINS_CONFIG[plugin_name], VERSION)
  File "/opt/netbox/netbox/extras/plugins/__init__.py", line 87, in validate
    f"Plugin {cls.__module__} requires NetBox maximum version {cls.max_version}."
django.core.exceptions.ImproperlyConfigured: Plugin netbox_bgp requires NetBox maximum version 2.11.9.

Expected behavior
Upgrade/migration of the plugin succeeds.

Screenshots
N/A

Additional context
N/A

Netbox 3.0.10 support

Please, add Netbox 3.0.10 support.

django.core.exceptions.ImproperlyConfigured: Plugin netbox_bgp requires NetBox maximum version 3.0.8.

Thank you.

Cannot update ASN object over python client

NetBox version
2.11.2

Describe the bug
We are able to create ASN object using pynetbox, and fetch it using .get(). However, .save() fails.

To Reproduce

# nb is instance of pynetbox.api in this example
nb.plugins.bgp.asn.create({'number': 12345, 'description': 'deleteme'})
# successfully creates ASN 12345

foo = nb.plugins.bgp.asn.get(number=12345)
In [104]: type(foo)
Out[104]: pynetbox.core.response.Record

In [105]: foo.description
Out[106]: 'deleteme'

In [108]: foo.description = 'asdf'
In [109]: foo.save()
---------------------------------------------------------------------------
RequestError                              Traceback (most recent call last)
<ipython-input-106-0dd54f04032b> in <module>()
----> 1 foo.save()

/pip/pynetbox/pynetbox-cpython-38/lib/pynetbox/core/response.py in save(self)
    458                     http_session=self.api.http_session,
    459                 )
--> 460                 if req.patch({i: serialized[i] for i in diff}):
    461                     return True
    462

/pip/pynetbox/pynetbox-cpython-38/lib/pynetbox/core/query.py in patch(self, data)
    411         :returns: Dict containing the response from NetBox's API.
    412         """
--> 413         return self._make_call(verb="patch", data=data)
    414
    415     def options(self):

pip/pynetbox/pynetbox-cpython-38/lib/pynetbox/core/query.py in _make_call(self, verb, url_override, add_params, 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': "'number'", 'exception': 'KeyError', 'netbox_version': '2.11.2', 'python_version': '3.8.8+'}

Expected behavior
The ASN object gets updated successfully.

Screenshots
Not necessary- the code snippet above is enough to easily reproduce.

Additional context

In [110]: nb.status()
Out[110]:
{'django-version': '3.2',
 'installed-apps': {'cacheops': '5.0.1',
  'debug_toolbar': '3.2.1',
  'django_filters': '2.4.0',
  'django_prometheus': '2.1.0',
  'django_rq': '2.4.1',
  'django_tables2': '2.3.4',
  'drf_yasg': '1!0.0.0.dev0+noscm.0000017b9d2cbe8a',
  'mptt': '0.12.0',
  'netbox_bgp': '0.3.9',
  'rest_framework': '3.12.4',
  'taggit': '1.4.0',
  'timezone_field': '4.1.2'},
 'netbox-version': '2.11.2',
 'plugins': {'netbox_bgp': '0.3.9'},
 'python-version': '3.8.8+',
 'rq-workers-running': 0}

Cannot add Custom Field of type JSON

NetBox version
v3.1.6 with plugin 0.5.0

Describe the bug
I can add custom field of any type ( text, boolean, number..) to the bgp plugin pages, but JSON is not working and make the page throw an error

To Reproduce
Steps to reproduce the behavior:
Add custom field with TYPE JSON and add it to BGP Routing Policies
Go to Routing Policies page and this error appear :

<class 'TypeError'>

the JSON object must be str, bytes or bytearray, not NoneType

Python version: 3.9.5
NetBox version: 3.1.6

Expected behavior
The json field is added to the page ( its working with other non-bgp pages)

Screenshots
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.