infobloxopen/infoblox-client

Updating Extensible Attributes using extattrs+ in infoblox-client API

Closed this issue · 1 comments

Hi All,

I am trying to update the Extensible attribute for a particular field but update() function deletes other existing values as well.
May I know how to counter this issue.

My code
def populate_NetworkContainer_ExtensibleAttribute(nw=str, comm=str, exatt=str):
ib_network_container = objects.NetworkContainer.search(connection, network=nw, network_view='default', return_fields=['default', 'extattrs'])
ib_network_container.comment = comm
ea = objects.EA(exatt)
ib_network_container.extattrs = ea
ib_network_container.update()
print(ib_network_container)

populate_NetworkContainer_ExtensibleAttribute('xxxxx', 'My comment', {'Description': 'This is my test container description', 'Environment': 'Test'})

I have used the merge operation on the dictionary

ea_dict = ib_network_container.extattrs.ea_dict
ea_dict.update(exatt)
merged_ea = objects.EA(ea_dict)
ib_network_container.extattrs = merged_ea
ib_network_container.update()