class ydk.path.RootSchemaNode

Instances of this class represent the Root of the SchemaTree. A RootSchemaNode can be used to instantiate a DataNode tree or an Rpc object. The children of the RootSchemaNode represent the top level SchemaNode in the YANG module submodules.

create_datanode(path, value=None)

Create data node with path and value. This methods creates a DataNode tree based on the path passed in. The path expression must identify a single node. If the last node created is of schema type list, leaf-list or anyxml that value is also set in the node.

The returned DataNode is the last node created (the terminal part of the path).

Note in the case of YANG list nodes the keys must be present in the path expression in the form of predicates.

  • path – (str) The XPath expression identifying the node relative to the root of the schema tree.
  • value – The string representation of the value to set.

Finds descendant nodes that match the given xpath expression.

This API finds descendant nodes in the SchemaNode 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

Get parent.

Returns:RootSchemaNode‘s parent, which is None.
Return type:None

Get path.

Returns:RootSchemaNode‘s path, which is \.
Return type:A Python string

Get the root schema node for RootSchemaNode.

Returns:RootSchemaNode‘s Root schema node.
Return type:SchemaNode

Create an Rpc instance.

The path expression should point to a SchemaNode that represents the Rpc.

Parameters:path – (str) The path to the rpc schema node.
Returns:Rpc instance if it could be created.
Return type:None or Rpc

Excample usage for creating a ydk:create rpc:

from ydk.path import NetconfSession
session = NetconfSession('', 'admin', 'admin')
root_schema = session.get_root_schema()