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


Python CodecService.encode方法代码示例

本文整理汇总了Python中ydk.services.CodecService.encode方法的典型用法代码示例。如果您正苦于以下问题:Python CodecService.encode方法的具体用法?Python CodecService.encode怎么用?Python CodecService.encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ydk.services.CodecService的用法示例。


在下文中一共展示了CodecService.encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_multiple_routing_bgp

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
def run_multiple_routing_bgp(netconf_service, session):
    crud = CRUDService()
    codec = CodecService()
    codec_provider = CodecServiceProvider()

    crud.delete(session, bgp())
    crud.delete(session, RoutingPolicy())

    multi_cfg = _get_bgp_routing_multiple_object()
    multi_payload_expected = codec.encode(codec_provider, multi_cfg)

    result = netconf_service.edit_config(session, Datastore.candidate, multi_cfg)
    assert 'ok' in result

    multi_filter = {'bgp':bgp(), 'routing-policy':RoutingPolicy()}
    multi_entity_read = netconf_service.get_config(session, Datastore.candidate, multi_filter)

    multi_payload_actual = codec.encode(codec_provider, multi_entity_read)

    assert multi_payload_expected == multi_payload_actual
开发者ID:mirceaulinic,项目名称:ydk-py,代码行数:22,代码来源:bgp_netconf.py

示例2: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    arpgmp = xr_ipv4_arp_cfg.Arpgmp()  # create object
    config_arpgmp(arpgmp)  # add object configuration

    # encode and print object
    print(codec.encode(provider, arpgmp))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-ipv4-arp-cfg-34-ydk.py

示例3: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    ntp = xr_ip_ntp_cfg.Ntp()  # create object
    config_ntp(ntp)  # add object configuration

    # encode and print object
    print(codec.encode(provider, ntp))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-ip-ntp-cfg-25-ydk.py

示例4: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.DEBUG)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    bgp = xr_ipv4_bgp_cfg.Bgp()  # create object
    config_bgp(bgp)  # add object configuration

    # encode and print object
    print(codec.encode(provider, bgp))

    provider.close()
    exit()
# End of script
开发者ID:abhikeshav,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-ipv4-bgp-cfg-44-ydk.py

示例5: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    clock = xr_infra_infra_clock_linux_cfg.Clock()  # create object
    config_clock(clock)  # add object configuration

    # encode and print object
    print(codec.encode(provider, clock))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-infra-infra-clock-linux-cfg-26-ydk.py

示例6: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    grpc = xr_man_ems_cfg.Grpc()  # create object
    config_grpc(grpc)  # add object configuration

    # encode and print object
    print(codec.encode(provider, grpc))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-man-ems-cfg-25-ydk.py

示例7: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    rsvp = xr_ip_rsvp_cfg.Rsvp()  # create object
    config_rsvp(rsvp)  # add object configuration

    # encode and print object
    print(codec.encode(provider, rsvp))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-ip-rsvp-cfg-22-ydk.py

示例8: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    ip_domain = xr_ip_domain_cfg.IpDomain()  # create object
    config_ip_domain(ip_domain)  # add object configuration

    # encode and print object
    print(codec.encode(provider, ip_domain))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-ip-domain-cfg-25-ydk.py

示例9: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    telemetry_system = oc_telemetry.TelemetrySystem()  # create object
    config_telemetry_system(telemetry_system)  # add object configuration

    # encode and print object
    print(codec.encode(provider, telemetry_system))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-oc-telemetry-34-ydk.py

示例10: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    lldp = xr_ethernet_lldp_cfg.Lldp()  # create object
    config_lldp(lldp)  # add object configuration

    # encode and print object
    print(codec.encode(provider, lldp))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-ethernet-lldp-cfg-22-ydk.py

示例11: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    cdp = xr_cdp_cfg.Cdp()  # create object
    config_cdp(cdp)  # add object configuration

    # encode and print object
    print(codec.encode(provider, cdp))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-cdp-cfg-24-ydk.py

示例12: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    sr = xr_segment_routing_ms_cfg.Sr()  # create object
    config_sr(sr)  # add object configuration

    # encode and print object
    print(codec.encode(provider, sr))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-segment-routing-ms-cfg-22-ydk.py

示例13: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.INFO)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    vrfs = xr_infra_rsi_cfg.Vrfs()  # create object
    config_vrfs(vrfs)  # add object configuration

    # encode and print object
    print(codec.encode(provider, vrfs))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-infra-rsi-cfg-20-ydk.py

示例14: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
if __name__ == "__main__":
    """Execute main program."""
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.DEBUG)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    routing_policy = oc_routing_policy.RoutingPolicy()  # create config object
    config_routing_policy(routing_policy)  # add object configuration

    print(codec.encode(provider, routing_policy))  # encode and print object
    provider.close()
    exit()
# End of script
开发者ID:fmontoy,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-config-routing-policy-24-ydk.py

示例15: ArgumentParser

# 需要导入模块: from ydk.services import CodecService [as 别名]
# 或者: from ydk.services.CodecService import encode [as 别名]
    parser = ArgumentParser()
    parser.add_argument("-v", "--verbose", help="print debugging messages",
                        action="store_true")
    args = parser.parse_args()

    # log debug messages if verbose argument specified
    if args.verbose:
        logger = logging.getLogger("ydk")
        logger.setLevel(logging.DEBUG)
        handler = logging.StreamHandler()
        formatter = logging.Formatter(("%(asctime)s - %(name)s - "
                                      "%(levelname)s - %(message)s"))
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    # create codec provider
    provider = CodecServiceProvider(type="xml")

    # create codec service
    codec = CodecService()

    isis = xr_clns_isis_cfg.Isis()  # create object
    config_isis(isis)  # add object configuration

    # encode and print object
    print(codec.encode(provider, isis))

    provider.close()
    exit()
# End of script
开发者ID:abhikeshav,项目名称:ydk-py-samples,代码行数:32,代码来源:cd-encode-xr-clns-isis-cfg-40-ydk.py


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