# Adding metadata to an iControl object using pycontrol

**URL:** <https://community.f5.com/t/adding-metadata-to-an-icontrol-object-using-pycontrol/8456>\
**Category:** Technical Forums\
**Tags:** icontrol, big-ip, devops\
**Created:** [January 25, 2016, 10:55pm UTC](https://community.f5.com/t/adding-metadata-to-an-icontrol-object-using-pycontrol/8456 "2016-01-25T22:55:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![droyo\_148031](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@droyo\_148031](https://community.f5.com/u/droyo_148031)\
**Post date:** [January 25, 2016, 10:55pm UTC](https://community.f5.com/t/adding-metadata-to-an-icontrol-object-using-pycontrol/8456/1 "2016-01-25T22:55:27Z")

</div>

I am trying to add custom metadata to a virtual address using pycontrol. None of my calls fail, but

```tcl
get_metadata

```

always returns an empty list. Here is my program:

```tcl
from pycontrol import pycontrol
bigip = pycontrol.BIGIP(
    hostname='my-lb.example.net',
    username='admin',
    password=' ******',
    fromurl=True,
    wsdls=['LocalLB.VirtualAddressV2'])

 Any virtual address shows the same behavior
vip = bigip.LocalLB.VirtualAddressV2.get_list()[0]

bigip.LocalLB.VirtualAddressV2.add_metadata([vip], [['owner']], [['daryll']])
meta = bigip.LocalLB.VirtualAddressV2.get_metadata([vip])
print "%r" % (meta,)

```

The output of the program is

```tcl
[[]]

```

. I have tried using an administrator account with the same results. Any tips would be appreciated. My BigIP is at version 11.4 and I am using pycontrol 2.1.

---

<div class="post-metadata">

**Author:** ![Kelly\_Jones\_500](https://avatars.discourse-cdn.com/v4/letter/k/8e7dd6/32.png) [@Kelly\_Jones\_500](https://community.f5.com/u/Kelly_Jones_500)\
**Post date:** [January 26, 2016, 12:36am UTC](https://community.f5.com/t/adding-metadata-to-an-icontrol-object-using-pycontrol/8456/2 "2016-01-26T00:36:03Z")

</div>

I’m using bigsuds instead of pycontrol, but I was able to get the following to work on 11.3 and 11.5.3.

```tcl
import bigsuds

b = bigsuds.BIGIP(hostname='1.2.3.4')
vip = b.LocalLB.VirtualAddressV2.get_list()[0]

b.LocalLB.VirtualAddressV2.add_metadata([vip], [['owner']], [['daryll']])
vip_metadata = b.LocalLB.VirtualAddressV2.get_metadata([vip])

for meta_data in vip_metadata:
    print b.LocalLB.VirtualAddressV2.get_metadata_value([vip],[[meta_data]])

```

If you are at the CLI of the bigip and run ‘tmsh save sys config’, then you should see metadata attached to the vip. Something like this in /config/bipip.conf:

```tcl
ltm virtual-address /Common/192.168.1.41 {
    address 192.168.1.41
    mask 255.255.255.255
    metadata {
        owner {
            value daryll
        }
}

```

Perhaps there is an issue with pycontrol? I used only bigsuds. Please let me know how that works out for you.

-Kelly

---

<div class="post-metadata">

**Author:** ![droyo\_148031](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@droyo\_148031](https://community.f5.com/u/droyo_148031)\
**Post date:** [January 26, 2016, 4:54pm UTC](https://community.f5.com/t/adding-metadata-to-an-icontrol-object-using-pycontrol/8456/3 "2016-01-26T16:54:41Z")

</div>

Thank you. This indeed worked when I switched to the bigsuds library. The API is similar enough that it is less work for me to port my code to bigsuds than diagnose the issue with pycontrol.
