ipfabric_netbox 3.1.2__py3-none-any.whl → 3.2.0__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.
Potentially problematic release.
This version of ipfabric_netbox might be problematic. Click here for more details.
- ipfabric_netbox/__init__.py +2 -31
- ipfabric_netbox/data/transform_map.json +625 -0
- ipfabric_netbox/forms.py +2 -8
- ipfabric_netbox/migrations/0007_prepare_custom_fields.py +102 -0
- ipfabric_netbox/migrations/0008_prepare_transform_maps.py +42 -0
- ipfabric_netbox/migrations/0009_transformmap_changes_for_netbox_v4_2.py +227 -0
- ipfabric_netbox/models.py +10 -1
- ipfabric_netbox/tables.py +4 -0
- ipfabric_netbox/tests/test_models.py +17 -950
- ipfabric_netbox/utilities/ipfutils.py +12 -0
- ipfabric_netbox/utilities/transform_map.py +37 -15
- ipfabric_netbox/views.py +3 -9
- {ipfabric_netbox-3.1.2.dist-info → ipfabric_netbox-3.2.0.dist-info}/METADATA +17 -3
- {ipfabric_netbox-3.1.2.dist-info → ipfabric_netbox-3.2.0.dist-info}/RECORD +15 -12
- ipfabric_netbox/signals.py +0 -68
- {ipfabric_netbox-3.1.2.dist-info → ipfabric_netbox-3.2.0.dist-info}/WHEEL +0 -0
ipfabric_netbox/__init__.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
from django.db import connection
|
|
3
1
|
from netbox.plugins import PluginConfig
|
|
4
2
|
|
|
5
3
|
|
|
@@ -7,36 +5,9 @@ class NetboxIPFabricConfig(PluginConfig):
|
|
|
7
5
|
name = "ipfabric_netbox"
|
|
8
6
|
verbose_name = "NetBox IP Fabric SoT Plugin"
|
|
9
7
|
description = "Sync IP Fabric into NetBox"
|
|
10
|
-
version = "3.
|
|
8
|
+
version = "3.2.0"
|
|
11
9
|
base_url = "ipfabric"
|
|
12
|
-
min_version = "4.
|
|
13
|
-
|
|
14
|
-
def ready(self):
|
|
15
|
-
super().ready()
|
|
16
|
-
try:
|
|
17
|
-
from ipfabric_netbox.signals import ipfabric_netbox_init
|
|
18
|
-
|
|
19
|
-
all_tables = connection.introspection.table_names()
|
|
20
|
-
if all(
|
|
21
|
-
item in all_tables
|
|
22
|
-
for item in [
|
|
23
|
-
"extras_customfield",
|
|
24
|
-
"ipfabric_netbox_ipfabricbranch",
|
|
25
|
-
"ipfabric_netbox_ipfabricsource",
|
|
26
|
-
]
|
|
27
|
-
):
|
|
28
|
-
ipfabric_netbox_init()
|
|
29
|
-
if "ipfabric_netbox_ipfabrictransformmap" in all_tables:
|
|
30
|
-
from ipfabric_netbox.models import IPFabricTransformMap
|
|
31
|
-
from ipfabric_netbox.utilities.transform_map import BuildTransformMaps
|
|
32
|
-
|
|
33
|
-
if IPFabricTransformMap.objects.count() == 0:
|
|
34
|
-
data = requests.get(
|
|
35
|
-
"https://gitlab.com/ip-fabric/integrations/ipfabric-netbox/-/raw/main/scripts/transform_map.json"
|
|
36
|
-
).json()
|
|
37
|
-
BuildTransformMaps(data=data)
|
|
38
|
-
except Exception as e:
|
|
39
|
-
print(f"Failed to initialize IP Fabric plugin: {e}.")
|
|
10
|
+
min_version = "4.2"
|
|
40
11
|
|
|
41
12
|
|
|
42
13
|
config = NetboxIPFabricConfig
|
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"data": {
|
|
4
|
+
"created": null,
|
|
5
|
+
"last_updated": null,
|
|
6
|
+
"custom_field_data": {},
|
|
7
|
+
"name": "IP Address Transform Map",
|
|
8
|
+
"source_model": "ipaddress",
|
|
9
|
+
"target_model": {
|
|
10
|
+
"app_label": "ipam",
|
|
11
|
+
"model": "ipaddress"
|
|
12
|
+
},
|
|
13
|
+
"status": "active"
|
|
14
|
+
},
|
|
15
|
+
"field_maps": [
|
|
16
|
+
{
|
|
17
|
+
"source_field": "sn",
|
|
18
|
+
"target_field": "assigned_object_id",
|
|
19
|
+
"coalesce": false,
|
|
20
|
+
"template": "{% if object.nameOriginal %}{{ dcim.Interface.objects.filter(device__serial=object.sn, name=object.nameOriginal).first().pk }}{% else %}{{ dcim.Interface.objects.filter(device__serial=object.sn, name=object.intName).first().pk }}{% endif %}"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"source_field": "net",
|
|
24
|
+
"target_field": "address",
|
|
25
|
+
"coalesce": true,
|
|
26
|
+
"template": "{% if object.net %}{% set MASK = object.net.split('/')[1] %}{% else %}{% set MASK = 32 %}{% endif %}{{ object.ip }}/{{MASK}}"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"relationship_maps": [
|
|
30
|
+
{
|
|
31
|
+
"source_model": {
|
|
32
|
+
"app_label": "contenttypes",
|
|
33
|
+
"model": "contenttype"
|
|
34
|
+
},
|
|
35
|
+
"target_field": "assigned_object_type",
|
|
36
|
+
"coalesce": false,
|
|
37
|
+
"template": "{{ contenttypes.ContentType.objects.get(app_label=\"dcim\", model=\"interface\").pk }}"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"source_model": {
|
|
41
|
+
"app_label": "ipam",
|
|
42
|
+
"model": "vrf"
|
|
43
|
+
},
|
|
44
|
+
"target_field": "vrf",
|
|
45
|
+
"coalesce": false,
|
|
46
|
+
"template": "{{ ipam.VRF.objects.filter(name=object.vrf).first().pk }}"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"data": {
|
|
52
|
+
"created": null,
|
|
53
|
+
"last_updated": null,
|
|
54
|
+
"custom_field_data": {},
|
|
55
|
+
"name": "Platform Transform Map",
|
|
56
|
+
"source_model": "device",
|
|
57
|
+
"target_model": {
|
|
58
|
+
"app_label": "dcim",
|
|
59
|
+
"model": "platform"
|
|
60
|
+
},
|
|
61
|
+
"status": ""
|
|
62
|
+
},
|
|
63
|
+
"field_maps": [
|
|
64
|
+
{
|
|
65
|
+
"source_field": "vendor",
|
|
66
|
+
"target_field": "slug",
|
|
67
|
+
"coalesce": true,
|
|
68
|
+
"template": "{{ object.vendor | slugify }}{%if object.family %}_{{ object.family | slugify }}{% endif %}"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"source_field": "family",
|
|
72
|
+
"target_field": "name",
|
|
73
|
+
"coalesce": false,
|
|
74
|
+
"template": "{%if object.family %}{{ object.family | slugify }}{% else %}{{ object.vendor }}{% endif %}"
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"relationship_maps": [
|
|
78
|
+
{
|
|
79
|
+
"source_model": {
|
|
80
|
+
"app_label": "dcim",
|
|
81
|
+
"model": "manufacturer"
|
|
82
|
+
},
|
|
83
|
+
"target_field": "manufacturer",
|
|
84
|
+
"coalesce": false,
|
|
85
|
+
"template": null
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"data": {
|
|
91
|
+
"created": null,
|
|
92
|
+
"last_updated": null,
|
|
93
|
+
"custom_field_data": {},
|
|
94
|
+
"name": "Site Transform Map",
|
|
95
|
+
"source_model": "site",
|
|
96
|
+
"target_model": {
|
|
97
|
+
"app_label": "dcim",
|
|
98
|
+
"model": "site"
|
|
99
|
+
},
|
|
100
|
+
"status": "active"
|
|
101
|
+
},
|
|
102
|
+
"field_maps": [
|
|
103
|
+
{
|
|
104
|
+
"source_field": "siteName",
|
|
105
|
+
"target_field": "slug",
|
|
106
|
+
"coalesce": true,
|
|
107
|
+
"template": "{{ object.siteName | slugify }}"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"source_field": "siteName",
|
|
111
|
+
"target_field": "name",
|
|
112
|
+
"coalesce": false,
|
|
113
|
+
"template": ""
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"relationship_maps": []
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"data": {
|
|
120
|
+
"created": null,
|
|
121
|
+
"last_updated": null,
|
|
122
|
+
"custom_field_data": {},
|
|
123
|
+
"name": "Manufacturer Transform Map",
|
|
124
|
+
"source_model": "device",
|
|
125
|
+
"target_model": {
|
|
126
|
+
"app_label": "dcim",
|
|
127
|
+
"model": "manufacturer"
|
|
128
|
+
},
|
|
129
|
+
"status": ""
|
|
130
|
+
},
|
|
131
|
+
"field_maps": [
|
|
132
|
+
{
|
|
133
|
+
"source_field": "vendor",
|
|
134
|
+
"target_field": "slug",
|
|
135
|
+
"coalesce": true,
|
|
136
|
+
"template": "{{ object.vendor | slugify }}"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"source_field": "vendor",
|
|
140
|
+
"target_field": "name",
|
|
141
|
+
"coalesce": false,
|
|
142
|
+
"template": null
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"relationship_maps": []
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"data": {
|
|
149
|
+
"created": null,
|
|
150
|
+
"last_updated": null,
|
|
151
|
+
"custom_field_data": {},
|
|
152
|
+
"name": "Device Transform Map",
|
|
153
|
+
"source_model": "device",
|
|
154
|
+
"target_model": {
|
|
155
|
+
"app_label": "dcim",
|
|
156
|
+
"model": "device"
|
|
157
|
+
},
|
|
158
|
+
"status": "active"
|
|
159
|
+
},
|
|
160
|
+
"field_maps": [
|
|
161
|
+
{
|
|
162
|
+
"source_field": "hostname",
|
|
163
|
+
"target_field": "name",
|
|
164
|
+
"coalesce": false,
|
|
165
|
+
"template": ""
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"source_field": "sn",
|
|
169
|
+
"target_field": "serial",
|
|
170
|
+
"coalesce": true,
|
|
171
|
+
"template": "{{ object | serial }}"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"source_field": "hostname",
|
|
175
|
+
"target_field": "vc_position",
|
|
176
|
+
"coalesce": false,
|
|
177
|
+
"template": "{% if object.virtual_chassis is defined %}{{ object.virtual_chassis.member }}{% else %}None{% endif %}"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"relationship_maps": [
|
|
181
|
+
{
|
|
182
|
+
"source_model": {
|
|
183
|
+
"app_label": "dcim",
|
|
184
|
+
"model": "virtualchassis"
|
|
185
|
+
},
|
|
186
|
+
"target_field": "virtual_chassis",
|
|
187
|
+
"coalesce": false,
|
|
188
|
+
"template": "{% if object.virtual_chassis is defined %}{{ dcim.VirtualChassis.objects.filter(name=object.virtual_chassis.master).first().pk }}{% endif %}"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"source_model": {
|
|
192
|
+
"app_label": "dcim",
|
|
193
|
+
"model": "platform"
|
|
194
|
+
},
|
|
195
|
+
"target_field": "platform",
|
|
196
|
+
"coalesce": false,
|
|
197
|
+
"template": null
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"source_model": {
|
|
201
|
+
"app_label": "dcim",
|
|
202
|
+
"model": "site"
|
|
203
|
+
},
|
|
204
|
+
"target_field": "site",
|
|
205
|
+
"coalesce": false,
|
|
206
|
+
"template": null
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"source_model": {
|
|
210
|
+
"app_label": "dcim",
|
|
211
|
+
"model": "devicetype"
|
|
212
|
+
},
|
|
213
|
+
"target_field": "device_type",
|
|
214
|
+
"coalesce": false,
|
|
215
|
+
"template": null
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"source_model": {
|
|
219
|
+
"app_label": "dcim",
|
|
220
|
+
"model": "devicerole"
|
|
221
|
+
},
|
|
222
|
+
"target_field": "role",
|
|
223
|
+
"coalesce": false,
|
|
224
|
+
"template": null
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"data": {
|
|
230
|
+
"created": null,
|
|
231
|
+
"last_updated": null,
|
|
232
|
+
"custom_field_data": {},
|
|
233
|
+
"name": "Device Role Transform Map",
|
|
234
|
+
"source_model": "device",
|
|
235
|
+
"target_model": {
|
|
236
|
+
"app_label": "dcim",
|
|
237
|
+
"model": "devicerole"
|
|
238
|
+
},
|
|
239
|
+
"status": ""
|
|
240
|
+
},
|
|
241
|
+
"field_maps": [
|
|
242
|
+
{
|
|
243
|
+
"source_field": "devType",
|
|
244
|
+
"target_field": "slug",
|
|
245
|
+
"coalesce": true,
|
|
246
|
+
"template": "{{ object.devType | slugify }}"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"source_field": "devType",
|
|
250
|
+
"target_field": "vm_role",
|
|
251
|
+
"coalesce": true,
|
|
252
|
+
"template": "False"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"source_field": "devType",
|
|
256
|
+
"target_field": "name",
|
|
257
|
+
"coalesce": false,
|
|
258
|
+
"template": ""
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"relationship_maps": []
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"data": {
|
|
265
|
+
"created": null,
|
|
266
|
+
"last_updated": null,
|
|
267
|
+
"custom_field_data": {},
|
|
268
|
+
"name": "Device Type Transform Map",
|
|
269
|
+
"source_model": "device",
|
|
270
|
+
"target_model": {
|
|
271
|
+
"app_label": "dcim",
|
|
272
|
+
"model": "devicetype"
|
|
273
|
+
},
|
|
274
|
+
"status": ""
|
|
275
|
+
},
|
|
276
|
+
"field_maps": [
|
|
277
|
+
{
|
|
278
|
+
"source_field": "model",
|
|
279
|
+
"target_field": "slug",
|
|
280
|
+
"coalesce": true,
|
|
281
|
+
"template": "{% if object.model != none %}{{ object.model | string | slugify }}{% else %}{{ object.vendor | slugify }}-{{ object.family | slugify}}-{{ object.platform }}{% endif %}"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"source_field": "model",
|
|
285
|
+
"target_field": "model",
|
|
286
|
+
"coalesce": false,
|
|
287
|
+
"template": "{% if object.model != none %}{{ object.model | string }}{% else %}{{ object.vendor }} - {{ object.family }} - {{ object.platform }}{% endif %}"
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"relationship_maps": [
|
|
291
|
+
{
|
|
292
|
+
"source_model": {
|
|
293
|
+
"app_label": "dcim",
|
|
294
|
+
"model": "manufacturer"
|
|
295
|
+
},
|
|
296
|
+
"target_field": "manufacturer",
|
|
297
|
+
"coalesce": false,
|
|
298
|
+
"template": null
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"data": {
|
|
304
|
+
"created": null,
|
|
305
|
+
"last_updated": null,
|
|
306
|
+
"custom_field_data": {},
|
|
307
|
+
"name": "Interface Transform Map",
|
|
308
|
+
"source_model": "interface",
|
|
309
|
+
"target_model": {
|
|
310
|
+
"app_label": "dcim",
|
|
311
|
+
"model": "interface"
|
|
312
|
+
},
|
|
313
|
+
"status": ""
|
|
314
|
+
},
|
|
315
|
+
"field_maps": [
|
|
316
|
+
{
|
|
317
|
+
"source_field": "nameOriginal",
|
|
318
|
+
"target_field": "name",
|
|
319
|
+
"coalesce": true,
|
|
320
|
+
"template": "{% if object.nameOriginal %}{{ object.nameOriginal }}{% else %}{{ object.intName }}{% endif %}"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"source_field": "dscr",
|
|
324
|
+
"target_field": "description",
|
|
325
|
+
"coalesce": false,
|
|
326
|
+
"template": "{% if (object.dscr | lower) != \"none\" %}{{ object.dscr or \"\" }}{% endif %}"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"source_field": "mtu",
|
|
330
|
+
"target_field": "mtu",
|
|
331
|
+
"coalesce": false,
|
|
332
|
+
"template": "{{ object.mtu or 1500 }}"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"source_field": "media",
|
|
336
|
+
"target_field": "type",
|
|
337
|
+
"coalesce": false,
|
|
338
|
+
"template": "1000base-t"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"source_field": "l1",
|
|
342
|
+
"target_field": "enabled",
|
|
343
|
+
"coalesce": false,
|
|
344
|
+
"template": "{% if object.l1 == \"up\" %}True{% else %}False{% endif %}"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"source_field": "primaryIp",
|
|
348
|
+
"target_field": "mgmt_only",
|
|
349
|
+
"coalesce": false,
|
|
350
|
+
"template": "{% if object.primaryIp == object.loginIp %}True{% else %}False{% endif %}"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"source_field": "speedValue",
|
|
354
|
+
"target_field": "speed",
|
|
355
|
+
"coalesce": false,
|
|
356
|
+
"template": "{% if not object.speedValue %}None{% else %}{{ object.speedValue|int // 1000 }}{% endif %}"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"source_field": "duplex",
|
|
360
|
+
"target_field": "duplex",
|
|
361
|
+
"coalesce": false,
|
|
362
|
+
"template": null
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
"relationship_maps": [
|
|
366
|
+
{
|
|
367
|
+
"source_model": {
|
|
368
|
+
"app_label": "dcim",
|
|
369
|
+
"model": "device"
|
|
370
|
+
},
|
|
371
|
+
"target_field": "device",
|
|
372
|
+
"coalesce": true,
|
|
373
|
+
"template": null
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"data": {
|
|
379
|
+
"created": "2025-02-12T21:43:50.322Z",
|
|
380
|
+
"last_updated": "2025-02-12T21:43:50.322Z",
|
|
381
|
+
"custom_field_data": {},
|
|
382
|
+
"name": "MAC Address Transform Map",
|
|
383
|
+
"source_model": "interface",
|
|
384
|
+
"target_model": {
|
|
385
|
+
"app_label": "dcim",
|
|
386
|
+
"model": "macaddress"
|
|
387
|
+
},
|
|
388
|
+
"status": ""
|
|
389
|
+
},
|
|
390
|
+
"field_maps": [
|
|
391
|
+
{
|
|
392
|
+
"source_field": "mac",
|
|
393
|
+
"target_field": "mac_address",
|
|
394
|
+
"coalesce": true,
|
|
395
|
+
"template": "{% if object.mac %}{{ object.mac | mac_to_format(frmt=\"MAC_COLON_TWO\") | upper }}{% else %}{{ \"00:00:00:00:00:01\" | mac_to_format(frmt=\"MAC_COLON_TWO\") | upper }}{% endif %}"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"source_field": "id",
|
|
399
|
+
"target_field": "assigned_object_id",
|
|
400
|
+
"coalesce": true,
|
|
401
|
+
"template": ""
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"relationship_maps": [
|
|
405
|
+
{
|
|
406
|
+
"source_model": {
|
|
407
|
+
"app_label": "contenttypes",
|
|
408
|
+
"model": "contenttype"
|
|
409
|
+
},
|
|
410
|
+
"target_field": "assigned_object_type",
|
|
411
|
+
"coalesce": true,
|
|
412
|
+
"template": "{{ contenttypes.ContentType.objects.get(app_label=\"dcim\", model=\"interface\").pk }}"
|
|
413
|
+
}
|
|
414
|
+
]
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"data": {
|
|
418
|
+
"created": null,
|
|
419
|
+
"last_updated": null,
|
|
420
|
+
"custom_field_data": {},
|
|
421
|
+
"name": "Inventory Transform Map",
|
|
422
|
+
"source_model": "part_number",
|
|
423
|
+
"target_model": {
|
|
424
|
+
"app_label": "dcim",
|
|
425
|
+
"model": "inventoryitem"
|
|
426
|
+
},
|
|
427
|
+
"status": ""
|
|
428
|
+
},
|
|
429
|
+
"field_maps": [
|
|
430
|
+
{
|
|
431
|
+
"source_field": "pid",
|
|
432
|
+
"target_field": "part_id",
|
|
433
|
+
"coalesce": false,
|
|
434
|
+
"template": ""
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"source_field": "sn",
|
|
438
|
+
"target_field": "serial",
|
|
439
|
+
"coalesce": true,
|
|
440
|
+
"template": ""
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"source_field": "name",
|
|
444
|
+
"target_field": "name",
|
|
445
|
+
"coalesce": false,
|
|
446
|
+
"template": "{% if object.name is not none %}{{ object.name }}{% elif object.dscr is not none %}{{ object.dscr}}{% else %}Default Name{% endif %}"
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
"relationship_maps": [
|
|
450
|
+
{
|
|
451
|
+
"source_model": {
|
|
452
|
+
"app_label": "dcim",
|
|
453
|
+
"model": "device"
|
|
454
|
+
},
|
|
455
|
+
"target_field": "device",
|
|
456
|
+
"coalesce": false,
|
|
457
|
+
"template": "{{ dcim.Device.objects.filter(serial=object.deviceSn).first().pk }}"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"source_model": {
|
|
461
|
+
"app_label": "dcim",
|
|
462
|
+
"model": "manufacturer"
|
|
463
|
+
},
|
|
464
|
+
"target_field": "manufacturer",
|
|
465
|
+
"coalesce": false,
|
|
466
|
+
"template": null
|
|
467
|
+
}
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"data": {
|
|
472
|
+
"created": null,
|
|
473
|
+
"last_updated": null,
|
|
474
|
+
"custom_field_data": {},
|
|
475
|
+
"name": "VLAN Transform Map",
|
|
476
|
+
"source_model": "vlan",
|
|
477
|
+
"target_model": {
|
|
478
|
+
"app_label": "ipam",
|
|
479
|
+
"model": "vlan"
|
|
480
|
+
},
|
|
481
|
+
"status": "active"
|
|
482
|
+
},
|
|
483
|
+
"field_maps": [
|
|
484
|
+
{
|
|
485
|
+
"source_field": "vlanName",
|
|
486
|
+
"target_field": "name",
|
|
487
|
+
"coalesce": false,
|
|
488
|
+
"template": "{{ object.vlanName or \"\"}}"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"source_field": "dscr",
|
|
492
|
+
"target_field": "description",
|
|
493
|
+
"coalesce": false,
|
|
494
|
+
"template": "{% if (object.dscr | lower) != \"none\" %}{{ object.dscr or \"\"}}{% endif %}"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"source_field": "vlanId",
|
|
498
|
+
"target_field": "vid",
|
|
499
|
+
"coalesce": true,
|
|
500
|
+
"template": ""
|
|
501
|
+
}
|
|
502
|
+
],
|
|
503
|
+
"relationship_maps": [
|
|
504
|
+
{
|
|
505
|
+
"source_model": {
|
|
506
|
+
"app_label": "dcim",
|
|
507
|
+
"model": "site"
|
|
508
|
+
},
|
|
509
|
+
"target_field": "site",
|
|
510
|
+
"coalesce": true,
|
|
511
|
+
"template": null
|
|
512
|
+
}
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"data": {
|
|
517
|
+
"created": null,
|
|
518
|
+
"last_updated": null,
|
|
519
|
+
"custom_field_data": {},
|
|
520
|
+
"name": "VRF Transform Map",
|
|
521
|
+
"source_model": "vrf",
|
|
522
|
+
"target_model": {
|
|
523
|
+
"app_label": "ipam",
|
|
524
|
+
"model": "vrf"
|
|
525
|
+
},
|
|
526
|
+
"status": ""
|
|
527
|
+
},
|
|
528
|
+
"field_maps": [
|
|
529
|
+
{
|
|
530
|
+
"source_field": "vrf",
|
|
531
|
+
"target_field": "name",
|
|
532
|
+
"coalesce": true,
|
|
533
|
+
"template": ""
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
"source_field": "rd",
|
|
537
|
+
"target_field": "rd",
|
|
538
|
+
"coalesce": true,
|
|
539
|
+
"template": ""
|
|
540
|
+
}
|
|
541
|
+
],
|
|
542
|
+
"relationship_maps": []
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"data": {
|
|
546
|
+
"created": null,
|
|
547
|
+
"last_updated": null,
|
|
548
|
+
"custom_field_data": {},
|
|
549
|
+
"name": "Prefix Transform Map",
|
|
550
|
+
"source_model": "prefix",
|
|
551
|
+
"target_model": {
|
|
552
|
+
"app_label": "ipam",
|
|
553
|
+
"model": "prefix"
|
|
554
|
+
},
|
|
555
|
+
"status": "active"
|
|
556
|
+
},
|
|
557
|
+
"field_maps": [
|
|
558
|
+
{
|
|
559
|
+
"source_field": "net",
|
|
560
|
+
"target_field": "prefix",
|
|
561
|
+
"coalesce": true,
|
|
562
|
+
"template": ""
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"source_field": "siteName",
|
|
566
|
+
"target_field": "scope_id",
|
|
567
|
+
"coalesce": true,
|
|
568
|
+
"template": "{% if object.siteName is defined %}{% set SLUG = object.siteName | slugify %}\n{{ dcim.Site.objects.filter(slug=SLUG).first().pk }}{% else %}None{% endif %}"
|
|
569
|
+
}
|
|
570
|
+
],
|
|
571
|
+
"relationship_maps": [
|
|
572
|
+
{
|
|
573
|
+
"source_model": {
|
|
574
|
+
"app_label": "ipam",
|
|
575
|
+
"model": "vrf"
|
|
576
|
+
},
|
|
577
|
+
"target_field": "vrf",
|
|
578
|
+
"coalesce": true,
|
|
579
|
+
"template": "{% if object.vrf %}{{ ipam.VRF.objects.filter(name=object.vrf).first().pk }}{% else %}None{% endif %}"
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"source_model": {
|
|
583
|
+
"app_label": "contenttypes",
|
|
584
|
+
"model": "contenttype"
|
|
585
|
+
},
|
|
586
|
+
"target_field": "scope_type",
|
|
587
|
+
"coalesce": true,
|
|
588
|
+
"template": "{% if object.siteName is defined %}{{ contenttypes.ContentType.objects.get(app_label=\"dcim\", model=\"site\").pk }}{% else %}None{% endif %}"
|
|
589
|
+
}
|
|
590
|
+
]
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
"data": {
|
|
594
|
+
"created": null,
|
|
595
|
+
"last_updated": null,
|
|
596
|
+
"custom_field_data": {},
|
|
597
|
+
"name": "Virtual Chassis Transform Map",
|
|
598
|
+
"source_model": "virtualchassis",
|
|
599
|
+
"target_model": {
|
|
600
|
+
"app_label": "dcim",
|
|
601
|
+
"model": "virtualchassis"
|
|
602
|
+
},
|
|
603
|
+
"status": ""
|
|
604
|
+
},
|
|
605
|
+
"field_maps": [
|
|
606
|
+
{
|
|
607
|
+
"source_field": "master",
|
|
608
|
+
"target_field": "name",
|
|
609
|
+
"coalesce": true,
|
|
610
|
+
"template": ""
|
|
611
|
+
}
|
|
612
|
+
],
|
|
613
|
+
"relationship_maps": [
|
|
614
|
+
{
|
|
615
|
+
"source_model": {
|
|
616
|
+
"app_label": "dcim",
|
|
617
|
+
"model": "device"
|
|
618
|
+
},
|
|
619
|
+
"target_field": "master",
|
|
620
|
+
"coalesce": false,
|
|
621
|
+
"template": "{{ dcim.Device.objects.filter(serial=object.sn).first().pk }}"
|
|
622
|
+
}
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
]
|