Forum Discussion
uisomdc_95191
Nimbostratus
Sep 04, 2008adding strings to data group
so we had a whole bunch of stuff to add to a string data group, but didn't feel safe giving operators privs to do this manually. in comes pycontrol and the class wsdl. This will iterate over inputfile.list, chop off carriage returns (you may need to take that part out depending on your inputfile), and submit it all to pyTest data group. I've only tried this for strings.
The try/except may not be all that elegant to prevent adding duplicate entries, but it works.
addString.py
!/usr/bin/python2.5
import pycontrol.pyControl as pyControl
BIG IP CONFIG
host = '123.456.78.9'
username = 'pyControl'
password = 'pyControl'
className = 'pyTest'
Create object
b = pyControl.BIGIP(
hostname = host,
username = username,
password = password,
wsdl_files = ['LocalLB.Class']
)
c = b.LocalLB_Class
f = open("inputfile.list", "r")
while True:
line = f.readline()[:-1] :-1 takes out carriage return
if len(line) == 0:
break
try:
c.add_string_class_member(class_members = [{'members': [line], 'name': className}])
except:
continue
f.close()
- This is great! Would you mind my contributing it to the iControl CodeShare? Since you posted it here, I'm sure you wouldn't but I figured I'd ask anyway...
- JRahm
Admin
@Joe, please do on the C & powershell front... - uisomdc_95191
Nimbostratus
hey Joe, I tried to add it myself to the codeshare but had no success. nodeAlert is all done too, let me know where you want it. - Here's how to manually add it to the Wiki.
- gerald_wegener_
Nimbostratus
I'm trying to add addresses to a data group with pycontrol and not having much luck using variations of: - Wish I could help you out but I no almost nothing about Python. I'd be able to get you going with Perl if that helps B-). Any Python folks out there care to help?
struct AddressEntry { String address String netmask } struct AddressClass { String name AddressEntry [] members } LocalLB.Class.add_address_class_member( AddressClass [] class_members )
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects