Configuration Utilities¶
A module that defines common configuration utility functions.
- munet.config.list_to_dict_with_key(lst, k)¶
Convert a YANG styl list of objects to dict of objects.
This function converts a YANG style list of objects (dictionaries) to a plain python dictionary of objects (dictionaries). The value for the supplied key for each object is used to store the object in the new diciontary.
This only works for lists of objects which are keyed on a single contained value.
- Parameters:
lst – a list of python dictionary objects.
k – the key value contained in each dictionary object in the list.
- Returns:
A dictionary of objects (dictionaries).
- munet.config.config_to_dict_with_key(c, ck, k)¶
Convert the config item from a list of objects to dict.
Use
list_to_dict_with_key()to convert the list of objects atc[ck]to a dict of the objects using the keyk.- Parameters:
c – config dictionary
ck – The key identifying the list of objects from
c.k – The key to pass to
list_to_dict_with_key().
- Returns:
A dictionary of objects (dictionaries).
- munet.config.value_merge_deepcopy(s1, s2)¶
Merge values using deepcopy.
Create a deepcopy of the result of merging the values from dicts
s1ands2. If a key exists in boths1ands2the value froms2is used.”