Compare commits

..

No commits in common. "master" and "v0.1.1" have entirely different histories.

4 changed files with 16 additions and 44 deletions

View File

@ -5,47 +5,33 @@ A simple device map plugin with filtering criteria for NetBox
![Map filters screenshot](docs/images/screenshot_map_filters.png) ![Map filters screenshot](docs/images/screenshot_map_filters.png)
## Installation ## Installation
### Requirements 1. Download plugin distribution from releases.
The plugin has been tested and confirmed works on NetBox versions from 3.2 to 3.5 and Python versions from 3.10 to 3.11. 2. If your NetBox installation uses virtualenv, activate it like this:
### Steps
1. If your NetBox installation uses virtualenv, activate it like this:
``` ```
source /opt/netbox/venv/bin/activate source /opt/netbox/venv/bin/activate
``` ```
3. Install the plugin from the distribution:
2. Install the plugin. ```
sudo pip install /path/to/netbox-plugin-device-map.tar.gz
```
4. Add plugin to `local_requirements.txt`:
To ensure plugin is automatically re-installed during future NetBox upgrades, create a file named `local_requirements.txt` (if not already existing) in the NetBox root directory To ensure plugin is automatically re-installed during future NetBox upgrades, create a file named `local_requirements.txt` (if not already existing) in the NetBox root directory
and list the `nextbox-plugin-device-map` package: and list the `nextbox-plugin-device-map` package:
- Option A: if you want to install it from PyPI:
```
echo netbox-plugin-device-map | sudo tee -a /opt/netbox/local_requirements.txt
```
- Option B: if you manually downloaded the plugin distribution from releases:
``` ```
echo "/path/to/netbox-plugin-device-map.tar.gz" | sudo tee -a /opt/netbox/local_requirements.txt echo "/path/to/netbox-plugin-device-map.tar.gz" | sudo tee -a /opt/netbox/local_requirements.txt
``` ```
Then run: 5. Collect static files:
```
sudo pip install -U -r /opt/netbox/local_requirements.txt
```
to install the plugin.
3. Collect static files:
``` ```
sudo python /opt/netbox/netbox/manage.py collectstatic sudo python /opt/netbox/netbox/manage.py collectstatic
``` ```
6. To enable plugin, add the plugin's name to the PLUGINS list in `configuration.py` (it's usually located in `/opt/netbox/netbox/netbox/`) like so:
4. To enable plugin, add the plugin's name to the PLUGINS list in `configuration.py` (it's usually located in `/opt/netbox/netbox/netbox/`) like so:
``` ```
PLUGINS = [ PLUGINS = [
'netbox_device_map' 'netbox_device_map'
] ]
``` ```
7. Restart NetBox WSGI service to apply changes:
5. Restart NetBox WSGI service to apply changes:
``` ```
sudo systemctl restart netbox sudo systemctl restart netbox
``` ```
@ -89,7 +75,7 @@ Custom tiles layer settings:
| Setting | Example value | Description | | Setting | Example value | Description |
|--------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |--------------|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| url_template | `https://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png` | `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; a, b or c by default, can be omitted), `{z}` — zoom level, `{x}` and `{y}` — tile coordinates. `{r}` can be used to add "@2x" to the URL to load retina tiles. | | url_template | `https://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png` | `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; a, b or c by default, can be omitted), `{z}` — zoom level, `{x}` and `{y}` — tile coordinates. `{r}` can be used to add "@2x" to the URL to load retina tiles. |
| options | `{'subdomains' : ['a', 'b', 'c'], 'minZoom': 0, 'maxZoom': 18}` | [Leaflet TileLayer](https://leafletjs.com/reference.html#tilelayer) options | | options | `{'subdomains' : ['a', 'b', 'c'], 'minZoom': 0, 'maxZoom': 18}` | [Leaflet TileLayer](https://leafletjs.com/SlavaUkraini/reference.html#tilelayer) options |
## Acknowledgements ## Acknowledgements
- [Leaflet](https://leafletjs.com/) - [Leaflet](https://leafletjs.com/)

View File

@ -4,7 +4,7 @@ from extras.plugins import PluginConfig
class DeviceMapConfig(PluginConfig): class DeviceMapConfig(PluginConfig):
name = 'netbox_device_map' name = 'netbox_device_map'
verbose_name = 'Device map' verbose_name = 'Device map'
version = '0.1.3' version = '0.1.1'
author = 'Victor Golovanenko' author = 'Victor Golovanenko'
author_email = 'drygdryg2014@yandex.com' author_email = 'drygdryg2014@yandex.com'
base_url = 'device-map' base_url = 'device-map'

View File

@ -2,8 +2,7 @@ from django import forms
from dcim.models import DeviceRole, Device from dcim.models import DeviceRole, Device
from ipam.models import VLANGroup, VLAN from ipam.models import VLANGroup, VLAN
from utilities.forms import BootstrapMixin from utilities.forms import BootstrapMixin, DynamicModelChoiceField, DynamicModelMultipleChoiceField
from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultipleChoiceField
class DeviceMapFilterForm(BootstrapMixin, forms.Form): class DeviceMapFilterForm(BootstrapMixin, forms.Form):

View File

@ -1,31 +1,18 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
version = '0.1.3'
with open('README.md', encoding='utf-8') as f: with open('README.md', encoding='utf-8') as f:
long_description = f.read() long_description = f.read()
setup( setup(
name='netbox-plugin-device-map', name='netbox-plugin-device-map',
version=version, version='0.1.1',
description='A simple device map with filter criteria', description='A simple device map with filter criteria',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
license='MIT',
author='Victor Golovanenko', author='Victor Golovanenko',
author_email='drygdryg2014@yandex.com', author_email='drygdryg2014@yandex.com',
url='https://github.com/drygdryg/netbox-plugin-device-map', license='GPL-3.0',
download_url='https://github.com/drygdryg/netbox-plugin-device-map/archive/v{}.zip'.format(version),
python_requires='>3.9',
classifiers=[
'Environment :: Plugins',
'Environment :: Web Environment',
'Framework :: Django',
'License :: OSI Approved :: MIT License',
'Topic :: System :: Networking',
'Topic :: System :: Systems Administration'
],
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
zip_safe=False, zip_safe=False
) )