ncdiff.netconf sub-module¶
-
class
ncdiff.netconf.
NetconfParser
(device, get_reply)[source]¶ A parser to convert a reply of get-config to an lxml Element object.
-
ele
¶ An lxml Element object which is the root of the config tree.
Type: Element
-
-
class
ncdiff.netconf.
NetconfCalculator
(device, etree1, etree2, preferred_create='merge', preferred_replace='merge', preferred_delete='delete')[source]¶ A Netconf calculator to do subtraction and addition. A subtraction is to compute the delta between two Config instances in a form of Netconf edit-config. An addition is to apply one Netconf edit-config to a Config instance.
-
sub
¶ Content of a Netconf edit-config which can achieve a transition from one config, i.e., self.etree2, to another config, i.e., self.etree1.
Type: Element
-
add
¶ Content of a Config instance.
Type: Element
-
preferred_create
¶ Preferred operation of creating a new element. Choice of ‘merge’, ‘create’ or ‘replace’.
Type: str
-
preferred_replace
¶ Preferred operation of replacing an existing element. Choice of ‘merge’ or ‘replace’.
Type: str
-
preferred_delete
¶ Preferred operation of deleting an existing element. Choice of ‘delete’ or ‘remove’.
Type: str
__init__ instantiates a NetconfCalculator instance.
-
node_add
(node_sum, node_other)[source]¶ High-level api: Combine two configs or apply an instance of ConfigDelta to a config. This method is recursive. node_sum will be modified during the process, and it becomes the result at the end.
Parameters: - node_sum (
Element
) – A config node in a config tree. - node_other (
Element
) – A config node in another config tree.
Returns: There is no return of this method.
Return type: None
- node_sum (
-
node_sub
(node_self, node_other)[source]¶ Low-level api: Compute the delta of two configs. This method is recursive. Assume two configs are different.
Parameters: - node_self (
Element
) – A config node in a config tree that is being processed. node_self cannot be a leaf node. - node_other (
Element
) – A config node in another config tree that is being processed.
Returns: There is no return of this method.
Return type: None
- node_self (
-