Tech Tip: Saving Your iControl Changes

When making changes to almost any networking device via the command line, the last step is to "save the running config". This is so that you can make changes, tweak them, test them, go for coffee, etc. Only after you are positive that all is behaving as you expect do you take that last fatal step of telling the device to save the running config.

This is true of the BIG-IP just as it is of most products. It's a nice feature to have because right up until you are ready to say the changes work correctly and save them, you can always revert to the saved configuration (or default configuration if you're on some vendor's platforms).

In the Web UI, we eliminate this need for you by saving the changes automatically. That does mean that you have to remember what you did and reverse the changes in order to get the state back to where you started, but that is the expected behavior of a web user interface - when you make a change, you expect that it is actually made on the box, not that it's there temporarily.

In iControl, we opted to go the route of the command line from an API perspective - this gives you the flexibility to roll back changes that your code has made, or commit them to the hardware so that they are active on the next reboot of your BIG-IP. This means that any changes you make via iControl are applied immediately and are active on the BIG-IP that your code is managing, but if you want them to be a permanent part of the configuration you will have to make an iControl API call to save them.

Rather than leave you to reinvent the wheel, this article will present you with a simple routine that you can call to save these changes. Then all you have to worry about is when you want to save the configuration. BIG-IP saves information in two different configurations - one for over-arching information that keeps many default objects and things like the default gateway, and one that contains items that your organization has created. The first is called the "base config" and the latter is called the "high-level config". The iControl API uses a single routine to save both of these with a parameter to tell it which we wish to save, so we'll need to cover both, and then build a single routine to do either or both.

All of the configuration saving routines are in the System.ConfigSync object. First we'll cover the simple case of saving the high and low-level configurations. The routine presented assumes only one thing - that you have imported iControl.SystemConfigSyncSaveMode,  iControl.SystemConfigSyncBindingStub and iControl.SystemConfigSyncLocator. Once you have, you can cut and paste this routine into any class you like.

saveConfig(boolean high, boolean base) {
    SystemConfigSyncBindingStub stub = null;
    // Get a connection to the VirtualServer services on the bigIP and ask it for the list of Virtual Servers.
    try {
stub = (SystemConfigSyncBindingStub)
new SystemConfigSyncLocator().getSystemConfigSyncPort(new URL(fullUrl));

    stub.save_configuration("", SystemConfigSyncSaveMode.SAVE_HIGH_LEVEL_CONFIG);
    stub.save_configuration("", SystemConfigSyncSaveMode
    } catch(Exception e) {

That will save the running configuration to the default configuration, but what if you want to save it to another named configuration that you can load at a later date? Well, our team thought of that also, that is what the first parameter to save_configuration() is for - you can pass in a filename, and if
you set the SystemConfigSyncSaveMode parameter to SAVE_FULL you can pass in a filename to use instead of the defaults. When you save in this manner, you have to call load_configuration() to access the configuration you saved.

save_configuration("my_base_config.conf", SystemConfigSyncSaveMode.SAVE_FULL);
Will save the configuration to the file my_vase_config.conf, and
load_configuration("my_base_config.conf", SystemConfigSyncLoadMode.LOAD_HIGH_LEVEL_CONFIG) will load the high-level information from the configuration file and make it the running config.

This could be useful if you wish to save many alternate configurations to use at different times, or if you are working on a configuration and need to stop working on it for a while.

As is normally the case with iControl, you have a lot of power and flexibility at your fingertips, you just have to make a few extra calls to take advantage of this power.

Next time - saving encrypted configurations.

Get the Flash Player to see this player.
Published Feb 29, 2008
Version 1.0

Was this article helpful?