netbox-cisco-cer 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.
- netbox_cisco_cer-0.1.0/LICENSE +190 -0
- netbox_cisco_cer-0.1.0/PKG-INFO +97 -0
- netbox_cisco_cer-0.1.0/README.md +67 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/__init__.py +56 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/address.py +179 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/api/__init__.py +1 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/api/serializers.py +50 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/api/urls.py +10 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/api/views.py +13 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/cer_client.py +206 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/filtersets.py +31 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/forms.py +102 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/geocode.py +133 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/migrations/0001_initial.py +69 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/migrations/0002_erl_onsite_alerts.py +18 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/migrations/__init__.py +0 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/models.py +154 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/navigation.py +25 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/tables.py +34 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/templates/netbox_cisco_cer/erl.html +84 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/templates/netbox_cisco_cer/site_tab.html +200 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/urls.py +31 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer/views.py +343 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer.egg-info/PKG-INFO +97 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer.egg-info/SOURCES.txt +28 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer.egg-info/dependency_links.txt +1 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer.egg-info/requires.txt +7 -0
- netbox_cisco_cer-0.1.0/netbox_cisco_cer.egg-info/top_level.txt +1 -0
- netbox_cisco_cer-0.1.0/pyproject.toml +56 -0
- netbox_cisco_cer-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,190 @@
|
|
|
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, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 sieteunoseis
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netbox-cisco-cer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NetBox plugin for Cisco Emergency Responder - manage Conventional ERLs from NetBox Site addresses
|
|
5
|
+
Author-email: sieteunoseis <jeremy.worden@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/sieteunoseis/netbox-cisco-cer
|
|
8
|
+
Project-URL: Repository, https://github.com/sieteunoseis/netbox-cisco-cer
|
|
9
|
+
Project-URL: Issues, https://github.com/sieteunoseis/netbox-cisco-cer/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/sieteunoseis/netbox-cisco-cer/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: netbox,cisco,cer,emergency-responder,e911,erl,plugin
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.28.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: black; extra == "dev"
|
|
26
|
+
Requires-Dist: flake8; extra == "dev"
|
|
27
|
+
Requires-Dist: isort; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# NetBox Cisco CER
|
|
32
|
+
|
|
33
|
+
NetBox plugin for Cisco Emergency Responder (CER). Keeps Conventional ERL records in NetBox, tied to Sites, and pushes them to CER through its REST API.
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- **ERL model**: Site, ERL name, ELIN and route pattern, ALI address fields, status. Includes list, filter, CSV import, REST API and change log.
|
|
38
|
+
- **Site tab ("Cisco CER")**:
|
|
39
|
+
- lists the ERLs linked to the Site;
|
|
40
|
+
- checks whether each is in CER's Conventional ERL list and whether the address matches;
|
|
41
|
+
- **Push / Update CER** sends the ERL to CER;
|
|
42
|
+
- **New ERL from site address** opens the add form prefilled from the Site's physical address;
|
|
43
|
+
- **Link existing ERL** searches CER's Conventional ERLs by name, address or location. Address matches to the Site are suggested even when names differ.
|
|
44
|
+
|
|
45
|
+
### National E911 workflow
|
|
46
|
+
|
|
47
|
+
Cisco has no API for National E911 ERLs. As a workaround:
|
|
48
|
+
|
|
49
|
+
1. Create the ERL in NetBox and push it to CER as a Conventional ERL. Before step 2, give it a unique ELIN, either in NetBox or in the CER web page.
|
|
50
|
+
2. In CER, run **Migrate to National E911 Service Provider ERL**.
|
|
51
|
+
3. CER removes the Conventional ERL after migration. Set the NetBox record's status to *Migrated*.
|
|
52
|
+
|
|
53
|
+
## CER API notes
|
|
54
|
+
|
|
55
|
+
- `GET /cerappservices/service/cerl` returns every Conventional ERL. `?erlName=` is ignored.
|
|
56
|
+
- Failures come back as HTTP 200 with `"status": "Failure"`.
|
|
57
|
+
- Each ERL needs a unique ELIN, and the CER migration wizard fails without one. Pushing without an ELIN is allowed.
|
|
58
|
+
- The JSON GET drops the last character of `RoutePattern` (`#911` comes back as `#91`). The plugin reads route patterns from `/cerappservices/export/conventionalerl/info` instead.
|
|
59
|
+
- Onsite alert IDs come back padded with spaces.
|
|
60
|
+
- ALI Comments are limited to 30 characters. The plugin writes `NetBox site <id>` there.
|
|
61
|
+
- CER needs legacy TLS ciphers. The client uses `DEFAULT@SECLEVEL=0`.
|
|
62
|
+
- The CER application user needs the API role.
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
PLUGINS = ["netbox_cisco_cer"]
|
|
68
|
+
PLUGINS_CONFIG = {
|
|
69
|
+
"netbox_cisco_cer": {
|
|
70
|
+
"cer_host": "cer.example.com",
|
|
71
|
+
"cer_username": "api-user",
|
|
72
|
+
"cer_password": "...",
|
|
73
|
+
"verify_ssl": False,
|
|
74
|
+
"default_route_pattern": "#911",
|
|
75
|
+
"default_onsite_alerts": ["PublicSafety"],
|
|
76
|
+
"tab_weight": 9008,
|
|
77
|
+
"default_time_zone": "America/Los_Angeles",
|
|
78
|
+
"default_cos": "Business PBX",
|
|
79
|
+
"default_tos": "FX in 911 area",
|
|
80
|
+
"default_customer_name": "",
|
|
81
|
+
"default_company_id": "",
|
|
82
|
+
"default_customer_code": "",
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then run `manage.py migrate`.
|
|
88
|
+
|
|
89
|
+
## Support
|
|
90
|
+
|
|
91
|
+
If you find this plugin helpful, consider supporting development:
|
|
92
|
+
|
|
93
|
+
[](https://buymeacoffee.com/automatebldrs)
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Apache-2.0
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# NetBox Cisco CER
|
|
2
|
+
|
|
3
|
+
NetBox plugin for Cisco Emergency Responder (CER). Keeps Conventional ERL records in NetBox, tied to Sites, and pushes them to CER through its REST API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **ERL model**: Site, ERL name, ELIN and route pattern, ALI address fields, status. Includes list, filter, CSV import, REST API and change log.
|
|
8
|
+
- **Site tab ("Cisco CER")**:
|
|
9
|
+
- lists the ERLs linked to the Site;
|
|
10
|
+
- checks whether each is in CER's Conventional ERL list and whether the address matches;
|
|
11
|
+
- **Push / Update CER** sends the ERL to CER;
|
|
12
|
+
- **New ERL from site address** opens the add form prefilled from the Site's physical address;
|
|
13
|
+
- **Link existing ERL** searches CER's Conventional ERLs by name, address or location. Address matches to the Site are suggested even when names differ.
|
|
14
|
+
|
|
15
|
+
### National E911 workflow
|
|
16
|
+
|
|
17
|
+
Cisco has no API for National E911 ERLs. As a workaround:
|
|
18
|
+
|
|
19
|
+
1. Create the ERL in NetBox and push it to CER as a Conventional ERL. Before step 2, give it a unique ELIN, either in NetBox or in the CER web page.
|
|
20
|
+
2. In CER, run **Migrate to National E911 Service Provider ERL**.
|
|
21
|
+
3. CER removes the Conventional ERL after migration. Set the NetBox record's status to *Migrated*.
|
|
22
|
+
|
|
23
|
+
## CER API notes
|
|
24
|
+
|
|
25
|
+
- `GET /cerappservices/service/cerl` returns every Conventional ERL. `?erlName=` is ignored.
|
|
26
|
+
- Failures come back as HTTP 200 with `"status": "Failure"`.
|
|
27
|
+
- Each ERL needs a unique ELIN, and the CER migration wizard fails without one. Pushing without an ELIN is allowed.
|
|
28
|
+
- The JSON GET drops the last character of `RoutePattern` (`#911` comes back as `#91`). The plugin reads route patterns from `/cerappservices/export/conventionalerl/info` instead.
|
|
29
|
+
- Onsite alert IDs come back padded with spaces.
|
|
30
|
+
- ALI Comments are limited to 30 characters. The plugin writes `NetBox site <id>` there.
|
|
31
|
+
- CER needs legacy TLS ciphers. The client uses `DEFAULT@SECLEVEL=0`.
|
|
32
|
+
- The CER application user needs the API role.
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
PLUGINS = ["netbox_cisco_cer"]
|
|
38
|
+
PLUGINS_CONFIG = {
|
|
39
|
+
"netbox_cisco_cer": {
|
|
40
|
+
"cer_host": "cer.example.com",
|
|
41
|
+
"cer_username": "api-user",
|
|
42
|
+
"cer_password": "...",
|
|
43
|
+
"verify_ssl": False,
|
|
44
|
+
"default_route_pattern": "#911",
|
|
45
|
+
"default_onsite_alerts": ["PublicSafety"],
|
|
46
|
+
"tab_weight": 9008,
|
|
47
|
+
"default_time_zone": "America/Los_Angeles",
|
|
48
|
+
"default_cos": "Business PBX",
|
|
49
|
+
"default_tos": "FX in 911 area",
|
|
50
|
+
"default_customer_name": "",
|
|
51
|
+
"default_company_id": "",
|
|
52
|
+
"default_customer_code": "",
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Then run `manage.py migrate`.
|
|
58
|
+
|
|
59
|
+
## Support
|
|
60
|
+
|
|
61
|
+
If you find this plugin helpful, consider supporting development:
|
|
62
|
+
|
|
63
|
+
[](https://buymeacoffee.com/automatebldrs)
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
Apache-2.0
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""
|
|
2
|
+
NetBox Cisco CER Plugin
|
|
3
|
+
|
|
4
|
+
Manage Cisco Emergency Responder (CER) Conventional ERLs from NetBox Site addresses.
|
|
5
|
+
ERL records live in NetBox, are pushed to CER via its REST API, and can be linked
|
|
6
|
+
to Conventional ERLs that already exist in CER.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from netbox.plugins import PluginConfig
|
|
10
|
+
|
|
11
|
+
__version__ = "0.1.0"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CiscoCERConfig(PluginConfig):
|
|
15
|
+
"""Plugin configuration for NetBox Cisco CER integration."""
|
|
16
|
+
|
|
17
|
+
name = "netbox_cisco_cer"
|
|
18
|
+
verbose_name = "Cisco CER"
|
|
19
|
+
description = "Manage Cisco Emergency Responder Conventional ERLs from NetBox Sites"
|
|
20
|
+
version = __version__
|
|
21
|
+
author = "Jeremy Worden"
|
|
22
|
+
author_email = "jeremy.worden@gmail.com"
|
|
23
|
+
base_url = "cisco-cer"
|
|
24
|
+
min_version = "4.7.4"
|
|
25
|
+
max_version = "5.99"
|
|
26
|
+
|
|
27
|
+
required_settings = []
|
|
28
|
+
|
|
29
|
+
default_settings = {
|
|
30
|
+
# CER publisher, e.g. "cer.example.com" (https is assumed)
|
|
31
|
+
"cer_host": "",
|
|
32
|
+
"cer_username": "",
|
|
33
|
+
"cer_password": "",
|
|
34
|
+
"timeout": 30,
|
|
35
|
+
# Seconds to cache the Conventional ERL list
|
|
36
|
+
"cache_timeout": 60,
|
|
37
|
+
"verify_ssl": False,
|
|
38
|
+
# Site tab position among other plugin tabs (lower = further left)
|
|
39
|
+
"tab_weight": 9008,
|
|
40
|
+
# Defaults applied to new ERL records (all editable per ERL)
|
|
41
|
+
"default_route_pattern": "#911",
|
|
42
|
+
# Onsite Alert IDs always attached to every ERL pushed to CER, e.g. ["PublicSafety"]
|
|
43
|
+
"default_onsite_alerts": [],
|
|
44
|
+
"default_time_zone": "America/Los_Angeles",
|
|
45
|
+
"default_cos": "Business PBX",
|
|
46
|
+
"default_tos": "FX in 911 area",
|
|
47
|
+
"default_customer_name": "",
|
|
48
|
+
"default_company_id": "",
|
|
49
|
+
"default_customer_code": "",
|
|
50
|
+
# Address lookup for Sites without an address (US Census + OpenStreetMap Nominatim)
|
|
51
|
+
"geocoder_countrycodes": "us",
|
|
52
|
+
"geocoder_user_agent": "", # defaults to "netbox-cisco-cer/<version>"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
config = CiscoCERConfig
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""Split a free-text US street address into CER ALI fields and compare addresses."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
DIRECTIONALS = {
|
|
6
|
+
"N": "N",
|
|
7
|
+
"NORTH": "N",
|
|
8
|
+
"S": "S",
|
|
9
|
+
"SOUTH": "S",
|
|
10
|
+
"E": "E",
|
|
11
|
+
"EAST": "E",
|
|
12
|
+
"W": "W",
|
|
13
|
+
"WEST": "W",
|
|
14
|
+
"NE": "NE",
|
|
15
|
+
"NORTHEAST": "NE",
|
|
16
|
+
"NW": "NW",
|
|
17
|
+
"NORTHWEST": "NW",
|
|
18
|
+
"SE": "SE",
|
|
19
|
+
"SOUTHEAST": "SE",
|
|
20
|
+
"SW": "SW",
|
|
21
|
+
"SOUTHWEST": "SW",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# USPS Publication 28 street suffix abbreviations (common subset)
|
|
25
|
+
STREET_SUFFIXES = {
|
|
26
|
+
"ALLEY": "ALY",
|
|
27
|
+
"AVENUE": "AVE",
|
|
28
|
+
"AVE": "AVE",
|
|
29
|
+
"BOULEVARD": "BLVD",
|
|
30
|
+
"BLVD": "BLVD",
|
|
31
|
+
"CIRCLE": "CIR",
|
|
32
|
+
"CIR": "CIR",
|
|
33
|
+
"COURT": "CT",
|
|
34
|
+
"CT": "CT",
|
|
35
|
+
"DRIVE": "DR",
|
|
36
|
+
"DR": "DR",
|
|
37
|
+
"HIGHWAY": "HWY",
|
|
38
|
+
"HWY": "HWY",
|
|
39
|
+
"LANE": "LN",
|
|
40
|
+
"LN": "LN",
|
|
41
|
+
"LOOP": "LOOP",
|
|
42
|
+
"PARKWAY": "PKWY",
|
|
43
|
+
"PKWY": "PKWY",
|
|
44
|
+
"PLACE": "PL",
|
|
45
|
+
"PL": "PL",
|
|
46
|
+
"ROAD": "RD",
|
|
47
|
+
"RD": "RD",
|
|
48
|
+
"SQUARE": "SQ",
|
|
49
|
+
"SQ": "SQ",
|
|
50
|
+
"STREET": "ST",
|
|
51
|
+
"ST": "ST",
|
|
52
|
+
"TERRACE": "TER",
|
|
53
|
+
"TER": "TER",
|
|
54
|
+
"TRAIL": "TRL",
|
|
55
|
+
"TRL": "TRL",
|
|
56
|
+
"WAY": "WAY",
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
_LINE_RE = re.compile(r"^\s*(?P<house>\d+)(?P<suffix>[A-Z])?\s+(?P<street>.+?)\s*$", re.IGNORECASE)
|
|
60
|
+
_CITY_RE = re.compile(r"^\s*(?P<city>.+?)\s*,?\s+(?P<state>[A-Z]{2})\s+(?P<zip>\d{5})(?:-(?P<zip4>\d{4}))?\s*$", re.I)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def parse_address(text):
|
|
64
|
+
"""Best-effort parse of "579 SW Campus Drive, Portland, OR 97239".
|
|
65
|
+
|
|
66
|
+
Returns a dict of model field names; unparsed parts are left blank for the user to fill in.
|
|
67
|
+
"""
|
|
68
|
+
result = {
|
|
69
|
+
"house_number": "",
|
|
70
|
+
"house_number_suffix": "",
|
|
71
|
+
"prefix_directional": "",
|
|
72
|
+
"street_name": "",
|
|
73
|
+
"street_suffix": "",
|
|
74
|
+
"post_directional": "",
|
|
75
|
+
"community_name": "",
|
|
76
|
+
"state": "",
|
|
77
|
+
"zip_code": "",
|
|
78
|
+
"zip_code_ext": "",
|
|
79
|
+
}
|
|
80
|
+
if not text:
|
|
81
|
+
return result
|
|
82
|
+
|
|
83
|
+
lines = [p.strip() for p in re.split(r"[\n,]", text) if p.strip()]
|
|
84
|
+
if not lines:
|
|
85
|
+
return result
|
|
86
|
+
|
|
87
|
+
# City / state / zip: try the last one or two comma-separated parts
|
|
88
|
+
tail = None
|
|
89
|
+
if len(lines) >= 3:
|
|
90
|
+
tail = f"{lines[-2]} {lines[-1]}"
|
|
91
|
+
street_parts = lines[:-2]
|
|
92
|
+
elif len(lines) == 2:
|
|
93
|
+
tail = lines[-1]
|
|
94
|
+
street_parts = lines[:-1]
|
|
95
|
+
else:
|
|
96
|
+
street_parts = lines
|
|
97
|
+
if tail:
|
|
98
|
+
m = _CITY_RE.match(tail)
|
|
99
|
+
if m:
|
|
100
|
+
result["community_name"] = m.group("city").strip()
|
|
101
|
+
result["state"] = m.group("state").upper()
|
|
102
|
+
result["zip_code"] = m.group("zip")
|
|
103
|
+
result["zip_code_ext"] = m.group("zip4") or ""
|
|
104
|
+
|
|
105
|
+
m = _LINE_RE.match(street_parts[0])
|
|
106
|
+
if not m:
|
|
107
|
+
result["street_name"] = street_parts[0]
|
|
108
|
+
return result
|
|
109
|
+
|
|
110
|
+
result["house_number"] = m.group("house")
|
|
111
|
+
result["house_number_suffix"] = (m.group("suffix") or "").upper()
|
|
112
|
+
words = m.group("street").split()
|
|
113
|
+
|
|
114
|
+
if len(words) > 1 and words[0].upper().rstrip(".") in DIRECTIONALS:
|
|
115
|
+
result["prefix_directional"] = DIRECTIONALS[words.pop(0).upper().rstrip(".")]
|
|
116
|
+
if len(words) > 1 and words[-1].upper().rstrip(".") in DIRECTIONALS:
|
|
117
|
+
result["post_directional"] = DIRECTIONALS[words.pop().upper().rstrip(".")]
|
|
118
|
+
if len(words) > 1 and words[-1].upper().rstrip(".") in STREET_SUFFIXES:
|
|
119
|
+
result["street_suffix"] = STREET_SUFFIXES[words.pop().upper().rstrip(".")]
|
|
120
|
+
result["street_name"] = " ".join(words)
|
|
121
|
+
return result
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _norm(value):
|
|
125
|
+
return re.sub(r"\s+", " ", str(value or "")).strip().upper()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def address_key(fields):
|
|
129
|
+
"""Comparable key from a dict of model-style address fields."""
|
|
130
|
+
suffix = _norm(fields.get("street_suffix"))
|
|
131
|
+
return (
|
|
132
|
+
_norm(fields.get("house_number")),
|
|
133
|
+
_norm(fields.get("house_number_suffix")),
|
|
134
|
+
DIRECTIONALS.get(_norm(fields.get("prefix_directional")), _norm(fields.get("prefix_directional"))),
|
|
135
|
+
_norm(fields.get("street_name")),
|
|
136
|
+
STREET_SUFFIXES.get(suffix, suffix),
|
|
137
|
+
DIRECTIONALS.get(_norm(fields.get("post_directional")), _norm(fields.get("post_directional"))),
|
|
138
|
+
_norm(fields.get("community_name")),
|
|
139
|
+
_norm(fields.get("state")),
|
|
140
|
+
_norm(fields.get("zip_code")),
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def ali_to_fields(ali):
|
|
145
|
+
"""Map CER ALIDetails keys to model field names."""
|
|
146
|
+
return {
|
|
147
|
+
"house_number": ali.get("HouseNumber", ""),
|
|
148
|
+
"house_number_suffix": ali.get("HouseNumberSuffix", ""),
|
|
149
|
+
"prefix_directional": ali.get("PrefixDirectional", ""),
|
|
150
|
+
"street_name": ali.get("StreetName", ""),
|
|
151
|
+
"street_suffix": ali.get("StreetSuffix", ""),
|
|
152
|
+
"post_directional": ali.get("PostDirectional", ""),
|
|
153
|
+
"community_name": ali.get("CommunityName", ""),
|
|
154
|
+
"state": ali.get("State", ""),
|
|
155
|
+
"zip_code": ali.get("ZipCode", ""),
|
|
156
|
+
"zip_code_ext": ali.get("ZipCodeExt", ""),
|
|
157
|
+
"location": ali.get("Location", ""),
|
|
158
|
+
"cos": ali.get("COS", ""),
|
|
159
|
+
"tos": ali.get("TOS", ""),
|
|
160
|
+
"customer_name": ali.get("CustomerName", ""),
|
|
161
|
+
"company_id": ali.get("CompanyID", ""),
|
|
162
|
+
"customer_code": ali.get("CustomerCode", ""),
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def format_address(fields):
|
|
167
|
+
street = " ".join(
|
|
168
|
+
p
|
|
169
|
+
for p in [
|
|
170
|
+
f"{fields.get('house_number', '')}{fields.get('house_number_suffix', '')}",
|
|
171
|
+
fields.get("prefix_directional", ""),
|
|
172
|
+
fields.get("street_name", ""),
|
|
173
|
+
fields.get("street_suffix", ""),
|
|
174
|
+
fields.get("post_directional", ""),
|
|
175
|
+
]
|
|
176
|
+
if p
|
|
177
|
+
)
|
|
178
|
+
city = ", ".join(p for p in [fields.get("community_name", ""), fields.get("state", "")] if p)
|
|
179
|
+
return " ".join(p for p in [street + ("," if street and city else ""), city, fields.get("zip_code", "")] if p)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""API package for NetBox Cisco CER plugin."""
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""API serializers for NetBox Cisco CER plugin."""
|
|
2
|
+
|
|
3
|
+
from dcim.api.serializers import SiteSerializer
|
|
4
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
5
|
+
from rest_framework import serializers
|
|
6
|
+
|
|
7
|
+
from ..models import ERL
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ERLSerializer(NetBoxModelSerializer):
|
|
11
|
+
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_cisco_cer-api:erl-detail")
|
|
12
|
+
site = SiteSerializer(nested=True)
|
|
13
|
+
|
|
14
|
+
class Meta:
|
|
15
|
+
model = ERL
|
|
16
|
+
fields = [
|
|
17
|
+
"id",
|
|
18
|
+
"url",
|
|
19
|
+
"display",
|
|
20
|
+
"site",
|
|
21
|
+
"name",
|
|
22
|
+
"status",
|
|
23
|
+
"description",
|
|
24
|
+
"route_pattern",
|
|
25
|
+
"elin",
|
|
26
|
+
"time_zone",
|
|
27
|
+
"house_number",
|
|
28
|
+
"house_number_suffix",
|
|
29
|
+
"prefix_directional",
|
|
30
|
+
"street_name",
|
|
31
|
+
"street_suffix",
|
|
32
|
+
"post_directional",
|
|
33
|
+
"community_name",
|
|
34
|
+
"state",
|
|
35
|
+
"zip_code",
|
|
36
|
+
"zip_code_ext",
|
|
37
|
+
"location",
|
|
38
|
+
"cos",
|
|
39
|
+
"tos",
|
|
40
|
+
"customer_name",
|
|
41
|
+
"company_id",
|
|
42
|
+
"customer_code",
|
|
43
|
+
"last_pushed",
|
|
44
|
+
"comments",
|
|
45
|
+
"tags",
|
|
46
|
+
"custom_fields",
|
|
47
|
+
"created",
|
|
48
|
+
"last_updated",
|
|
49
|
+
]
|
|
50
|
+
brief_fields = ["id", "url", "display", "name", "elin"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""API views for NetBox Cisco CER plugin."""
|
|
2
|
+
|
|
3
|
+
from netbox.api.viewsets import NetBoxModelViewSet
|
|
4
|
+
|
|
5
|
+
from ..filtersets import ERLFilterSet
|
|
6
|
+
from ..models import ERL
|
|
7
|
+
from .serializers import ERLSerializer
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ERLViewSet(NetBoxModelViewSet):
|
|
11
|
+
queryset = ERL.objects.select_related("site").prefetch_related("tags")
|
|
12
|
+
serializer_class = ERLSerializer
|
|
13
|
+
filterset_class = ERLFilterSet
|