francoismdj / netbox-kea-dhcp Goto Github PK
View Code? Open in Web Editor NEWSync netbox to ISC Kea DHCP server
License: MIT License
Sync netbox to ISC Kea DHCP server
License: MIT License
Netbox 3.7.3
Python: 3.10.2
Kea: 2.2.1
I'm manually running the script and feeding it a basic config. I can see connections being made to both kea and netbox, however it pukes on the first prefix it receives back from netbox. This particular subnet (10.10.0.0/16) is actually empty. I don't have "status" set as dhcp in the config.
2024-02-29 11:32:01,451 [INFO] Start full sync
2024-02-29 11:32:01,451 [INFO] pull running config from DHCP server
2024-02-29 11:32:01,459 [DEBUG] command "config-get" OK (text: None)
2024-02-29 11:32:01,459 [INFO] delete all current subnets
2024-02-29 11:32:01,459 [DEBUG] check configuration
2024-02-29 11:32:01,465 [DEBUG] command "config-test" OK (text: Configuration seems sane. Control-socket, hook-libraries, and D2 configuration were sanity checked, but not applied.)
2024-02-29 11:32:01,465 [DEBUG] commit configuration
2024-02-29 11:32:01,997 [DEBUG] prefix 10.10.0.0/16: generate DHCP config
2024-02-29 11:32:01,997 [INFO] subnets: add 10.10.0.0/16, ID 33997
Traceback (most recent call last):
File "/usr/local/bin/netbox-kea-dhcp", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.10/dist-packages/netboxkea/entry_point.py", line 32, in run
conn.sync_all()
File "/usr/local/lib/python3.10/dist-packages/netboxkea/connector.py", line 96, in sync_all
self._prefix_to_subnet(p, fullsync=True)
File "/usr/local/lib/python3.10/dist-packages/netboxkea/connector.py", line 179, in _prefix_to_subnet
for r in self.nb.ip_ranges(parent=pref.prefix):
File "/usr/local/lib/python3.10/dist-packages/netboxkea/netbox.py", line 31, in ip_ranges
for r in self.nb.ipam.ip_ranges.filter(
File "/usr/local/lib/python3.10/dist-packages/pynetbox/core/response.py", line 127, in __next__
next(self.response), self.endpoint.api, self.endpoint
File "/usr/local/lib/python3.10/dist-packages/pynetbox/core/query.py", line 280, in get
req = self._make_call(add_params=add_params)
File "/usr/local/lib/python3.10/dist-packages/pynetbox/core/query.py", line 247, in _make_call
raise RequestError(req)
pynetbox.core.query.RequestError: The request failed with code 400 Bad Request: {'status': ['Select a valid choice. dhcp is not one of the available choices.']}
Hello,
would it be possible to read various DHCP options such as the domain name or the NTP server from the parent prefix? In most cases, the options are the same for all subnets, so that they do not have to be configured individually for each subnet as a Custom_Field in Netbox.
Thanks and Regards,
Daniel
During a server reboot, netbox-kea-dhcp
crashes with the following trace:
août 22 09:32:08 charade netbox-kea-dhcp[846]: netbox: https://netbox-srv, kea: http://127.0.0.1:8000/
août 22 09:32:08 charade netbox-kea-dhcp[846]: Start full sync
août 22 09:32:08 charade netbox-kea-dhcp[846]: pull running config from DHCP server
août 22 09:32:08 charade netbox-kea-dhcp[846]: Traceback (most recent call last):
août 22 09:32:08 charade netbox-kea-dhcp[846]: File "/usr/local/bin/netbox-kea-dhcp", line 8, in <module>
août 22 09:32:08 charade netbox-kea-dhcp[846]: sys.exit(run())
août 22 09:32:08 charade netbox-kea-dhcp[846]: File "/usr/local/lib/netbox-kea-dhcp/lib/python3.10/site-packages/netboxkea/entry_point.py", line 32, in run
août 22 09:32:08 charade netbox-kea-dhcp[846]: conn.sync_all()
août 22 09:32:08 charade netbox-kea-dhcp[846]: File "/usr/local/lib/netbox-kea-dhcp/lib/python3.10/site-packages/netboxkea/connector.py", line 83, in sync_all
août 22 09:32:08 charade netbox-kea-dhcp[846]: self.kea.pull()
août 22 09:32:08 charade netbox-kea-dhcp[846]: File "/usr/local/lib/netbox-kea-dhcp/lib/python3.10/site-packages/netboxkea/kea/app.py", line 64, in pull
août 22 09:32:08 charade netbox-kea-dhcp[846]: self.conf = self.api.get_conf()
août 22 09:32:08 charade netbox-kea-dhcp[846]: File "/usr/local/lib/netbox-kea-dhcp/lib/python3.10/site-packages/netboxkea/kea/api.py", line 68, in get_conf
août 22 09:32:08 charade netbox-kea-dhcp[846]: return self._request_kea('config-get')['Dhcp4']
août 22 09:32:08 charade netbox-kea-dhcp[846]: File "/usr/local/lib/netbox-kea-dhcp/lib/python3.10/site-packages/netboxkea/kea/api.py", line 60, in _request_kea
août 22 09:32:08 charade netbox-kea-dhcp[846]: raise KeaCmdError(f'command "{command}" returns "{text}"')
août 22 09:32:08 charade netbox-kea-dhcp[846]: netboxkea.kea.exceptions.KeaCmdError: command "config-get" returns "unable to forward command to the dhcp4 service: No such file or directory. The server is likely to be offline"
Expected result: handle errors trowned by Kea API, retry later when dhcp4 service is alive
Symptoms
/health/
route returns 404 error when listener is running
Reproduction Steps
netbox-kea-dhcp
with --listen
flag/health/
Potential solutions
Re-release pypi package to be in sync with repo
Hello,
Thank you for your work on this plugin.
Would it be possible to implement support for the netbox-gateways plugin for the "option-data.routers" option?
Unfortunately, the routing information is not in Custom_fields but must be read from the API tree "plugins".
http://netbox/api/plugins/nb-gateways/gateway/
Thanks and Regards,
Daniel
current location of issue: ipaddress_filter={'status': 'dhcp'}
netbox docs explicitly state:
Statuses are hard-coded in NetBox and can be one of the following:
- Container - A summary of child prefixes
- Active - Provisioned and in use
- Reserved - Designated for future use
- Deprecated - No longer in use
I'd suggest to change this to roles
or, is there a plugin that creates extra status fields?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.