-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated imports for Netbox 3.6.1 Closes #21 and #23 * Changed Fieldtypes of Start and Expiration Date Closes #22 * Bump to NetBox v3.6.1 * Add pyproject.toml and python workflow --------- Co-authored-by: Manuel Hartung <[email protected]>
- Loading branch information
Showing
59 changed files
with
2,238 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Python | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install tools | ||
run: pip install .[tools] | ||
|
||
- name: Run ruff | ||
run: ruff netbox_slm | ||
|
||
- name: Run black | ||
run: black netbox_slm |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from extras.plugins import PluginConfig | ||
|
||
__version__ = "1.4" | ||
|
||
|
||
class SLMConfig(PluginConfig): | ||
name = 'netbox_slm' | ||
verbose_name = 'Software Lifecycle Management' | ||
description = 'Software Lifecycle Management Netbox Plugin.' | ||
version = __version__ | ||
author = 'ICTU' | ||
author_email = '[email protected]' | ||
base_url = 'slm' | ||
required_settings = [] | ||
default_settings = { | ||
'version_info': False | ||
} | ||
|
||
|
||
config = SLMConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.apps import apps | ||
from django.conf import settings | ||
from django.contrib import admin | ||
|
||
if settings.DEBUG: | ||
for model in apps.get_app_config("netbox_slm").get_models(): | ||
admin.site.register(model) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from rest_framework import serializers | ||
|
||
from netbox.api.serializers import NetBoxModelSerializer | ||
from netbox_slm.models import SoftwareProduct, SoftwareProductVersion, SoftwareProductInstallation, SoftwareLicense | ||
|
||
|
||
class SoftwareProductSerializer(NetBoxModelSerializer): | ||
display = serializers.SerializerMethodField() | ||
url = serializers.HyperlinkedIdentityField( | ||
view_name="plugins-api:netbox_slm-api:softwareproduct-detail" | ||
) | ||
|
||
class Meta: | ||
model = SoftwareProduct | ||
fields = [ | ||
'id', 'display', 'url', 'name', | ||
'tags', 'custom_field_data', 'created', 'last_updated', | ||
] | ||
|
||
def get_display(self, obj): | ||
return f"{obj.manufacturer} - {obj}" | ||
|
||
|
||
class SoftwareProductVersionSerializer(NetBoxModelSerializer): | ||
display = serializers.SerializerMethodField() | ||
url = serializers.HyperlinkedIdentityField( | ||
view_name="plugins-api:netbox_slm-api:softwareproductversion-detail" | ||
) | ||
|
||
class Meta: | ||
model = SoftwareProductVersion | ||
fields = [ | ||
'id', 'display', 'url', 'name', 'software_product', | ||
'tags', 'custom_field_data', 'created', 'last_updated', | ||
] | ||
|
||
def get_display(self, obj): | ||
return f"{obj}" | ||
|
||
|
||
class SoftwareProductInstallationSerializer(NetBoxModelSerializer): | ||
display = serializers.SerializerMethodField() | ||
url = serializers.HyperlinkedIdentityField( | ||
view_name="plugins-api:netbox_slm-api:softwareproductinstallation-detail" | ||
) | ||
|
||
class Meta: | ||
model = SoftwareProductInstallation | ||
fields = [ | ||
'id', 'display', 'url', 'device', 'virtualmachine', 'software_product', 'version', | ||
'tags', 'custom_field_data', 'created', 'last_updated', | ||
] | ||
|
||
def get_display(self, obj): | ||
return f"{obj}" | ||
|
||
|
||
class SoftwareLicenseSerializer(NetBoxModelSerializer): | ||
display = serializers.SerializerMethodField() | ||
url = serializers.HyperlinkedIdentityField( | ||
view_name="plugins-api:netbox_slm-api:softwarelicense-detail" | ||
) | ||
|
||
class Meta: | ||
model = SoftwareLicense | ||
fields = [ | ||
'id', 'display', 'url', 'name', 'description', 'type', 'stored_location', | ||
'start_date', 'expiration_date', 'software_product', 'version', 'installation', | ||
'tags', 'custom_field_data', 'created', 'last_updated', | ||
] | ||
|
||
def get_display(self, obj): | ||
return f"{obj}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from netbox.api.routers import NetBoxRouter | ||
from netbox_slm.api.views import ( | ||
NetboxSLMRootView, | ||
SoftwareProductViewSet, | ||
SoftwareProductVersionViewSet, | ||
SoftwareProductInstallationViewSet, | ||
SoftwareLicenseViewSet, | ||
) | ||
|
||
router = NetBoxRouter() | ||
router.APIRootView = NetboxSLMRootView | ||
|
||
router.register("softwareproducts", SoftwareProductViewSet) | ||
router.register("softwareproductversions", SoftwareProductVersionViewSet) | ||
router.register("softwareproductinstallations", SoftwareProductInstallationViewSet) | ||
router.register("softwarelicenses", SoftwareLicenseViewSet) | ||
urlpatterns = router.urls |
Oops, something went wrong.