Skip to content

Commit 6af5886

Browse files
author
Thomas v.d. Jagt
committed
added get_ip_by_virtual_machine method. Fixed get_ip_by_device filter.
1 parent 63164ff commit 6af5886

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

netbox/ipam.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ def get_ip_by_device(self, device_name):
1818
:param device_name: Name of the device
1919
:return: ip address information
2020
"""
21-
return self.netbox_con.get('/ipam/ip-addresses', device_name=device_name)
21+
return self.netbox_con.get('/ipam/ip-addresses', device=device_name)
22+
23+
def get_ip_by_virtual_machine(self, vm_name):
24+
"""Get IPs which are associated to a device
25+
26+
:param vm_name: Name of the virtual machine
27+
:return: ip address information
28+
"""
29+
return self.netbox_con.get('/ipam/ip-addresses', virtual_machine=vm_name)
2230

2331
def create_ip_address(self, address, **kwargs):
2432
"""Create a new ip address

0 commit comments

Comments
 (0)