diff --git a/nautobot_device_onboarding/jobs.py b/nautobot_device_onboarding/jobs.py index 383c2c29..8f0de0d7 100755 --- a/nautobot_device_onboarding/jobs.py +++ b/nautobot_device_onboarding/jobs.py @@ -789,7 +789,7 @@ def run( _discovered_ips = DiscoveredIPAddress.objects.filter( discovered_group=discovered_group, marked_for_onboarding=True ).values_list("ip_address", flat=True) - self.ip_addresses = [ip for ip in _discovered_ips] + self.ip_addresses = [str(IPAddress.objects.get(id=ip).address) for ip in _discovered_ips] self.set_mgmt_only = set_mgmt_only self.update_devices_without_primary_ip = update_devices_without_primary_ip self.device_role = device_role @@ -801,6 +801,8 @@ def run( self.secrets_group = secrets_group self.platform = platform + self.logger.info(f"IP Addresses: {self.ip_addresses}") + self.job_result.task_kwargs = { "debug": debug, "location": location, diff --git a/nautobot_device_onboarding/navigation.py b/nautobot_device_onboarding/navigation.py index 2d3f9e44..e1edf68a 100644 --- a/nautobot_device_onboarding/navigation.py +++ b/nautobot_device_onboarding/navigation.py @@ -22,7 +22,7 @@ menu_items = ( NavMenuTab( - name="Discovered Network", + name="Device Onboarding", weight=1000, groups=(NavMenuGroup(name="Discovered Models", weight=100, items=items),), ), diff --git a/nautobot_device_onboarding/tables.py b/nautobot_device_onboarding/tables.py index 1bd1c80f..3a0d8327 100644 --- a/nautobot_device_onboarding/tables.py +++ b/nautobot_device_onboarding/tables.py @@ -54,7 +54,7 @@ class DiscoveredIPAddressTable(BaseTable): extra_info = JSONExpandColumn() class Meta(BaseTable.Meta): - """Meta.""" + """Meta options.""" model = DiscoveredIPAddress fields = ("pk", "name", "discovered_group", "ip_address", "marked_for_onboarding", "extra_info") @@ -73,8 +73,6 @@ class DiscoveredPortTable(BaseTable): state = tables.Column() class Meta(BaseTable.Meta): - """Meta.""" - model = DiscoveredPort fields = ("pk", "port_id", "discovered_ip_address", "protocol", "state", "service", "reason", "reason_ttl") default_columns = ( diff --git a/nautobot_device_onboarding/templates/nautobot_device_onboarding/discoveredgroup_detail.html b/nautobot_device_onboarding/templates/nautobot_device_onboarding/discoveredgroup_detail.html new file mode 100644 index 00000000..67a8387f --- /dev/null +++ b/nautobot_device_onboarding/templates/nautobot_device_onboarding/discoveredgroup_detail.html @@ -0,0 +1,17 @@ +{% extends 'generic/object_detail.html' %} +{% load static %} +{% block content_left_page %} +
+
+ Discovered Group +
+

{{ object.name }}

+

{{ object.description }}

+

Associated IP Addresses

+ +
+{% endblock %} \ No newline at end of file diff --git a/nautobot_device_onboarding/templates/nautobot_device_onboarding/discoveredipaddress_detail.html b/nautobot_device_onboarding/templates/nautobot_device_onboarding/discoveredipaddress_detail.html new file mode 100644 index 00000000..5725b75d --- /dev/null +++ b/nautobot_device_onboarding/templates/nautobot_device_onboarding/discoveredipaddress_detail.html @@ -0,0 +1,14 @@ +{% extends 'generic/object_detail.html' %} +{% load static %} +{% block content_left_page %} +
+
+ Discovered IP Address +
+

{{ object.ip_address }}

+

Marked for onboarding: {{ object.marked_for_onboarding }}

+

Extra Info

+
{{ object.extra_info|default_if_none:"No extra information available" }}
+ +
+{% endblock %} \ No newline at end of file diff --git a/nautobot_device_onboarding/urls.py b/nautobot_device_onboarding/urls.py index 2d1b7f4f..1c71aebc 100644 --- a/nautobot_device_onboarding/urls.py +++ b/nautobot_device_onboarding/urls.py @@ -1,5 +1,7 @@ """Urls.""" +from django.urls import path + from nautobot.core.views.routers import NautobotUIViewSetRouter from . import views @@ -11,4 +13,7 @@ router.register("discovered-ipaddresses", views.DiscoveredIPAddressUIViewSet) router.register("discovered-ports", views.DiscoveredPortUIViewSet) -urlpatterns = router.urls +urlpatterns = [ + path("discovered-groups//", views.DiscoveredGroupView.as_view(), name="discoveredgroup-detail"), + path("discovered-ipaddresses//", views.DiscoveredIPAddressView.as_view(), name="discoveredipaddress-detail"), +] + router.urls diff --git a/nautobot_device_onboarding/views.py b/nautobot_device_onboarding/views.py index 301d322e..e6e29d89 100644 --- a/nautobot_device_onboarding/views.py +++ b/nautobot_device_onboarding/views.py @@ -1,6 +1,8 @@ """Model UI Viewset.""" +from nautobot.core.views import generic from nautobot.core.views.viewsets import NautobotUIViewSet +from nautobot.core.views.generic import ObjectView from . import filters, forms, tables from .api import serializers