NetBox plugin for BGP related objects documentation

Overview

Netbox BGP Plugin

Netbox plugin for BGP related objects documentation.

Compatibility

This plugin in compatible with NetBox 2.10 and later.

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

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.

Screenshots

BGP Session Object BGP Session

BGP Session Table BGP Session Table

Device Extension Device Session Table

ASN Object ASN

ASN Table ASN Table

Community Object Community

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

    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.

    bug 
    opened by pspdbx 8
  • PR to Support Netbox 3.3

    PR to Support Netbox 3.3

    This is my first attempt at a contribution to this plugin. We are deploying ISIS/MPLS-SR currently, and this plugin is very helpful in documenting our network.

    So here goes...

    Netbox recently refactored the API Serializers. The BGP Plugin needs these updated to function.

    I was able to test this in my development instance here. With a version bump in the init.py, the plugin seems to work after this change.

    opened by kvedder-amplex 7
  • NetBox v3.2 support

    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!

    enhancement 
    opened by jeremystretch 6
  • Netbox BGP ModuleNotFoundError

    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?

    enhancement 
    opened by jbparrish17 6
  • Move Session model to use the NetBox core ASN model

    Move Session model to use the NetBox core ASN model

    ported @nahun's commit to latest k01ek/netbox-bgp@develop Credits: Nathan Wheeler [email protected] https://github.com/nahun/netbox-bgp/commit/6b870b086d46f58cb42e603b5daab3f6fb9d9ee1

    NetBox v3.1 added a native ASN model. The plugin should utilize that model instead of a separate model that is specific to BGP.

    Fixes https://github.com/k01ek/netbox-bgp/issues/82

    opened by christianharendt 5
  • Add a field to represent BGP session state like Open, Idle, Established

    Add a field to represent BGP session state like Open, Idle, Established

    The BGP session table has a 'Status' field, which represents the intended/operational status of a BGP session. It would be great if we also had a 'State' field that represents the state of the BGP session, such as Open, Connect, Active, Idle, Established

    Details: https://www.ciscopress.com/articles/article.asp?p=2756480&seqNum=4

    enhancement 
    opened by pspdbx 5
  • Feature Request: Add fields for import and export policies

    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.

    enhancement 
    opened by pspdbx 5
  • Feature Request: Deprecate ASN model in favor of NetBox 3.1.0 ASN model

    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

    enhancement 
    opened by ryanmerolle 4
  • Feature Request: BGP Peer Type attribute

    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.

    duplicate 
    opened by falz 4
  • NetBox 3.3.0 Support

    NetBox 3.3.0 Support

    Is your feature request related to a problem? Please describe. NetBox 3.3.0 Support & supported matrix updated.

    Describe the solution you'd like NetBox 3.3.0 Support & supported matrix updated.

    enhancement 
    opened by ryanmerolle 3
  • Netbox 3.1.0 support

    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
    
    enhancement 
    opened by zombah 3
  • Filtering on custom fields on BGP sessions doesn't work

    Filtering on custom fields on BGP sessions doesn't work

    NetBox version 3.3.10

    Describe the bug Filtering on custom fields on BGP sessions returns all objects

    To Reproduce Steps to reproduce the behavior:

    1. Create a custom field on BGP sessions (e.g., create CF named 'testfield' as a boolean)
    2. Set the test field value (set 'testfield' on a BGP session to 'true')
    3. Search on the created field's value (go to BGP sessions -> Filter, and select 'true' under the 'testfield' CF)
    4. Results will show all BGP sessions

    Expected behavior BGP Sessions would be filtered only the value of the custom field.

    Screenshots I basically did the exact thing in the "To Reproduce" section and here are the results (note that I added the "testfield" column so you can see the value):

    image

    Additional context I also attempted this via the API and the results were the same. Wasn't sure if this was a Netbox issue, Netbox BGP issue, or personal issue, but I figured I'd start here.

    bug 
    opened by bgianpetro 1
  • fix routing policy permission name

    fix routing policy permission name

    Non superusers can't see the buttons for "add prefix-list-rule" even if they have permissions to view, add, change and delete netbox_bgp | routing policy rule

    The permission name is *_routingpolicy instead of *_policy.

    opened by christianharendt 0
  • Extending comminuty length 64->128

    Extending comminuty length 64->128

    My clients sometimes use strange BGP communities. I realize that they are not very efficient, but trying to reconfigure network during NetBox implementation is not the best thing. As you know, regexp communities can be lengthy. I.e.:

    > show configuration policy-options community INTERNAL_COMMUNITY 
    members "65500:([0-9]|[0-9][0-9]|[0-9][0-9][0-9]|[0-9][0-9][0-9][0-9]|[1-467890][0-9][0-9][0-9][0-9])";
    

    Can you please accept this PR which extents community size twice?

    opened by ivanovuri 4
  • how to create a prefix lists automatically via script

    how to create a prefix lists automatically via script

    NetBox version v3.3.4

    Describe the bug try to create a prefix list via pynetbox or via requests generate a traceback error. the fields name, decription and family are required. expected value for the fields is string. when you post your request you've got the following return

    pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'family': ['"test" is not a valid choice.']}
    

    but if you create a prefix list object manually, you don't have this field. In addition when you get the previously created object, the field family is a empty string.

     v=operator.attrgetter('plugins.bgp.prefix-list')(nb).get(**dict(name='test'))
    dict(v)
    {'id': 6, 'tags': [], 'custom_fields': {}, 'display': 'test', 'created': '2022-11-22T14:11:32.356173Z', 'last_updated': '2022-11-22T14:11:32.356189Z', 'custom_field_data': {}, 'name': 'test', 'description': '', 'family': ''}
    

    I don't understand what's the expected value for family.

    To Reproduce

    operator.attrgetter('plugins.bgp.prefix-list')(nb).create(dict(name='pl-test',description='pl-test', family='test')) 
    

    Expected behavior

    operator.attrgetter('plugins.bgp.prefix-list')(nb).create(dict(name='pl-test',description='pl-test', family='test')) 
    True
    

    Thank for your support.

    bug 
    opened by Zulzig 1
