RootSchemaNode
- class ydk.path.RootSchemaNode
Instances of this class represent the
Rootof theSchemaTree. ARootSchemaNodecan be used to instantiate aDataNodetree or anRpcobject. The children of theRootSchemaNoderepresent the top levelSchemaNodein the YANG module submodules.- create_datanode(path, value=None)
Create data node with path and value. This methods creates a
DataNodetree based on the path passed in. The path expression must identify a single node. If the last node created is of schema typelist,leaf-listoranyxmlthat value is also set in the node.The returned
DataNodeis the last node created (the terminal part of the path).Note in the case of YANG
listnodes 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
SchemaNodetree 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 isNone.- 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:
- create_rpc(path)
Create an Rpc instance.
The path expression should point to a
SchemaNodethat represents theRpc.- 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:createrpc: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')