Forum Discussion

droyo_148031's avatar
droyo_148031
Icon for Nimbostratus rankNimbostratus
Jan 25, 2016

Adding metadata to an iControl object using pycontrol

I am trying to add custom metadata to a virtual address using pycontrol. None of my calls fail, but get_metadata always returns an empty list. Here is my program: from pycontrol import pycontr...
  • Kelly_Jones_500's avatar
    Jan 26, 2016

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

    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:

    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