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


Python ExecutorService.execute_rpc方法代码示例

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


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

示例1: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    infra_bridge_new_root = xr_snmp_test_trap_act.InfraBridgeNewRoot()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, infra_bridge_new_root)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-215-ydk.py

示例2: SanityTest

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
class SanityTest(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.csp = CodecServiceProvider(type=EncodingFormat.XML)
        self.es = ExecutorService()
        self.cs = CodecService()

    def setUp(self):
        # start a brand new session for every single test case
        # so test_close_session_rpc will not interfere with other test cases
        # self.ncc = NetconfServiceProvider('127.0.0.1', 'admin', 'admin', 12022)
        self.ncc = NetconfServiceProvider(
            self.hostname,
            self.username,
            self.password,
            self.port,
            self.protocol,
            self.on_demand,
            self.common_cache,
            self.timeout)
        from ydk.services import CRUDService
        crud = CRUDService()
        runner = ysanity.Runner()
        crud.delete(self.ncc, runner)

    def tearDown(self):
        # close session by close session rpc
        try:
            rpc = ietf_netconf.CloseSession()
            self.es.execute_rpc(self.ncc, rpc)
        except YError:
            pass
        del self.ncc

    @unittest.skip('Issues in confd')
    def test_close_session_rpc(self):
        rpc = ietf_netconf.CloseSession()

        reply = self.es.execute_rpc(self.ncc, rpc)
        self.assertIsNone(reply)

    def test_commit_rpc(self):
        rpc = ietf_netconf.Commit()
        rpc.input.confirmed = Empty()
        rpc.input.confirm_timeout = 5

        reply = self.es.execute_rpc(self.ncc, rpc)
        self.assertIsNone(reply)

    def test_copy_config_rpc(self):
        rpc = ietf_netconf.CopyConfig()
        rpc.input.target.candidate = Empty()
        rpc.input.source.running = Empty()

        reply = self.es.execute_rpc(self.ncc, rpc)
        self.assertIsNone(reply)

    @unittest.skip('Issues in netsim')
    def test_delete_config_rpc(self):
        rpc = ietf_netconf.DeleteConfig()
        rpc.input.target.url = "http://test"

        reply = self.es.execute_rpc(self.ncc, rpc)
        self.assertIsNone(reply)

    def test_discard_changes_rpc(self):
        rpc = ietf_netconf.DiscardChanges()
        reply = self.es.execute_rpc(self.ncc, rpc)
        self.assertIsNone(reply)

    # test edit config, get config, and get rpcs
    def test_edit_config_rpc(self):
        runner = ysanity.Runner()
        runner.ydktest_sanity_one.number = 1
        runner.ydktest_sanity_one.name = 'runner:one:name'

        runner_xml = self.cs.encode(self.csp, runner)
        filter_xml = self.cs.encode(self.csp, ysanity.Runner())

        # Edit Config
        edit_rpc = ietf_netconf.EditConfig()
        edit_rpc.input.target.candidate = Empty()
        edit_rpc.input.config = runner_xml
        reply = self.es.execute_rpc(self.ncc, edit_rpc)
        self.assertIsNone(reply)

        # Get Config
        get_config_rpc = ietf_netconf.GetConfig()
        get_config_rpc.input.source.candidate = Empty()
        get_config_rpc.input.filter = filter_xml
        reply = self.es.execute_rpc(self.ncc, get_config_rpc, runner)
        self.assertIsNotNone(reply)
        self.assertEqual(reply, runner)

        # Commit
        commit_rpc = ietf_netconf.Commit()
        reply = self.es.execute_rpc(self.ncc, commit_rpc)
        self.assertIsNone(reply)

#.........这里部分代码省略.........
开发者ID:111pontes,项目名称:ydk-gen,代码行数:103,代码来源:test_sanity_executor_rpc.py

示例3: urlparse

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    roll_back_configuration_to = xr_cfgmgr_rollback_act.RollBackConfigurationTo()  # create object
    prepare_roll_back_configuration_to(roll_back_configuration_to)  # add RPC input

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, roll_back_configuration_to)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-cfgmgr-rollback-act-32-ydk.py

示例4: urlparse

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    routing_mpls_tunnel_re_routed = xr_snmp_test_trap_act.RoutingMplsTunnelReRouted()  # create object
    prepare_routing_mpls_tunnel_re_routed(routing_mpls_tunnel_re_routed)  # add RPC input

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, routing_mpls_tunnel_re_routed)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-532-ydk.py

示例5: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    entity_sensor_threshold_notification = xr_snmp_test_trap_act.EntitySensorThresholdNotification()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, entity_sensor_threshold_notification)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-400-ydk.py

示例6: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    sonet_line_status = xr_snmp_test_trap_act.SonetLineStatus()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, sonet_line_status)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-312-ydk.py

示例7: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    routing_ospf_neighbor_state_change = xr_snmp_test_trap_act.RoutingOspfNeighborStateChange()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, routing_ospf_neighbor_state_change)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-510-ydk.py

示例8: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    infra_bridge_topology_change = xr_snmp_test_trap_act.InfraBridgeTopologyChange()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, infra_bridge_topology_change)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-216-ydk.py

示例9: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    infra_flash_device_inserted = xr_snmp_test_trap_act.InfraFlashDeviceInserted()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, infra_flash_device_inserted)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-211-ydk.py

示例10: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    infra_redundancy_progression = xr_snmp_test_trap_act.InfraRedundancyProgression()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, infra_redundancy_progression)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-213-ydk.py

示例11: urlparse

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    get_schema = ietf_netconf_monitoring.GetSchema()  # create object
    prepare_get_schema(get_schema)  # add RPC input

    # execute RPC on NETCONF device
    print(executor.execute_rpc(provider, get_schema))

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-ietf-netconf-monitoring-20-ydk.py

示例12: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    platform_hfr_plane_state = xr_snmp_test_trap_act.PlatformHfrPlaneState()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, platform_hfr_plane_state)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-448-ydk.py

示例13: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    entity_fru_fan_tray_inserted = xr_snmp_test_trap_act.EntityFruFanTrayInserted()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, entity_fru_fan_tray_inserted)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-420-ydk.py

示例14: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    all = xr_snmp_test_trap_act.All()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, all)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-900-ydk.py

示例15: device

# 需要导入模块: from ydk.services import ExecutorService [as 别名]
# 或者: from ydk.services.ExecutorService import execute_rpc [as 别名]
                        help="NETCONF device (ssh://user:[email protected]:port)")
    args = parser.parse_args()
    device = urlparse(args.device)

    # 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 NETCONF provider
    provider = NetconfServiceProvider(address=device.hostname,
                                      port=device.port,
                                      username=device.username,
                                      password=device.password,
                                      protocol=device.scheme)
    # create executor service
    executor = ExecutorService()

    sonet_path_status = xr_snmp_test_trap_act.SonetPathStatus()  # create object

    # execute RPC on NETCONF device
    executor.execute_rpc(provider, sonet_path_status)

    exit()
# End of script
开发者ID:111pontes,项目名称:ydk-py-samples,代码行数:32,代码来源:nc-execute-xr-snmp-test-trap-act-316-ydk.py


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