class ydk.path.SchemaNode

Class represents a Node in the SchemaTree.


The Python SchemaNode is wrapper for YDK C++ SchemaNode implementation. No constructor is defined and the user could not instantiate a SchemaNode instance. However, the user could get an instance of SchemaNode through DataNode:

>>> from ydk.path import NetconfSession
>>> session = NetconfSession('', 'admin', 'admin', 830)
>>> root_schema = session.get_root_schema()                               # <-- root_schema is an instance of RootSchemaNode
>>> bgp = root_schema.create_datanode('openconfig-bgp:bgp')               # <-- bgp is an instance of DataNode
>>> schema_node = bgp.get_schema_node()                                   # <-- schema node for bgp

Finds descendant nodes that match the given xpath expression. This API finds descendant nodes in the schema node tree that satisfy the given path expression. See How do I use the Path API?.


path – (str) The path expression.


List of schema node satisfies the criterion.

Return type:

list of SchemaNode

  • RuntimeError – With YPathError prefix if the path expression in invalid, see error code for details.
  • RuntimeError – With YInvalidArgumentError if the argument is invalid.

Get the parent node of this schema node in the tree.

Returns:Parent schema node.
Return type:SchemaNode

Get the path expression representing this schema node in in the schema node tree.

Returns:Path to this schema node.
Return type:A Python string

Get the root schema node of current schema node.

Returns:Root schema node of current schema node.
Return type:SchemaNode

Get current schema node’s YANG statement.

Returns:YANG statements for this schema node.
Return type:Statement