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 Python Package To Generate Strong Passwords For You in Your Projects.

shPassGenerator Version 1.0.6 Ready To Use Developed by Shervin Badanara (shervinbdndev) on Github Language and technologies used in This Project Work

Shervin 11 Dec 19, 2022
Generating a report CSV and send it to an email - Python / Django Rest Framework

Generating a report in CSV format and sending it to a email How to start project. Create a folder in your machine Create a virtual environment python3

alexandre Lopes 1 Jan 17, 2022
A Power BI/Google Studio Dashboard to analyze previous OTC CatchUps

OTC CatchUp Dashboard A Power BI/Google Studio dashboard analyzing OTC CatchUps. File Contents * ├───data ├───old summaries ─── *.md ├

11 Oct 30, 2022
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
Comprehensive Python Cheatsheet

Comprehensive Python Cheatsheet Download text file, Buy PDF, Fork me on GitHub or Check out FAQ. Contents 1. Collections: List, Dictionary, Set, Tuple

Jefferson 1 Jan 23, 2022
BakTst_Org is a backtesting system for quantitative transactions.

BakTst_Org 中文reademe:传送门 Introduction: BakTst_Org is a prototype of the backtesting system used for BTC quantitative trading. This readme is mainly di

18 May 08, 2021
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
A repository of links with advice related to grad school applications, research, phd etc

A repository of links with advice related to grad school applications, research, phd etc

Shaily Bhatt 946 Dec 30, 2022
Spin-off Notice: the modules and functions used by our research notebooks have been refactored into another repository

Fecon235 - Notebooks for financial economics. Keywords: Jupyter notebook pandas Federal Reserve FRED Ferbus GDP CPI PCE inflation unemployment wage income debt Case-Shiller housing asset portfolio eq

Adriano 825 Dec 27, 2022
A collection of online resources to help you on your Tech journey.

Everything Tech Resources & Projects About The Project Coming from an engineering background and looking to up skill yourself on a new field can be di

Mohamed A 396 Dec 31, 2022
python package sphinx template

python-package-sphinx-template python-package-sphinx-template

Soumil Nitin Shah 2 Dec 26, 2022
A collection of simple python mini projects to enhance your python skills

A collection of simple python mini projects to enhance your python skills

PYTHON WORLD 12.1k Jan 05, 2023
Hasköy is an open-source variable sans-serif typeface family

Hasköy Hasköy is an open-source variable sans-serif typeface family. Designed with powerful opentype features and each weight includes latin-extended

67 Jan 04, 2023
YAML metadata extension for Python-Markdown

YAML metadata extension for Python-Markdown This extension adds YAML meta data handling to markdown with all YAML features. As in the original, metada

Nikita Sivakov 14 Dec 30, 2022
EasyMultiClipboard - Python script written to handle more than 1 string in clipboard

EasyMultiClipboard - Python script written to handle more than 1 string in clipboard

WVlab 1 Jun 18, 2022
Tips for Writing a Research Paper using LaTeX

Tips for Writing a Research Paper using LaTeX

Guanying Chen 727 Dec 26, 2022
Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.

datamodel-code-generator This code generator creates pydantic model from an openapi file and others. Help See documentation for more details. Supporte

Koudai Aono 1.3k Dec 29, 2022
Easy OpenAPI specs and Swagger UI for your Flask API

Flasgger Easy Swagger UI for your Flask API Flasgger is a Flask extension to extract OpenAPI-Specification from all Flask views registered in your API

Flasgger 3.1k Dec 24, 2022
Python code for working with NFL play by play data.

nfl_data_py nfl_data_py is a Python library for interacting with NFL data sourced from nflfastR, nfldata, dynastyprocess, and Draft Scout. Includes im

82 Jan 05, 2023
Mayan EDMS is a document management system.

Mayan EDMS is a document management system. Its main purpose is to store, introspect, and categorize files, with a strong emphasis on preserving the contextual and business information of documents.

3 Oct 02, 2021