Metadata-Version: 2.4
Name: netbox-plugin-itsm
Version: 0.2
Summary: Manage contracts and services in NetBox.
Author-email: Jan Gilla <jgilla@level66.network>
License-Expression: AGPL-3.0-or-later
Keywords: netbox,plugin,itsm,contract,service,management
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.md
Dynamic: license-file

# netbox-plugin-itsm

A NetBox plugin for managing IT service management (ITSM) data — products, contracts, and contract services — and linking them to objects within NetBox such as devices, IP addresses, circuits, and virtual machines.

## Features

- **Product catalogue** — define products and organise them into product groups
- **Contract management** — track contracts per tenant with active/planned/terminated status
- **Contract services** — link products to contracts with optional quantity
- **Contract service items** — attach any NetBox object (device, IP, circuit, VM, etc.) to a contract service
- Full NetBox integration: change logging, tagging, custom fields, and global search

## Requirements

- NetBox 4.0 or later (tested up to 4.6)

## Installation

Add the plugin to the NetBox Python virtual environment:

```bash
source /opt/netbox/venv/bin/activate
pip install netbox-plugin-itsm
```

Or install in development mode from source:

```bash
source /opt/netbox/venv/bin/activate
pip install setuptools
python setup.py develop
```

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

```python
PLUGINS = [
    'netbox_itsm',
]
```

Run migrations:

```bash
python /opt/netbox/netbox/manage.py migrate
```

Collect static assets:

```bash
python /opt/netbox/netbox/manage.py collectstatic
```

Restart the NetBox service.

## Development

### Setup

```bash
source /opt/netbox/venv/bin/activate
pip install setuptools
python setup.py develop
python /opt/netbox/netbox/manage.py migrate
```

### Useful commands

```bash
# Open the NetBox shell
python /opt/netbox/netbox/manage.py nbshell

# Run a local dev server
python /opt/netbox/netbox/manage.py runserver 127.0.0.1:8001
```

### Updating data models

After changing a model, generate and apply a migration:

```bash
python /opt/netbox/netbox/manage.py makemigrations netbox_itsm
python /opt/netbox/netbox/manage.py migrate
```

## Testing

Install test dependencies (only Django is required — NetBox itself is not needed):

```bash
pip install pytest pytest-django django
```

Run the test suite:

```bash
pytest
```

Tests use module-level stubs for all NetBox and third-party dependencies, so they run in any environment with Django installed. No database or NetBox installation required.

## License

AGPL-3.0-or-later — see [LICENSE](LICENSE.md) for details.
