Implementing Cisco Support APIs into NetBox

Overview

NetBox Cisco Support API Plugin

NetBox plugin using Cisco Support APIs to gather EoX and Contract coverage information for Cisco devices.

Compatibility

This plugin in compatible with NetBox 3.0.3 and later.

Installation

The plugin is available as a Python package in pypi and can be installed with pip

$ source /opt/netbox/venv/bin/activate
(venv) $ pip install netbox-cisco-support

Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:

# Enable installed plugins. Add the name of each plugin to the list.
PLUGINS = ['netbox_cisco_support']

# Plugins configuration settings. These settings are used by various plugins that the user may have installed.
# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
PLUGINS_CONFIG = {
    'netbox_cisco_support': {
        'cisco_client_id': 'bar',     # Client ID of your plugin installation. Generate it inside Cisco API Console
        'cisco_client_secret': 'bazz' # Client Secret of your plugin installation. Generate it inside Cisco API Console
    }
}

Restart NetBox and add netbox-cisco-support to your local_requirements.txt

(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py migrate
# sudo systemctl restart netbox

Sync Cisco EoX data for the first time

(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py sync_eox_data

To periodically refresh EoX data create a cronjob which calls sync_eox_data periodically

$ cat /etc/cron.d/netbox_sync_eox_data

# Update Cisco EoX Data every Saturday at 14:03
MAILTO="[email protected]"
3 14 * * 6 root /opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py sync_eox_data

or log into /tmp file

$ cat /etc/cron.d/netbox_sync_eox_data

# Update Cisco EoX Data every Saturday at 14:03
3 14 * * 6 root /opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py sync_eox_data > /tmp/netbox_sync_eox_data

Configuration

The following options are available:

  • cisco_client_id: String - Client ID of your plugin installation. Generate it inside Cisco API Console
  • cisco_client_secret: String - Client Secret of your plugin installation. Generate it inside Cisco API Console

Requirements

In order to get the correct data using the API, several requirements must be fulfilled:

  1. A Cisco API ID and secret must have been created and configured inside configuration.py
  2. A manufacturer called Cisco must have been configured inside NetBox. If your manufacturer is named differently, change if inside configuration.py:
PLUGINS_CONFIG = {
    'netbox_cisco_support': {
        ...,
        'manufacturer': 'Cisco Systems' # Optional setting for definiing the manufacturer
    }
}
  1. All devices types for manufacturer Cisco must have filled the optional Part number field inside NetBox with the correct Base PID for that Cisco product.
  2. All devices with devices types from manufacturer Cisco must have filled the Serial Number field inside NetBox with a valid Cisco serial number for that Cisco product.
  3. If you want full visibility, the support contracts for all your devices needs to be associated with the CCO ID which has been used for created the API ID and secret. Otherwise you will only get a coverage true/false answer, but no detailed information regarding end of support contract coverage.

How it works

  1. Calling the sync_eox_data method will catch all device types for the configured manufacturer
  2. Each device types Part number will be send to Cisco EoX API. API answer will be saved inside a CiscoDeviceTypeSupport model. One CiscoDeviceTypeSupport per device.
  3. Afterwards all devices for the configured manufacturer will be gathered
  4. Each devices Serial number will be send to Cisco sn2info coverage API. API answer will be saved inside a CiscoDeviceSupport model. One CiscoDeviceSupport per device.
  5. The device type template will be extended to display this data. Information will be shown, if a CiscoDeviceTypeSupport object for that device type exists.
  6. The device template will be exteneded to display device and device type information. Information will be shown, if a CiscoDeviceSupport object for that device exists. Additionally device type information will be shown, if a CiscoDeviceTypeSupport object for the parent device type exists.
  7. Coloring: Expired timestamps will be colored red, timestamps which will expire in the next calendar year will be colored yellow for planning / forecast reasons.

Screenshots

Screenshot

Comments
  • Improving error handling with conflicting SN and PN's

    Improving error handling with conflicting SN and PN's

    If Netbox has multiple device types with the same Part Number the DeviceType.objects.get function throws an error. Same applies for devices with the same Serial Number. Neither condition should technically happen but Netbox doesn't treat PN or SN as unique so rather than throwing an exception, handle it gracefully.

    opened by jasonyates 2
  • Improving API error handling with Cisco response.

    Improving API error handling with Cisco response.

    If the Cisco API returns HTTP 403 the sync_eox_data.py throws a JSON decode error. Adding some error handling to gracefully show an unauthorised error.

    opened by jasonyates 1
  • Manufacturer doesn't exist

    Manufacturer doesn't exist

    Hi, I have configured plugin option with different manufacturer but when I launch the sync option on manage.py I receive:

    CommandError: Manufacturer "cisco-systems-inc" does not exist

    The option on configuration.py is the following:

    'manufacturer': 'cisco-systems-inc'

    Regards,

    Aldo Pellini

    opened by apellini 1
  • Install/Sync Issues?

    Install/Sync Issues?

    Hi, Having added the plugin to a docker netbox 3.2.7 install I do not see the plugin in the netbox UI? When I SSH to the docker instance to run the initial sync I get the following output...

    Thank you in advance for any assistance helping me resolve this issue.

    Cheers Jason

    $ python3 manage.py sync_eox_data 🧬 loaded config '/etc/netbox/config/configuration.py' 🧬 loaded config '/etc/netbox/config/extra.py' 🧬 loaded config '/etc/netbox/config/logging.py' 🧬 loaded config '/etc/netbox/config/plugins.py' Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in validate_conn conn.connect() File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/connection.py", line 414, in connect self.sock = ssl_wrap_socket( File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib/python3.10/ssl.py", line 512, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.10/ssl.py", line 1070, in _create self.do_handshake() File "/usr/lib/python3.10/ssl.py", line 1341, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen retries = retries.increment( File "/opt/netbox/venv/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cloudsso.cisco.com', port=443): Max retries exceeded with url: /as/token.oauth2 (Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)')))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/opt/netbox/netbox/manage.py", line 10, in execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/init.py", line 446, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/init.py", line 440, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute output = self.handle(*args, **options) File "/opt/netbox/venv/lib/python3.10/site-packages/netbox_cisco_support/management/commands/sync_eox_data.py", line 292, in handle api_call_headers = self.logon() File "/opt/netbox/venv/lib/python3.10/site-packages/netbox_cisco_support/management/commands/sync_eox_data.py", line 278, in logon access_token_response = requests.post(token_url, data=data) File "/opt/netbox/venv/lib/python3.10/site-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, **kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, **kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/requests/adapters.py", line 563, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='cloudsso.cisco.com', port=443): Max retries exceeded with url: /as/token.oauth2 (Caused by SSLError(SSLError(1, '[SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)'))) $

    opened by CalderValleyIT 1
  • Create a support contract model

    Create a support contract model

    It would be ideal to create a new model to populate support contracts. Support contracts could then be associated to devices (assuming the vendor uses support contracts).

    opened by ryanmerolle 0
  • Netbox devel 3.0 bump

    Netbox devel 3.0 bump

    Closes #8

    • Move to use netbox-docker project.
    • Adds some sample data to test.
    • Updates Makefile commands.
    • Remove env from gitignore since just using default development vars
    opened by ryanmerolle 0
  • Add NetBox API Support

    Add NetBox API Support

    Two options here:

    • Add the plugin's support models additions to existing devices & device type NetBox API.
    • Create a new api endpoint for support model(s).
    opened by ryanmerolle 0
  • Expand to a broader plugin scope for all vendors

    Expand to a broader plugin scope for all vendors

    There is a huge need in the community to track warranty/support status for all devices (i.e. all manufacturers).

    It would be nice to leverage this same data model across all devices(physical & virtual), but still allow users the selectable option (an configurations like cron) to auto-populate devices depending on the vendor support for that via an API or web-scraping.

    What does this feature request mean?

    1. Rename feature to something like netbox-support
    2. Rename widgets/cards to remove Cisco
    3. Allow plugin to work with or without setting up cron or cisco syncs
    4. Allow manual setting of EOL/EOS, and other options in a Support page for editing the support plugin model
    opened by ryanmerolle 1
