RootSchemaNode
- class ydk.path.RootSchemaNode
Instances of this class represent the
Root
of theSchemaTree
. ARootSchemaNode
can be used to instantiate aDataNode
tree or anRpc
object. The children of theRootSchemaNode
represent the top levelSchemaNode
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 typelist
,leaf-list
oranyxml
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 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
SchemaNode
that 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: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')