netbox-device-type-sync 1.0.0__tar.gz

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.
Files changed (28) hide show
  1. netbox_device_type_sync-1.0.0/LICENSE +21 -0
  2. netbox_device_type_sync-1.0.0/MANIFEST.in +1 -0
  3. netbox_device_type_sync-1.0.0/PKG-INFO +267 -0
  4. netbox_device_type_sync-1.0.0/README.md +243 -0
  5. netbox_device_type_sync-1.0.0/netbox_device_type_sync/__init__.py +23 -0
  6. netbox_device_type_sync-1.0.0/netbox_device_type_sync/apply.py +402 -0
  7. netbox_device_type_sync-1.0.0/netbox_device_type_sync/components.py +641 -0
  8. netbox_device_type_sync-1.0.0/netbox_device_type_sync/diff.py +248 -0
  9. netbox_device_type_sync-1.0.0/netbox_device_type_sync/forms.py +35 -0
  10. netbox_device_type_sync-1.0.0/netbox_device_type_sync/templates/netbox_device_type_sync/device_sync.html +239 -0
  11. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/__init__.py +0 -0
  12. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/test_apply.py +427 -0
  13. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/test_coverage.py +174 -0
  14. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/test_diff.py +313 -0
  15. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/test_load.py +15 -0
  16. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/test_ui.py +111 -0
  17. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/test_views.py +123 -0
  18. netbox_device_type_sync-1.0.0/netbox_device_type_sync/tests/utils.py +41 -0
  19. netbox_device_type_sync-1.0.0/netbox_device_type_sync/ui.py +96 -0
  20. netbox_device_type_sync-1.0.0/netbox_device_type_sync/urls.py +7 -0
  21. netbox_device_type_sync-1.0.0/netbox_device_type_sync/version.py +1 -0
  22. netbox_device_type_sync-1.0.0/netbox_device_type_sync/views.py +109 -0
  23. netbox_device_type_sync-1.0.0/netbox_device_type_sync.egg-info/PKG-INFO +267 -0
  24. netbox_device_type_sync-1.0.0/netbox_device_type_sync.egg-info/SOURCES.txt +26 -0
  25. netbox_device_type_sync-1.0.0/netbox_device_type_sync.egg-info/dependency_links.txt +1 -0
  26. netbox_device_type_sync-1.0.0/netbox_device_type_sync.egg-info/top_level.txt +1 -0
  27. netbox_device_type_sync-1.0.0/pyproject.toml +57 -0
  28. netbox_device_type_sync-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Maksym Ototiuk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ recursive-include netbox_device_type_sync/templates *.html
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: netbox-device-type-sync
3
+ Version: 1.0.0
4
+ Summary: Sync the components of a NetBox device with its device type.
5
+ Author-email: Maksym Ototiuk <pypi@masik.slmail.me>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Maksym-Ototiuk/netbox-device-type-sync
8
+ Project-URL: Documentation, https://github.com/Maksym-Ototiuk/netbox-device-type-sync#readme
9
+ Project-URL: Changelog, https://github.com/Maksym-Ototiuk/netbox-device-type-sync/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/Maksym-Ototiuk/netbox-device-type-sync/issues
11
+ Keywords: netbox,netbox-plugin,device-type,components,sync
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Framework :: Django
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Requires-Python: >=3.12
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # NetBox Device Type Sync
26
+
27
+ A [NetBox](https://github.com/netbox-community/netbox) plugin that brings the
28
+ components of a device in line with its device type.
29
+
30
+ ## Table of Contents
31
+
32
+ - [Purpose](#purpose)
33
+ - [How it works](#how-it-works)
34
+ - [What is synchronized](#what-is-synchronized)
35
+ - [How components are created and updated](#how-components-are-created-and-updated)
36
+ - [Permissions](#permissions)
37
+ - [Compatibility](#compatibility)
38
+ - [Installation](#installation)
39
+ - [Troubleshooting](#troubleshooting)
40
+ - [Limitations](#limitations)
41
+ - [Development](#development)
42
+ - [License](#license)
43
+
44
+ ## Purpose
45
+
46
+ NetBox creates the components of a device (interfaces, ports, bays and so on)
47
+ from its device type only once, when the device is created. Later changes do
48
+ not reach the device:
49
+
50
+ - **A device is replaced by another model.** After you change the device type
51
+ of the device, its components still have the names, types and settings of
52
+ the old model.
53
+ - **A component is added to a device type.** Existing devices of that type do
54
+ not get it.
55
+
56
+ Deleting and recreating the device would lose its cables, IP addresses, VLANs
57
+ and other settings. This plugin updates the device in place instead.
58
+
59
+ [⬆ Back to ToC](#table-of-contents)
60
+
61
+ ## How it works
62
+
63
+ 1. To replace a device, edit it and change its device type first. Then, on the
64
+ Device page, click **Sync** in the header of the *Device Type* card.
65
+
66
+ ![The Sync button in the Device Type card](https://raw.githubusercontent.com/Maksym-Ototiuk/netbox-device-type-sync/main/docs/images/sync-button.png)
67
+
68
+ 2. The plugin compares the component templates of the device type with the
69
+ components of the device that have the same name, and shows:
70
+ - the device fields that NetBox copies from the device type only when a
71
+ device is created (platform, airflow, cooling method);
72
+ - for each component type, the components that exist in the device type
73
+ but not on the device — they will be created;
74
+ - for each component type, the properties that differ. Each property has a
75
+ checkbox; expand a property to see the value on the device and in the
76
+ device type for every component it differs on.
77
+
78
+ ![The sync page](https://raw.githubusercontent.com/Maksym-Ototiuk/netbox-device-type-sync/main/docs/images/sync-page.png)
79
+
80
+ 3. Check the properties to copy from the device type and click **Apply**.
81
+ - A checked property is copied to every component of that type with the
82
+ same name.
83
+ - An unchecked property keeps the value of the device.
84
+ - All checkboxes are unchecked by default: if you check nothing, only the
85
+ missing components are created.
86
+
87
+ All changes are made in one transaction. If any component fails validation,
88
+ nothing is changed and the page lists the errors. Every change is recorded in
89
+ the NetBox change log with the message `Synced with device type <name>`.
90
+
91
+ [⬆ Back to ToC](#table-of-contents)
92
+
93
+ ## What is synchronized
94
+
95
+ Only the properties that a component template defines are compared:
96
+
97
+ | Component | Properties |
98
+ | --- | --- |
99
+ | Console port, console server port | type, label, description |
100
+ | Power port | type, maximum draw, allocated draw, label, description |
101
+ | Power outlet | type, color, power port, feed leg, label, description |
102
+ | Cooling intake | type, diameter, maximum flow, label, description |
103
+ | Cooling outflow | type, diameter, cooling intake, label, description |
104
+ | Interface | type, enabled, management only, PoE mode, PoE type, wireless role, channels, channel ID, parent, bridge, label, description |
105
+ | Rear port | type, color, positions, label, description |
106
+ | Front port | type, color, positions, port mappings, label, description |
107
+ | Module bay | position, enabled, module bay types, label, description |
108
+ | Device bay | enabled, label, description |
109
+ | Inventory item | parent, component, role, manufacturer, part ID, label, description |
110
+
111
+ Device fields: **platform** (from the default platform of the device type),
112
+ **airflow** and **cooling method**. NetBox copies them from the device type
113
+ only when a device is created. A field is offered only when the device type
114
+ has a value and it differs from the device.
115
+
116
+ **Never changed:**
117
+
118
+ - cables, IP addresses, VLANs, MAC addresses, VRFs, MTU, mode, custom fields
119
+ and tags of components — a device type does not define them;
120
+ - components installed by modules;
121
+ - components that exist on the device but not in the device type;
122
+ - device fields other than the three above. Height, weight, full depth and
123
+ images are not stored on the device; NetBox always shows them from the
124
+ device type.
125
+
126
+ [⬆ Back to ToC](#table-of-contents)
127
+
128
+ ## How components are created and updated
129
+
130
+ - **Matching.** A device component matches a template with the same name.
131
+ Names with `{vc_position}` are resolved for the virtual chassis position of
132
+ the device. Inventory items are matched by their name and the names of their
133
+ parents.
134
+ - **New components** are created from the template the same way NetBox
135
+ creates them for a new device, including custom field defaults, interface
136
+ parents and bridges, power outlet power ports, front/rear port mappings and
137
+ module bay types. Like NetBox, the plugin does not copy the description of
138
+ the template to a new component; select *Description* on a later sync to
139
+ copy it.
140
+ - **Name conflicts.** If the name of a template is used by a component of an
141
+ installed module, the component is not created and the page shows a
142
+ warning.
143
+ - **Validation.** Every component is validated by NetBox before it is saved.
144
+ For example, an interface with a cable cannot become a virtual interface:
145
+ remove the cable or leave *Type* unchecked.
146
+ - **Inventory items** are deprecated since NetBox 4.3 and planned for removal.
147
+ The plugin syncs them while NetBox has them.
148
+
149
+ [⬆ Back to ToC](#table-of-contents)
150
+
151
+ ## Permissions
152
+
153
+ - The **Sync** button and the sync page require the permission to change the
154
+ device (`dcim.change_device`), including any constraints of the object
155
+ permission.
156
+ - **Apply** additionally requires the permission to add the components that
157
+ are created and to change the components that are updated (for example
158
+ `dcim.add_interface`, `dcim.change_interface`). If a permission is missing,
159
+ nothing is changed and the page names the component.
160
+
161
+ [⬆ Back to ToC](#table-of-contents)
162
+
163
+ ## Compatibility
164
+
165
+ | NetBox | netbox-device-type-sync |
166
+ | ------ | ----------------------- |
167
+ | 4.7.4 | 1.0.0 |
168
+
169
+ Every NetBox version in this table has been tested with the plugin. Versions
170
+ that are not listed are not guaranteed to work: the Sync button relies on the
171
+ internal structure of the NetBox Device page (see
172
+ [Limitations](#limitations)).
173
+
174
+ NetBox 4.7 requires Python 3.12 or later, PostgreSQL 15 or later and Redis 6
175
+ or later.
176
+
177
+ [⬆ Back to ToC](#table-of-contents)
178
+
179
+ ## Installation
180
+
181
+ 1. Install the package into the NetBox virtual environment:
182
+
183
+ ```bash
184
+ source /opt/netbox/venv/bin/activate
185
+ pip install netbox-device-type-sync
186
+ ```
187
+
188
+ To keep the plugin across NetBox upgrades, add it to
189
+ `/opt/netbox/local_requirements.txt`:
190
+
191
+ ```bash
192
+ echo netbox-device-type-sync >> /opt/netbox/local_requirements.txt
193
+ ```
194
+
195
+ 2. Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`:
196
+
197
+ ```python
198
+ PLUGINS = [
199
+ 'netbox_device_type_sync',
200
+ ]
201
+ ```
202
+
203
+ 3. Restart NetBox:
204
+
205
+ ```bash
206
+ sudo systemctl restart netbox netbox-rq
207
+ ```
208
+
209
+ The plugin has no settings and no database tables.
210
+
211
+ [⬆ Back to ToC](#table-of-contents)
212
+
213
+ ## Troubleshooting
214
+
215
+ **The Sync button is missing.**
216
+
217
+ - The button is shown only to users who may change the device.
218
+ - If nobody sees it, the plugin could not find the *Device Type* card in this
219
+ NetBox version. The plugin then logs a warning to the logger
220
+ `netbox.plugins.netbox_device_type_sync` when NetBox starts. With the
221
+ default NetBox logging configuration the warning goes to the journal of the
222
+ NetBox service:
223
+
224
+ ```bash
225
+ sudo journalctl -u netbox | grep netbox_device_type_sync
226
+ ```
227
+
228
+ The sync page itself still works:
229
+ `/plugins/device-type-sync/devices/<device ID>/sync/`.
230
+
231
+ **Apply shows errors.** Nothing was changed. Each error names the component
232
+ and the reason given by NetBox. Fix the component or leave the property
233
+ unchecked, then apply again.
234
+
235
+ [⬆ Back to ToC](#table-of-contents)
236
+
237
+ ## Limitations
238
+
239
+ - **The Sync button relies on NetBox internals.** NetBox has no plugin API to
240
+ add a button to a built-in card. The plugin adds the button to the
241
+ *Device Type* card of the Device page when NetBox starts. If a NetBox
242
+ version changes that card, the button is not shown (see
243
+ [Troubleshooting](#troubleshooting)); NetBox itself keeps working.
244
+ - **Components are matched by name.** A component that was renamed in the new
245
+ device type (for example `GigabitEthernet1/0/1` → `TenGigabitEthernet1/0/1`)
246
+ is treated as a new component; the old one, with its cable and IP
247
+ addresses, is left as it is.
248
+ - **Devices only.** Modules are not synced with their module types.
249
+
250
+ [⬆ Back to ToC](#table-of-contents)
251
+
252
+ ## Development
253
+
254
+ The tests run against a NetBox source checkout; see *Local test environment*
255
+ in [CLAUDE.md](CLAUDE.md) for the setup. Run them from the NetBox directory:
256
+
257
+ ```bash
258
+ python netbox/manage.py test netbox_device_type_sync.tests --parallel
259
+ ```
260
+
261
+ [⬆ Back to ToC](#table-of-contents)
262
+
263
+ ## License
264
+
265
+ [MIT](LICENSE)
266
+
267
+ [⬆ Back to ToC](#table-of-contents)
@@ -0,0 +1,243 @@
1
+ # NetBox Device Type Sync
2
+
3
+ A [NetBox](https://github.com/netbox-community/netbox) plugin that brings the
4
+ components of a device in line with its device type.
5
+
6
+ ## Table of Contents
7
+
8
+ - [Purpose](#purpose)
9
+ - [How it works](#how-it-works)
10
+ - [What is synchronized](#what-is-synchronized)
11
+ - [How components are created and updated](#how-components-are-created-and-updated)
12
+ - [Permissions](#permissions)
13
+ - [Compatibility](#compatibility)
14
+ - [Installation](#installation)
15
+ - [Troubleshooting](#troubleshooting)
16
+ - [Limitations](#limitations)
17
+ - [Development](#development)
18
+ - [License](#license)
19
+
20
+ ## Purpose
21
+
22
+ NetBox creates the components of a device (interfaces, ports, bays and so on)
23
+ from its device type only once, when the device is created. Later changes do
24
+ not reach the device:
25
+
26
+ - **A device is replaced by another model.** After you change the device type
27
+ of the device, its components still have the names, types and settings of
28
+ the old model.
29
+ - **A component is added to a device type.** Existing devices of that type do
30
+ not get it.
31
+
32
+ Deleting and recreating the device would lose its cables, IP addresses, VLANs
33
+ and other settings. This plugin updates the device in place instead.
34
+
35
+ [⬆ Back to ToC](#table-of-contents)
36
+
37
+ ## How it works
38
+
39
+ 1. To replace a device, edit it and change its device type first. Then, on the
40
+ Device page, click **Sync** in the header of the *Device Type* card.
41
+
42
+ ![The Sync button in the Device Type card](https://raw.githubusercontent.com/Maksym-Ototiuk/netbox-device-type-sync/main/docs/images/sync-button.png)
43
+
44
+ 2. The plugin compares the component templates of the device type with the
45
+ components of the device that have the same name, and shows:
46
+ - the device fields that NetBox copies from the device type only when a
47
+ device is created (platform, airflow, cooling method);
48
+ - for each component type, the components that exist in the device type
49
+ but not on the device — they will be created;
50
+ - for each component type, the properties that differ. Each property has a
51
+ checkbox; expand a property to see the value on the device and in the
52
+ device type for every component it differs on.
53
+
54
+ ![The sync page](https://raw.githubusercontent.com/Maksym-Ototiuk/netbox-device-type-sync/main/docs/images/sync-page.png)
55
+
56
+ 3. Check the properties to copy from the device type and click **Apply**.
57
+ - A checked property is copied to every component of that type with the
58
+ same name.
59
+ - An unchecked property keeps the value of the device.
60
+ - All checkboxes are unchecked by default: if you check nothing, only the
61
+ missing components are created.
62
+
63
+ All changes are made in one transaction. If any component fails validation,
64
+ nothing is changed and the page lists the errors. Every change is recorded in
65
+ the NetBox change log with the message `Synced with device type <name>`.
66
+
67
+ [⬆ Back to ToC](#table-of-contents)
68
+
69
+ ## What is synchronized
70
+
71
+ Only the properties that a component template defines are compared:
72
+
73
+ | Component | Properties |
74
+ | --- | --- |
75
+ | Console port, console server port | type, label, description |
76
+ | Power port | type, maximum draw, allocated draw, label, description |
77
+ | Power outlet | type, color, power port, feed leg, label, description |
78
+ | Cooling intake | type, diameter, maximum flow, label, description |
79
+ | Cooling outflow | type, diameter, cooling intake, label, description |
80
+ | Interface | type, enabled, management only, PoE mode, PoE type, wireless role, channels, channel ID, parent, bridge, label, description |
81
+ | Rear port | type, color, positions, label, description |
82
+ | Front port | type, color, positions, port mappings, label, description |
83
+ | Module bay | position, enabled, module bay types, label, description |
84
+ | Device bay | enabled, label, description |
85
+ | Inventory item | parent, component, role, manufacturer, part ID, label, description |
86
+
87
+ Device fields: **platform** (from the default platform of the device type),
88
+ **airflow** and **cooling method**. NetBox copies them from the device type
89
+ only when a device is created. A field is offered only when the device type
90
+ has a value and it differs from the device.
91
+
92
+ **Never changed:**
93
+
94
+ - cables, IP addresses, VLANs, MAC addresses, VRFs, MTU, mode, custom fields
95
+ and tags of components — a device type does not define them;
96
+ - components installed by modules;
97
+ - components that exist on the device but not in the device type;
98
+ - device fields other than the three above. Height, weight, full depth and
99
+ images are not stored on the device; NetBox always shows them from the
100
+ device type.
101
+
102
+ [⬆ Back to ToC](#table-of-contents)
103
+
104
+ ## How components are created and updated
105
+
106
+ - **Matching.** A device component matches a template with the same name.
107
+ Names with `{vc_position}` are resolved for the virtual chassis position of
108
+ the device. Inventory items are matched by their name and the names of their
109
+ parents.
110
+ - **New components** are created from the template the same way NetBox
111
+ creates them for a new device, including custom field defaults, interface
112
+ parents and bridges, power outlet power ports, front/rear port mappings and
113
+ module bay types. Like NetBox, the plugin does not copy the description of
114
+ the template to a new component; select *Description* on a later sync to
115
+ copy it.
116
+ - **Name conflicts.** If the name of a template is used by a component of an
117
+ installed module, the component is not created and the page shows a
118
+ warning.
119
+ - **Validation.** Every component is validated by NetBox before it is saved.
120
+ For example, an interface with a cable cannot become a virtual interface:
121
+ remove the cable or leave *Type* unchecked.
122
+ - **Inventory items** are deprecated since NetBox 4.3 and planned for removal.
123
+ The plugin syncs them while NetBox has them.
124
+
125
+ [⬆ Back to ToC](#table-of-contents)
126
+
127
+ ## Permissions
128
+
129
+ - The **Sync** button and the sync page require the permission to change the
130
+ device (`dcim.change_device`), including any constraints of the object
131
+ permission.
132
+ - **Apply** additionally requires the permission to add the components that
133
+ are created and to change the components that are updated (for example
134
+ `dcim.add_interface`, `dcim.change_interface`). If a permission is missing,
135
+ nothing is changed and the page names the component.
136
+
137
+ [⬆ Back to ToC](#table-of-contents)
138
+
139
+ ## Compatibility
140
+
141
+ | NetBox | netbox-device-type-sync |
142
+ | ------ | ----------------------- |
143
+ | 4.7.4 | 1.0.0 |
144
+
145
+ Every NetBox version in this table has been tested with the plugin. Versions
146
+ that are not listed are not guaranteed to work: the Sync button relies on the
147
+ internal structure of the NetBox Device page (see
148
+ [Limitations](#limitations)).
149
+
150
+ NetBox 4.7 requires Python 3.12 or later, PostgreSQL 15 or later and Redis 6
151
+ or later.
152
+
153
+ [⬆ Back to ToC](#table-of-contents)
154
+
155
+ ## Installation
156
+
157
+ 1. Install the package into the NetBox virtual environment:
158
+
159
+ ```bash
160
+ source /opt/netbox/venv/bin/activate
161
+ pip install netbox-device-type-sync
162
+ ```
163
+
164
+ To keep the plugin across NetBox upgrades, add it to
165
+ `/opt/netbox/local_requirements.txt`:
166
+
167
+ ```bash
168
+ echo netbox-device-type-sync >> /opt/netbox/local_requirements.txt
169
+ ```
170
+
171
+ 2. Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`:
172
+
173
+ ```python
174
+ PLUGINS = [
175
+ 'netbox_device_type_sync',
176
+ ]
177
+ ```
178
+
179
+ 3. Restart NetBox:
180
+
181
+ ```bash
182
+ sudo systemctl restart netbox netbox-rq
183
+ ```
184
+
185
+ The plugin has no settings and no database tables.
186
+
187
+ [⬆ Back to ToC](#table-of-contents)
188
+
189
+ ## Troubleshooting
190
+
191
+ **The Sync button is missing.**
192
+
193
+ - The button is shown only to users who may change the device.
194
+ - If nobody sees it, the plugin could not find the *Device Type* card in this
195
+ NetBox version. The plugin then logs a warning to the logger
196
+ `netbox.plugins.netbox_device_type_sync` when NetBox starts. With the
197
+ default NetBox logging configuration the warning goes to the journal of the
198
+ NetBox service:
199
+
200
+ ```bash
201
+ sudo journalctl -u netbox | grep netbox_device_type_sync
202
+ ```
203
+
204
+ The sync page itself still works:
205
+ `/plugins/device-type-sync/devices/<device ID>/sync/`.
206
+
207
+ **Apply shows errors.** Nothing was changed. Each error names the component
208
+ and the reason given by NetBox. Fix the component or leave the property
209
+ unchecked, then apply again.
210
+
211
+ [⬆ Back to ToC](#table-of-contents)
212
+
213
+ ## Limitations
214
+
215
+ - **The Sync button relies on NetBox internals.** NetBox has no plugin API to
216
+ add a button to a built-in card. The plugin adds the button to the
217
+ *Device Type* card of the Device page when NetBox starts. If a NetBox
218
+ version changes that card, the button is not shown (see
219
+ [Troubleshooting](#troubleshooting)); NetBox itself keeps working.
220
+ - **Components are matched by name.** A component that was renamed in the new
221
+ device type (for example `GigabitEthernet1/0/1` → `TenGigabitEthernet1/0/1`)
222
+ is treated as a new component; the old one, with its cable and IP
223
+ addresses, is left as it is.
224
+ - **Devices only.** Modules are not synced with their module types.
225
+
226
+ [⬆ Back to ToC](#table-of-contents)
227
+
228
+ ## Development
229
+
230
+ The tests run against a NetBox source checkout; see *Local test environment*
231
+ in [CLAUDE.md](CLAUDE.md) for the setup. Run them from the NetBox directory:
232
+
233
+ ```bash
234
+ python netbox/manage.py test netbox_device_type_sync.tests --parallel
235
+ ```
236
+
237
+ [⬆ Back to ToC](#table-of-contents)
238
+
239
+ ## License
240
+
241
+ [MIT](LICENSE)
242
+
243
+ [⬆ Back to ToC](#table-of-contents)
@@ -0,0 +1,23 @@
1
+ from netbox.plugins import PluginConfig
2
+
3
+ from .version import __version__
4
+
5
+
6
+ class NetBoxDeviceTypeSyncConfig(PluginConfig):
7
+ name = 'netbox_device_type_sync'
8
+ verbose_name = 'NetBox Device Type Sync'
9
+ version = __version__
10
+ description = 'Sync the components of a NetBox device with its device type.'
11
+ author = 'Maksym Ototiuk'
12
+ author_email = 'pypi@masik.slmail.me'
13
+ base_url = 'device-type-sync'
14
+ min_version = '4.7.4'
15
+
16
+ def ready(self):
17
+ super().ready()
18
+ from .ui import add_sync_button
19
+
20
+ add_sync_button()
21
+
22
+
23
+ config = NetBoxDeviceTypeSyncConfig