Skip to content

Commit

Permalink
Merge pull request #13 from netboxlabs/develop
Browse files Browse the repository at this point in the history
🚚 release
  • Loading branch information
mfiedorowicz authored Jul 23, 2024
2 parents 85da26d + f102fb5 commit 8b04e4f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Diode NetBox Plugin

The Diode NetBox plugin is a [NetBox](https://netboxlabs.com/oss/netbox/) plugin and a required component of the [Diode](https://github.com/netboxlabs/diode) ingestion service.
The Diode NetBox plugin is a [NetBox](https://netboxlabs.com/oss/netbox/) plugin. It is a required component of the [Diode](https://github.com/netboxlabs/diode) ingestion service.

Diode is a NetBox ingestion service that greatly simplifies and enhances the process to add and update network data
in NetBox, ensuring your network source of truth is always accurate and can be trusted to power your network automation
Expand All @@ -17,6 +17,15 @@ at [https://netboxlabs.com/blog/introducing-diode-streamlining-data-ingestion-in

## Installation

Source the NetBox Python virtual environment:

```shell
cd /opt/netbox
source venv/bin/activate
```

Install the plugin:

```bash
pip install netboxlabs-diode-netbox-plugin
```
Expand All @@ -29,36 +38,37 @@ PLUGINS = [
]
```

Restart NetBox services to load the plugin:

```
sudo systemctl restart netbox netbox-rq
```

See [NetBox Documentation](https://netboxlabs.com/docs/netbox/en/stable/plugins/#installing-plugins) for details.

## Configuration

Source the NetBox Python virtual environment:
Source the NetBox Python virtual environment (if not already):

```shell
cd /opt/netbox
source venv/bin/activate
```

Generate 3 API keys as random 40 character long alphanumeric strings:
Three API keys will be needed (these are random 40 character long alphanumeric strings). They can be generated and set to the appropriate environment variables with the following commands:

```shell
echo "export DIODE_TO_NETBOX_API_KEY=$(head -c20 </dev/urandom|xxd -p)"
echo "export NETBOX_TO_DIODE_API_KEY=$(head -c20 </dev/urandom|xxd -p)"
echo "export INGESTION_API_KEY=$(head -c20 </dev/urandom|xxd -p)"
# API key for the Diode service to interact with NetBox
export DIODE_TO_NETBOX_API_KEY=$(head -c20 </dev/urandom|xxd -p); env | grep DIODE_TO_NETBOX_API_KEY
# API key for the NetBox service to interact with Diode
export NETBOX_TO_DIODE_API_KEY=$(head -c20 </dev/urandom|xxd -p); env | grep NETBOX_TO_DIODE_API_KEY
# API key for Diode SDKs to ingest data into Diode
export DIODE_API_KEY=$(head -c20 </dev/urandom|xxd -p); env | grep DIODE_API_KEY
```

**Note:** store these API key strings in a safe place as they will be needed later to configure the Diode server

Set the environment variables based on the random generated strings:

```shell
export DIODE_TO_NETBOX_API_KEY={random_string_1} # API key for the Diode service to interact with NetBox
export NETBOX_TO_DIODE_API_KEY={random_string_2} # API key for the NetBox service to interact with Diode
export INGESTION_API_KEY={random_string_3} # API key for Diode SDKs to ingest data into Diode
```

Configure the plugin:
Configure the plugin to use the previously generated API keys:

```shell
cd /opt/netbox/netbox
Expand All @@ -74,3 +84,8 @@ make docker-compose-netbox-plugin-test
## License

Distributed under the PolyForm Shield License 1.0.0 License. See [LICENSE.md](./LICENSE.md) for more information.

## Required Notice

Copyright NetBox Labs, Inc.

2 changes: 1 addition & 1 deletion docker/netbox/env/netbox.env
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ WEBHOOKS_ENABLED=true
RELOAD_NETBOX_ON_DIODE_PLUGIN_CHANGE=false
DIODE_TO_NETBOX_API_KEY=1368dbad13e418d5a443d93cf255edde03a2a754
NETBOX_TO_DIODE_API_KEY=1e99338b8cab5fc637bc55f390bda1446f619c42
INGESTION_API_KEY=5a52c45ee8231156cb620d193b0291912dd15433
DIODE_API_KEY=5a52c45ee8231156cb620d193b0291912dd15433
BASE_PATH=netbox/
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Command(BaseCommand):

diode_to_netbox_username = "DIODE_TO_NETBOX"
netbox_to_diode_username = "NETBOX_TO_DIODE"
ingestion_username = "INGESTION"
diode_username = "DIODE"

def handle(self, *args, **options):
"""Handle command execution."""
Expand All @@ -57,7 +57,7 @@ def handle(self, *args, **options):
self.diode_to_netbox_username, group
)
_ = _create_user_with_token(self.netbox_to_diode_username, group, True)
_ = _create_user_with_token(self.ingestion_username, group)
_ = _create_user_with_token(self.diode_username, group)

diode_plugin_object_type = NetBoxType.objects.get(
app_label="netbox_diode_plugin", model="diode"
Expand Down

0 comments on commit 8b04e4f

Please sign in to comment.