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
✨ Real-life Data Analysis and Model Training Workshop by Global AI Hub.

πŸŽ“ Data Analysis and Model Training Course by Global AI Hub Syllabus: Day 1 What is Data? Multimedia Structured and Unstructured Data Data Types Data

Global AI Hub 71 Oct 28, 2022
Automatically open a pull request for repositories that have no CONTRIBUTING.md file

automatic-contrib-prs Automatically open a pull request for repositories that have no CONTRIBUTING.md file for a targeted set of repositories. What th

GitHub 8 Oct 20, 2022
Second version of SQL-PYTHON-Practicas

SQLite-Python Acerca de | Autor Sobre el repositorio Segunda version de SQL-PYTHON-Practicas πŸ’» Tecnologias Visual Studio Code Python SQLite3 πŸ“– Requi

1 Jan 06, 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
This programm checks your knowlege about the capital of Japan

Introduction This programm checks your knowlege about the capital of Japan. Now, what does it actually do? After you run the programm you get asked wh

1 Dec 16, 2021
A Python library for setting up projects using tabular data.

A Python library for setting up projects using tabular data. It can create project folders, standardize delimiters, and convert files to CSV from either individual files or a directory.

0 Dec 13, 2022
Tutorial for STARKs with supporting code in python

stark-anatomy STARK tutorial with supporting code in python Outline: introduction overview of STARKs basic tools -- algebra and polynomials FRI low de

121 Jan 03, 2023
Markdown documentation generator from Google docstrings

mkgendocs A Python package for automatically generating documentation pages in markdown for Python source files by parsing Google style docstring. The

Davide Nunes 44 Dec 18, 2022
The purpose of this project is to share knowledge on how awesome Streamlit is and can be

Awesome Streamlit The fastest way to build Awesome Tools and Apps! Powered by Python! The purpose of this project is to share knowledge on how Awesome

Marc Skov Madsen 1.5k Jan 07, 2023
charcade is a string manipulation library that can animate, color, and bruteforce strings

charcade charcade is a string manipulation library that can animate, color, and bruteforce strings. Features Animating text for CLI applications with

Aaron 8 May 23, 2022
Manage your WordPress installation directly from SublimeText SideBar and Command Palette.

WordpressPluginManager Manage your WordPress installation directly from SublimeText SideBar and Command Palette. Installation Dependencies You will ne

Art-i desenvolvimento 1 Dec 14, 2021
A plugin to introduce a generic API for Decompiler support in GEF

decomp2gef A plugin to introduce a generic API for Decompiler support in GEF. Like GEF, the plugin is battery-included and requires no external depend

Zion 379 Jan 08, 2023
Grokking the Object Oriented Design Interview

Grokking the Object Oriented Design Interview

Tusamma Sal Sabil 2.6k Jan 08, 2023
MkDocs plugin for setting revision date from git per markdown file

mkdocs-git-revision-date-plugin MkDocs plugin that displays the last revision date of the current page of the documentation based on Git. The revision

Terry Zhao 48 Jan 06, 2023
Uses diff command to compare expected output with student's submission output

AUTOGRADER for GRADESCOPE using diff with partial grading Description: Uses diff command to compare expected output with student's submission output U

2 Jan 11, 2022
A Python package develop for transportation spatio-temporal big data processing, analysis and visualization.

English δΈ­ζ–‡η‰ˆ TransBigData Introduction TransBigData is a Python package developed for transportation spatio-temporal big data processing, analysis and

Qing Yu 251 Jan 03, 2023
A simple flask application to collect annotations for the Turing Change Point Dataset, a benchmark dataset for change point detection algorithms

AnnotateChange Welcome to the repository of the "AnnotateChange" application. This application was created to collect annotations of time series data

The Alan Turing Institute 16 Jul 21, 2022
A Python library that simplifies the extraction of datasets from XML content.

xmldataset: simple xml parsing πŸ—ƒοΈ XML Dataset: simple xml parsing Documentation: https://xmldataset.readthedocs.io A Python library that simplifies t

James Spurin 75 Dec 30, 2022
OpenAPI Spec validator

OpenAPI Spec validator About OpenAPI Spec Validator is a Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger) and OpenAPI

A 241 Jan 05, 2023
Example Python code for running the mango-explorer marketmaker

πŸ₯­ Mango Explorer πŸ“– Introduction This guide will show you how to load and run a customisable marketmaker that runs on Mango Markets using the mango-e

Blockworks Foundation 2 Apr 11, 2022