Releases(v0.8.1)
Owner
Nikolay Yuzefovich
Nikolay Yuzefovich
NetBox plugin that stores configuration diffs and checks templates compliance

Config Officer - NetBox plugin NetBox plugin that deals with Cisco device configuration (collects running config from Cisco devices, indicates config

null 77 Dec 21, 2022
Main repository for the Sphinx documentation builder

Sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of mul

null 5.1k Jan 2, 2023
A curated list of awesome tools for Sphinx Python Documentation Generator

Awesome Sphinx (Python Documentation Generator) A curated list of awesome extra libraries, software and resources for Sphinx (Python Documentation Gen

Hyunjun Kim 831 Dec 27, 2022
API Documentation for Python Projects

API Documentation for Python Projects. Example pdoc -o ./html pdoc generates this website: pdoc.dev/docs. Installation pip install pdoc pdoc is compat

mitmproxy 1.4k Jan 7, 2023
Literate-style documentation generator.

888888b. 888 Y88b 888 888 888 d88P 888 888 .d8888b .d8888b .d88b. 8888888P" 888 888 d88P" d88P" d88""88b 888 888 888

Pycco 808 Dec 27, 2022
Main repository for the Sphinx documentation builder

Sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of mul

null 5.1k Jan 4, 2023
Project documentation with Markdown.

MkDocs Project documentation with Markdown. View the MkDocs documentation. Project release notes. Visit the MkDocs wiki for community resources, inclu

MkDocs 15.6k Jan 2, 2023
Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a livereload enabled web server.

sphinx-autobuild Rebuild Sphinx documentation on changes, with live-reload in the browser. Installation sphinx-autobuild is available on PyPI. It can

Executable Books 440 Jan 6, 2023
Your Project with Great Documentation.

Read Latest Documentation - Browse GitHub Code Repository The only thing worse than documentation never written, is documentation written but never di

Timothy Edmund Crosley 809 Dec 28, 2022
:blue_book: Automatic documentation from sources, for MkDocs.

mkdocstrings Automatic documentation from sources, for MkDocs. Features Python handler features Requirements Installation Quick usage Features Languag

Timothée Mazzucotelli 1.1k Dec 31, 2022
Run `black` on python code blocks in documentation files

blacken-docs Run black on python code blocks in documentation files. install pip install blacken-docs usage blacken-docs provides a single executable

Anthony Sottile 460 Dec 23, 2022
:blue_book: Automatic documentation from sources, for MkDocs.

mkdocstrings Automatic documentation from sources, for MkDocs. Features - Python handler - Requirements - Installation - Quick usage Features Language

null 1.1k Jan 4, 2023
📖 Generate markdown API documentation from Google-style Python docstring. The lazy alternative to Sphinx.

lazydocs Generate markdown API documentation for Google-style Python docstring. Getting Started • Features • Documentation • Support • Contribution •

Machine Learning Tooling 118 Dec 31, 2022
Seamlessly integrate pydantic models in your Sphinx documentation.

Seamlessly integrate pydantic models in your Sphinx documentation.

Franz Wöllert 71 Dec 26, 2022
Documentation generator for C++ based on Doxygen and mosra/m.css.

mosra/m.css is a Doxygen-based documentation generator that significantly improves on Doxygen's default output by controlling some of Doxygen's more unruly options, supplying it's own slick HTML+CSS generation and adding a fantastic live search feature.

Mark Gillard 109 Dec 7, 2022
Automated Integration Testing and Live Documentation for your API

Automated Integration Testing and Live Documentation for your API

ScanAPI 1.3k Dec 30, 2022
Documentation of the QR code found on new Austrian ID cards.

Austrian ID Card QR Code This document aims to be a complete documentation of the format used in the QR area on the back of new Austrian ID cards (Per

Gabriel Huber 9 Dec 12, 2022
Swagger Documentation Generator for Django REST Framework: deprecated

Django REST Swagger: deprecated (2019-06-04) This project is no longer being maintained. Please consider drf-yasg as an alternative/successor. I haven

Marc Gibbons 2.6k Jan 3, 2023
Test utility for validating OpenAPI documentation

DRF OpenAPI Tester This is a test utility to validate DRF Test Responses against OpenAPI 2 and 3 schema. It has built-in support for: OpenAPI 2/3 yaml

snok 106 Jan 5, 2023