Forum Discussion

gerald_wegener_'s avatar
gerald_wegener_
Icon for Nimbostratus rankNimbostratus
Sep 23, 2008

pycontrol - upload data group external file

 

I am a pycontrol newbie and have been unable to figure out how to reload a data group list (external) file once it has be edited. The name of the data group is 'blacklisttest' type:external contents:address and the external file location/name is /var/class/blacklist. I basically copy the blacklisted file to bipip and would like a way to activate rather than using 'b load'

 

 

I can see how to use 'get' using pycontrol but can't figure out how to reload the class file:

 

 

b.LocalLB_Class.get_external_class_file_name(class_names = ['blacklisttest'])

 

{'return': ['/var/class/blacklist']}

 

 

Thank you for any help.

 

8 Replies

  • There isn't a "load class" command per-say. As far as I know the only way to forcefully reload an external class is to do a configuration load (b load, or System.ConfigSync.install_configuration()). I'm not sure if this will work, but you could try to make a call to set_external_class_file_name to a different value and then back to your target file. This may cause the system to reload it since it's a different file. Not sure, but worth a try.

     

     

    -Joe
  • Oh yeah I forgot to mention that - As you sugested I did try doing a:

     

     

    b.System_ConfigSync.download_configuration(config_name = ['bigip.conf'])

     

     

    and various other permutations of that but can't get it to work. I assuming command this would do a 'b load'.
  • The System.ConfigSync.download_configuration() method will download the compressed configuration archive (*.ucs) files from the BIG-IP to your local system. See my tech tip on configuration archiving for more details on how this method works:

     

     

    http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=259

     

    Click here

     

     

     

    If you want to load the current bigip.conf, you'll want to look at the System.ConfigSync.load_configuration() passing in "bigip.conf" along with the LoadFlag of LOAD_HIGH_LEVEL_CONFIG.

     

     

    This shells out and performs a "b load" on the server.

     

     

    Hope this helps...

     

     

    -Joe
  • Actually, I just saw this on an internal thread that if you want to force a reload of a external class, all you need to do is to change one of the attributes on the class. Changing the filename, type, or mode will force a reload. So, the easiest way would likely be to call the LocalLB.Class.set_external_class_file_mode method toggling the class from FILE_MODE_TYPE_READ_WRITE to FILE_MODE_TYPE_READ.

     

     

    Hope this helps.

     

     

    -Joe
  •  

    I wasn't able to get the 'b load' to work properly using pycontrol. I was using the following syntax.

     

     

    b.System_ConfigSync.load_configuration(filename = ['bigip.conf'] , load_flag = 'LOAD_HIGH_LEVEL_CONFIG')

     

     

    After executing this I would get intermittant connectivity to the box and it would lose at least part of it's config. It recovered after a reboot

     

     

    ****************

     

     

    I did get the data group list reload working using:

     

     

    b.LocalLB_Class.set_external_class_file_mode(class_names = ['blacklisttest'] , file_modes = 'FILE_MODE_TYPE_READ_WRITE')

     

     

    When loading large lists (e.g. an external address list with 50k hosts) the impact on the CPU seems to be the same for 'b load' or when using the pycontrol method to reset the file mode.

     

     

    I was hoping it would have less CPU impact that using the 'b load'. I'm running 6800's so CPU0 is the one hit. Loading 50k hosts will drive it up to 90%

     

     

     

    Thanks for your help.
  • What BigIP version are you running? The pyControl library is essentially just a wrapper for the iControl calls, so this seems surprising. I will try as well and see what I get.

     

     

    -Matt