Owner
Timo Reimann
Infrastructure architect at CTS Eventim Solutions GmbH
Timo Reimann
Netwalk is a Python library to discover, parse, analyze and change Cisco switched networks

Netwalk is a Python library born out of a large remadiation project aimed at making network device discovery and management as fast and painless as possible.

null 38 Nov 7, 2022
Converts from PC formatted MAC addresses (hardware addresses) to Cisco format or vice-versa

MAC-Converter Converts from PC formatted MAC addresses (hardware addresses) to Cisco format or vice-versa Stores the results to a file in the same dir

Stew Alexander 0 Dec 24, 2022
Python Scripts for Cisco Identity Services Engine (ISE)

A set of Python scripts to configure a freshly installed Cisco Identity Services Engine (ISE) for simple operation; in my case, a basic Cisco Software-Defined Access environment.

Roddie Hasan 9 Jul 19, 2022
Converts Cisco formatted MAC Addresses to PC formatted MAC Addresses

Cisco-MAC-to-PC-MAC Converts a file with a list of Cisco formatted MAC Addresses to PC formatted MAC Addresses... Ex: abcd.efgh.ijkl to AB:CD:EF:GH:I

Stew Alexander 0 Jan 4, 2022
This program ingests a Cisco "sh ip arp" as a text file and produces the list of vendors seen in the file

