Statement

class ydk.path.Statement(keyword, arg)

Represents the YANG Statement.

Parameters:
  • keyword – (str) YANG keyword.
  • arg – (str) YANG argument.
keyword

Read only attribute for YANG keyword.

arg

Read only attribute for YANG argument.

Example usage for creating a statement:

>>> from ydk.path import Statement
>>> s = Statement('container', 'bgp')

Example usage for getting statement from schema node:

>>> 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
>>> statement = schema_node.get_statement()                               # <-- YANG statement for this schema node
>>> statement.keyword
'container'
>>> statement.arg
'bgp'