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/[email protected] 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
A markdown wiki and dashboarding system for Datasette

datasette-notebook A markdown wiki and dashboarding system for Datasette This is an experimental alpha and everything about it is likely to change. In

Simon Willison 19 Apr 20, 2022
Fully reproducible, Dockerized, step-by-step, tutorial on how to mock a "real-time" Kafka data stream from a timestamped csv file. Detailed blog post published on Towards Data Science.

time-series-kafka-demo Mock stream producer for time series data using Kafka. I walk through this tutorial and others here on GitHub and on my Medium

Maria Patterson 26 Nov 15, 2022
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
A clean customizable documentation theme for Sphinx

A clean customizable documentation theme for Sphinx

Pradyun Gedam 1.5k Jan 06, 2023
The Python Dict that's better than heroin.

addict addict is a Python module that gives you dictionaries whose values are both gettable and settable using attributes, in addition to standard ite

Mats Julian Olsen 2.3k Dec 22, 2022
An open-source script written in python just for fun

Owersite Owersite is an open-source script written in python just for fun. It do

大きなペニスを持つ少年 7 Sep 21, 2022
100 numpy exercises (with solutions)

100 numpy exercises This is a collection of numpy exercises from numpy mailing list, stack overflow, and numpy documentation. I've also created some p

Nicolas P. Rougier 9.5k Dec 30, 2022
Żmija is a simple universal code generation tool.

Żmija Żmija is a simple universal code generation tool. It is intended to be used as a means to generate code that is both efficient and easily mainta

Adrian Samoticha 2 Nov 23, 2021
An ongoing curated list of OS X best applications, libraries, frameworks and tools to help developers set up their macOS Laptop.

macOS Development Setup Welcome to MacOS Local Development & Setup. An ongoing curated list of OS X best applications, libraries, frameworks and tools

Paul Veillard 3 Apr 03, 2022
Legacy python processor for AsciiDoc

AsciiDoc.py This branch is tracking the alpha, in-progress 10.x release. For the stable 9.x code, please go to the 9.x branch! AsciiDoc is a text docu

AsciiDoc.py 178 Dec 25, 2022
An awesome Data Science repository to learn and apply for real world problems.

AWESOME DATA SCIENCE An open source Data Science repository to learn and apply towards solving real world problems. This is a shortcut path to start s

Academic.io 20.3k Jan 09, 2023
Sms Bomber, Tool Encryptor

ɴᴏʙɪᴛᴀシ︎ ғᴏʀ ᴀɴʏ ʜᴇʟᴘシ︎ Install pkg install git -y pkg install python -y pip install requests git clone https://github.com/AK27HVAU/akash Run cd Akash

ɴᴏʙɪᴛᴀシ︎ 4 May 23, 2022
Que es S4K Builder?, Fácil un constructor de tokens grabbers con muchas opciones, como BTC Miner, Clipper, shutdown PC, Y más! Disfrute el proyecto. <3

S4K Builder Este script Python 3 de código abierto es un constructor del muy popular registrador de tokens que está en [mi GitHub] (https://github.com

SadicX 1 Oct 22, 2021
Materi workshop "Light up your Python!" Himpunan Mahasiswa Sistem Informasi Fakultas Ilmu Komputer Universitas Singaperbangsa Karawang, 4 September 2021 (Online via Zoom).

Workshop Python UNSIKA 2021 Materi workshop "Light up your Python!" Himpunan Mahasiswa Sistem Informasi Fakultas Ilmu Komputer Universitas Singaperban

Eka Putra 20 Mar 24, 2022
A Material Design theme for MkDocs

A Material Design theme for MkDocs Create a branded static site from a set of Markdown files to host the documentation of your Open Source or commerci

Martin Donath 12.3k Jan 04, 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
A module filled with many useful functions and modules in various subjects.

Usefulpy Check out the Usefulpy site Usefulpy site is not always up to date Download and Import download and install with with pip download usefulpyth

Austin Garcia 1 Dec 28, 2021
DataRisk Detection Learning Resources

DataRisk Detection Learning Resources Data security: Based on the "data-centric security system" position, it generally refers to the entire security

Liao Wenzhe 59 Dec 05, 2022
Lightweight, configurable Sphinx theme. Now the Sphinx default!

What is Alabaster? Alabaster is a visually (c)lean, responsive, configurable theme for the Sphinx documentation system. It is Python 2+3 compatible. I

Jeff Forcier 670 Dec 19, 2022
Some custom tweaks to the results produced by pytkdocs.

pytkdocs_tweaks Some custom tweaks for pytkdocs. For use as part of the documentation-generation-for-Python stack that comprises mkdocs, mkdocs-materi

Patrick Kidger 4 Nov 24, 2022