IP-ARP-Vendor_lookup This program ingests a Cisco "sh ip arp" as a text file and produces the list of vendors seen in the file Why? Answers the questi

Stew Alexander 1 Dec 24, 2022
This is simple script that changes the config register of a cisco router over serial so that you can reset the password

Cisco-router-config-bypass-tool- This is simple script that changes the config register of a cisco router over serial so that you can bypass the confi

James 1 Jan 2, 2022
Python tutorial for implementing Oxylabs' Residential Proxies with AIOHTTP

Integrating Oxylabs' Residential Proxies with AIOHTTP Requirements for the Integration For the integration to work you'll need to install aiohttp libr

Oxylabs.io 6 Sep 14, 2022
Build custom OSINT tools and APIs (Ping, Traceroute, Scans, Archives, DNS, Scrape, Whois, Metadata & built-in database for more info) with this python package

Build custom OSINT tools and APIs with this python package - It includes different OSINT modules (Ping, Traceroute, Scans, Archives, DNS, Scrape, Whoi

QeeqBox 52 Jan 6, 2023
Best discord webhook spammer using proxy (support all proxy type)

Best discord webhook spammer using proxy (support all proxy type)

Iтѕ_Ѵιcнч#1337 25 Nov 1, 2022
RabbitMQ asynchronous connector library for Python with built in RPC support

About RabbitMQ connector library for Python that is fully integrated with the aio-pika framework. Introduction BunnyStorm is here to simplify working

null 22 Sep 11, 2022
It's an extra broadcast driver for masonite. It adds support for socketio.

It's an extra broadcast driver for masonite. It adds support for socketio.

Yubaraj Shrestha 6 Feb 23, 2022
The can package provides controller area network support for Python developers

python-can The Controller Area Network is a bus standard designed to allow microcontrollers and devices to communicate with each other. It has priorit

Brian Thorne 904 Dec 29, 2022
forward several ports into a single port

port forwarding Multi-Input-Single-Output forward several ports into a single one this tool forwards packets from several ports into one single port.

Erfan Kheyrollahi QaroÄŸlu 3 Sep 11, 2021
InfraGenie is allows you to split out your infrastructure project into separate independent pieces, each with its own terraform state.

?? InfraGenie InfraGenie is allows you to split out your infrastructure project into separate independent pieces, each with its own terraform state. T

Digger 53 Nov 23, 2022
Simple Port Scanner script written in Python, plans is to expand upon this script to turn it into a GUI based pen testing suite

PortScanner Simple Port Scanner script written in Python, plans is to expand upon this script to turn it into a GUI based pen testing suite. #IMPORTAN

null 1 Oct 23, 2021
The best way to send tokens into a specific server, which can be used for discord bots, and some tools..

XTRA420 The simplified version of sending tokens into a server, the basic and fastest way.. When using this, you have the option to use proxies (http)

07v 1 Nov 30, 2021
Multi-path load balancing is a method used by most of the real-time network to split the packets into different paths rather than transferring it through a single path

Multipath-Load-Balancing Method of managing incoming traffic by distributing and sharing load fairly among multiple routes from source to destination

Dharshan Kumar 6 Dec 10, 2022
Utility for converting IP Fabric webhooks into a Teams format.

IP Fabric Webhook Integration for Microsoft Teams Setup IP Fabric Setup Go to Settings > Webhooks > Add webhook Provide a name URL will be: 'http://<Y

Community Fabric 1 Jan 26, 2022
Utility for converting IP Fabric webhooks into a Teams format.

IP Fabric Webhook Integration for Microsoft Teams and/or Slack Setup IP Fabric Setup Go to Settings > Webhooks > Add webhook Provide a name URL will b

Community Fabric 1 Jan 26, 2022