napalm-device-types 0.1.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.
@@ -0,0 +1,191 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other transformations
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and incorporated
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combined Contribution(s) and the Work
78
+ to which such Contribution(s) was submitted. If You institute patent
79
+ litigation against any entity (including a cross-claim or counterclaim
80
+ in a lawsuit) alleging that the Work or any Contribution embodied
81
+ within the Work constitutes direct or contributory patent infringement,
82
+ then any patent licenses granted to You under this License for that
83
+ Work shall terminate as of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the
86
+ Work or Derivative Works thereof in any medium, with or without
87
+ modifications, and in Source or Object form, provided that You
88
+ meet the following conditions:
89
+
90
+ (a) You must give any other recipients of the Work or Derivative
91
+ Works a copy of this License; and
92
+
93
+ (b) You must cause any modified files to carry prominent notices
94
+ stating that You changed the files; and
95
+
96
+ (c) You must retain, in the Source form of any Derivative Works
97
+ that You distribute, all copyright, patent, trademark, and
98
+ attribution notices from the Source form of the Work,
99
+ excluding those notices that do not pertain to any part of
100
+ the Derivative Works; and
101
+
102
+ (d) If the Work includes a "NOTICE" text file as part of its
103
+ distribution, You must include a readable copy of the
104
+ attribution notices contained within such NOTICE file, in
105
+ at least one of the following places: within a NOTICE text file
106
+ distributed as part of the Derivative Works; within the Source
107
+ form or documentation, if provided along with the Derivative
108
+ Works; or, within a display generated by the Derivative Works,
109
+ if and wherever such third-party notices normally appear. The
110
+ contents of the NOTICE file are for informational purposes only
111
+ and do not modify the License. You may add Your own attribution
112
+ notices within Derivative Works that You distribute, alongside
113
+ or as an addendum to the NOTICE text from the Work, provided
114
+ that such additional attribution notices cannot be construed
115
+ as modifying the License.
116
+
117
+ You may add Your own license statement for Your modifications and
118
+ may provide additional grant of rights to use, copy, modify, merge,
119
+ publish, distribute, sublicense, and/or sell copies of the Work,
120
+ and to permit persons to whom the Work is furnished to do so,
121
+ subject to the following conditions:
122
+
123
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
124
+ any Contribution intentionally submitted for inclusion in the Work
125
+ by You to the Licensor shall be under the terms and conditions of
126
+ this License, without any additional terms or conditions.
127
+ Notwithstanding the above, nothing herein shall supersede or modify
128
+ the terms of any separate license agreement you may have executed
129
+ with Licensor regarding such Contributions.
130
+
131
+ 6. Trademarks. This License does not grant permission to use the trade
132
+ names, trademarks, service marks, or product names of the Licensor,
133
+ except as required for reasonable and customary use in describing the
134
+ origin of the Work and reproducing the content of the NOTICE file.
135
+
136
+ 7. Disclaimer of Warranty. Unless required by applicable law or
137
+ agreed to in writing, Licensor provides the Work (and each
138
+ Contributor provides its Contributions) on an "AS IS" BASIS,
139
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
140
+ implied, including, without limitation, any conditions of TITLE,
141
+ MERCHANTIBILITY, or FITNESS FOR A PARTICULAR PURPOSE.
142
+ See the License for the specific language governing permissions and
143
+ limitations under the License.
144
+
145
+ 8. Limitation of Liability. In no event and under no legal theory,
146
+ whether in tort (including negligence), contract, or otherwise,
147
+ unless required by applicable law (such as deliberate and grossly
148
+ negligent acts) or agreed to in writing, shall any Contributor be
149
+ liable to You for damages, including any direct, indirect, special,
150
+ incidental, or exemplary damages of any character arising as a
151
+ result of this License or out of the use or inability to use the
152
+ Work (even if such Contributor has been advised of the possibility
153
+ of such damages).
154
+
155
+ 9. Accepting Warranty or Additional Liability. While redistributing
156
+ the Work or Derivative Works thereof, You may choose to offer,
157
+ and charge a fee for, acceptance of support, warranty, indemnity,
158
+ or other liability obligations and/or rights consistent with this
159
+ License. However, in accepting such obligations, You may offer only
160
+ conditions consistent with this License, subject to the following
161
+ additional conditions:
162
+
163
+ (a) You may offer additional warranty, indemnity, or other liability
164
+ terms and conditions; and
165
+
166
+ (b) You may offer support for the Work in return for a fee.
167
+
168
+ END OF TERMS AND CONDITIONS
169
+
170
+ APPENDIX: How to apply the Apache License to your work.
171
+
172
+ To apply the Apache License to your work, attach the following
173
+ boilerplate notice, with the fields enclosed by brackets "[]"
174
+ replaced with your own identifying information. (Don't include
175
+ the brackets!) The text should be enclosed in the appropriate
176
+ comment syntax for the file format in question. It may also be
177
+ possible to make it available with a creative commons license.
178
+
179
+ Copyright 2026 Christian Manivong
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: napalm-device-types
3
+ Version: 0.1.0
4
+ Summary: Abstract device-type base classes for NAPALM drivers
5
+ Author-email: Christian Manivong <christian@manivong.de>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/chrismanivong/napalm-device-types
8
+ Project-URL: Repository, https://github.com/chrismanivong/napalm-device-types
9
+ Project-URL: Issues, https://github.com/chrismanivong/napalm-device-types/issues
10
+ Keywords: napalm,network,automation,driver,access-point,switch,firewall,hypervisor,storage,nas
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: System :: Networking
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: napalm>=4.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest; extra == "dev"
30
+ Requires-Dist: mypy; extra == "dev"
31
+ Requires-Dist: build; extra == "dev"
32
+ Requires-Dist: twine; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # napalm-device-types
36
+
37
+ Abstract intermediate device-type base classes for [NAPALM](https://napalm.readthedocs.io/) drivers.
38
+
39
+ Instead of inheriting directly from `napalm.base.NetworkDriver`, a driver can inherit from one of the device-type classes here to gain a richer, type-specific contract:
40
+
41
+ ```python
42
+ # without napalm-device-types
43
+ class OpenWrtDriver(NetworkDriver):
44
+ ...
45
+
46
+ # with napalm-device-types
47
+ from napalm_device_types import AccessPointDriver
48
+
49
+ class OpenWrtDriver(AccessPointDriver):
50
+ ...
51
+ ```
52
+
53
+ ## Why?
54
+
55
+ NAPALM's `NetworkDriver` defines a common interface for all network devices. In practice, devices fall into distinct categories with very different capabilities. A switch exposes spanning-tree and PoE data; a firewall exposes NAT tables and VPN tunnels; a NAS exposes disk pools and shares. Writing these methods directly in a concrete driver mixes concerns and makes drivers harder to discover and compare.
56
+
57
+ `napalm-device-types` sits in between: it adds one well-typed layer of abstract methods per device category, so every driver for the same category exposes the same interface.
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ pip install napalm-device-types
63
+ ```
64
+
65
+ Requires Python ≥ 3.9 and NAPALM ≥ 4.0.
66
+
67
+ ## Available base classes
68
+
69
+ | Class | Target devices | Example implementations |
70
+ |---|---|---|
71
+ | `AccessPointDriver` | Wireless access points | OpenWrt, Ubiquiti UniFi, Cisco Meraki AP |
72
+ | `SwitchDriver` | Ethernet switches | Cisco IOS, Arista EOS, Juniper EX |
73
+ | `FirewallDriver` | Firewalls & UTM appliances | pfSense, Fortinet FortiOS, Cisco ASA |
74
+ | `HypervisorDriver` | Hypervisors & virtualisation platforms | Proxmox VE, VMware ESXi, KVM/libvirt |
75
+ | `StorageDriver` | Storage appliances & NAS/SAN | TrueNAS, Synology DSM, QNAP QTS |
76
+
77
+ ## Usage
78
+
79
+ ### Access Point
80
+
81
+ ```python
82
+ from napalm_device_types import AccessPointDriver
83
+
84
+ class OpenWrtDriver(AccessPointDriver):
85
+
86
+ def get_wireless_clients(self):
87
+ # return List[WirelessClientDict]
88
+ ...
89
+
90
+ def get_ssids(self):
91
+ # return Dict[str, SSIDDict]
92
+ ...
93
+ ```
94
+
95
+ ### Switch
96
+
97
+ ```python
98
+ from napalm_device_types import SwitchDriver
99
+
100
+ class CiscoIOSDriver(SwitchDriver):
101
+
102
+ def get_spanning_tree(self):
103
+ # return Dict[str, SpanningTreeDict]
104
+ ...
105
+
106
+ def get_poe_status(self):
107
+ # return PoESummaryDict
108
+ ...
109
+ ```
110
+
111
+ ### Firewall
112
+
113
+ ```python
114
+ from napalm_device_types import FirewallDriver
115
+
116
+ class PfSenseDriver(FirewallDriver):
117
+
118
+ def get_nat_translations(self):
119
+ # return List[NATTranslationDict]
120
+ ...
121
+
122
+ def get_vpn_tunnels(self):
123
+ # return Dict[str, VPNTunnelDict]
124
+ ...
125
+ ```
126
+
127
+ ### Hypervisor
128
+
129
+ ```python
130
+ from napalm_device_types import HypervisorDriver
131
+
132
+ class ProxmoxDriver(HypervisorDriver):
133
+
134
+ def get_vms(self):
135
+ # return List[VMDict]
136
+ ...
137
+
138
+ def snapshot_create(self, name, snapshot, description="", include_memory=False):
139
+ ...
140
+ ```
141
+
142
+ ### Storage / NAS
143
+
144
+ ```python
145
+ from napalm_device_types import StorageDriver
146
+
147
+ class TrueNASDriver(StorageDriver):
148
+
149
+ def get_disks(self):
150
+ # return List[PhysicalDiskDict]
151
+ ...
152
+
153
+ def get_shares(self):
154
+ # return Dict[str, NASShareDict]
155
+ ...
156
+ ```
157
+
158
+ ## Return types
159
+
160
+ All return types are `TypedDict` classes defined in `napalm_device_types.models`. Import them directly for type annotations in your driver:
161
+
162
+ ```python
163
+ from napalm_device_types.models import (
164
+ PhysicalDiskDict,
165
+ DiskPoolDict,
166
+ NASShareDict,
167
+ VolumeSnapshotDict,
168
+ )
169
+ ```
170
+
171
+ ## Development
172
+
173
+ ```bash
174
+ git clone https://github.com/chrismanivong/napalm-device-types.git
175
+ cd napalm-device-types
176
+ pip install -e ".[dev]"
177
+ ```
178
+
179
+ Run type-checking:
180
+
181
+ ```bash
182
+ mypy napalm_device_types
183
+ ```
184
+
185
+ ## Contributing
186
+
187
+ 1. Fork the repository
188
+ 2. Create a feature branch (`git checkout -b feature/router-driver`)
189
+ 3. Implement your changes
190
+ 4. Open a Pull Request
191
+
192
+ ## License
193
+
194
+ Apache-2.0 – see [LICENSE](LICENSE) for details.
@@ -0,0 +1,160 @@
1
+ # napalm-device-types
2
+
3
+ Abstract intermediate device-type base classes for [NAPALM](https://napalm.readthedocs.io/) drivers.
4
+
5
+ Instead of inheriting directly from `napalm.base.NetworkDriver`, a driver can inherit from one of the device-type classes here to gain a richer, type-specific contract:
6
+
7
+ ```python
8
+ # without napalm-device-types
9
+ class OpenWrtDriver(NetworkDriver):
10
+ ...
11
+
12
+ # with napalm-device-types
13
+ from napalm_device_types import AccessPointDriver
14
+
15
+ class OpenWrtDriver(AccessPointDriver):
16
+ ...
17
+ ```
18
+
19
+ ## Why?
20
+
21
+ NAPALM's `NetworkDriver` defines a common interface for all network devices. In practice, devices fall into distinct categories with very different capabilities. A switch exposes spanning-tree and PoE data; a firewall exposes NAT tables and VPN tunnels; a NAS exposes disk pools and shares. Writing these methods directly in a concrete driver mixes concerns and makes drivers harder to discover and compare.
22
+
23
+ `napalm-device-types` sits in between: it adds one well-typed layer of abstract methods per device category, so every driver for the same category exposes the same interface.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install napalm-device-types
29
+ ```
30
+
31
+ Requires Python ≥ 3.9 and NAPALM ≥ 4.0.
32
+
33
+ ## Available base classes
34
+
35
+ | Class | Target devices | Example implementations |
36
+ |---|---|---|
37
+ | `AccessPointDriver` | Wireless access points | OpenWrt, Ubiquiti UniFi, Cisco Meraki AP |
38
+ | `SwitchDriver` | Ethernet switches | Cisco IOS, Arista EOS, Juniper EX |
39
+ | `FirewallDriver` | Firewalls & UTM appliances | pfSense, Fortinet FortiOS, Cisco ASA |
40
+ | `HypervisorDriver` | Hypervisors & virtualisation platforms | Proxmox VE, VMware ESXi, KVM/libvirt |
41
+ | `StorageDriver` | Storage appliances & NAS/SAN | TrueNAS, Synology DSM, QNAP QTS |
42
+
43
+ ## Usage
44
+
45
+ ### Access Point
46
+
47
+ ```python
48
+ from napalm_device_types import AccessPointDriver
49
+
50
+ class OpenWrtDriver(AccessPointDriver):
51
+
52
+ def get_wireless_clients(self):
53
+ # return List[WirelessClientDict]
54
+ ...
55
+
56
+ def get_ssids(self):
57
+ # return Dict[str, SSIDDict]
58
+ ...
59
+ ```
60
+
61
+ ### Switch
62
+
63
+ ```python
64
+ from napalm_device_types import SwitchDriver
65
+
66
+ class CiscoIOSDriver(SwitchDriver):
67
+
68
+ def get_spanning_tree(self):
69
+ # return Dict[str, SpanningTreeDict]
70
+ ...
71
+
72
+ def get_poe_status(self):
73
+ # return PoESummaryDict
74
+ ...
75
+ ```
76
+
77
+ ### Firewall
78
+
79
+ ```python
80
+ from napalm_device_types import FirewallDriver
81
+
82
+ class PfSenseDriver(FirewallDriver):
83
+
84
+ def get_nat_translations(self):
85
+ # return List[NATTranslationDict]
86
+ ...
87
+
88
+ def get_vpn_tunnels(self):
89
+ # return Dict[str, VPNTunnelDict]
90
+ ...
91
+ ```
92
+
93
+ ### Hypervisor
94
+
95
+ ```python
96
+ from napalm_device_types import HypervisorDriver
97
+
98
+ class ProxmoxDriver(HypervisorDriver):
99
+
100
+ def get_vms(self):
101
+ # return List[VMDict]
102
+ ...
103
+
104
+ def snapshot_create(self, name, snapshot, description="", include_memory=False):
105
+ ...
106
+ ```
107
+
108
+ ### Storage / NAS
109
+
110
+ ```python
111
+ from napalm_device_types import StorageDriver
112
+
113
+ class TrueNASDriver(StorageDriver):
114
+
115
+ def get_disks(self):
116
+ # return List[PhysicalDiskDict]
117
+ ...
118
+
119
+ def get_shares(self):
120
+ # return Dict[str, NASShareDict]
121
+ ...
122
+ ```
123
+
124
+ ## Return types
125
+
126
+ All return types are `TypedDict` classes defined in `napalm_device_types.models`. Import them directly for type annotations in your driver:
127
+
128
+ ```python
129
+ from napalm_device_types.models import (
130
+ PhysicalDiskDict,
131
+ DiskPoolDict,
132
+ NASShareDict,
133
+ VolumeSnapshotDict,
134
+ )
135
+ ```
136
+
137
+ ## Development
138
+
139
+ ```bash
140
+ git clone https://github.com/chrismanivong/napalm-device-types.git
141
+ cd napalm-device-types
142
+ pip install -e ".[dev]"
143
+ ```
144
+
145
+ Run type-checking:
146
+
147
+ ```bash
148
+ mypy napalm_device_types
149
+ ```
150
+
151
+ ## Contributing
152
+
153
+ 1. Fork the repository
154
+ 2. Create a feature branch (`git checkout -b feature/router-driver`)
155
+ 3. Implement your changes
156
+ 4. Open a Pull Request
157
+
158
+ ## License
159
+
160
+ Apache-2.0 – see [LICENSE](LICENSE) for details.
@@ -0,0 +1,37 @@
1
+ """
2
+ napalm-device-types
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Abstract device-type base classes for NAPALM drivers.
6
+
7
+ Instead of inheriting directly from ``napalm.base.NetworkDriver``, a driver
8
+ can inherit from one of the device-type classes defined here to gain
9
+ type-specific abstract methods and a clearer contract::
10
+
11
+ from napalm_device_types import AccessPointDriver
12
+
13
+ class OpenWrtDriver(AccessPointDriver):
14
+ ...
15
+
16
+ Available base classes:
17
+
18
+ * :class:`~napalm_device_types.access_point.AccessPointDriver`
19
+ * :class:`~napalm_device_types.switch.SwitchDriver`
20
+ * :class:`~napalm_device_types.firewall.FirewallDriver`
21
+ * :class:`~napalm_device_types.hypervisor.HypervisorDriver`
22
+ * :class:`~napalm_device_types.storage.StorageDriver`
23
+ """
24
+
25
+ from napalm_device_types.access_point import AccessPointDriver
26
+ from napalm_device_types.firewall import FirewallDriver
27
+ from napalm_device_types.hypervisor import HypervisorDriver
28
+ from napalm_device_types.storage import StorageDriver
29
+ from napalm_device_types.switch import SwitchDriver
30
+
31
+ __all__ = [
32
+ "AccessPointDriver",
33
+ "FirewallDriver",
34
+ "HypervisorDriver",
35
+ "StorageDriver",
36
+ "SwitchDriver",
37
+ ]