cisco_node_utils_mgx 2.1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,90 @@
|
|
|
1
|
+
# January 2018, Rahul Shenoy
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2018 Cisco and/or its affiliates.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
require_relative 'cisco_cmn_utils'
|
|
18
|
+
require_relative 'node_util'
|
|
19
|
+
require_relative 'feature'
|
|
20
|
+
|
|
21
|
+
module Cisco
|
|
22
|
+
# node_utils class for evpn_multisite
|
|
23
|
+
class IpMulticast < NodeUtil
|
|
24
|
+
def initialize(instantiate=true)
|
|
25
|
+
@get_args = @set_args = {}
|
|
26
|
+
enable_features if instantiate
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def destroy
|
|
30
|
+
@set_args[:state] = 'no'
|
|
31
|
+
config_set('ip_multicast', 'overlay_distributed_dr', @set_args)
|
|
32
|
+
config_set('ip_multicast', 'overlay_spt_only', @set_args)
|
|
33
|
+
Feature.ngmvpn_disable
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def enable_features
|
|
37
|
+
Feature.nv_overlay_enable
|
|
38
|
+
Feature.nv_overlay_evpn_enable
|
|
39
|
+
Feature.ngmvpn_enable
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def ip_multicast
|
|
43
|
+
Feature.ngmvpn_enabled?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def overlay_distributed_dr
|
|
47
|
+
config_get('ip_multicast', 'overlay_distributed_dr')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def overlay_distributed_dr=(bool)
|
|
51
|
+
fail TypeError unless [true, false].include?(bool)
|
|
52
|
+
@set_args[:state] = bool ? '' : 'no'
|
|
53
|
+
if @set_args[:state] == 'no'
|
|
54
|
+
unless overlay_distributed_dr == default_overlay_distributed_dr
|
|
55
|
+
config_set('ip_multicast', 'overlay_distributed_dr', @set_args)
|
|
56
|
+
end
|
|
57
|
+
else
|
|
58
|
+
config_set('ip_multicast', 'overlay_distributed_dr', @set_args)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def default_overlay_distributed_dr
|
|
63
|
+
config_get_default('ip_multicast', 'overlay_distributed_dr')
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def overlay_spt_only
|
|
67
|
+
result = config_get('ip_multicast', 'overlay_spt_only')
|
|
68
|
+
result.nil? ? false : result
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def overlay_spt_only=(bool)
|
|
72
|
+
fail TypeError unless [true, false].include?(bool)
|
|
73
|
+
@set_args[:state] = bool ? '' : 'no'
|
|
74
|
+
config_set('ip_multicast', 'overlay_spt_only', @set_args)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def default_overlay_spt_only
|
|
78
|
+
val = config_get_default('ip_multicast', 'overlay_spt_only')
|
|
79
|
+
# The default value for this property is different for older
|
|
80
|
+
# Nexus software verions.
|
|
81
|
+
#
|
|
82
|
+
# Versions: 7.0(3)I7(1), 7.0(3)I7(2), 7.0(3)I7(3)
|
|
83
|
+
# Default State: false
|
|
84
|
+
#
|
|
85
|
+
# Versions: 7.0(3)I7(4) and later
|
|
86
|
+
# Default State: true
|
|
87
|
+
node.os_version[/7\.0\(3\)I7\([1-3]\)/] ? !val : val
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# February 2016, Sai Chintalapudi
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
require_relative 'node_util'
|
|
18
|
+
|
|
19
|
+
module Cisco
|
|
20
|
+
# node_utils class for itd_device_group
|
|
21
|
+
class ItdDeviceGroup < NodeUtil
|
|
22
|
+
attr_reader :name
|
|
23
|
+
|
|
24
|
+
def initialize(name, instantiate=true)
|
|
25
|
+
fail TypeError unless name.is_a?(String)
|
|
26
|
+
fail ArgumentError unless name.length > 0
|
|
27
|
+
@name = name
|
|
28
|
+
|
|
29
|
+
set_args_keys_default
|
|
30
|
+
create if instantiate
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.itds
|
|
34
|
+
hash = {}
|
|
35
|
+
groups = config_get('itd_device_group',
|
|
36
|
+
'all_itd_device_groups')
|
|
37
|
+
return hash if groups.nil?
|
|
38
|
+
|
|
39
|
+
groups.each do |id|
|
|
40
|
+
hash[id] = ItdDeviceGroup.new(id, false)
|
|
41
|
+
end
|
|
42
|
+
hash
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
########################################################
|
|
46
|
+
# PROPERTIES #
|
|
47
|
+
########################################################
|
|
48
|
+
|
|
49
|
+
def create
|
|
50
|
+
Feature.itd_enable
|
|
51
|
+
config_set('itd_device_group', 'create', name: @name)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def destroy
|
|
55
|
+
config_set('itd_device_group', 'destroy', name: @name)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Helper method to delete @set_args hash keys
|
|
59
|
+
def set_args_keys_default
|
|
60
|
+
keys = { name: @name }
|
|
61
|
+
@get_args = @set_args = keys
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# rubocop:disable Style/AccessorMethodName
|
|
65
|
+
def set_args_keys(hash={})
|
|
66
|
+
set_args_keys_default
|
|
67
|
+
@set_args = @get_args.merge!(hash) unless hash.empty?
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# probe configuration is all done in a single line (like below)
|
|
71
|
+
# probe tcp port 32 frequency 10 timeout 5 retry-down-count 3 ...
|
|
72
|
+
# probe udp port 23 frequency 10 timeout 5 retry-down-count 3 ...
|
|
73
|
+
# probe icmp frequency 10 timeout 5 retry-down-count 3 retry-up-count 3
|
|
74
|
+
# probe dns host 8.8.8.8 frequency 10 timeout 5 retry-down-count 3 ...
|
|
75
|
+
# also the 'control enable' can be set if the type is tcp or udp only
|
|
76
|
+
# probe udp port 23 control enable frequency 10 timeout 5 ...
|
|
77
|
+
def probe_get
|
|
78
|
+
str = config_get('itd_device_group', 'probe', @get_args)
|
|
79
|
+
return nil if str.nil?
|
|
80
|
+
regexp = Regexp.new('(?<type>\S+)'\
|
|
81
|
+
' *(?<dns_host>host \S+)?'\
|
|
82
|
+
' *(?<port>port \d+)?'\
|
|
83
|
+
' *(?<control>control \S+)?'\
|
|
84
|
+
' *(?<frequency>frequency \d+)?'\
|
|
85
|
+
' *(?<timeout>timeout \d+)'\
|
|
86
|
+
' *(?<retry_down>retry-down-count \d+)'\
|
|
87
|
+
' *(?<retry_up>retry-up-count \d+)')
|
|
88
|
+
regexp.match(str)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def probe_control
|
|
92
|
+
val = Utils.extract_value(probe_get, 'control')
|
|
93
|
+
return default_probe_control if val.nil?
|
|
94
|
+
val == 'enable' ? true : default_probe_control
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def probe_control=(control)
|
|
98
|
+
if control
|
|
99
|
+
@set_args[:control] = 'control enable'
|
|
100
|
+
else
|
|
101
|
+
@set_args[:control] = ''
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def default_probe_control
|
|
106
|
+
config_get_default('itd_device_group', 'probe_control')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def probe_dns_host
|
|
110
|
+
Utils.extract_value(probe_get, 'dns_host', 'host')
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def probe_dns_host=(dns_host)
|
|
114
|
+
@set_args[:dns_host] = Utils.attach_prefix(dns_host, :dns_host, 'host')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def probe_frequency
|
|
118
|
+
val = Utils.extract_value(probe_get, 'frequency')
|
|
119
|
+
return default_probe_frequency if val.nil?
|
|
120
|
+
val.to_i
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def probe_frequency=(frequency)
|
|
124
|
+
@set_args[:frequency] = Utils.attach_prefix(frequency, :frequency)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def default_probe_frequency
|
|
128
|
+
config_get_default('itd_device_group', 'probe_frequency')
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def probe_port
|
|
132
|
+
val = Utils.extract_value(probe_get, 'port')
|
|
133
|
+
val.to_i unless val.nil?
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def probe_port=(port)
|
|
137
|
+
@set_args[:port] = Utils.attach_prefix(port, :port)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def probe_retry_down
|
|
141
|
+
val = Utils.extract_value(probe_get, 'retry_down', 'retry-down-count')
|
|
142
|
+
return default_probe_retry_down if val.nil?
|
|
143
|
+
val.to_i
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def probe_retry_down=(rdc)
|
|
147
|
+
@set_args[:retry_down_count] = Utils.attach_prefix(rdc,
|
|
148
|
+
:retry_down_count,
|
|
149
|
+
'retry-down-count')
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def default_probe_retry_down
|
|
153
|
+
config_get_default('itd_device_group', 'probe_retry_down')
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def probe_retry_up
|
|
157
|
+
val = Utils.extract_value(probe_get, 'retry_up', 'retry-up-count')
|
|
158
|
+
return default_probe_retry_up if val.nil?
|
|
159
|
+
val.to_i
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def probe_retry_up=(ruc)
|
|
163
|
+
@set_args[:retry_up_count] = Utils.attach_prefix(ruc,
|
|
164
|
+
:retry_up_count,
|
|
165
|
+
'retry-up-count')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def default_probe_retry_up
|
|
169
|
+
config_get_default('itd_device_group', 'probe_retry_up')
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def probe_timeout
|
|
173
|
+
val = Utils.extract_value(probe_get, 'timeout')
|
|
174
|
+
return default_probe_timeout if val.nil?
|
|
175
|
+
val.to_i
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def probe_timeout=(timeout)
|
|
179
|
+
@set_args[:timeout] = Utils.attach_prefix(timeout, :timeout)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def default_probe_timeout
|
|
183
|
+
config_get_default('itd_device_group', 'probe_timeout')
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def probe_type
|
|
187
|
+
match = probe_get
|
|
188
|
+
return default_probe_type if match.nil?
|
|
189
|
+
match.names.include?('type') ? match[:type] : default_probe_type
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def probe_type=(type)
|
|
193
|
+
@set_args[:type] = type
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def default_probe_type
|
|
197
|
+
config_get_default('itd_device_group', 'probe_type')
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def probe_set(attrs)
|
|
201
|
+
if attrs[:probe_type] == false
|
|
202
|
+
cmd = 'probe_type'
|
|
203
|
+
@set_args[:state] = 'no'
|
|
204
|
+
else
|
|
205
|
+
cmd = 'probe'
|
|
206
|
+
set_args_keys_default
|
|
207
|
+
set_args_keys(attrs)
|
|
208
|
+
[:probe_type,
|
|
209
|
+
:probe_dns_host,
|
|
210
|
+
:probe_port,
|
|
211
|
+
:probe_control,
|
|
212
|
+
:probe_frequency,
|
|
213
|
+
:probe_timeout,
|
|
214
|
+
:probe_retry_down,
|
|
215
|
+
:probe_retry_up,
|
|
216
|
+
].each do |p|
|
|
217
|
+
attrs[p] = '' if attrs[p].nil?
|
|
218
|
+
send(p.to_s + '=', attrs[p])
|
|
219
|
+
end
|
|
220
|
+
# for boolean we need to do this
|
|
221
|
+
send('probe_control=', false) if attrs[:probe_control] == ''
|
|
222
|
+
@get_args = @set_args
|
|
223
|
+
end
|
|
224
|
+
config_set('itd_device_group', cmd, @set_args)
|
|
225
|
+
set_args_keys_default
|
|
226
|
+
end
|
|
227
|
+
end # Class
|
|
228
|
+
end # Module
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# February 2016, Sai Chintalapudi
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2016 Cisco and/or its affiliates.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
require_relative 'node_util'
|
|
18
|
+
require_relative 'itd_device_group'
|
|
19
|
+
|
|
20
|
+
module Cisco
|
|
21
|
+
# node_utils class for itd_device_group_node
|
|
22
|
+
class ItdDeviceGroupNode < ItdDeviceGroup
|
|
23
|
+
attr_reader :itd_device_group_name, :name, :node_type
|
|
24
|
+
|
|
25
|
+
def initialize(itd_dg_name, node_name, node_type, instantiate=true)
|
|
26
|
+
fail TypeError unless itd_dg_name.is_a?(String)
|
|
27
|
+
fail TypeError unless node_name.is_a?(String)
|
|
28
|
+
fail ArgumentError unless itd_dg_name.length > 0
|
|
29
|
+
fail ArgumentError unless node_name.length > 0
|
|
30
|
+
|
|
31
|
+
@itd_device_group_name = itd_dg_name
|
|
32
|
+
@itddg = ItdDeviceGroup.itds[itd_dg_name]
|
|
33
|
+
fail "itd device-group #{itd_dg_name} does not exist" if
|
|
34
|
+
@itddg.nil?
|
|
35
|
+
@name = node_name
|
|
36
|
+
@node_type = node_type
|
|
37
|
+
|
|
38
|
+
set_args_keys_default
|
|
39
|
+
create_node if instantiate
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# itd_device_group_nodes have the name form as
|
|
43
|
+
# node ip 1.1.1.1
|
|
44
|
+
# node IPv6 2000::1
|
|
45
|
+
# and they depdend on the device_group
|
|
46
|
+
def self.itd_nodes(node_name=nil)
|
|
47
|
+
fail TypeError unless node_name.is_a?(String) || node_name.nil?
|
|
48
|
+
itd_nodes = {}
|
|
49
|
+
itd_list = ItdDeviceGroup.itds
|
|
50
|
+
return itd_nodes if itd_list.nil?
|
|
51
|
+
itd_list.keys.each do |name|
|
|
52
|
+
itd_nodes[name] = {}
|
|
53
|
+
match = config_get('itd_device_group',
|
|
54
|
+
'all_itd_device_group_nodes', name: name)
|
|
55
|
+
next if match.nil?
|
|
56
|
+
match.each do |vars|
|
|
57
|
+
ntype = vars[0]
|
|
58
|
+
nname = vars[1].strip
|
|
59
|
+
next unless node_name.nil? || nname == node_name
|
|
60
|
+
itd_nodes[name][nname] =
|
|
61
|
+
ItdDeviceGroupNode.new(name, nname, ntype, false)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
itd_nodes
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
########################################################
|
|
68
|
+
# PROPERTIES #
|
|
69
|
+
########################################################
|
|
70
|
+
|
|
71
|
+
def ==(other)
|
|
72
|
+
(itd_device_group_name == other.itd_device_group_name) &&
|
|
73
|
+
(name == other.name) && (node_type == other.node_type)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def create_node
|
|
77
|
+
config_set('itd_device_group', 'create_node',
|
|
78
|
+
name: @itddg.name, ntype: @node_type, nname: @name)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def destroy
|
|
82
|
+
config_set('itd_device_group', 'destroy_node', name: @itddg.name,
|
|
83
|
+
ntype: @node_type, nname: @name)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Helper method to delete @set_args hash keys
|
|
87
|
+
def set_args_keys_default
|
|
88
|
+
@set_args = { name: @itddg.name }
|
|
89
|
+
@set_args[:ntype] = @node_type
|
|
90
|
+
@set_args[:nname] = @name
|
|
91
|
+
@get_args = @set_args
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def hot_standby
|
|
95
|
+
config_get('itd_device_group', 'hot_standby', @get_args)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# DO NOT call this directly
|
|
99
|
+
def lhot_standby=(state)
|
|
100
|
+
no_cmd = (state ? '' : 'no')
|
|
101
|
+
@set_args[:state] = no_cmd
|
|
102
|
+
config_set('itd_device_group', 'hot_standby', @set_args)
|
|
103
|
+
set_args_keys_default
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def default_hot_standby
|
|
107
|
+
config_get_default('itd_device_group', 'hot_standby')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def weight
|
|
111
|
+
config_get('itd_device_group', 'weight', @get_args)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# DO NOT call this directly
|
|
115
|
+
def lweight=(val)
|
|
116
|
+
@set_args[:state] = val == default_weight ? 'no' : ''
|
|
117
|
+
@set_args[:weight] = val
|
|
118
|
+
config_set('itd_device_group', 'weight', @set_args)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Call this for setting hot_standby and weight together because
|
|
122
|
+
# the CLI is pretty weird and it accepts these params in a very
|
|
123
|
+
# particular way and they cannot even be reset unless proper
|
|
124
|
+
# order is followed
|
|
125
|
+
def hs_weight(hs, wt)
|
|
126
|
+
if hs != hot_standby && hot_standby == default_hot_standby
|
|
127
|
+
self.lweight = wt unless weight == wt
|
|
128
|
+
self.lhot_standby = hs
|
|
129
|
+
elsif hs != hot_standby && hot_standby != default_hot_standby
|
|
130
|
+
self.lhot_standby = hs
|
|
131
|
+
self.lweight = wt unless weight == wt
|
|
132
|
+
elsif wt != weight && weight == default_weight
|
|
133
|
+
self.lweight = wt
|
|
134
|
+
elsif wt != weight && weight != default_weight
|
|
135
|
+
self.lweight = wt
|
|
136
|
+
end
|
|
137
|
+
set_args_keys_default
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def default_weight
|
|
141
|
+
config_get_default('itd_device_group', 'weight')
|
|
142
|
+
end
|
|
143
|
+
end # Class
|
|
144
|
+
end # Module
|