def _extend_with_bridge_opts(kernel_config, running_config): for net, attrs in six.viewitems(running_config['networks']): if not attrs['bridged']: continue if net not in kernel_config.networks: continue running_opts_str = attrs.get('custom', {}).get('bridge_opts') if not running_opts_str: continue running_opts_dict = bridge_opts_str_to_dict(running_opts_str) kernel_opts_dict = { key: val for key, val in six.viewitems(bridges.bridge_options(net)) if key in running_opts_dict} kernel_opts_str = bridge_opts_dict_to_sorted_str(kernel_opts_dict) kernel_config.networks[net].setdefault( 'custom', {})['bridge_opts'] = kernel_opts_str