NetBox Plugin Installation
This guide provides detailed instructions for installing and configuring the IP Fabric NetBox plugin across different environments. The plugin enables seamless integration between IP Fabric’s network discovery capabilities and NetBox’s infrastructure management platform.
These instructions contain configuration of netbox-branching plugin since it is a hard requirement for this plugin to work.
1. System Requirements
Before installation, ensure:
- You follow requirements for version compatibility between IP Fabric and NetBox
- You have administrative access to your NetBox instance
- Your NetBox installation meets the minimum version requirements
- You have Python and pip available in your environment
- Your system has sufficient resources for additional plugin operations
2. Standard Installation (Bare Metal/VM)
2.1 Install via Package Manager
The plugin is available as a Python package on PyPI and can be installed using pip:
# Activate the NetBox virtual environment
source /opt/netbox/venv/bin/activate
# Install the plugin
(venv) $ pip install ipfabric_netbox
# Install the plugin with specific version
(venv) $ pip install ipfabric_netbox[$IPFABRIC_VERSION]==$IPFABRIC_NETBOX_VERSION
To ensure the plugin is automatically reinstalled during future NetBox upgrades:
-
Create or edit the
local_requirements.txt
file in the NetBox root directory:In case we defined specific version of the plugin:(venv) $ echo "ipfabric_netbox" >> /opt/netbox/local_requirements.txt
(venv) $ echo "ipfabric_netbox[$IPFABRIC_VERSION]==$IPFABRIC_NETBOX_VERSION" >> /opt/netbox/local_requirements.txt
-
This ensures the plugin will be reinstalled whenever NetBox is upgraded using the standard upgrade procedures.
2.3 Enable the Plugin in NetBox Configuration
After installing the plugin, enable it in the NetBox configuration:
-
Open the NetBox configuration file:
(venv) $ nano /opt/netbox/netbox/netbox/configuration.py
-
Add the plugins to the
PLUGINS
list:PLUGINS = [ 'ipfabric_netbox', # other plugins... 'netbox_branching', ]
-
Optionally, configure plugin-specific settings in the
PLUGINS_CONFIG
dictionary:PLUGINS_CONFIG = { 'ipfabric_netbox': { # Plugin-specific settings can be added here } }
-
Additionally, configure plugin-specific logging for debugging purposes, for instance:
LOGGING = { "handlers": { "console": { "level": "DEBUG", "class": "logging.StreamHandler", "formatter": "simple", }, }, "loggers": { "ipfabric_netbox": { "level": "DEBUG", "handlers": ["console"], }, "netbox_branching": { "level": "DEBUG", "handlers": ["console"], }, }, }
2.4. Configure database router to support branching:
- Create
local_settings.py
with following content.2. Place the file tofrom netbox_branching.utilities import DynamicSchemaDict from .configuration import DATABASE # Wrap DATABASES with DynamicSchemaDict for dynamic schema support DATABASES = DynamicSchemaDict({ 'default': DATABASE, }) # Employ our custom database router DATABASE_ROUTERS = [ 'netbox_branching.database.BranchAwareRouter', ]
/opt/netbox/netbox/netbox/
, same directory that containssettings.py
.
2.5 Apply Database Migrations
Run the following commands to apply database migrations and collect static files:
# Activate the virtual environment if not already activated
source /opt/netbox/venv/bin/activate
# Navigate to the NetBox directory
(venv) $ cd /opt/netbox/netbox/
# Apply database migrations
(venv) $ python3 manage.py migrate
Collect static files within venv
:
python3 manage.py collectstatic --no-input
2.6 Restart NetBox Services
Restart the NetBox services to apply all changes:
# For systemd-based systems
sudo systemctl restart netbox netbox-rq
3. Docker Installation
3.1 Using Docker Compose Override
For NetBox instances running in Docker, follow these steps:
-
Create or modify the
docker-compose.override.yml
file in your NetBox Docker directory:version: '3' services: netbox: build: context: . dockerfile: Dockerfile args: - NETBOX_LOCAL_REQUIREMENTS=ipfabric_netbox
-
Update
configuration.py
as described in the previous section. -
Rebuild and restart your Docker containers:
docker-compose build --no-cache netbox docker-compose up -d
3.2 Using Plugin Mounts (Alternative Method)
For development or testing purposes, you can mount the plugin directly:
-
Clone the plugin repository:
git clone https://github.com/ipfabric/ipfabric-netbox.git
-
Add a volume mount in your
docker-compose.override.yml
:version: '3' services: netbox: volumes: - ./ipfabric-netbox:/opt/netbox/netbox/plugins/ipfabric_netbox
-
Update
configuration.py
as described in the previous section. -
Rebuild and restart your Docker containers.
4. Version-Specific Installations
4.1 Locking IP Fabric Python SDK Version
It’s recommended to use the same SDK version as your IP Fabric API version. To lock the SDK dependency to a specific minor version, install the plugin with the appropriate extras:
# For IP Fabric version 6.10.x
pip install ipfabric_netbox[ipfabric_6_10]
# For IP Fabric version 7.0.x
pip install ipfabric_netbox[ipfabric_7_0]
4.2 Available Version Extras
The following extras are currently available:
Extra Name | Compatible IP Fabric Version | SDK Version |
---|---|---|
ipfabric_6_6 | 6.6.x | 6.6.x |
ipfabric_6_7 | 6.7.x | 6.7.x |
ipfabric_6_8 | 6.8.x | 6.8.x |
ipfabric_6_9 | 6.9.x | 6.9.x |
ipfabric_6_10 | 6.10.x | 6.10.x |
ipfabric_7_0 | 7.0.x | 7.0.x |
5. Verification
5.1 Verify Plugin Installation
To verify the plugin is installed correctly:
- Log in to the NetBox web interface
- Navigate to the Plugins menu
- Confirm “IP Fabric NetBox” appears in the list of installed plugins
- Check the plugin version matches your expected version
5.2 Verify Database Migrations
To verify database migrations were applied successfully:
source /opt/netbox/venv/bin/activate
(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py showmigrations ipfabric_netbox
All migrations should be marked as applied (with [X]).
6. Troubleshooting
6.1 Common Issues
Issue | Possible Cause | Solution |
---|---|---|
Plugin not appearing in NetBox | Plugin not enabled in configuration | Check PLUGINS list in configuration.py |
Database migration errors | Incompatible NetBox version | Verify NetBox version meets requirements |
SDK version conflicts | Mismatched IP Fabric and SDK versions | Install with correct version-specific extras |
Static files not loading | collectstatic not run |
Run python manage.py collectstatic |
Permission errors | File system permissions | Check permissions on NetBox directories |
6.2 Logs and Debugging
To troubleshoot installation issues:
-
Check the NetBox application logs:
sudo tail -f /var/log/netbox/netbox.log
-
For Docker installations, check container logs:
docker-compose logs -f netbox
-
Enable debug mode in NetBox configuration for more verbose logging:
DEBUG = True
7. Upgrade Procedures
7.1 Standard Upgrade
To upgrade the plugin to a newer version:
source /opt/netbox/venv/bin/activate
(venv) $ pip install --upgrade ipfabric_netbox
(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py migrate
(venv) $ python3 manage.py collectstatic --no-input
sudo systemctl restart netbox netbox-rq
7.2 Docker Upgrade
For Docker installations, update your configuration to specify the new version and rebuild:
docker-compose build --no-cache netbox
docker-compose up -d
7.3 Upgrading plugin to v4.0.0 (NetBox v4.3.0+)
For a smooth upgrade to v4.0.0, upgrading must be done at the same time as upgrading to NetBox v4.3.0+. The crucial part is running all migrations from both upgrades at once.
The plugin now depends on netbox-branching
plugin and these extra steps are simplified installation instructions of the plugin:
- Enable the plugin in
configuration.py
(must be last!)PLUGINS = [ # ... 'netbox_branching', ]
- Create
/opt/netbox/netbox/netbox/local_settings.py
with the following content. It assumes yourconfiguration.py
is in/opt/netbox/netbox/netbox/
.from netbox_branching.utilities import DynamicSchemaDict from .configuration import DATABASE # Wrap DATABASES with DynamicSchemaDict for dynamic schema support DATABASES = DynamicSchemaDict({ 'default': DATABASE, }) # Employ our custom database router DATABASE_ROUTERS = [ 'netbox_branching.database.BranchAwareRouter', ]
Warning
If you’ve upgraded NetBox first or run migrations only for NetBox, you’ll see the following error when attempting to upgrade plugin:
django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for [<ModelState: 'ipfabric_netbox.IPFabricBranch'>]
Follow Cannot resolve bases for [<ModelState: 'ipfabric_netbox.IPFabricBranch'>]
instructions to resolve this issue.