当前位置: 首页>>代码示例>>Python>>正文


Python plugin.register_plugin函数代码示例

本文整理汇总了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")
开发者ID:Trilliant,项目名称:pyang,代码行数:29,代码来源:restconf.py

示例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)
开发者ID:prashg28,项目名称:pyang-ct,代码行数:26,代码来源:smi.py

示例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")
开发者ID:XiuzhongChen,项目名称:pyang,代码行数:26,代码来源:smi.py

示例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)])
开发者ID:BroadbandForum,项目名称:pyang,代码行数:15,代码来源:metadata.py

示例5: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(CxmlPlugin())
开发者ID:janlindblad,项目名称:yang-explorer,代码行数:2,代码来源:cxml.py

示例6: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(TreePlugin())
开发者ID:rchuppala,项目名称:usc_agent,代码行数:2,代码来源:tree.py

示例7: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(IETFPlugin())
开发者ID:OpenNetworkingFoundation,项目名称:configuration,代码行数:2,代码来源:ietf.py

示例8: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(JtoXPlugin())
开发者ID:brenoah,项目名称:pyang,代码行数:2,代码来源:jtox.py

示例9: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(ModuleCatalogPlugin())
开发者ID:cmoberg,项目名称:pyang-module-catalog-plugin,代码行数:2,代码来源:modulecatalog.py

示例10: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(PuppetPlugin())
开发者ID:Juniper,项目名称:py-auto-resource-generator,代码行数:2,代码来源:puppet.py

示例11: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(JsonXslPlugin())
开发者ID:eggface,项目名称:pyang,代码行数:2,代码来源:jsonxsl.py

示例12: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(YANGXMLPlugin())
开发者ID:prashg28,项目名称:pyang-ct,代码行数:2,代码来源:yangxml.py

示例13: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(SwaggerPlugin())
开发者ID:cmoberg,项目名称:pyang-swagger-plugin,代码行数:2,代码来源:swagger.py

示例14: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(LintPlugin())
开发者ID:SDTN,项目名称:Test,代码行数:2,代码来源:lint.py

示例15: pyang_plugin_init

def pyang_plugin_init():
    plugin.register_plugin(ModDescPlugin())
开发者ID:BroadbandForum,项目名称:pyang,代码行数:2,代码来源:mod-desc.py


注:本文中的pyang.plugin.register_plugin函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。