Skip to content

Commit 571d14e

Browse files
committed
cleanup Device42 idea
1 parent e2bdbfb commit 571d14e

File tree

14 files changed

+90
-707
lines changed

14 files changed

+90
-707
lines changed

examples/device42_to_infrahub/README.md

Lines changed: 0 additions & 200 deletions
This file was deleted.

examples/device42_to_infrahub/config.yml

Lines changed: 18 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
name: from-device42
33

44
source:
5-
name: device42
5+
name: genericrestapi
66
settings:
77
url: "http://swaggerdemo.device42.com"
8+
auth_method: "basic"
89
username: "guest"
910
password: "device42_rocks!"
10-
verify_ssl: false
11-
# debug: true # Uncomment to enable debug logging
11+
api_endpoint: "/api/1.0"
12+
response_key_pattern: "objects"
1213

1314
destination:
1415
name: infrahub
@@ -17,125 +18,37 @@ destination:
1718

1819
order: [
1920
"BuiltinTag",
20-
"RoleGeneric",
21-
"OrganizationGeneric",
22-
"LocationGeneric",
23-
"InfraRack",
24-
"ChoiceDeviceType",
25-
"InfraDevice",
26-
"InfraInterfaceL2L3",
21+
"OrganizationTenant",
22+
"LocationSite",
2723
]
2824

2925
schema_mapping:
30-
# Organizations (Customers in Device42)
31-
- name: OrganizationGeneric
32-
mapping: customers
26+
# Builtin Tags (Device42 tags)
27+
- name: BuiltinTag
28+
mapping: tags
3329
identifiers: ["name"]
3430
fields:
3531
- name: name
3632
mapping: name
37-
- name: description
38-
mapping: notes
3933

40-
# Locations (Buildings in Device42)
41-
- name: LocationGeneric
42-
mapping: buildings
43-
identifiers: ["name"]
44-
fields:
45-
- name: name
46-
mapping: name
47-
- name: description
48-
mapping: notes
49-
- name: type
50-
static: "Building"
51-
52-
# Locations (Rooms in Device42)
53-
- name: LocationGeneric
54-
mapping: rooms
34+
# Organizations (Customers in Device42)
35+
- name: OrganizationTenant
36+
mapping: customers
5537
identifiers: ["name"]
5638
fields:
5739
- name: name
5840
mapping: name
5941
- name: description
6042
mapping: notes
61-
- name: type
62-
static: "Room"
6343

64-
# Racks
65-
- name: InfraRack
66-
mapping: racks
67-
identifiers: ["name", "location"]
68-
fields:
69-
- name: name
70-
mapping: name
71-
- name: location
72-
mapping: room
73-
reference: LocationGeneric
74-
- name: height
75-
mapping: size
76-
- name: serial_number
77-
mapping: serial_no
78-
- name: asset_tag
79-
mapping: asset_no
80-
81-
# Hardware Models (Device Types)
82-
- name: ChoiceDeviceType
83-
mapping: hardwares
84-
identifiers: ["name", "manufacturer"]
85-
fields:
86-
- name: name
87-
mapping: name
88-
- name: part_number
89-
mapping: part_no
90-
- name: height
91-
mapping: size
92-
- name: manufacturer
93-
mapping: manufacturer
94-
reference: OrganizationGeneric
95-
96-
# Devices
97-
- name: InfraDevice
44+
# Locations (Buildings in Device42)
45+
- name: LocationSite
46+
mapping: buildings
9847
identifiers: ["name"]
99-
mapping: devices
10048
fields:
10149
- name: name
10250
mapping: name
103-
- name: serial_number
104-
mapping: serial_no
105-
- name: asset_tag
106-
mapping: asset_no
107-
- name: description
108-
mapping: notes
109-
- name: model
110-
mapping: hardware
111-
reference: ChoiceDeviceType
112-
- name: organization
113-
mapping: customer
114-
reference: OrganizationGeneric
115-
- name: location
116-
mapping: room
117-
reference: LocationGeneric
118-
- name: rack
119-
mapping: rack
120-
reference: InfraRack
121-
transforms:
122-
- field: name
123-
expression: "{{ name.lower() if name else '' }}"
51+
- name: tags
52+
mapping: tags
53+
reference: BuiltinTag
12454

125-
# Network Interfaces (Device42 IP addresses often represent interfaces)
126-
- name: InfraInterfaceL2L3
127-
identifiers: ["device", "name"]
128-
mapping: ips
129-
fields:
130-
- name: name
131-
mapping: label
132-
- name: description
133-
mapping: notes
134-
- name: device
135-
mapping: device
136-
reference: InfraDevice
137-
# Only include IPs that have interface-like labels
138-
filters:
139-
- field: label
140-
operation: "exists"
141-
value: true

examples/device42_to_infrahub/device42/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/device42_to_infrahub/device42/sync_adapter.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)