infrastructure-manager-sync 0.5.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- infrastructure_manager_sync/__init__.py +14 -0
- infrastructure_manager_sync/api/__init__.py +0 -0
- infrastructure_manager_sync/api/serializers.py +89 -0
- infrastructure_manager_sync/api/urls.py +16 -0
- infrastructure_manager_sync/api/views.py +26 -0
- infrastructure_manager_sync/filtersets.py +108 -0
- infrastructure_manager_sync/forms.py +204 -0
- infrastructure_manager_sync/graphql.py +36 -0
- infrastructure_manager_sync/migrations/0001_initial.py +123 -0
- infrastructure_manager_sync/migrations/0002_infrastructuremanagersyncvminfo_ims.py +23 -0
- infrastructure_manager_sync/migrations/0003_alter_infrastructuremanagersyncvminfo_ims.py +23 -0
- infrastructure_manager_sync/migrations/0004_infrastructuremanagersynchostinfo.py +61 -0
- infrastructure_manager_sync/migrations/0005_infrastructuremanagersynchostinfo_ims.py +23 -0
- infrastructure_manager_sync/migrations/0006_alter_infrastructuremanagersynchostinfo_options_and_more.py +21 -0
- infrastructure_manager_sync/migrations/0007_infrastructuremanagersync_version.py +20 -0
- infrastructure_manager_sync/migrations/0008_rename_physical_cpu_cores_infrastructuremanagersynchostinfo_cpu_type_and_more.py +22 -0
- infrastructure_manager_sync/migrations/0009_infrastructuremanagersynchostinfo_core_per_cpu.py +20 -0
- infrastructure_manager_sync/migrations/0010_infrastructuremanagersync_last_successful_sync.py +20 -0
- infrastructure_manager_sync/migrations/0011_infrastructuremanagersync_update_prio.py +20 -0
- infrastructure_manager_sync/migrations/0012_alter_infrastructuremanagersyncvminfo_financial_info_and_more.py +23 -0
- infrastructure_manager_sync/migrations/0013_alter_infrastructuremanagersyncvminfo_financial_info_and_more.py +26 -0
- infrastructure_manager_sync/migrations/0014_infrastructuremanagersyncvminfo_backup_status_and_more.py +41 -0
- infrastructure_manager_sync/migrations/0015_alter_infrastructuremanagersyncvminfo_last_backup.py +21 -0
- infrastructure_manager_sync/migrations/0016_alter_infrastructuremanagersyncvminfo_financial_info_and_more.py +26 -0
- infrastructure_manager_sync/migrations/0017_infrastructuremanagersync_assign_by_default_to_cluster_tenant.py +21 -0
- infrastructure_manager_sync/migrations/0018_infrastructuremanagersyncvminfo_vm_hardware_compatibility_and_more.py +26 -0
- infrastructure_manager_sync/migrations/__init__.py +0 -0
- infrastructure_manager_sync/models.py +272 -0
- infrastructure_manager_sync/navigation.py +53 -0
- infrastructure_manager_sync/search.py +34 -0
- infrastructure_manager_sync/tables.py +141 -0
- infrastructure_manager_sync/template_content.py +48 -0
- infrastructure_manager_sync/templates/infrastructure_manager_sync/inc/host_info.html +79 -0
- infrastructure_manager_sync/templates/infrastructure_manager_sync/inc/vm_info.html +180 -0
- infrastructure_manager_sync/templates/infrastructure_manager_sync/infrastructuremanagersync.html +72 -0
- infrastructure_manager_sync/templates/infrastructure_manager_sync/infrastructuremanagersynchostinfo.html +92 -0
- infrastructure_manager_sync/templates/infrastructure_manager_sync/infrastructuremanagersyncvminfo.html +193 -0
- infrastructure_manager_sync/urls.py +101 -0
- infrastructure_manager_sync/views.py +102 -0
- infrastructure_manager_sync-0.5.5.dist-info/METADATA +13 -0
- infrastructure_manager_sync-0.5.5.dist-info/RECORD +43 -0
- infrastructure_manager_sync-0.5.5.dist-info/WHEEL +5 -0
- infrastructure_manager_sync-0.5.5.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from netbox.plugins import PluginConfig
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class InfrastructureManagerSync(PluginConfig):
|
|
5
|
+
name = "infrastructure_manager_sync"
|
|
6
|
+
verbose_name = "Infrastructure Manager Sync"
|
|
7
|
+
description = "Plugin that configures the vcenter import for VM, clusters & hosts"
|
|
8
|
+
version = "0.5.5"
|
|
9
|
+
author = "Mattijs Vanhaverbeke"
|
|
10
|
+
base_url = "infrastructure-manager-sync"
|
|
11
|
+
min_version = "3.4.0"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
config = InfrastructureManagerSync
|
|
File without changes
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
from ..models import (
|
|
5
|
+
InfrastructureManagerSync,
|
|
6
|
+
InfrastructureManagerSyncVMInfo,
|
|
7
|
+
InfrastructureManagerSyncHostInfo,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# Regular serializers
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class InfrastructureManagerSyncSerializer(NetBoxModelSerializer):
|
|
17
|
+
url = serializers.HyperlinkedIdentityField(
|
|
18
|
+
view_name="plugins-api:infrastructure_manager_sync-api:infrastructuremanagersync-detail"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
class Meta:
|
|
22
|
+
model = InfrastructureManagerSync
|
|
23
|
+
fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"fqdn",
|
|
26
|
+
"name",
|
|
27
|
+
"username",
|
|
28
|
+
"password",
|
|
29
|
+
"cluster_tenant",
|
|
30
|
+
"entry_type",
|
|
31
|
+
"url",
|
|
32
|
+
"primary_site",
|
|
33
|
+
"enabled",
|
|
34
|
+
"build_number",
|
|
35
|
+
"version",
|
|
36
|
+
"last_successful_sync",
|
|
37
|
+
"update_prio",
|
|
38
|
+
"assign_by_default_to_cluster_tenant",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class InfrastructureManagerSyncVMInfoSerializer(NetBoxModelSerializer):
|
|
43
|
+
url = serializers.HyperlinkedIdentityField(
|
|
44
|
+
view_name="plugins-api:infrastructure_manager_sync-api:infrastructuremanagersyncvminfo-detail"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
class Meta:
|
|
48
|
+
model = InfrastructureManagerSyncVMInfo
|
|
49
|
+
fields = (
|
|
50
|
+
"id",
|
|
51
|
+
"vm",
|
|
52
|
+
"backup_plan",
|
|
53
|
+
"backup_type",
|
|
54
|
+
"criticality",
|
|
55
|
+
"environment",
|
|
56
|
+
"financial_info",
|
|
57
|
+
"licensing",
|
|
58
|
+
"owner",
|
|
59
|
+
"service_info",
|
|
60
|
+
"url",
|
|
61
|
+
"ims",
|
|
62
|
+
"backup_status",
|
|
63
|
+
"last_backup",
|
|
64
|
+
"deployed_on",
|
|
65
|
+
"deployed_by",
|
|
66
|
+
"billing_reference",
|
|
67
|
+
"vmware_tools_version",
|
|
68
|
+
"vm_hardware_compatibility",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class InfrastructureManagerSyncHostInfoSerializer(NetBoxModelSerializer):
|
|
73
|
+
url = serializers.HyperlinkedIdentityField(
|
|
74
|
+
view_name="plugins-api:infrastructure_manager_sync-api:infrastructuremanagersynchostinfo-detail"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
class Meta:
|
|
78
|
+
model = InfrastructureManagerSyncHostInfo
|
|
79
|
+
fields = (
|
|
80
|
+
"id",
|
|
81
|
+
"host",
|
|
82
|
+
"url",
|
|
83
|
+
"ims",
|
|
84
|
+
"physical_cpu_count",
|
|
85
|
+
"core_per_cpu",
|
|
86
|
+
"cpu_type",
|
|
87
|
+
"build_number",
|
|
88
|
+
"memory",
|
|
89
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from netbox.api.routers import NetBoxRouter
|
|
2
|
+
from . import views
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
app_name = "infrastructure_manager_sync"
|
|
6
|
+
|
|
7
|
+
router = NetBoxRouter()
|
|
8
|
+
router.register("infrastructuremanagersync", views.InfrastructureManagerSyncViewSet)
|
|
9
|
+
router.register(
|
|
10
|
+
"infrastructuremanagersyncvminfo", views.InfrastructureManagerSyncVMInfoViewSet
|
|
11
|
+
)
|
|
12
|
+
router.register(
|
|
13
|
+
"infrastructuremanagersynchostinfo", views.InfrastructureManagerSyncHostInfoViewSet
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
urlpatterns = router.urls
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from netbox.api.viewsets import NetBoxModelViewSet
|
|
2
|
+
|
|
3
|
+
from .. import filtersets, models
|
|
4
|
+
from .serializers import (
|
|
5
|
+
InfrastructureManagerSyncSerializer,
|
|
6
|
+
InfrastructureManagerSyncVMInfoSerializer,
|
|
7
|
+
InfrastructureManagerSyncHostInfoSerializer,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class InfrastructureManagerSyncViewSet(NetBoxModelViewSet):
|
|
12
|
+
# permission_required = 'netbox_vcenter_tag_sync.view_vcenters' #TODO
|
|
13
|
+
queryset = models.InfrastructureManagerSync.objects.all()
|
|
14
|
+
serializer_class = InfrastructureManagerSyncSerializer
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InfrastructureManagerSyncVMInfoViewSet(NetBoxModelViewSet):
|
|
18
|
+
# permission_required = 'netbox_vcenter_tag_sync.view_vcenters' #TODO
|
|
19
|
+
queryset = models.InfrastructureManagerSyncVMInfo.objects.all()
|
|
20
|
+
serializer_class = InfrastructureManagerSyncVMInfoSerializer
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class InfrastructureManagerSyncHostInfoViewSet(NetBoxModelViewSet):
|
|
24
|
+
# permission_required = 'netbox_vcenter_tag_sync.view_vcenters' #TODO
|
|
25
|
+
queryset = models.InfrastructureManagerSyncHostInfo.objects.all()
|
|
26
|
+
serializer_class = InfrastructureManagerSyncHostInfoSerializer
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import django_filters
|
|
2
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
3
|
+
from .models import (
|
|
4
|
+
InfrastructureManagerSync,
|
|
5
|
+
InfrastructureManagerSyncVMInfo,
|
|
6
|
+
InfrastructureManagerSyncHostInfo,
|
|
7
|
+
)
|
|
8
|
+
from tenancy.models import Tenant
|
|
9
|
+
from virtualization.models import Cluster
|
|
10
|
+
from django.db.models import Q
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class InfrastructureManagerSyncFilterSet(NetBoxModelFilterSet):
|
|
14
|
+
class Meta:
|
|
15
|
+
model = InfrastructureManagerSync
|
|
16
|
+
fields = (
|
|
17
|
+
"name",
|
|
18
|
+
"fqdn",
|
|
19
|
+
"username",
|
|
20
|
+
"primary_site_id",
|
|
21
|
+
"enabled",
|
|
22
|
+
"update_prio",
|
|
23
|
+
"cluster_tenant_id",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
assign_by_default_to_cluster_tenant = django_filters.BooleanFilter(
|
|
27
|
+
label="Assigned tenant by default",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
enabled = django_filters.BooleanFilter(
|
|
31
|
+
label="Enabled",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
def search(self, queryset, name, value):
|
|
35
|
+
"""Perform the filtered search."""
|
|
36
|
+
if not value.strip():
|
|
37
|
+
return queryset
|
|
38
|
+
qs_filter = Q(name__icontains=value) | Q(fqdn__icontains=value)
|
|
39
|
+
return queryset.filter(qs_filter)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class InfrastructureManagerSyncVMInfoFilterSet(NetBoxModelFilterSet):
|
|
43
|
+
|
|
44
|
+
tenant_id = django_filters.ModelMultipleChoiceFilter(
|
|
45
|
+
field_name="vm__tenant",
|
|
46
|
+
queryset=Tenant.objects.all(),
|
|
47
|
+
label="Tenant (ID)",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
cluster_id = django_filters.ModelMultipleChoiceFilter(
|
|
51
|
+
field_name="vm__cluster",
|
|
52
|
+
queryset=Cluster.objects.all(),
|
|
53
|
+
label="Cluster (ID)",
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
def search(self, queryset, name, value):
|
|
57
|
+
"""Perform the filtered search."""
|
|
58
|
+
if not value.strip():
|
|
59
|
+
return queryset
|
|
60
|
+
qs_filter = Q(vm__name__icontains=value)
|
|
61
|
+
return queryset.filter(qs_filter)
|
|
62
|
+
|
|
63
|
+
class Meta:
|
|
64
|
+
model = InfrastructureManagerSyncVMInfo
|
|
65
|
+
fields = (
|
|
66
|
+
"environment",
|
|
67
|
+
"criticality",
|
|
68
|
+
"financial_info",
|
|
69
|
+
"licensing",
|
|
70
|
+
"owner",
|
|
71
|
+
"backup_status",
|
|
72
|
+
"backup_plan",
|
|
73
|
+
"backup_type",
|
|
74
|
+
"deployed_by",
|
|
75
|
+
"billing_reference",
|
|
76
|
+
"ims",
|
|
77
|
+
"vmware_tools_version",
|
|
78
|
+
"vm_hardware_compatibility",
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class InfrastructureManagerSyncHostInfoFilterSet(NetBoxModelFilterSet):
|
|
83
|
+
class Meta:
|
|
84
|
+
model = InfrastructureManagerSyncHostInfo
|
|
85
|
+
fields = (
|
|
86
|
+
"memory",
|
|
87
|
+
"build_number",
|
|
88
|
+
"ims",
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
tenant_id = django_filters.ModelMultipleChoiceFilter(
|
|
92
|
+
field_name="host__tenant",
|
|
93
|
+
queryset=Tenant.objects.all(),
|
|
94
|
+
label="Tenant (ID)",
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
cluster_id = django_filters.ModelMultipleChoiceFilter(
|
|
98
|
+
field_name="host__cluster",
|
|
99
|
+
queryset=Cluster.objects.all(),
|
|
100
|
+
label="Cluster (ID)",
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
def search(self, queryset, name, value):
|
|
104
|
+
"""Perform the filtered search."""
|
|
105
|
+
if not value.strip():
|
|
106
|
+
return queryset
|
|
107
|
+
qs_filter = Q(host__name__icontains=value)
|
|
108
|
+
return queryset.filter(qs_filter)
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
from django import forms
|
|
2
|
+
|
|
3
|
+
from netbox.forms import NetBoxModelForm, NetBoxModelFilterSetForm
|
|
4
|
+
from utilities.forms.fields import (
|
|
5
|
+
CommentField,
|
|
6
|
+
TagFilterField,
|
|
7
|
+
DynamicModelMultipleChoiceField,
|
|
8
|
+
)
|
|
9
|
+
from .models import (
|
|
10
|
+
CriticalityChoise,
|
|
11
|
+
EnvironmentChoise,
|
|
12
|
+
FinancialInfoChoise,
|
|
13
|
+
InfrastructureManagerSync,
|
|
14
|
+
InfrastructureManagerSyncVMInfo,
|
|
15
|
+
LicensingChoise,
|
|
16
|
+
SyncType,
|
|
17
|
+
UpdatePrioChoise,
|
|
18
|
+
InfrastructureManagerSyncHostInfo,
|
|
19
|
+
)
|
|
20
|
+
from utilities.forms.widgets import DatePicker, DateTimePicker
|
|
21
|
+
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
|
|
22
|
+
from django.utils.translation import gettext as _
|
|
23
|
+
from tenancy.models import Tenant
|
|
24
|
+
from virtualization.models import Cluster
|
|
25
|
+
from utilities.forms.rendering import FieldSet
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class InfrastructureManagerSyncForm(NetBoxModelForm):
|
|
29
|
+
comments = CommentField()
|
|
30
|
+
|
|
31
|
+
assign_by_default_to_cluster_tenant = forms.BooleanField(
|
|
32
|
+
label=("Assign untagged vms to cluster tenant"),
|
|
33
|
+
required=False,
|
|
34
|
+
initial=False,
|
|
35
|
+
help_text=_(
|
|
36
|
+
"Assign VMs without tenant tag automatically to the Cluster tenant"
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
class Meta:
|
|
41
|
+
model = InfrastructureManagerSync
|
|
42
|
+
fields = (
|
|
43
|
+
"name",
|
|
44
|
+
"fqdn",
|
|
45
|
+
"username",
|
|
46
|
+
"password",
|
|
47
|
+
"cluster_tenant",
|
|
48
|
+
"entry_type",
|
|
49
|
+
"primary_site",
|
|
50
|
+
"enabled",
|
|
51
|
+
"update_prio",
|
|
52
|
+
"assign_by_default_to_cluster_tenant",
|
|
53
|
+
"comments",
|
|
54
|
+
"tags",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class InfrastructureManagerSyncFilterForm(NetBoxModelFilterSetForm):
|
|
59
|
+
model = InfrastructureManagerSync
|
|
60
|
+
|
|
61
|
+
fieldsets = (
|
|
62
|
+
FieldSet("q", "filter_id", "tag"),
|
|
63
|
+
FieldSet(
|
|
64
|
+
"entry_type",
|
|
65
|
+
"update_prio",
|
|
66
|
+
"assign_by_default_to_cluster_tenant",
|
|
67
|
+
"enabled",
|
|
68
|
+
name=_("IMS"),
|
|
69
|
+
),
|
|
70
|
+
FieldSet(
|
|
71
|
+
"cluster_tenant_id",
|
|
72
|
+
name=_("Tenancy"),
|
|
73
|
+
),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
entry_type = forms.MultipleChoiceField(choices=SyncType, required=False)
|
|
77
|
+
update_prio = forms.MultipleChoiceField(choices=UpdatePrioChoise, required=False)
|
|
78
|
+
|
|
79
|
+
assign_by_default_to_cluster_tenant = forms.NullBooleanField(
|
|
80
|
+
required=False,
|
|
81
|
+
label=_("Assign default tenant"),
|
|
82
|
+
widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
enabled = forms.NullBooleanField(
|
|
86
|
+
required=False,
|
|
87
|
+
label=_("Enabled"),
|
|
88
|
+
widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES),
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
cluster_tenant_id = DynamicModelMultipleChoiceField(
|
|
92
|
+
queryset=Tenant.objects.all(),
|
|
93
|
+
required=False,
|
|
94
|
+
null_option="None",
|
|
95
|
+
label=_("Cluster Tenant"),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
tag = TagFilterField(model)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class InfrastructureManagerSyncVMInfoSyncForm(NetBoxModelForm):
|
|
102
|
+
class Meta:
|
|
103
|
+
model = InfrastructureManagerSyncVMInfo
|
|
104
|
+
fields = (
|
|
105
|
+
"vm",
|
|
106
|
+
"backup_plan",
|
|
107
|
+
"backup_type",
|
|
108
|
+
"criticality",
|
|
109
|
+
"environment",
|
|
110
|
+
"financial_info",
|
|
111
|
+
"licensing",
|
|
112
|
+
"owner",
|
|
113
|
+
"service_info",
|
|
114
|
+
"backup_status",
|
|
115
|
+
"last_backup",
|
|
116
|
+
"deployed_on",
|
|
117
|
+
"deployed_by",
|
|
118
|
+
"billing_reference",
|
|
119
|
+
"ims",
|
|
120
|
+
"vmware_tools_version",
|
|
121
|
+
"vm_hardware_compatibility",
|
|
122
|
+
)
|
|
123
|
+
widgets = {
|
|
124
|
+
"deployed_on": DatePicker(),
|
|
125
|
+
"last_backup": DateTimePicker(),
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class InfrastructureManagerSyncVMInfoFilterForm(NetBoxModelFilterSetForm):
|
|
130
|
+
model = InfrastructureManagerSyncVMInfo
|
|
131
|
+
|
|
132
|
+
fieldsets = (
|
|
133
|
+
FieldSet("q", "filter_id", "tag"),
|
|
134
|
+
FieldSet(
|
|
135
|
+
"environment",
|
|
136
|
+
"criticality",
|
|
137
|
+
"financial_info",
|
|
138
|
+
"licensing",
|
|
139
|
+
"ims",
|
|
140
|
+
"owner",
|
|
141
|
+
"backup_plan",
|
|
142
|
+
"backup_type",
|
|
143
|
+
name=_("Attributes"),
|
|
144
|
+
),
|
|
145
|
+
FieldSet("tenant_id", name=_("Tenant")),
|
|
146
|
+
FieldSet("cluster_id", name=_("Cluster")),
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
environment = forms.MultipleChoiceField(choices=EnvironmentChoise, required=False)
|
|
150
|
+
criticality = forms.MultipleChoiceField(choices=CriticalityChoise, required=False)
|
|
151
|
+
financial_info = forms.MultipleChoiceField(
|
|
152
|
+
choices=FinancialInfoChoise, required=False
|
|
153
|
+
)
|
|
154
|
+
licensing = forms.MultipleChoiceField(choices=LicensingChoise, required=False)
|
|
155
|
+
|
|
156
|
+
ims = forms.ModelChoiceField(
|
|
157
|
+
queryset=InfrastructureManagerSync.objects.all(),
|
|
158
|
+
required=False,
|
|
159
|
+
label=_("ims"),
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
owner = forms.CharField(max_length=100, required=False)
|
|
163
|
+
|
|
164
|
+
backup_plan = forms.CharField(max_length=100, required=False)
|
|
165
|
+
|
|
166
|
+
backup_type = forms.CharField(max_length=100, required=False)
|
|
167
|
+
|
|
168
|
+
tenant_id = DynamicModelMultipleChoiceField(
|
|
169
|
+
queryset=Tenant.objects.all(), required=False, label=_("Tenants")
|
|
170
|
+
)
|
|
171
|
+
cluster_id = DynamicModelMultipleChoiceField(
|
|
172
|
+
queryset=Cluster.objects.all(), required=False, label=_("Clusters")
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
class InfrastructureManagerSyncHostInfoSyncForm(NetBoxModelForm):
|
|
177
|
+
class Meta:
|
|
178
|
+
model = InfrastructureManagerSyncHostInfo
|
|
179
|
+
fields = ("host", "build_number")
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class InfrastructureManagerSyncHostInfoFilterForm(NetBoxModelFilterSetForm):
|
|
183
|
+
model = InfrastructureManagerSyncHostInfo
|
|
184
|
+
|
|
185
|
+
fieldsets = (
|
|
186
|
+
FieldSet("q", "filter_id", "tag"),
|
|
187
|
+
FieldSet("ims", name=_("Attributes")),
|
|
188
|
+
FieldSet("tenant_id", name=_("Tenant")),
|
|
189
|
+
FieldSet("cluster_id", name=_("Cluster")),
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
ims = forms.ModelChoiceField(
|
|
193
|
+
queryset=InfrastructureManagerSync.objects.all(),
|
|
194
|
+
required=False,
|
|
195
|
+
label=_("ims"),
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
tenant_id = DynamicModelMultipleChoiceField(
|
|
199
|
+
queryset=Tenant.objects.all(), required=False, label=_("Tenants")
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
cluster_id = DynamicModelMultipleChoiceField(
|
|
203
|
+
queryset=Cluster.objects.all(), required=False, label=_("Clusters")
|
|
204
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
import strawberry
|
|
3
|
+
import strawberry_django
|
|
4
|
+
|
|
5
|
+
from . import models
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@strawberry_django.type(
|
|
9
|
+
models.InfrastructureManagerSync,
|
|
10
|
+
fields=["name",
|
|
11
|
+
"fqdn",
|
|
12
|
+
"cluster_tenant",
|
|
13
|
+
"entry_type",
|
|
14
|
+
"primary_site",
|
|
15
|
+
"enabled",
|
|
16
|
+
"update_prio",
|
|
17
|
+
"assign_by_default_to_cluster_tenant",
|
|
18
|
+
"last_successful_sync",
|
|
19
|
+
"build_number",
|
|
20
|
+
"version",
|
|
21
|
+
"id"
|
|
22
|
+
],
|
|
23
|
+
)
|
|
24
|
+
class InfrastructureManagerSyncType:
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@strawberry.type(name="Query")
|
|
29
|
+
class DummyQuery:
|
|
30
|
+
infrastructure_manager_sync: InfrastructureManagerSyncType = strawberry_django.field()
|
|
31
|
+
infrastructure_manager_sync_list: List[InfrastructureManagerSyncType] = strawberry_django.field()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
schema = [
|
|
35
|
+
DummyQuery,
|
|
36
|
+
]
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Generated by Django 4.1.8 on 2023-05-12 13:20
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
import django.db.models.deletion
|
|
5
|
+
import taggit.managers
|
|
6
|
+
import utilities.json
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Migration(migrations.Migration):
|
|
10
|
+
initial = True
|
|
11
|
+
|
|
12
|
+
dependencies = [
|
|
13
|
+
("virtualization", "0034_standardize_description_comments"),
|
|
14
|
+
("extras", "0092_delete_jobresult"),
|
|
15
|
+
("tenancy", "0010_tenant_relax_uniqueness"),
|
|
16
|
+
("dcim", "0171_cabletermination_change_logging"),
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
operations = [
|
|
20
|
+
migrations.CreateModel(
|
|
21
|
+
name="InfrastructureManagerSyncVMInfo",
|
|
22
|
+
fields=[
|
|
23
|
+
(
|
|
24
|
+
"id",
|
|
25
|
+
models.BigAutoField(
|
|
26
|
+
auto_created=True, primary_key=True, serialize=False
|
|
27
|
+
),
|
|
28
|
+
),
|
|
29
|
+
("created", models.DateTimeField(auto_now_add=True, null=True)),
|
|
30
|
+
("last_updated", models.DateTimeField(auto_now=True, null=True)),
|
|
31
|
+
(
|
|
32
|
+
"custom_field_data",
|
|
33
|
+
models.JSONField(
|
|
34
|
+
blank=True,
|
|
35
|
+
default=dict,
|
|
36
|
+
encoder=utilities.json.CustomFieldJSONEncoder,
|
|
37
|
+
),
|
|
38
|
+
),
|
|
39
|
+
("backup_plan", models.CharField(blank=True, max_length=100)),
|
|
40
|
+
("backup_type", models.CharField(blank=True, max_length=100)),
|
|
41
|
+
("criticality", models.CharField(blank=True, max_length=30)),
|
|
42
|
+
("environment", models.CharField(blank=True, max_length=30)),
|
|
43
|
+
("financial_info", models.CharField(blank=True, max_length=30)),
|
|
44
|
+
("licensing", models.CharField(blank=True, max_length=30)),
|
|
45
|
+
("owner", models.CharField(blank=True, max_length=100)),
|
|
46
|
+
("service_info", models.CharField(blank=True, max_length=30)),
|
|
47
|
+
(
|
|
48
|
+
"tags",
|
|
49
|
+
taggit.managers.TaggableManager(
|
|
50
|
+
through="extras.TaggedItem", to="extras.Tag"
|
|
51
|
+
),
|
|
52
|
+
),
|
|
53
|
+
(
|
|
54
|
+
"vm",
|
|
55
|
+
models.OneToOneField(
|
|
56
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
57
|
+
related_name="InfrastructureManagerSyncVMInfo",
|
|
58
|
+
to="virtualization.virtualmachine",
|
|
59
|
+
),
|
|
60
|
+
),
|
|
61
|
+
],
|
|
62
|
+
options={
|
|
63
|
+
"ordering": ("pk",),
|
|
64
|
+
},
|
|
65
|
+
),
|
|
66
|
+
migrations.CreateModel(
|
|
67
|
+
name="InfrastructureManagerSync",
|
|
68
|
+
fields=[
|
|
69
|
+
(
|
|
70
|
+
"id",
|
|
71
|
+
models.BigAutoField(
|
|
72
|
+
auto_created=True, primary_key=True, serialize=False
|
|
73
|
+
),
|
|
74
|
+
),
|
|
75
|
+
("created", models.DateTimeField(auto_now_add=True, null=True)),
|
|
76
|
+
("last_updated", models.DateTimeField(auto_now=True, null=True)),
|
|
77
|
+
(
|
|
78
|
+
"custom_field_data",
|
|
79
|
+
models.JSONField(
|
|
80
|
+
blank=True,
|
|
81
|
+
default=dict,
|
|
82
|
+
encoder=utilities.json.CustomFieldJSONEncoder,
|
|
83
|
+
),
|
|
84
|
+
),
|
|
85
|
+
("name", models.CharField(max_length=100)),
|
|
86
|
+
("fqdn", models.CharField(max_length=100)),
|
|
87
|
+
("username", models.CharField(max_length=100)),
|
|
88
|
+
("password", models.CharField(default="ChangeMe", max_length=100)),
|
|
89
|
+
("entry_type", models.CharField(blank=True, max_length=30)),
|
|
90
|
+
("enabled", models.BooleanField(default=True)),
|
|
91
|
+
("comments", models.TextField(blank=True)),
|
|
92
|
+
(
|
|
93
|
+
"cluster_tenant",
|
|
94
|
+
models.ForeignKey(
|
|
95
|
+
blank=True,
|
|
96
|
+
null=True,
|
|
97
|
+
on_delete=django.db.models.deletion.PROTECT,
|
|
98
|
+
related_name="infrastructuremanagersync",
|
|
99
|
+
to="tenancy.tenant",
|
|
100
|
+
),
|
|
101
|
+
),
|
|
102
|
+
(
|
|
103
|
+
"primary_site",
|
|
104
|
+
models.ForeignKey(
|
|
105
|
+
blank=True,
|
|
106
|
+
null=True,
|
|
107
|
+
on_delete=django.db.models.deletion.PROTECT,
|
|
108
|
+
related_name="infrastructuremanagersync_sync",
|
|
109
|
+
to="dcim.site",
|
|
110
|
+
),
|
|
111
|
+
),
|
|
112
|
+
(
|
|
113
|
+
"tags",
|
|
114
|
+
taggit.managers.TaggableManager(
|
|
115
|
+
through="extras.TaggedItem", to="extras.Tag"
|
|
116
|
+
),
|
|
117
|
+
),
|
|
118
|
+
],
|
|
119
|
+
options={
|
|
120
|
+
"ordering": ("name",),
|
|
121
|
+
},
|
|
122
|
+
),
|
|
123
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 4.1.8 on 2023-06-19 08:39
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
import django.db.models.deletion
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("infrastructure_manager_sync", "0001_initial"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name="infrastructuremanagersyncvminfo",
|
|
15
|
+
name="ims",
|
|
16
|
+
field=models.OneToOneField(
|
|
17
|
+
null=True,
|
|
18
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
19
|
+
related_name="InfrastructureManagerSync",
|
|
20
|
+
to="infrastructure_manager_sync.infrastructuremanagersync",
|
|
21
|
+
),
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 4.1.8 on 2023-06-19 09:27
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
import django.db.models.deletion
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("infrastructure_manager_sync", "0002_infrastructuremanagersyncvminfo_ims"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="infrastructuremanagersyncvminfo",
|
|
15
|
+
name="ims",
|
|
16
|
+
field=models.ForeignKey(
|
|
17
|
+
null=True,
|
|
18
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
19
|
+
related_name="InfrastructureManagerSync",
|
|
20
|
+
to="infrastructure_manager_sync.infrastructuremanagersync",
|
|
21
|
+
),
|
|
22
|
+
),
|
|
23
|
+
]
|