SchemaNode

class ydk.path.SchemaNode

Class represents a Node in the SchemaTree.

Note

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('127.0.0.1', '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
find(path)

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?.

Parameters:

path – (str) The path expression.

Returns:

List of schema node satisfies the criterion.

Return type:

list of SchemaNode

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

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

Returns:Parent schema node.
Return type:SchemaNode
get_path()

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_root()

Get the root schema node of current schema node.

Returns:Root schema node of current schema node.
Return type:SchemaNode
get_statement()

Get current schema node’s YANG statement.

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