The netconf.util Module

netconf.util.elm(tag, attrib=None, **extra)
netconf.util.filter_containment_iter(fcontain_elm, dest_node, containment_nodes, leaf_elms, append_to)

Given a containment filter node (or None) verify that all leaf elements either match, have corresponding selection nodes (empty) or are not present.

If all leaf criteria are met then the iterator will return a triple of (new_filter_node, new_dest_node, new_data). new_filter_node corresponds to the matched containment node which is returned in new_dest_node, and new_data will be an element corresponding to the passed in dest_node.

These should be processed by calling filter_containment_iter again.

Additionally the correct leaf data will be added to dest_node, and dest_node will be appended to append_to if append_to is not None.

This implements RFC6241 section 6.2.5

netconf.util.filter_leaf_allows(filter_elm, xpath, value)

Check the value at the xpath specified leaf matches the value.

  • If filter_elm is None then allow.
  • If there is no xpath element then allow if there are no other children.
  • XXX what about xpath that has embedded predicates! perhaps what we want to call this is a normal path not an xpath.
netconf.util.filter_leaf_allows_add(filter_elm, tag, data, value)
netconf.util.filter_leaf_values(fcontain_elm, dest_node, leaf_elms, append_to)

Given a containment element (or None) verify that all leaf elements in leaf_elms either match, have corresponding selection nodes (empty) or are not present.

Additionally the correct leaf data will be added to dest_node, and dest_node will be appended to append_to if append_to is not None.

The return value with be True, False, or a possibly empty set of selection/containment nodes The only failing value is False, if True is returned then the caller should include all containment sibling nodes, otherwise the caller should process the list of containment/selection nodes.

netconf.util.filter_list_iter(filter_list, key_xpath, keys)

Return key, elm pairs that are allowed by keys using the values found using the given key_xpath

netconf.util.filter_node_match(filter_node, match_elm)

Given a filter node element and a nodename and attribute dictionary return true if the filter element matches the elmname, attributes and value (if not None).

The filter element can use a wildcard namespace or a specific namespace the attributes can be missing from the filter node but otherwise must match and the value is only checked for a match if it is not None.

netconf.util.filter_node_match_no_value(filter_node, match_elm)
netconf.util.filter_tag_match(filter_tag, elm_tag)
netconf.util.is_selection_node(felm)
netconf.util.leaf(tag, value, attrib=None, **extra)
netconf.util.leaf_elm(tag, value, attrib=None, **extra)
netconf.util.qname(tag)
netconf.util.subelm(pelm, tag, attrib=None, **extra)