Closed dietybright closed 8 months ago
You should not customize Netdoc scripts, you should create one that help you. BTW a better solution is:
The (3) could be a script to be added in Netdoc.
Hi @dainok ,
I am able develop a python script to get ip address/mask from pyvmomi, compare with current vm ip address via netbox api, then create/up ip address, primary ip4.
For netdoc sync ipam from arp, I am encountering error message as below, any idea?
An exception occurred: AttributeError: 'NoneType' object has no attribute 'address'
Traceback (most recent call last): File "/opt/netbox/netbox/extras/scripts.py", line 504, in _run_script script.output = script.run(data=data, commit=commit) File "/opt/netbox/netbox/scripts/netdoc_scripts.py", line 439, in run .address.prefixlen AttributeError: 'NoneType' object has no attribute 'address'
Hi @dietybright sorry for the late response. The affected lines are:
prefixlen = (
arptableentry_o.interface.ip_addresses.filter(
address__net_contains_or_equals=address
)
.first()
.address.prefixlen
)
I suspect that the query arptableentry_o.interface.ip_addresses.filter
is returning None, thus address.prefixlen
is Failing. This should not happen.
Can you debug your setup?
I suggest to run the script line by line from a Netbox shell because each type you restart Netbox, the init script will update and overwrite Netbox scripts.
Will create another issue with update IPAM from arp table
I tried to customizing script to ingest vm ip address but having issue.
Discover script:
Investor script:
When trying to run discovery/ingest, there is an issue "unexpected keyword arguments: 'address'".
Seem address of vm interface need to ingest under IPAM or something