A Nautobot plugin for managing reusable Function Codes.
Project description
Nautobot Function Codes
A Nautobot plugin for managing reusable Function Codes and assigning them to devices.
Documentation: docs.nautobot.com/projects/function-codes
Features
Function Codes
- Create and manage Function Codes (
name,slug,description,is_active) - REST API and GraphQL support
- Global and list search, filtering, and CSV import/export
- Object permissions, changelog, notes, custom fields, relationships, custom links, and webhooks
Device assignments
- One Function Code per device (via
DeviceFunctionCodeAssignment) - Assign devices in bulk from Function Code detail or Device Assignments
- Device Assignments list with view, edit, bulk edit, and delete
- Clear assignments in bulk from the plugin menu
- Function Code column on the Device list
- Editable Function Code panel on Device detail pages
- Validation prevents assigning inactive Function Codes
Coverage and import
- Coverage dashboard with assignment statistics by Function Code, status, location, and role
- Links to unassigned devices and assignments that reference inactive Function Codes
- Synchronous CSV import/export from Function Codes → Import Assignments (no Celery required)
- Nautobot Jobs for scheduled or background audit and CSV import (requires Celery worker)
Filtering
- Filter Device list by Function Code
- Filter Device list by whether a device has a Function Code assigned (
Has Function Code)
Requirements
- Nautobot 3.1.0 or higher
- Python 3.12 or higher
Installation
Install the package from PyPI:
pip install nautobot-function-codes
Add the plugin to your Nautobot configuration:
PLUGINS = ["nautobot_function_codes"]
Run database migrations:
nautobot-server migrate nautobot_function_codes
Restart Nautobot after installing and migrating the plugin.
Compatibility
| Nautobot | Plugin | Python |
|---|---|---|
| 3.1.x | 0.1.x | 3.12+ |
Development
This project uses the cookiecutter-nautobot-app development environment.
poetry install
invoke makemigrations
invoke start
invoke unittest
Other useful commands:
invoke pylint
invoke ruff
poetry run mkdocs build --no-directory-urls --strict
poetry run python -m build
poetry run python -m twine check dist/*
For local invoke commands that should run outside Docker, set:
export INVOKE_NAUTOBOT_FUNCTION_CODES_LOCAL=True
Releasing
Releases are published to PyPI automatically when a Git tag matching v* is pushed.
-
Update the version in
pyproject.toml, for example:poetry version patch
-
Update release notes or changelog content as needed.
-
Commit the release changes:
git add pyproject.toml poetry.lock CHANGELOG.md docs/admin/release_notes git commit -m "Prepare release vX.Y.Z"
-
Create and push the tag:
git tag vX.Y.Z git push origin vX.Y.Z
The Release GitHub Actions workflow builds the package with python -m build, verifies it with twine check, and publishes it to PyPI. If PyPI Trusted Publishing is configured for this repository and workflow, no API token is needed. Otherwise, add a repository or environment secret named PYPI_API_TOKEN containing a PyPI API token.
Managing Device Assignments
Device assignments are managed from the Function Codes plugin menu:
- Function Codes → Function Codes — create and manage Function Code records
- Function Code detail → Assign Devices — assign many devices to one Function Code
- Function Codes → Device Assignments → Add — bulk form with Function Code and Devices fields
- Function Codes → Device Assignments — list, edit, bulk edit, and delete assignments
- Function Code detail → Assigned Devices — view devices linked to a Function Code
- Device detail → Function Code — view or update the assignment for a single device
- Function Codes → Coverage — review assignment coverage and open unassigned or inactive assignments
- Function Codes → Import Assignments — upload, validate, or export assignment CSV files
- Function Codes → Clear Assignments — clear assignments for selected devices
REST API
| Endpoint | Description |
|---|---|
/api/plugins/function-codes/function-codes/ |
Function Code CRUD |
/api/plugins/function-codes/device-assignments/ |
Device assignment CRUD |
Device list filtering examples:
?nautobot_function_codes_function_code=acc— devices with Function Code slugacc?nautobot_function_codes_has_function_code=true— devices with any Function Code assigned?nautobot_function_codes_has_function_code=false— devices without a Function Code
CSV import format
Required columns:
device,function_code
switch-01,acc
switch-02,
Use the device name or UUID. Leave function_code empty to clear an assignment. Inactive Function Codes are rejected.
The same format is used by both Import Assignments (UI) and the Import Function Code Assignments job. The import UI can also download a blank CSV template or export the current assignment state.
Jobs
The plugin registers two Nautobot Jobs:
- Audit Function Code Assignments — report unassigned devices and assignments to inactive Function Codes
- Import Function Code Assignments — import assignments from CSV via the job engine
Jobs require a running Celery worker. The Coverage dashboard and Import Assignments UI work without Celery.
Run diagnostics after deployment:
nautobot-server diagnose_nautobot_function_codes
Tags
Function Codes use Nautobot's OrganizationalModel base class (similar to Roles and Platforms). Tags are supported on Device objects, not on Function Code records.
About
This plugin is created and maintained by hibulla.com. Contact: contact@hibulla.com
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nautobot_function_codes-0.1.0.tar.gz.
File metadata
- Download URL: nautobot_function_codes-0.1.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f8a56aff98732b870f00274df02ad488e03ad48ba20c0e1a83fab25dc35f03e
|
|
| MD5 |
c3b638333413f315a514bc53f72d904c
|
|
| BLAKE2b-256 |
d61849cd50a34559b8e4bdd68c34514a1ce1bacd13165bc7331e66f166ab2049
|
Provenance
The following attestation bundles were made for nautobot_function_codes-0.1.0.tar.gz:
Publisher:
release.yml on hibulla/nautobot-function-codes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nautobot_function_codes-0.1.0.tar.gz -
Subject digest:
8f8a56aff98732b870f00274df02ad488e03ad48ba20c0e1a83fab25dc35f03e - Sigstore transparency entry: 2138017254
- Sigstore integration time:
-
Permalink:
hibulla/nautobot-function-codes@de37f7a1b9450ca3b4378fbcdf030d3fb81270c8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hibulla
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@de37f7a1b9450ca3b4378fbcdf030d3fb81270c8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nautobot_function_codes-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nautobot_function_codes-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f284fd5b28d4b92467b6b4879c68ab85fe1e77e997be299b08f50b164cd2aeca
|
|
| MD5 |
41fb2194c57bd9aa29f8b4f61279ce19
|
|
| BLAKE2b-256 |
fa3ed888fe588489505a74f3cbc9ea6249460a7237800eff9f3fad336e0a6992
|
Provenance
The following attestation bundles were made for nautobot_function_codes-0.1.0-py3-none-any.whl:
Publisher:
release.yml on hibulla/nautobot-function-codes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nautobot_function_codes-0.1.0-py3-none-any.whl -
Subject digest:
f284fd5b28d4b92467b6b4879c68ab85fe1e77e997be299b08f50b164cd2aeca - Sigstore transparency entry: 2138017256
- Sigstore integration time:
-
Permalink:
hibulla/nautobot-function-codes@de37f7a1b9450ca3b4378fbcdf030d3fb81270c8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/hibulla
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@de37f7a1b9450ca3b4378fbcdf030d3fb81270c8 -
Trigger Event:
push
-
Statement type: