本文整理汇总了Python中pyang.plugin.register_plugin函数的典型用法代码示例。如果您正苦于以下问题:Python register_plugin函数的具体用法?Python register_plugin怎么用?Python register_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register_plugin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pyang_plugin_init
def pyang_plugin_init():
"""Called by pyang plugin framework at to initialize the plugin."""
# Register the plugin
plugin.register_plugin(RESTCONFPlugin())
# Register that we handle extensions from the YANG module 'ietf-restconf'
grammar.register_extension_module(restconf_module_name)
yd = (restconf_module_name, 'yang-data')
statements.add_data_keyword(yd)
statements.add_keyword_with_children(yd)
statements.add_keywords_with_no_explicit_config(yd)
# Register the special grammar
for (stmt, occurance, (arg, rules), add_to_stmts) in restconf_stmts:
grammar.add_stmt((restconf_module_name, stmt), (arg, rules))
grammar.add_to_stmts_rules(add_to_stmts,
[((restconf_module_name, stmt), occurance)])
# Add validation functions
statements.add_validation_fun('expand_2',
[yd],
v_yang_data)
# Register special error codes
error.add_error_code('RESTCONF_YANG_DATA_CHILD', 1,
"the 'yang-data' extension must have exactly one " +
"child that is a container")
示例2: pyang_plugin_init
def pyang_plugin_init():
"""Called by pyang plugin framework at to initialize the plugin."""
# Register the plugin
plugin.register_plugin(SMIPlugin())
# Add our special argument syntax checker
syntax.add_arg_type('smi-oid', _chk_smi_oid)
# Register that we handle extensions from the YANG module 'smi'
grammar.register_extension_module(smi_module_name)
# Register the special grammar
for (stmt, occurance, (arg, rules), add_to_stmts) in smi_stmts:
grammar.add_stmt((smi_module_name, stmt), (arg, rules))
grammar.add_to_stmts_rules(add_to_stmts,
[((smi_module_name, stmt), occurance)])
# Add validation step
statements.add_validation_fun('type',
[(smi_module_name, 'oid')],
v_parse_oid)
statements.add_validation_phase('smi_set_oid', after='inherit_properties')
statements.add_validation_fun('smi_set_oid',
['module', 'submodule'],
v_set_oid)
示例3: pyang_plugin_init
def pyang_plugin_init():
"""Called by pyang plugin framework at to initialize the plugin."""
# Register the plugin
plugin.register_plugin(SMIPlugin())
# Add our special argument syntax checkers
syntax.add_arg_type("smi-oid", _chk_smi_oid)
syntax.add_arg_type("smi-max-access", _chk_smi_max_access)
# Register that we handle extensions from the YANG module 'ietf-yang-smiv2'
grammar.register_extension_module(smi_module_name)
# Register the special grammar
for (stmt, occurance, (arg, rules), add_to_stmts) in smi_stmts:
grammar.add_stmt((smi_module_name, stmt), (arg, rules))
grammar.add_to_stmts_rules(add_to_stmts, [((smi_module_name, stmt), occurance)])
# Add validation step
statements.add_validation_phase("smi_set_oid", after="inherit_properties")
statements.add_validation_fun("smi_set_oid", [(smi_module_name, "oid")], v_set_oid)
statements.add_validation_fun("smi_set_oid", [(smi_module_name, "subid")], v_set_subid)
# Register special error codes
error.add_error_code("SMIv2_BAD_SUBID", 1, "subid needs an oid or subid statement in an ancestor")
error.add_error_code("SMIv2_SUBID_AND_OID", 1, "subid and oid cannot be given at the same time")
示例4: pyang_plugin_init
def pyang_plugin_init():
"""Called by pyang plugin framework at to initialize the plugin."""
# Register the plugin
plugin.register_plugin(MDPlugin())
# Register that we handle extensions from the YANG module
# 'ietf-yang-metadata'
grammar.register_extension_module(md_module_name)
# Register the special grammar
for (stmt, occurance, (arg, rules), add_to_stmts) in md_stmts:
grammar.add_stmt((md_module_name, stmt), (arg, rules))
grammar.add_to_stmts_rules(add_to_stmts,
[((md_module_name, stmt), occurance)])
示例5: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(CxmlPlugin())
示例6: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(TreePlugin())
示例7: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(IETFPlugin())
示例8: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(JtoXPlugin())
示例9: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(ModuleCatalogPlugin())
示例10: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(PuppetPlugin())
示例11: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(JsonXslPlugin())
示例12: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(YANGXMLPlugin())
示例13: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(SwaggerPlugin())
示例14: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(LintPlugin())
示例15: pyang_plugin_init
def pyang_plugin_init():
plugin.register_plugin(ModDescPlugin())