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 Collection of Cheatsheets, Books, Questions, and Portfolio For DS/ML Interview Prep

Here are the sections: Data Science Cheatsheets Data Science EBooks Data Science Question Bank Data Science Case Studies Data Science Portfolio Data J

James Le 2.5k Jan 02, 2023
Members: Thomas Longuevergne Program: Network Security Course: 1DV501 Date of submission: 2021-11-02

Mini-project report Members: Thomas Longuevergne Program: Network Security Course: 1DV501 Date of submission: 2021-11-02 Introduction This project was

1 Nov 08, 2021
Tampilan - Change Termux Appearance With Python

Tampilan Gambar usage pkg update && pkg upgrade pkg install git && pkg install f

Creator Lord-Botz 1 Jan 31, 2022
Canonical source repository for PyYAML

PyYAML - The next generation YAML parser and emitter for Python. To install, type 'python setup.py install'. By default, the setup.py script checks

The YAML Project 2k Jan 01, 2023
Paper and Code for "Curriculum Learning by Optimizing Learning Dynamics" (AISTATS 2021)

Curriculum Learning by Optimizing Learning Dynamics (DoCL) AISTATS 2021 paper: Title: Curriculum Learning by Optimizing Learning Dynamics [pdf] [appen

Tianyi Zhou 15 Dec 06, 2022
Workbench to integrate pyoptools with freecad, that means basically optics ray tracing capabilities for FreeCAD.

freecad-pyoptools Workbench to integrate pyoptools with freecad, that means basically optics ray tracing capabilities for FreeCAD. Requirements It req

Combustión Ingenieros SAS 12 Nov 16, 2022
Course materials for: Geospatial Data Science

Course materials for: Geospatial Data Science These course materials cover the lectures for the course held for the first time in spring 2022 at IT Un

Michael Szell 266 Jan 02, 2023
Sphinx theme for readthedocs.org

Read the Docs Sphinx Theme This Sphinx theme was designed to provide a great reader experience for documentation users on both desktop and mobile devi

Read the Docs 4.3k Dec 31, 2022
Explorative Data Analysis Guidelines

Explorative Data Analysis Get data into a usable format! Find out if the following predictive modeling phase will be successful! Combine everything in

Florian Rohrer 18 Dec 26, 2022
Get link preview of a website.

Preview Link You may have seen a preview of a link with a title, image, domain, and description when you share a link on social media. This preview ha

SREEHARI K.V 8 Jan 08, 2023
NetBox plugin for BGP related objects documentation

Netbox BGP Plugin Netbox plugin for BGP related objects documentation. Compatibility This plugin in compatible with NetBox 2.10 and later. Installatio

Nikolay Yuzefovich 133 Dec 27, 2022
Deduplicating archiver with compression and authenticated encryption.

More screencasts: installation, advanced usage What is BorgBackup? BorgBackup (short: Borg) is a deduplicating backup program. Optionally, it supports

BorgBackup 9k Jan 09, 2023
Testing-crud-login-drf - Creation of an application in django on music albums

testing-crud-login-drf Creation of an application in django on music albums Befo

Juan 1 Jan 11, 2022
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
This repo contains everything you'll ever need to learn/revise python basics

Python Notes/cheat sheet Simplified notes to get your Python basics right Just compare code and output side by side and feel the rush of enlightenment

Hem 5 Oct 06, 2022
🏆 A ranked list of awesome python developer tools and libraries. Updated weekly.

Best-of Python Developer Tools 🏆 A ranked list of awesome python developer tools and libraries. Updated weekly. This curated list contains 250 awesom

Machine Learning Tooling 646 Jan 07, 2023
Exercism exercises in Python.

Exercism exercises in Python.

Exercism 1.3k Jan 04, 2023
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 tutorial will guide you through the process of self-hosting Polygon

Hosting guide This tutorial will guide you through the process of self-hosting Polygon Before starting Make sure you have the following tools installe

Polygon 2 Jan 31, 2022
Software engineering course project. Secondhand trading system.

PigeonSale Software engineering course project. Secondhand trading system. Documentation API doumenatation: list of APIs Backend documentation: notes

Harry Lee 1 Sep 01, 2022