def _update_running_config(networks, bonds): """ Recreate RunningConfig so that following setSafeNetworkConfig will persist a valid configuration. """ running_config = RunningConfig() for net, net_attr in six.viewitems(networks): running_config.setNetwork(net, net_attr) for bonding, bonding_attr in six.viewitems(bonds): running_config.setBonding(bonding, bonding_attr) running_config.save()
def _persist(networks, bondings): runningConfig = RunningConfig() runningConfig.delete() for network, attributes in networks.iteritems(): runningConfig.setNetwork(network, attributes) for bond, attributes in bondings.iteritems(): runningConfig.setBonding(bond, attributes) runningConfig.save() runningConfig.store()