RootSchemaNode

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.

Parameters
  • 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.

find(path)

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

Get parent.

Returns

RootSchemaNode’s parent, which is None.

Return type

None

get_path()

Get path.

Returns

RootSchemaNode’s path, which is \.

Return type

A Python string

get_root()

Get the root schema node for RootSchemaNode.

Returns

RootSchemaNode’s Root schema node.

Return type

SchemaNode

create_rpc(path)

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:

1from ydk.path import NetconfSession
2session = NetconfSession('127.0.0.1', 'admin', 'admin')
3root_schema = session.get_root_schema()
4root_schema.create_rpc('ydk:create')