bigsuds
23 TopicsGet current connection of pool members
Hi, I tried write a script (python) to checking numeber current connection and when is 0 mark member 'disabled'. How can I get only value of current connection and then check is 0 ? member_stat = b.LocalLB.Pool.get_member_statistics( ['/Common/' + pool], [[{'address': member, 'port': port}]]) for statistic in member_stat: .... if ( 'STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS' == 0 ) : pl.set_member_session_enabled_state(['/Common/' + pool ], [[{'address': member, 'port': port}]], [['STATE_DISABLED']]) pl.set_member_monitor_state(['/Common/' + pool ], [[{'address': member, 'port': port}]], [['STATE_DISABLED']])382Views0likes2CommentsPython bigsuds for Bigip 4.x
I have some very old legacy devices running on version 4.5.13 and I need to pull some information via Icontrol. Firstly does 4.x support Icontrol ? Python is my language of choice and i use the bigsuds library mostly for my work.I did the following : >>> import bigsuds >>> b = bigsuds.BIGIP(hostname = 'x.x.x.x',username = 'root', password ='password') >>> vlans = b.Networking.Interfaces.get_list() Traceback (most recent call last): File "", line 1, in File "build/bdist.linux-x86_64/egg/bigsuds.py", line 313, in __getattr__ File "build/bdist.linux-x86_64/egg/bigsuds.py", line 139, in _create_client bigsuds.ParseError: :12:2: mismatched tag Failed to parse wsdl. Is "Networking.Interfaces" a valid namespace? What is the problem and how do i overcome it ?301Views0likes3CommentsiApp elements in iControl (bigsuds)
I have two LTM boxes running BigIP 11.5 on which I configured several iApps. Now I'd like to use iControl to check the pool/node status, statistics, enable and disable nodes, etc. However, I can't get a list of the iApps and pools configured. Here's what I tried using the (awesome!) bigsuds library: bs = bigsuds.BIGIP(hostname="my_ltm_box", username="my_username", password="some_pass") print bs.Management.ApplicationService.get_list() print bs.LocalLB.Pool.get_list() I would expect at least the first, but preferably also the second print out a list of items. But both commands return an empty list (I currently don't have any pools configured normally, only through iApps, though when I add one it gets listed). To make it even a bit more confusing, the listing of nodes works (both for normally configured nodes as for nodes configured in an iApp): print bs.LocalLB.NodeAddressV2.get_list() Am I missing something? How can I find out which iApps are configured and more importantly, how can I find the pools and possibly other elements related to these iApps, since they don't seem to be available through the regular API calls.Solved393Views0likes2CommentsBigsuds - save_configuration
I am new to python and iControl. I am trying to use bigsuds to save a UCS file on the box but I am getting a strange error - >>> b.System.ConfigSync.save_configuration(['/shared/tmp/test.ucs'],['SAVE_FULL']) Traceback (most recent call last): ......Output omitted ........ bigsuds.ArgumentError: "['SAVE_FULL']" is not a valid value for System.ConfigSync.SaveMode, expecting: SAVE_FULL, SAVE_HIGH_LEVEL_CONFIG, SAVE_BASE_LEVEL_CONFIG, SAVE_GTM_CONFIG_ONLY It shows an error with my agrument in the raw list format. If I make the second argument a string then I also get errors - >>> b.System.ConfigSync.save_configuration(['/shared/tmp/test.ucs'],'SAVE_FULL') Traceback (most recent call last): ......Output omitted ........ suds.TypeNotFound: Type not found: 'filename' I dont quite get what I am doing wrong.236Views0likes5CommentsPython/Bigsuds: change_my_password does not work for guest user
Hi, I'd like to change the password of a user with guest permissions on a BIG-IP v10.2.4 using python with bigsuds. Although the login is successful (I can get a list of pools etc.), Management.UserManagement.change_my_password exits with an error: ServerError: Server raised fault: 'Exception caught in Management::urn:iControl:Management/UserManagement::change_my_password() Exception: Common::OperationFailed primary_error_code : 17238053 (0x01070825) secondary_error_code : 0 error_string : 01070825:3: Access denied - Administrators only: User (guestuser) is not an Administrator and must supply the old password.' How can I either supply the old password or change my password any other way? Thanks in advance Lukas335Views0likes2CommentsAssign a monitor to an already existing node using iControl
Hello everyone, I am using the python bigsuds iControl library. I have created a couple of nodes and now trying to assign a monitor to them. Looked at the API reference but it throws the same error overtime. I am not sure what it is expecting in "type". >>> c.LocalLB.NodeAddressV2.set_monitor_rule(['node1'],['MONITOR_RULE_TYPE_SINGLE', 0L, ['icmp']]) Traceback (most recent call last): File "", line 1, in File "build/bdist.macosx-10.10-intel/egg/bigsuds.py", line 412, in wrapped_method File "build/bdist.macosx-10.10-intel/egg/bigsuds.py", line 472, in process File "build/bdist.macosx-10.10-intel/egg/bigsuds.py", line 478, in _process_args File "build/bdist.macosx-10.10-intel/egg/bigsuds.py", line 540, in _process_arg File "build/bdist.macosx-10.10-intel/egg/bigsuds.py", line 559, in _process_arg bigsuds.ArgumentError: "MONITOR_RULE_TYPE_SINGLE" is not a valid value for LocalLB.MonitorRule, expecting: type, quorum, monitor_templates Also, i think i have to use the set_default_node_monitor after this. Has anyone been in a similar situation. Would really appreciate any help. Thanks!194Views0likes1Commentroute advertisement and ssl certificates with bigsuds / icontrol inside transaction
I'am writing deployment scripting for our loadbalancer configuration. For the moment I take the simple approach of deleting the whole configuration and rebuilding it within a transaction. But I have encountered two problems with this approach: 1. route advertisements cannot be set inside the same transaction as the creation of the virtual server/address. 2. ssl keys/certificates cannot be recreated inside a transaction. The questions: 1. Am I doing something wrong? 2. I would like, for now, to do this delete and create step inside a single transaction. It is much simpler and a little downtime is acceptable for now. But i would like to allways have a valid configuration, hence the transaction. Is this possible? Example code for 1: with bigsuds.Transaction(bigip_session) as bigip: bigip.System.Session.set_active_folder('/acc') print bigip.System.Session.get_active_folder() bigip.LocalLB.VirtualServer.delete_all_virtual_servers() bigip.LocalLB.Pool.delete_all_pools() bigip.LocalLB.NodeAddressV2.delete_all_node_addresses() bigip.LocalLB.ProfileHttp.delete_all_profiles() for sslprofile in bigip.LocalLB.ProfileClientSSL.get_list(): print "deleting sslprofile: {}".format(sslprofile) bigip.LocalLB.ProfileClientSSL.delete_profile(profile_names=[sslprofile]) bigip.LocalLB.NodeAddressV2.create(nodes=['node1'], addresses=['10.10.10.1'], limits=[0]) bigip.LocalLB.NodeAddressV2.create(nodes=['node2'], addresses=['10.10.10.2'], limits=[0]) lb_method = 'LB_METHOD_ROUND_ROBIN' members = [] members.append({'address': 'node1', 'port': 80}) members.append({'address': 'node2', 'port': 80}) bigip.LocalLB.Pool.create_v2(pool_names=['test_pool'], lb_methods=[lb_method], members=[members]) monitor_rule = {'type': 'MONITOR_RULE_TYPE_AND_LIST', 'quorum': 0, 'monitor_templates': ['/Common/tcp']} bigip.LocalLB.Pool.set_monitor_association( monitor_associations=[{'pool_name': 'test_pool', 'monitor_rule': monitor_rule}]) definition = {'name': 'test_vip', 'address': '185.14.168.80', 'port': 80, 'protocol': 'PROTOCOL_TCP'} resources = {'type': 'RESOURCE_TYPE_POOL', 'default_pool_name': 'test_pool'} profile = [{'profile_context': 'PROFILE_CONTEXT_TYPE_ALL', 'profile_name': 'tcp'}] bigip.LocalLB.VirtualServer.create(definitions=[definition], wildmasks=['255.255.255.255'], resources=[resources], profiles=[profile]) bigip.LocalLB.VirtualServer.set_snat_automap(virtual_servers=['test_vip']) bigip.LocalLB.VirtualAddressV2.set_route_advertisement_state(virtual_addresses=['/acc/185.14.168.80'], states=['STATE_ENABLED']) Error message: bigsuds.ServerError: Server raised fault: 'Exception caught in System::urn:iControl:System/Session::submit_transaction() Exception: Common::OperationFailed primary_error_code : 16908342 (0x01020036) secondary_error_code : 0 error_string : 01020036:3: The requested virtual address (/acc/185.14.168.80) was not found.' Example for 2: Uses simular code but uses the keycertificate calls to delete and create the keys/certificates. namely: bigip.Management.KeyCertificate.get_certificate_list(mode='MANAGEMENT_MODE_DEFAULT'): bigip.Management.KeyCertificate.certificate_delete(mode='MANAGEMENT_MODE_DEFAULT', cert_ids=[cert['file_name']]) bigip.Management.KeyCertificate.get_key_list(mode='MANAGEMENT_MODE_DEFAULT'): bigip.Management.KeyCertificate.key_delete(mode='MANAGEMENT_MODE_DEFAULT', ids=[cert['file_name']]) bigip.Management.KeyCertificate.key_import_from_pem(mode='MANAGEMENT_MODE_DEFAULT', key_ids=[clientssl.get_full_name()], pem_data=[clientssl.key], overwrite=False) TODO: why can't i delete the certificate? bigip.Management.KeyCertificate.certificate_import_from_pem(mode='MANAGEMENT_MODE_DEFAULT', cert_ids=[clientssl.get_full_name()], pem_data=[clientssl.cert], overwrite=False) The error: bigsuds.ServerError: Server raised fault: 'Exception caught in Management::urn:iControl:Management/KeyCertificate::key_import_from_pem() Exception: Common::OperationFailed primary_error_code : -11 (0xFFFFFFF5) secondary_error_code : 0 error_string : Would overwrite file'189Views0likes0CommentsSOAP File transfers for backup .ucs files result in unreadable files that are bigger than they should be
Greetings! I am trying to automate our backup process for .ucs files remotely. Using bigsuds with the System.ConfigSync.download_configuration() method I am getting strange results, in that not only is my resulting file unreadable locally or through re-upload to the BIGIP device, but it is also significantly larger than I am expecting it to be. For example, my "backup.ucs" file local to the BIGIP device might be 2.6 Mb; however, at the conclusion of my write loop, the resulting file size would be 3.5 Mb remotely. I am admittedly new to SOAP's idiosyncrasies with downloading files, and I tried to follow the example pseudo code I found for managing loops to handle file chunks and offsets. My "download progress" output shows that the bytes written are actually pretty close to what I am expecting (though a multiple of the chunk size), but then the resulting file is much larger and corrupt, and I have no idea why. Perhaps I am not handling the file handle properly because of SOAP weirdness? Any help would be greatly appreciated. Here is the code: !/usr/bin/python import bigsuds import datetime temp_date = str(datetime.datetime.utcnow()) split_date = string.split(temp_date) my_date = split_date[0] bigip_ip = '***.***.***.***' bigip_user='***********' bigip_pwd='************' chunk_size = 64 * 1024 file_offset = 0 write_continue = 1 create filename filename = 'test_' + date instantiate connection to bigip obj = bigsuds.BIGIP(hostname=bigip_ip, username=bigip_user, password=bigip_pwd) first save config file on bigip device obj.System.ConfigSync.save_configuration(filename,'SAVE_FULL') open target file for writing f = open('/home/bigip_backups/' + filename + '.ucs','a') download data to file while write_continue == 1: temp_config = obj.System.ConfigSync.download_configuration(filename + '.ucs',chunk_size,file_offset) file_info = temp_config['return'] f.write(file_info['file_data']) detect EOF if file_info['chain_type'] == 'FILE_LAST' or file_info['chain_type'] == 'FILE_FIRST_AND_LAST': write_continue = 0 set offset file_offset = file_offset + chunk_size track download progress print str(file_offset) + " bytes written" DEBUG print file_info['chain_type'] cleanup f.close()271Views0likes2Commentstmsh to bigsuds - virtual server - associate a vlan and assign a persistence profile
Hi all I've successfully ported tmsh LTM Pool creation statements to bigsuds, but partly succeeded for virtuals I'm working with different bippipe versions but have only tested the following code on v10.2.4... ['BIG-IP_v10.2.4'] ['BIG-IP_v10.2.2'] ['BIG-IP_v11.2.1'] So, after a successful Virtual creation on all these bigpipe versions (has the expected pool member), I still cannot assign/associate to an existing vlan assign an existing persistence profile as default (no failback) create a SNAT pool (how?) Example tmsh statements I'm working to port to icontrol/bigsuds 1. tmsh create /ltm virtual MY_VIRTUAL { destination 1.2.3.4:https pool MYPOOL vlans add { External Internal } vlans-enabled profiles add { tcp } persist replace-all-with { source_addr } fallback-persistence none } corresponding code: obj.LocalLB.VirtualServer.create( definitions = [{'name': [virtualname], 'address': [address], 'port': [port], 'protocol': 'PROTOCOL_TCP'}], wildmasks = ['255.255.255.255'], resources = [{'type': 'RESOURCE_TYPE_POOL', 'default_pool_name': [member_pool]}], profiles = [[{'profile_context': 'PROFILE_CONTEXT_TYPE_ALL', 'profile_name': 'tcp'}]]) ** set_vlan: does not work obj.LocalLB.VirtualServer.set_vlan( virtual_servers = [virtualname], vlans = [vlans] ) errors with "Internal" is not a valid value for Common.VLANFilterList, expecting: state, vlans ** persistence: does not work: b.LocalLB.VirtualServer.add_persistence_profile( virtual_servers = [virtualname], profiles = [[ {'profile_name': 'source_addr_SR', 'default_profile': 'true'} ]] ) At a loss for SNAT pool creation (on terms of where to start) tmsh create /ltm snat MY_SNAT_POOL translation 1.2.3.4 origins add { 5.6.7.8/32 } vlans-enabled vlans add { Internal } tmsh modify /ltm snat-translation 1.2.3.4 { tcp-idle-timeout 300 udp-idle-timeout 300 ip-idle-timeout 300 } Digging into this work is great and rewarding but sadly I'm getting dry... Any help is greatly appreciated THks Patrick285Views0likes2Comments