cisco_node_utils_mgx 2.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +96 -0
- data/.travis.yml +17 -0
- data/CHANGELOG.md +676 -0
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +10 -0
- data/LICENSE +201 -0
- data/README.md +246 -0
- data/Rakefile +44 -0
- data/SUPPORT.md +3 -0
- data/bin/.rubocop.yml +18 -0
- data/bin/check_metric_limits.rb +109 -0
- data/bin/git/hooks/commit-msg/enforce_style +89 -0
- data/bin/git/hooks/hook_lib +115 -0
- data/bin/git/hooks/hooks-wrapper +38 -0
- data/bin/git/hooks/post-flow-hotfix-start/update-version +24 -0
- data/bin/git/hooks/post-flow-release-finish/update-version +29 -0
- data/bin/git/hooks/post-flow-release-start/update-version +19 -0
- data/bin/git/hooks/post-merge/update-hooks +6 -0
- data/bin/git/hooks/post-rewrite/update-hooks +6 -0
- data/bin/git/hooks/pre-commit/check_unstaged_changes +18 -0
- data/bin/git/hooks/pre-commit/rubocop +25 -0
- data/bin/git/hooks/pre-commit/validate-diffs +45 -0
- data/bin/git/hooks/pre-commit/validate-yaml +18 -0
- data/bin/git/hooks/pre-push/check-changelog +24 -0
- data/bin/git/hooks/pre-push/rubocop +7 -0
- data/bin/git/update-hooks +123 -0
- data/bin/show_running_yang.rb +233 -0
- data/cisco_node_utils.gemspec +41 -0
- data/docs/README-develop-best-practices.md +521 -0
- data/docs/README-develop-node-utils-APIs.md +570 -0
- data/docs/README-maintainers.md +77 -0
- data/docs/README-test-execution.md +57 -0
- data/docs/README-utilities.md +14 -0
- data/docs/agent_files.png +0 -0
- data/docs/cisco_node_utils.yaml.example +36 -0
- data/docs/template-router.rb +123 -0
- data/docs/template-test_router.rb +104 -0
- data/ext/mkrf_conf.rb +63 -0
- data/lib/.rubocop.yml +18 -0
- data/lib/cisco_node_utils/aaa_authentication_login.rb +95 -0
- data/lib/cisco_node_utils/aaa_authentication_login_service.rb +138 -0
- data/lib/cisco_node_utils/aaa_authorization_service.rb +156 -0
- data/lib/cisco_node_utils/ace.rb +467 -0
- data/lib/cisco_node_utils/acl.rb +101 -0
- data/lib/cisco_node_utils/banner.rb +63 -0
- data/lib/cisco_node_utils/bfd_global.rb +305 -0
- data/lib/cisco_node_utils/bgp.rb +988 -0
- data/lib/cisco_node_utils/bgp_af.rb +545 -0
- data/lib/cisco_node_utils/bgp_af_aggr_addr.rb +207 -0
- data/lib/cisco_node_utils/bgp_neighbor.rb +527 -0
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +780 -0
- data/lib/cisco_node_utils/bridge_domain.rb +178 -0
- data/lib/cisco_node_utils/bridge_domain_vni.rb +206 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +444 -0
- data/lib/cisco_node_utils/client/client.rb +238 -0
- data/lib/cisco_node_utils/client/grpc/client.rb +395 -0
- data/lib/cisco_node_utils/client/grpc/ems.proto +148 -0
- data/lib/cisco_node_utils/client/grpc/ems.rb +111 -0
- data/lib/cisco_node_utils/client/grpc/ems_services.rb +49 -0
- data/lib/cisco_node_utils/client/grpc.rb +33 -0
- data/lib/cisco_node_utils/client/nxapi/client.rb +368 -0
- data/lib/cisco_node_utils/client/nxapi.rb +31 -0
- data/lib/cisco_node_utils/client/utils.rb +180 -0
- data/lib/cisco_node_utils/client.rb +35 -0
- data/lib/cisco_node_utils/cmd_ref/README_YAML.md +590 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_auth_login_service.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authentication_login.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +40 -0
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +48 -0
- data/lib/cisco_node_utils/cmd_ref/banner.yaml +11 -0
- data/lib/cisco_node_utils/cmd_ref/bfd_global.yaml +117 -0
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +383 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +223 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_af_aa.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +174 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +236 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +49 -0
- data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +33 -0
- data/lib/cisco_node_utils/cmd_ref/dhcp_relay_global.yaml +128 -0
- data/lib/cisco_node_utils/cmd_ref/dnsclient.yaml +55 -0
- data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_multicast.yaml +12 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_multisite.yaml +18 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_stormcontrol.yaml +18 -0
- data/lib/cisco_node_utils/cmd_ref/evpn_vni.yaml +48 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +183 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +40 -0
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +126 -0
- data/lib/cisco_node_utils/cmd_ref/hostname.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/hsrp_global.yaml +25 -0
- data/lib/cisco_node_utils/cmd_ref/images.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +781 -0
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/interface_evpn_multisite.yaml +17 -0
- data/lib/cisco_node_utils/cmd_ref/interface_hsrp_group.yaml +120 -0
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +112 -0
- data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +87 -0
- data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +42 -0
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/ip_multicast.yaml +22 -0
- data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +83 -0
- data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +119 -0
- data/lib/cisco_node_utils/cmd_ref/memory.yaml +24 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_auth_key.yaml +10 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +27 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +34 -0
- data/lib/cisco_node_utils/cmd_ref/object_group.yaml +32 -0
- data/lib/cisco_node_utils/cmd_ref/ospf.yaml +91 -0
- data/lib/cisco_node_utils/cmd_ref/ospf_area.yaml +91 -0
- data/lib/cisco_node_utils/cmd_ref/ospf_area_vlink.yaml +88 -0
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +37 -0
- data/lib/cisco_node_utils/cmd_ref/pim.yaml +43 -0
- data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +86 -0
- data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +37 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server.yaml +100 -0
- data/lib/cisco_node_utils/cmd_ref/radius_server_group.yaml +19 -0
- data/lib/cisco_node_utils/cmd_ref/route_map.yaml +601 -0
- data/lib/cisco_node_utils/cmd_ref/show_system.yaml +9 -0
- data/lib/cisco_node_utils/cmd_ref/show_version.yaml +84 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +81 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_group.yaml +9 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +74 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +91 -0
- data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +57 -0
- data/lib/cisco_node_utils/cmd_ref/snmpnotification.yaml +23 -0
- data/lib/cisco_node_utils/cmd_ref/span_session.yaml +65 -0
- data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +235 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_facility.yaml +10 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +34 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/system.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_global.yaml +37 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +63 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_group.yaml +45 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +64 -0
- data/lib/cisco_node_utils/cmd_ref/upgrade.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/vdc.yaml +52 -0
- data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/vlan.yaml +106 -0
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +233 -0
- data/lib/cisco_node_utils/cmd_ref/vrf.yaml +86 -0
- data/lib/cisco_node_utils/cmd_ref/vrf_af.yaml +139 -0
- data/lib/cisco_node_utils/cmd_ref/vtp.yaml +32 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +114 -0
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +71 -0
- data/lib/cisco_node_utils/cmd_ref/yang.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +68 -0
- data/lib/cisco_node_utils/command_reference.rb +724 -0
- data/lib/cisco_node_utils/configparser_lib.rb +195 -0
- data/lib/cisco_node_utils/constants.rb +40 -0
- data/lib/cisco_node_utils/dhcp_relay_global.rb +302 -0
- data/lib/cisco_node_utils/dns_domain.rb +93 -0
- data/lib/cisco_node_utils/domain_name.rb +82 -0
- data/lib/cisco_node_utils/encapsulation.rb +112 -0
- data/lib/cisco_node_utils/environment.rb +110 -0
- data/lib/cisco_node_utils/evpn_multicast.rb +66 -0
- data/lib/cisco_node_utils/evpn_multisite.rb +96 -0
- data/lib/cisco_node_utils/evpn_stormcontrol.rb +84 -0
- data/lib/cisco_node_utils/evpn_vni.rb +159 -0
- data/lib/cisco_node_utils/exceptions.rb +140 -0
- data/lib/cisco_node_utils/fabricpath_global.rb +405 -0
- data/lib/cisco_node_utils/fabricpath_topology.rb +137 -0
- data/lib/cisco_node_utils/feature.rb +377 -0
- data/lib/cisco_node_utils/hostname.rb +62 -0
- data/lib/cisco_node_utils/hsrp_global.rb +97 -0
- data/lib/cisco_node_utils/interface.rb +2128 -0
- data/lib/cisco_node_utils/interface_channel_group.rb +142 -0
- data/lib/cisco_node_utils/interface_evpn_multisite.rb +72 -0
- data/lib/cisco_node_utils/interface_hsrp_group.rb +557 -0
- data/lib/cisco_node_utils/interface_ospf.rb +378 -0
- data/lib/cisco_node_utils/interface_portchannel.rb +180 -0
- data/lib/cisco_node_utils/interface_service_vni.rb +132 -0
- data/lib/cisco_node_utils/ip_multicast.rb +90 -0
- data/lib/cisco_node_utils/itd_device_group.rb +228 -0
- data/lib/cisco_node_utils/itd_device_group_node.rb +144 -0
- data/lib/cisco_node_utils/itd_service.rb +511 -0
- data/lib/cisco_node_utils/logger.rb +78 -0
- data/lib/cisco_node_utils/name_server.rb +64 -0
- data/lib/cisco_node_utils/node.rb +443 -0
- data/lib/cisco_node_utils/node_util.rb +111 -0
- data/lib/cisco_node_utils/ntp_auth_key.rb +67 -0
- data/lib/cisco_node_utils/ntp_config.rb +83 -0
- data/lib/cisco_node_utils/ntp_server.rb +86 -0
- data/lib/cisco_node_utils/object_group.rb +75 -0
- data/lib/cisco_node_utils/object_group_entry.rb +143 -0
- data/lib/cisco_node_utils/overlay_global.rb +142 -0
- data/lib/cisco_node_utils/pim.rb +131 -0
- data/lib/cisco_node_utils/pim_group_list.rb +109 -0
- data/lib/cisco_node_utils/pim_rp_address.rb +103 -0
- data/lib/cisco_node_utils/platform.rb +217 -0
- data/lib/cisco_node_utils/portchannel_global.rb +347 -0
- data/lib/cisco_node_utils/radius_global.rb +165 -0
- data/lib/cisco_node_utils/radius_server.rb +421 -0
- data/lib/cisco_node_utils/radius_server_group.rb +117 -0
- data/lib/cisco_node_utils/route_map.rb +2540 -0
- data/lib/cisco_node_utils/router_ospf.rb +77 -0
- data/lib/cisco_node_utils/router_ospf_area.rb +416 -0
- data/lib/cisco_node_utils/router_ospf_area_vlink.rb +313 -0
- data/lib/cisco_node_utils/router_ospf_vrf.rb +342 -0
- data/lib/cisco_node_utils/snmp_notification_receiver.rb +176 -0
- data/lib/cisco_node_utils/snmpcommunity.rb +109 -0
- data/lib/cisco_node_utils/snmpgroup.rb +54 -0
- data/lib/cisco_node_utils/snmpnotification.rb +57 -0
- data/lib/cisco_node_utils/snmpserver.rb +132 -0
- data/lib/cisco_node_utils/snmpuser.rb +403 -0
- data/lib/cisco_node_utils/span_session.rb +149 -0
- data/lib/cisco_node_utils/stp_global.rb +676 -0
- data/lib/cisco_node_utils/syslog_facility.rb +64 -0
- data/lib/cisco_node_utils/syslog_server.rb +146 -0
- data/lib/cisco_node_utils/syslog_settings.rb +174 -0
- data/lib/cisco_node_utils/tacacs_global.rb +137 -0
- data/lib/cisco_node_utils/tacacs_server.rb +173 -0
- data/lib/cisco_node_utils/tacacs_server_group.rb +149 -0
- data/lib/cisco_node_utils/tacacs_server_host.rb +216 -0
- data/lib/cisco_node_utils/upgrade.rb +122 -0
- data/lib/cisco_node_utils/vdc.rb +118 -0
- data/lib/cisco_node_utils/version.rb +21 -0
- data/lib/cisco_node_utils/vlan.rb +301 -0
- data/lib/cisco_node_utils/vpc.rb +466 -0
- data/lib/cisco_node_utils/vrf.rb +192 -0
- data/lib/cisco_node_utils/vrf_af.rb +327 -0
- data/lib/cisco_node_utils/vtp.rb +125 -0
- data/lib/cisco_node_utils/vxlan_vtep.rb +286 -0
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +331 -0
- data/lib/cisco_node_utils/yang.rb +160 -0
- data/lib/cisco_node_utils/yum.rb +213 -0
- data/lib/cisco_node_utils.rb +21 -0
- data/lib/minitest/environment_plugin.rb +31 -0
- data/lib/minitest/log_level_plugin.rb +41 -0
- data/spec/client_spec.rb +7 -0
- data/spec/environment_spec.rb +384 -0
- data/spec/grpc_client_spec.rb +23 -0
- data/spec/isolate/all_clients_spec.rb +9 -0
- data/spec/isolate/grpc_only_spec.rb +16 -0
- data/spec/isolate/no_clients_spec.rb +26 -0
- data/spec/isolate/nxapi_only_spec.rb +16 -0
- data/spec/nxapi_client_spec.rb +42 -0
- data/spec/schema.yaml +82 -0
- data/spec/shared_examples_for_clients.rb +14 -0
- data/spec/spec_helper.rb +91 -0
- data/spec/whitespace_spec.rb +10 -0
- data/spec/yaml_spec.rb +42 -0
- data/tests/.rubocop.yml +18 -0
- data/tests/CSCuxdublin-1.0.0-7.0.3.I3.1.lib32_n9000.rpm +0 -0
- data/tests/basetest.rb +243 -0
- data/tests/ciscotest.rb +577 -0
- data/tests/cmd_config.yaml +75 -0
- data/tests/cmd_config_invalid.yaml +16 -0
- data/tests/n9000_sample-1.0.0-7.0.3.x86_64.rpm +0 -0
- data/tests/noop.rb +7 -0
- data/tests/platform_info.rb +63 -0
- data/tests/tacacs_server.yaml.example +6 -0
- data/tests/test_aaa_authentication_login.rb +243 -0
- data/tests/test_aaa_authentication_login_service.rb +761 -0
- data/tests/test_aaa_authorization_service.rb +874 -0
- data/tests/test_ace.rb +304 -0
- data/tests/test_acl.rb +185 -0
- data/tests/test_banner.rb +85 -0
- data/tests/test_bfd_global.rb +272 -0
- data/tests/test_bgp_af.rb +875 -0
- data/tests/test_bgp_af_aa.rb +108 -0
- data/tests/test_bgp_neighbor.rb +596 -0
- data/tests/test_bgp_neighbor_af.rb +781 -0
- data/tests/test_bridge_domain.rb +198 -0
- data/tests/test_bridge_domain_vni.rb +109 -0
- data/tests/test_client_utils.rb +111 -0
- data/tests/test_cmn_utils.rb +76 -0
- data/tests/test_command_config.rb +206 -0
- data/tests/test_command_reference.rb +669 -0
- data/tests/test_dhcp_relay_global.rb +286 -0
- data/tests/test_dns_domain.rb +123 -0
- data/tests/test_domain_name.rb +96 -0
- data/tests/test_encapsulation.rb +75 -0
- data/tests/test_evpn_multicast.rb +65 -0
- data/tests/test_evpn_multisite.rb +70 -0
- data/tests/test_evpn_stormcontrol.rb +56 -0
- data/tests/test_evpn_vni.rb +131 -0
- data/tests/test_fabricpath_global.rb +246 -0
- data/tests/test_fabricpath_topology.rb +77 -0
- data/tests/test_feature.rb +272 -0
- data/tests/test_grpc.rb +166 -0
- data/tests/test_hostname.rb +64 -0
- data/tests/test_hsrp_global.rb +79 -0
- data/tests/test_interface.rb +1958 -0
- data/tests/test_interface_bdi.rb +80 -0
- data/tests/test_interface_channel_group.rb +131 -0
- data/tests/test_interface_evpn_multisite.rb +94 -0
- data/tests/test_interface_hsrp.rb +134 -0
- data/tests/test_interface_hsrp_group.rb +570 -0
- data/tests/test_interface_ospf.rb +820 -0
- data/tests/test_interface_portchannel.rb +135 -0
- data/tests/test_interface_private_vlan.rb +365 -0
- data/tests/test_interface_service_vni.rb +203 -0
- data/tests/test_interface_svi.rb +210 -0
- data/tests/test_interface_switchport.rb +468 -0
- data/tests/test_ip_multicast.rb +80 -0
- data/tests/test_itd_device_group.rb +145 -0
- data/tests/test_itd_device_group_node.rb +199 -0
- data/tests/test_itd_service.rb +314 -0
- data/tests/test_logger.rb +43 -0
- data/tests/test_name_server.rb +94 -0
- data/tests/test_node.rb +50 -0
- data/tests/test_node_ext.rb +406 -0
- data/tests/test_node_util.rb +119 -0
- data/tests/test_ntp_auth_key.rb +77 -0
- data/tests/test_ntp_config.rb +100 -0
- data/tests/test_ntp_server.rb +146 -0
- data/tests/test_nxapi.rb +236 -0
- data/tests/test_object_group.rb +122 -0
- data/tests/test_overlay_global.rb +108 -0
- data/tests/test_pim.rb +203 -0
- data/tests/test_pim_group_list.rb +147 -0
- data/tests/test_pim_rp_address.rb +155 -0
- data/tests/test_platform.rb +254 -0
- data/tests/test_portchannel_global.rb +322 -0
- data/tests/test_radius_global.rb +108 -0
- data/tests/test_radius_server.rb +377 -0
- data/tests/test_radius_server_group.rb +151 -0
- data/tests/test_route_map.rb +1479 -0
- data/tests/test_router_bgp.rb +1325 -0
- data/tests/test_router_ospf.rb +56 -0
- data/tests/test_router_ospf_area.rb +433 -0
- data/tests/test_router_ospf_area_vlink.rb +298 -0
- data/tests/test_router_ospf_vrf.rb +690 -0
- data/tests/test_snmp_notification_receiver.rb +169 -0
- data/tests/test_snmpcommunity.rb +422 -0
- data/tests/test_snmpgroup.rb +71 -0
- data/tests/test_snmpnotification.rb +91 -0
- data/tests/test_snmpserver.rb +251 -0
- data/tests/test_snmpuser.rb +666 -0
- data/tests/test_span_session.rb +155 -0
- data/tests/test_stp_global.rb +575 -0
- data/tests/test_syslog_facility.rb +80 -0
- data/tests/test_syslog_server.rb +119 -0
- data/tests/test_syslog_settings.rb +123 -0
- data/tests/test_tacacs_global.rb +109 -0
- data/tests/test_tacacs_server.rb +436 -0
- data/tests/test_tacacs_server_group.rb +434 -0
- data/tests/test_tacacs_server_host.rb +427 -0
- data/tests/test_upgrade.rb +105 -0
- data/tests/test_vdc.rb +64 -0
- data/tests/test_vlan.rb +386 -0
- data/tests/test_vlan_private.rb +656 -0
- data/tests/test_vpc.rb +548 -0
- data/tests/test_vrf.rb +248 -0
- data/tests/test_vrf_af.rb +288 -0
- data/tests/test_vtp.rb +278 -0
- data/tests/test_vxlan_vtep.rb +327 -0
- data/tests/test_vxlan_vtep_vni.rb +326 -0
- data/tests/test_yang.rb +369 -0
- data/tests/test_yum.rb +109 -0
- data/tests/upgrade_info.yaml.example +3 -0
- data/tests/yum_package.yaml +94 -0
- metadata +534 -0
@@ -0,0 +1,395 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# October 2015, Glenn F. Matthews
|
4
|
+
#
|
5
|
+
# Copyright (c) 2015-2016 Cisco and/or its affiliates.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require_relative '../client'
|
20
|
+
require_relative '../../constants'
|
21
|
+
Cisco::Client.silence_warnings do
|
22
|
+
require 'grpc'
|
23
|
+
end
|
24
|
+
require 'json'
|
25
|
+
require_relative 'ems_services'
|
26
|
+
|
27
|
+
include IOSXRExtensibleManagabilityService
|
28
|
+
include Cisco::Logger
|
29
|
+
|
30
|
+
# Client implementation using gRPC API for IOS XR
|
31
|
+
class Cisco::Client::GRPC < Cisco::Client
|
32
|
+
register_client(self)
|
33
|
+
|
34
|
+
attr_accessor :timeout
|
35
|
+
|
36
|
+
def initialize(**kwargs)
|
37
|
+
# Defaults for gRPC:
|
38
|
+
kwargs[:host] ||= '127.0.0.1'
|
39
|
+
kwargs[:port] ||= 57_400
|
40
|
+
# rubocop:disable Style/HashSyntax
|
41
|
+
super(data_formats: [:cli, :yang_json],
|
42
|
+
platform: :ios_xr,
|
43
|
+
**kwargs)
|
44
|
+
# rubocop:enable Style/HashSyntax
|
45
|
+
@config = GRPCConfigOper::Stub.new(@address, :this_channel_is_insecure)
|
46
|
+
@exec = GRPCExec::Stub.new(@address, :this_channel_is_insecure)
|
47
|
+
|
48
|
+
# Make sure we can actually connect
|
49
|
+
@timeout = 10
|
50
|
+
begin
|
51
|
+
base_msg = 'gRPC client creation failure: '
|
52
|
+
get(command: 'show clock')
|
53
|
+
rescue Cisco::ClientError => e
|
54
|
+
error 'initial connect failed: ' + e.to_s
|
55
|
+
if e.message[/deadline exceeded/i]
|
56
|
+
raise Cisco::ConnectionRefused, \
|
57
|
+
base_msg + 'timed out during initial connection: ' + e.message
|
58
|
+
end
|
59
|
+
raise e.class, base_msg + e.message
|
60
|
+
end
|
61
|
+
|
62
|
+
# Let commands in general take up to 2 minutes
|
63
|
+
@timeout = 120
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.validate_args(**kwargs)
|
67
|
+
super
|
68
|
+
base_msg = 'gRPC client creation failure: '
|
69
|
+
# Connection to remote system - username and password are required
|
70
|
+
fail TypeError, base_msg + 'username must be specified' \
|
71
|
+
if kwargs[:username].nil?
|
72
|
+
fail TypeError, base_msg + 'password must be specified' \
|
73
|
+
if kwargs[:password].nil?
|
74
|
+
end
|
75
|
+
|
76
|
+
def cache_flush
|
77
|
+
@cache_hash = {
|
78
|
+
'cli_config' => {},
|
79
|
+
'show_cmd_text_output' => {},
|
80
|
+
'show_cmd_json_output' => {},
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
# Configure the given CLI command(s) on the device.
|
85
|
+
#
|
86
|
+
# @param data_format one of Cisco::DATA_FORMATS. Default is :cli
|
87
|
+
# @param context [Array<String>] Zero or more configuration commands used
|
88
|
+
# to enter the desired CLI sub-mode
|
89
|
+
# @param values [Array<String>] One or more commands to execute /
|
90
|
+
# config strings to send
|
91
|
+
# @param kwargs data-format-specific args
|
92
|
+
def set(data_format: :cli,
|
93
|
+
context: nil,
|
94
|
+
values: nil,
|
95
|
+
**kwargs)
|
96
|
+
context = munge_to_array(context)
|
97
|
+
values = munge_to_array(values)
|
98
|
+
super
|
99
|
+
if data_format == :yang_json
|
100
|
+
mode = kwargs[:mode] || :merge_config
|
101
|
+
fail ArgumentError unless Cisco::YANG_SET_MODE.include? mode
|
102
|
+
values.each do |yang|
|
103
|
+
yang_req(@config, mode.to_s, ConfigArgs.new(yangjson: yang))
|
104
|
+
end
|
105
|
+
else
|
106
|
+
# IOS XR lets us concatenate submode commands together.
|
107
|
+
# This makes it possible to guarantee we are in the correct context:
|
108
|
+
# context: ['foo', 'bar'], values: ['baz', 'bat']
|
109
|
+
# ---> values: ['foo bar baz', 'foo bar bat']
|
110
|
+
# However, there's a special case for 'no' commands:
|
111
|
+
# context: ['foo', 'bar'], values: ['no baz']
|
112
|
+
# ---> values: ['no foo bar baz'] ---- the 'no' goes at the start
|
113
|
+
context = context.join(' ')
|
114
|
+
unless context.empty?
|
115
|
+
values.map! do |cmd|
|
116
|
+
match = cmd[/^\s*no\s+(.*)/, 1]
|
117
|
+
if match
|
118
|
+
cmd = "no #{context} #{match}"
|
119
|
+
else
|
120
|
+
cmd = "#{context} #{cmd}"
|
121
|
+
end
|
122
|
+
cmd
|
123
|
+
end
|
124
|
+
end
|
125
|
+
# CliConfigArgs wants a newline-separated string of commands
|
126
|
+
args = CliConfigArgs.new(cli: values.join("\n"))
|
127
|
+
req(@config, 'cli_config', args)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def get(data_format: :cli,
|
132
|
+
command: nil,
|
133
|
+
context: nil,
|
134
|
+
value: nil,
|
135
|
+
**kwargs)
|
136
|
+
super
|
137
|
+
fail ArgumentError if command.nil?
|
138
|
+
|
139
|
+
if data_format == :yang_json
|
140
|
+
mode = kwargs[:mode] || :get_config
|
141
|
+
yang_req(@config, mode, ConfigGetArgs.new(yangpathjson: command))
|
142
|
+
else
|
143
|
+
args = ShowCmdArgs.new(cli: command)
|
144
|
+
output = req(@exec, 'show_cmd_text_output', args)
|
145
|
+
self.class.filter_cli(cli_output: output, context: context, value: value)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def req(stub, type, args)
|
150
|
+
if cache_enable? && @cache_hash[type] && @cache_hash[type][args.cli]
|
151
|
+
return @cache_hash[type][args.cli]
|
152
|
+
end
|
153
|
+
|
154
|
+
debug "Sending '#{type}' request:"
|
155
|
+
if args.is_a?(ShowCmdArgs) || args.is_a?(CliConfigArgs)
|
156
|
+
debug " with cli: '#{args.cli}'"
|
157
|
+
end
|
158
|
+
output = Cisco::Client.silence_warnings do
|
159
|
+
response = stub.send(type, args,
|
160
|
+
timeout: @timeout,
|
161
|
+
username: @username,
|
162
|
+
password: @password)
|
163
|
+
# gRPC server may split the response into multiples
|
164
|
+
response = response.is_a?(Enumerator) ? response.to_a : [response]
|
165
|
+
debug "Got responses: #{response.map(&:class).join(', ')}"
|
166
|
+
# Check for errors first
|
167
|
+
handle_errors(args, response.select { |r| !r.errors.empty? })
|
168
|
+
|
169
|
+
# If we got here, no errors occurred
|
170
|
+
handle_response(args, response)
|
171
|
+
end
|
172
|
+
|
173
|
+
@cache_hash[type][args.cli] = output if cache_enable? && !output.empty?
|
174
|
+
return output
|
175
|
+
rescue ::GRPC::BadStatus => e
|
176
|
+
warn "gRPC error '#{e.code}' during '#{type}' request: "
|
177
|
+
if args.is_a?(ShowCmdArgs) || args.is_a?(CliConfigArgs)
|
178
|
+
warn " with cli: '#{args.cli}'"
|
179
|
+
end
|
180
|
+
warn " '#{e.details}'"
|
181
|
+
case e.code
|
182
|
+
when ::GRPC::Core::StatusCodes::UNAVAILABLE
|
183
|
+
raise Cisco::ConnectionRefused, "Connection refused: #{e.details}"
|
184
|
+
when ::GRPC::Core::StatusCodes::UNAUTHENTICATED
|
185
|
+
raise Cisco::AuthenticationFailed, e.details
|
186
|
+
else
|
187
|
+
raise Cisco::ClientError, e.details
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Send a YANG request via gRPC
|
192
|
+
def yang_req(stub, type, args)
|
193
|
+
debug "Sending '#{type}' request:"
|
194
|
+
if args.is_a?(ConfigGetArgs)
|
195
|
+
debug " with yangpathjson: #{args.yangpathjson}"
|
196
|
+
elsif args.is_a?(ConfigArgs)
|
197
|
+
debug " with yangjson: #{args.yangjson}"
|
198
|
+
end
|
199
|
+
|
200
|
+
output = Cisco::Client.silence_warnings do
|
201
|
+
response = stub.send(type, args,
|
202
|
+
timeout: @timeout,
|
203
|
+
username: @username,
|
204
|
+
password: @password)
|
205
|
+
# gRPC server may split the response into multiples
|
206
|
+
response = response.is_a?(Enumerator) ? response.to_a : [response]
|
207
|
+
debug "Got responses: #{response.map(&:class).join(', ')}"
|
208
|
+
debug "response: #{response}"
|
209
|
+
# Check for errors first
|
210
|
+
handle_errors(args, response.select { |r| !r.errors.empty? })
|
211
|
+
|
212
|
+
# If we got here, no errors occurred
|
213
|
+
handle_response(args, response)
|
214
|
+
end
|
215
|
+
return output
|
216
|
+
|
217
|
+
rescue ::GRPC::BadStatus => e
|
218
|
+
warn "gRPC error '#{e.code}' during '#{type}' request: "
|
219
|
+
if args.is_a?(ConfigGetArgs)
|
220
|
+
debug " with yangpathjson: #{args.yangpathjson}"
|
221
|
+
elsif args.is_a?(ConfigArgs)
|
222
|
+
debug " with yangjson: #{args.yangjson}"
|
223
|
+
end
|
224
|
+
|
225
|
+
warn " '#{e.details}'"
|
226
|
+
case e.code
|
227
|
+
when ::GRPC::Core::StatusCodes::UNAVAILABLE
|
228
|
+
raise Cisco::ConnectionRefused, "Connection refused: #{e.details}"
|
229
|
+
when ::GRPC::Core::StatusCodes::UNAUTHENTICATED
|
230
|
+
raise Cisco::AuthenticationFailed, e.details
|
231
|
+
else
|
232
|
+
raise Cisco::ClientError, e.details
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def handle_response(args, replies)
|
237
|
+
klass = replies[0].class
|
238
|
+
unless replies.all? { |r| r.class == klass }
|
239
|
+
fail Cisco::ClientError, 'reply class inconsistent: ' +
|
240
|
+
replies.map(&:class).join(', ')
|
241
|
+
end
|
242
|
+
debug "Handling #{replies.length} '#{klass}' reply(s):"
|
243
|
+
case klass.to_s
|
244
|
+
when /ShowCmdTextReply/
|
245
|
+
replies.each { |r| debug " output:\n#{r.output}" }
|
246
|
+
output = replies.map(&:output).join('')
|
247
|
+
output = handle_text_output(args, output)
|
248
|
+
when /ShowCmdJSONReply/
|
249
|
+
# TODO: not yet supported by server to test against
|
250
|
+
replies.each { |r| debug " jsonoutput:\n#{r.jsonoutput}" }
|
251
|
+
output = replies.map(&:jsonoutput).join("\n---\n")
|
252
|
+
when /CliConfigReply/
|
253
|
+
# nothing to process
|
254
|
+
output = ''
|
255
|
+
when /ConfigGetReply/
|
256
|
+
replies.each { |r| debug " yangjson:\n#{r.yangjson}" }
|
257
|
+
output = replies.map(&:yangjson).join('')
|
258
|
+
when /GetOperReply/
|
259
|
+
replies.each { |r| debug " yangjson:\n#{r.yangjson}" }
|
260
|
+
output = replies.map(&:yangjson).join('')
|
261
|
+
when /ConfigReply/
|
262
|
+
# nothing to process
|
263
|
+
output = ''
|
264
|
+
else
|
265
|
+
fail Cisco::ClientError, "unsupported reply class #{klass}"
|
266
|
+
end
|
267
|
+
debug "Success with output:\n#{output}"
|
268
|
+
output
|
269
|
+
end
|
270
|
+
|
271
|
+
def handle_text_output(args, output)
|
272
|
+
# For a successful show command, gRPC presents the output as:
|
273
|
+
# \n--------- <cmd> ----------
|
274
|
+
# \n<output of command>
|
275
|
+
# \n\n
|
276
|
+
|
277
|
+
# For an invalid CLI, gRPC presents the output as:
|
278
|
+
# \n--------- <cmd> --------
|
279
|
+
# \n<cmd>
|
280
|
+
# \n<error output>
|
281
|
+
# \n\n
|
282
|
+
|
283
|
+
# Discard the leading whitespace, header, and trailing whitespace
|
284
|
+
output = output.split("\n").drop(2)
|
285
|
+
return '' if output.nil? || output.empty?
|
286
|
+
|
287
|
+
# Now we have either [<output_line_1>, <output_line_2>, ...] or
|
288
|
+
# [<cmd>, <error_line_1>, <error_line_2>, ...]
|
289
|
+
if output[0].strip == args.cli.strip
|
290
|
+
fail Cisco::CliError.new( # rubocop:disable Style/RaiseArgs
|
291
|
+
rejected_input: args.cli,
|
292
|
+
clierror: output.join("\n"),
|
293
|
+
)
|
294
|
+
end
|
295
|
+
output.join("\n")
|
296
|
+
end
|
297
|
+
|
298
|
+
def handle_errors(args, error_responses)
|
299
|
+
return if error_responses.empty?
|
300
|
+
debug "#{error_responses.length} response(s) had errors:"
|
301
|
+
error_responses.each { |r| debug " error:\n#{r.errors}" }
|
302
|
+
first_error = error_responses.first.errors
|
303
|
+
# Conveniently for us, all *Reply protobufs in EMS have an errors field
|
304
|
+
# Less conveniently, some are JSON and some are not.
|
305
|
+
begin
|
306
|
+
msg = JSON.parse(first_error)
|
307
|
+
handle_json_error(msg)
|
308
|
+
rescue JSON::ParserError
|
309
|
+
handle_text_error(args, first_error)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
# Generate an error from a failed request
|
314
|
+
def handle_text_error(args, msg)
|
315
|
+
if /^Disallowed commands:/ =~ msg
|
316
|
+
fail Cisco::RequestNotSupported, msg
|
317
|
+
elsif args.is_a?(ConfigGetArgs) || args.is_a?(ConfigArgs)
|
318
|
+
fail Cisco::YangError.new( # rubocop:disable Style/RaiseArgs
|
319
|
+
rejected_input: args.yangpathjson,
|
320
|
+
error: msg,
|
321
|
+
)
|
322
|
+
else
|
323
|
+
fail Cisco::CliError.new( # rubocop:disable Style/RaiseArgs
|
324
|
+
rejected_input: args.cli,
|
325
|
+
clierror: msg,
|
326
|
+
)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
# Generate a CliError from a failed CliConfigReply
|
331
|
+
def handle_json_error(msg)
|
332
|
+
# {
|
333
|
+
# "cisco-grpc:errors": {
|
334
|
+
# "error": [
|
335
|
+
# {
|
336
|
+
# "error-type": "application",
|
337
|
+
# "error-tag": "operation-failed",
|
338
|
+
# "error-severity": "error",
|
339
|
+
# "error-message": "....",
|
340
|
+
# },
|
341
|
+
# {
|
342
|
+
# ...
|
343
|
+
|
344
|
+
# {
|
345
|
+
# "cisco-grpc:errors": [
|
346
|
+
# {
|
347
|
+
# "error-type": "protocol",
|
348
|
+
# "error-message": "Failed authentication"
|
349
|
+
# }
|
350
|
+
# ]
|
351
|
+
# }
|
352
|
+
|
353
|
+
msg = msg['cisco-grpc:errors']
|
354
|
+
msg = msg['error'] unless msg.is_a?(Array)
|
355
|
+
msg.each do |m|
|
356
|
+
type = m['error-type']
|
357
|
+
message = m['error-message'] || m['error-tag']
|
358
|
+
message += ': ' + m['error-path'] if m['error-path']
|
359
|
+
if type == 'protocol' && message == 'Failed authentication'
|
360
|
+
fail Cisco::AuthenticationFailed, message
|
361
|
+
elsif type == 'application'
|
362
|
+
# Example message:
|
363
|
+
# !! SYNTAX/AUTHORIZATION ERRORS: This configuration failed due to
|
364
|
+
# !! one or more of the following reasons:
|
365
|
+
# !! - the entered commands do not exist,
|
366
|
+
# !! - the entered commands have errors in their syntax,
|
367
|
+
# !! - the software packages containing the commands are not active,
|
368
|
+
# !! - the current user is not a member of a task-group that has
|
369
|
+
# !! permissions to use the commands.
|
370
|
+
#
|
371
|
+
# foo
|
372
|
+
# bar
|
373
|
+
#
|
374
|
+
if m['error-path']
|
375
|
+
fail Cisco::YangError.new( # rubocop:disable Style/RaiseArgs
|
376
|
+
message
|
377
|
+
)
|
378
|
+
else
|
379
|
+
match = /\n\n(.*)\n\n\Z/m.match(message)
|
380
|
+
if match.nil?
|
381
|
+
rejected = '(unknown, see error message)'
|
382
|
+
else
|
383
|
+
rejected = match[1].split("\n")
|
384
|
+
end
|
385
|
+
fail Cisco::CliError.new( # rubocop:disable Style/RaiseArgs
|
386
|
+
rejected_input: rejected,
|
387
|
+
clierror: message,
|
388
|
+
)
|
389
|
+
end
|
390
|
+
else
|
391
|
+
fail Cisco::ClientError, message
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
package IOSXRExtensibleManagabilityService;
|
4
|
+
|
5
|
+
service gRPCConfigOper {
|
6
|
+
|
7
|
+
// Configuration related commands
|
8
|
+
|
9
|
+
rpc GetConfig(ConfigGetArgs) returns(stream ConfigGetReply) {};
|
10
|
+
// 6.0 Config commands do implicit commits
|
11
|
+
rpc MergeConfig(ConfigArgs) returns(ConfigReply) {};
|
12
|
+
|
13
|
+
rpc DeleteConfig(ConfigArgs) returns(ConfigReply) {};
|
14
|
+
|
15
|
+
rpc ReplaceConfig(ConfigArgs) returns(ConfigReply) {};
|
16
|
+
|
17
|
+
rpc CliConfig(CliConfigArgs) returns(CliConfigReply) {};
|
18
|
+
|
19
|
+
// not implemented for 6.0
|
20
|
+
rpc CommitReplace(CommitReplaceArgs) returns (CommitReplaceReply) {};
|
21
|
+
// not implemented for 6.0
|
22
|
+
rpc CommitConfig(CommitArgs) returns(CommitReply) {};
|
23
|
+
// not implemented for 6.0
|
24
|
+
rpc ConfigDiscardChanges(DiscardChangesArgs) returns(DiscardChangesReply) {};
|
25
|
+
|
26
|
+
|
27
|
+
// Get only returns oper data
|
28
|
+
//
|
29
|
+
rpc GetOper(GetOperArgs) returns(stream GetOperReply) {};
|
30
|
+
// Do we need "Get" also to give combined oper and config?
|
31
|
+
}
|
32
|
+
|
33
|
+
//
|
34
|
+
// Should we seperate Exec from Config/Oper?
|
35
|
+
//
|
36
|
+
|
37
|
+
service gRPCExec {
|
38
|
+
// Exec commands
|
39
|
+
rpc ShowCmdTextOutput(ShowCmdArgs) returns(stream ShowCmdTextReply) {};
|
40
|
+
rpc ShowCmdJSONOutput(ShowCmdArgs) returns(stream ShowCmdJSONReply) {};
|
41
|
+
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
message ConfigGetArgs {
|
46
|
+
int64 ReqId = 1;
|
47
|
+
string yangpathjson = 2;
|
48
|
+
}
|
49
|
+
|
50
|
+
message ConfigGetReply {
|
51
|
+
int64 ResReqId = 1;
|
52
|
+
string yangjson = 2;
|
53
|
+
string errors = 3;
|
54
|
+
}
|
55
|
+
|
56
|
+
message GetOperArgs {
|
57
|
+
int64 ReqId = 1;
|
58
|
+
string yangpathjson = 2;
|
59
|
+
}
|
60
|
+
|
61
|
+
message GetOperReply {
|
62
|
+
int64 ResReqId = 1;
|
63
|
+
string yangjson = 2;
|
64
|
+
string errors = 3;
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
message ConfigArgs {
|
69
|
+
int64 ReqId = 1;
|
70
|
+
string yangjson = 2;
|
71
|
+
|
72
|
+
}
|
73
|
+
|
74
|
+
message ConfigReply {
|
75
|
+
int64 ResReqId = 1;
|
76
|
+
string errors = 2;
|
77
|
+
}
|
78
|
+
|
79
|
+
message CliConfigArgs {
|
80
|
+
int64 ReqId = 1;
|
81
|
+
string cli = 2;
|
82
|
+
}
|
83
|
+
|
84
|
+
message CliConfigReply {
|
85
|
+
int64 ResReqId = 1;
|
86
|
+
string errors = 2;
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
message CommitReplaceArgs {
|
91
|
+
int64 ReqId = 1;
|
92
|
+
string cli = 2;
|
93
|
+
string yangjson = 3;
|
94
|
+
}
|
95
|
+
|
96
|
+
message CommitReplaceReply {
|
97
|
+
int64 ResReqId = 1;
|
98
|
+
string errors = 2;
|
99
|
+
}
|
100
|
+
|
101
|
+
message CommitMsg {
|
102
|
+
string label = 1;
|
103
|
+
string comment = 2;
|
104
|
+
}
|
105
|
+
|
106
|
+
enum CommitResult {
|
107
|
+
CHANGE = 0;
|
108
|
+
NO_CHANGE = 1;
|
109
|
+
FAIL = 2;
|
110
|
+
}
|
111
|
+
|
112
|
+
message CommitArgs {
|
113
|
+
CommitMsg msg = 1;
|
114
|
+
int64 ReqId = 2;
|
115
|
+
}
|
116
|
+
|
117
|
+
message CommitReply {
|
118
|
+
CommitResult result = 1;
|
119
|
+
int64 ResReqId = 2;
|
120
|
+
string errors = 3;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
message DiscardChangesArgs {
|
125
|
+
int64 ReqId = 1;
|
126
|
+
}
|
127
|
+
|
128
|
+
message DiscardChangesReply {
|
129
|
+
int64 ResReqId = 1;
|
130
|
+
string errors = 2;
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
message ShowCmdArgs {
|
135
|
+
int64 ReqId = 1;
|
136
|
+
string cli = 2;
|
137
|
+
}
|
138
|
+
|
139
|
+
message ShowCmdTextReply {
|
140
|
+
int64 ResReqId =1;
|
141
|
+
string output = 2;
|
142
|
+
string errors = 3;
|
143
|
+
}
|
144
|
+
message ShowCmdJSONReply {
|
145
|
+
int64 ResReqId =1;
|
146
|
+
string jsonoutput = 2;
|
147
|
+
string errors = 3;
|
148
|
+
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: ems.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_message "IOSXRExtensibleManagabilityService.ConfigGetArgs" do
|
8
|
+
optional :ReqId, :int64, 1
|
9
|
+
optional :yangpathjson, :string, 2
|
10
|
+
end
|
11
|
+
add_message "IOSXRExtensibleManagabilityService.ConfigGetReply" do
|
12
|
+
optional :ResReqId, :int64, 1
|
13
|
+
optional :yangjson, :string, 2
|
14
|
+
optional :errors, :string, 3
|
15
|
+
end
|
16
|
+
add_message "IOSXRExtensibleManagabilityService.GetOperArgs" do
|
17
|
+
optional :ReqId, :int64, 1
|
18
|
+
optional :yangpathjson, :string, 2
|
19
|
+
end
|
20
|
+
add_message "IOSXRExtensibleManagabilityService.GetOperReply" do
|
21
|
+
optional :ResReqId, :int64, 1
|
22
|
+
optional :yangjson, :string, 2
|
23
|
+
optional :errors, :string, 3
|
24
|
+
end
|
25
|
+
add_message "IOSXRExtensibleManagabilityService.ConfigArgs" do
|
26
|
+
optional :ReqId, :int64, 1
|
27
|
+
optional :yangjson, :string, 2
|
28
|
+
end
|
29
|
+
add_message "IOSXRExtensibleManagabilityService.ConfigReply" do
|
30
|
+
optional :ResReqId, :int64, 1
|
31
|
+
optional :errors, :string, 2
|
32
|
+
end
|
33
|
+
add_message "IOSXRExtensibleManagabilityService.CliConfigArgs" do
|
34
|
+
optional :ReqId, :int64, 1
|
35
|
+
optional :cli, :string, 2
|
36
|
+
end
|
37
|
+
add_message "IOSXRExtensibleManagabilityService.CliConfigReply" do
|
38
|
+
optional :ResReqId, :int64, 1
|
39
|
+
optional :errors, :string, 2
|
40
|
+
end
|
41
|
+
add_message "IOSXRExtensibleManagabilityService.CommitReplaceArgs" do
|
42
|
+
optional :ReqId, :int64, 1
|
43
|
+
optional :cli, :string, 2
|
44
|
+
optional :yangjson, :string, 3
|
45
|
+
end
|
46
|
+
add_message "IOSXRExtensibleManagabilityService.CommitReplaceReply" do
|
47
|
+
optional :ResReqId, :int64, 1
|
48
|
+
optional :errors, :string, 2
|
49
|
+
end
|
50
|
+
add_message "IOSXRExtensibleManagabilityService.CommitMsg" do
|
51
|
+
optional :label, :string, 1
|
52
|
+
optional :comment, :string, 2
|
53
|
+
end
|
54
|
+
add_message "IOSXRExtensibleManagabilityService.CommitArgs" do
|
55
|
+
optional :msg, :message, 1, "IOSXRExtensibleManagabilityService.CommitMsg"
|
56
|
+
optional :ReqId, :int64, 2
|
57
|
+
end
|
58
|
+
add_message "IOSXRExtensibleManagabilityService.CommitReply" do
|
59
|
+
optional :result, :enum, 1, "IOSXRExtensibleManagabilityService.CommitResult"
|
60
|
+
optional :ResReqId, :int64, 2
|
61
|
+
optional :errors, :string, 3
|
62
|
+
end
|
63
|
+
add_message "IOSXRExtensibleManagabilityService.DiscardChangesArgs" do
|
64
|
+
optional :ReqId, :int64, 1
|
65
|
+
end
|
66
|
+
add_message "IOSXRExtensibleManagabilityService.DiscardChangesReply" do
|
67
|
+
optional :ResReqId, :int64, 1
|
68
|
+
optional :errors, :string, 2
|
69
|
+
end
|
70
|
+
add_message "IOSXRExtensibleManagabilityService.ShowCmdArgs" do
|
71
|
+
optional :ReqId, :int64, 1
|
72
|
+
optional :cli, :string, 2
|
73
|
+
end
|
74
|
+
add_message "IOSXRExtensibleManagabilityService.ShowCmdTextReply" do
|
75
|
+
optional :ResReqId, :int64, 1
|
76
|
+
optional :output, :string, 2
|
77
|
+
optional :errors, :string, 3
|
78
|
+
end
|
79
|
+
add_message "IOSXRExtensibleManagabilityService.ShowCmdJSONReply" do
|
80
|
+
optional :ResReqId, :int64, 1
|
81
|
+
optional :jsonoutput, :string, 2
|
82
|
+
optional :errors, :string, 3
|
83
|
+
end
|
84
|
+
add_enum "IOSXRExtensibleManagabilityService.CommitResult" do
|
85
|
+
value :CHANGE, 0
|
86
|
+
value :NO_CHANGE, 1
|
87
|
+
value :FAIL, 2
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
module IOSXRExtensibleManagabilityService
|
92
|
+
ConfigGetArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.ConfigGetArgs").msgclass
|
93
|
+
ConfigGetReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.ConfigGetReply").msgclass
|
94
|
+
GetOperArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.GetOperArgs").msgclass
|
95
|
+
GetOperReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.GetOperReply").msgclass
|
96
|
+
ConfigArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.ConfigArgs").msgclass
|
97
|
+
ConfigReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.ConfigReply").msgclass
|
98
|
+
CliConfigArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CliConfigArgs").msgclass
|
99
|
+
CliConfigReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CliConfigReply").msgclass
|
100
|
+
CommitReplaceArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CommitReplaceArgs").msgclass
|
101
|
+
CommitReplaceReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CommitReplaceReply").msgclass
|
102
|
+
CommitMsg = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CommitMsg").msgclass
|
103
|
+
CommitArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CommitArgs").msgclass
|
104
|
+
CommitReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CommitReply").msgclass
|
105
|
+
DiscardChangesArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.DiscardChangesArgs").msgclass
|
106
|
+
DiscardChangesReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.DiscardChangesReply").msgclass
|
107
|
+
ShowCmdArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.ShowCmdArgs").msgclass
|
108
|
+
ShowCmdTextReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.ShowCmdTextReply").msgclass
|
109
|
+
ShowCmdJSONReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.ShowCmdJSONReply").msgclass
|
110
|
+
CommitResult = Google::Protobuf::DescriptorPool.generated_pool.lookup("IOSXRExtensibleManagabilityService.CommitResult").enummodule
|
111
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: ems.proto for package 'IOSXRExtensibleManagabilityService'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'ems'
|
6
|
+
|
7
|
+
module IOSXRExtensibleManagabilityService
|
8
|
+
module GRPCConfigOper
|
9
|
+
|
10
|
+
# TODO: add proto service documentation here
|
11
|
+
class Service
|
12
|
+
|
13
|
+
include GRPC::GenericService
|
14
|
+
|
15
|
+
self.marshal_class_method = :encode
|
16
|
+
self.unmarshal_class_method = :decode
|
17
|
+
self.service_name = 'IOSXRExtensibleManagabilityService.gRPCConfigOper'
|
18
|
+
|
19
|
+
rpc :GetConfig, ConfigGetArgs, stream(ConfigGetReply)
|
20
|
+
rpc :MergeConfig, ConfigArgs, ConfigReply
|
21
|
+
rpc :DeleteConfig, ConfigArgs, ConfigReply
|
22
|
+
rpc :ReplaceConfig, ConfigArgs, ConfigReply
|
23
|
+
rpc :CliConfig, CliConfigArgs, CliConfigReply
|
24
|
+
rpc :CommitReplace, CommitReplaceArgs, CommitReplaceReply
|
25
|
+
rpc :CommitConfig, CommitArgs, CommitReply
|
26
|
+
rpc :ConfigDiscardChanges, DiscardChangesArgs, DiscardChangesReply
|
27
|
+
rpc :GetOper, GetOperArgs, stream(GetOperReply)
|
28
|
+
end
|
29
|
+
|
30
|
+
Stub = Service.rpc_stub_class
|
31
|
+
end
|
32
|
+
module GRPCExec
|
33
|
+
|
34
|
+
# TODO: add proto service documentation here
|
35
|
+
class Service
|
36
|
+
|
37
|
+
include GRPC::GenericService
|
38
|
+
|
39
|
+
self.marshal_class_method = :encode
|
40
|
+
self.unmarshal_class_method = :decode
|
41
|
+
self.service_name = 'IOSXRExtensibleManagabilityService.gRPCExec'
|
42
|
+
|
43
|
+
rpc :ShowCmdTextOutput, ShowCmdArgs, stream(ShowCmdTextReply)
|
44
|
+
rpc :ShowCmdJSONOutput, ShowCmdArgs, stream(ShowCmdJSONReply)
|
45
|
+
end
|
46
|
+
|
47
|
+
Stub = Service.rpc_stub_class
|
48
|
+
end
|
49
|
+
end
|