fix ip association
This commit is contained in:
parent
dc582b5de6
commit
1d98d3c8e9
1 changed files with 7 additions and 2 deletions
|
@ -324,7 +324,12 @@ class Network(object):
|
||||||
'status': "active",
|
'status': "active",
|
||||||
}
|
}
|
||||||
if self.netbox_version > 2.8:
|
if self.netbox_version > 2.8:
|
||||||
query_params.update({self.intf_type: "assigned_object_id"})
|
query_params.update({
|
||||||
|
'assigned_object_type': self.assigned_object_type,
|
||||||
|
'assigned_object_id': interface.id
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
query_params.update({'interface_id': interface.id})
|
||||||
|
|
||||||
netbox_ip = nb.ipam.ip_addresses.create(
|
netbox_ip = nb.ipam.ip_addresses.create(
|
||||||
**query_params
|
**query_params
|
||||||
|
@ -412,7 +417,7 @@ class Network(object):
|
||||||
if len(nb_nics):
|
if len(nb_nics):
|
||||||
if self.netbox_version > 2.8:
|
if self.netbox_version > 2.8:
|
||||||
netbox_ips = nb.ipam.ip_addresses.filter(
|
netbox_ips = nb.ipam.ip_addresses.filter(
|
||||||
assigned_object=[x.id for x in nb_nics],
|
**{self.intf_type: [x.id for x in nb_nics]}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
netbox_ips = nb.ipam.ip_addresses.filter(
|
netbox_ips = nb.ipam.ip_addresses.filter(
|
||||||
|
|
Loading…
Reference in a new issue