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,159 @@
|
|
|
1
|
+
# December 2015, Andi Shen
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2015-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 'cisco_cmn_utils'
|
|
18
|
+
require_relative 'node_util'
|
|
19
|
+
require_relative 'feature'
|
|
20
|
+
|
|
21
|
+
module Cisco
|
|
22
|
+
# node_utils class for evpn_vni
|
|
23
|
+
class EvpnVni < NodeUtil
|
|
24
|
+
attr_reader :vni
|
|
25
|
+
|
|
26
|
+
def initialize(vni, instantiate=true)
|
|
27
|
+
err_msg = "vni must be either a 'String' or an" \
|
|
28
|
+
" 'Integer' object"
|
|
29
|
+
fail ArgumentError, err_msg unless vni.is_a?(Integer) ||
|
|
30
|
+
vni.is_a?(String)
|
|
31
|
+
@vni = vni.to_i
|
|
32
|
+
@get_args = @set_args = { vni: @vni }
|
|
33
|
+
create if instantiate
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Creat a hash of all vni instance
|
|
37
|
+
def self.vnis
|
|
38
|
+
hash = {}
|
|
39
|
+
return hash unless Feature.bgp_enabled?
|
|
40
|
+
vni_list = config_get('evpn_vni', 'vni')
|
|
41
|
+
return hash if vni_list.nil?
|
|
42
|
+
|
|
43
|
+
vni_list.each do |vni_id|
|
|
44
|
+
hash[vni_id] = EvpnVni.new(vni_id, false)
|
|
45
|
+
end
|
|
46
|
+
hash
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def create
|
|
50
|
+
EvpnVni.enable unless EvpnVni.enabled
|
|
51
|
+
@set_args[:state] = ''
|
|
52
|
+
config_set('evpn_vni', 'vni', @set_args)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def destroy
|
|
56
|
+
@set_args[:state] = 'no'
|
|
57
|
+
config_set('evpn_vni', 'vni', @set_args)
|
|
58
|
+
|
|
59
|
+
# no evpn if no vni left
|
|
60
|
+
vni_list = config_get('evpn_vni', 'vni')
|
|
61
|
+
config_set('evpn_vni', 'evpn', @set_args) if vni_list.nil?
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# enable feature bgp and nv overlay evpn
|
|
65
|
+
def self.enable
|
|
66
|
+
Feature.bgp_enable
|
|
67
|
+
Feature.nv_overlay_evpn_enable
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.enabled
|
|
71
|
+
Feature.bgp_enabled? && Feature.nv_overlay_evpn_enabled?
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def set_args_keys_default
|
|
75
|
+
@set_args = { vni: @vni }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Attributes:
|
|
79
|
+
# Route Distinguisher (Getter/Setter/Default)
|
|
80
|
+
def route_distinguisher
|
|
81
|
+
config_get('evpn_vni', 'route_distinguisher', @get_args)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def route_distinguisher=(rd)
|
|
85
|
+
if rd == default_route_distinguisher
|
|
86
|
+
@set_args[:state] = 'no'
|
|
87
|
+
# I2 images require an rd for removal
|
|
88
|
+
rd = route_distinguisher
|
|
89
|
+
return if rd.to_s.empty?
|
|
90
|
+
else
|
|
91
|
+
@set_args[:state] = ''
|
|
92
|
+
end
|
|
93
|
+
@set_args[:rd] = rd
|
|
94
|
+
config_set('evpn_vni', 'route_distinguisher', @set_args)
|
|
95
|
+
set_args_keys_default
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def default_route_distinguisher
|
|
99
|
+
config_get_default('evpn_vni', 'route_distinguisher')
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# route target both
|
|
103
|
+
def route_target_both
|
|
104
|
+
cmds = config_get('evpn_vni', 'route_target_both', @get_args)
|
|
105
|
+
cmds.sort
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def route_target_both=(should)
|
|
109
|
+
route_target_delta(should, route_target_both, 'route_target_both')
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def default_route_target_both
|
|
113
|
+
config_get_default('evpn_vni', 'route_target_both')
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# route target export
|
|
117
|
+
def route_target_export
|
|
118
|
+
cmds = config_get('evpn_vni', 'route_target_export', @get_args)
|
|
119
|
+
cmds.sort
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def route_target_export=(should)
|
|
123
|
+
route_target_delta(should, route_target_export, 'route_target_export')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def default_route_target_export
|
|
127
|
+
config_get_default('evpn_vni', 'route_target_export')
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# route target import
|
|
131
|
+
def route_target_import
|
|
132
|
+
cmds = config_get('evpn_vni', 'route_target_import', @get_args)
|
|
133
|
+
cmds.sort
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def route_target_import=(should)
|
|
137
|
+
route_target_delta(should, route_target_import, 'route_target_import')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def default_route_target_import
|
|
141
|
+
config_get_default('evpn_vni', 'route_target_import')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def route_target_delta(should, is, prop)
|
|
145
|
+
delta_hash = Utils.delta_add_remove(should, is)
|
|
146
|
+
return if delta_hash.values.flatten.empty?
|
|
147
|
+
[:add, :remove].each do |action|
|
|
148
|
+
Cisco::Logger.debug("#{prop}" \
|
|
149
|
+
"#{@get_args}\n #{action}: #{delta_hash[action]}")
|
|
150
|
+
delta_hash[action].each do |community|
|
|
151
|
+
state = (action == :add) ? '' : 'no'
|
|
152
|
+
@set_args[:state] = state
|
|
153
|
+
@set_args[:community] = community
|
|
154
|
+
config_set('evpn_vni', prop, @set_args)
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# March 2016, Glenn F. Matthews
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2014-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
|
+
# Add generic exception classes to the Cisco module
|
|
18
|
+
# The hierarchy is:
|
|
19
|
+
# RuntimeError
|
|
20
|
+
# Cisco::CiscoError
|
|
21
|
+
# Cisco::ClientError
|
|
22
|
+
# Cisco::ConnectionRefused
|
|
23
|
+
# Cisco::AuthenticationFailed
|
|
24
|
+
# Cisco::RequestFailed
|
|
25
|
+
# Cisco::CliError
|
|
26
|
+
# Cisco::RequestNotSupported
|
|
27
|
+
# Cisco::UnsupportedError
|
|
28
|
+
module Cisco
|
|
29
|
+
# Generic class for exceptions raised by this module
|
|
30
|
+
class CiscoError < RuntimeError
|
|
31
|
+
attr_reader :kwargs
|
|
32
|
+
|
|
33
|
+
def initialize(message=nil, **kwargs)
|
|
34
|
+
@kwargs = kwargs
|
|
35
|
+
super(message)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def respond_to?(method_sym, include_private=false)
|
|
39
|
+
@kwargs.key?(method_sym) ? true : super
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def method_missing(method_sym, *args, **kwargs, &block)
|
|
43
|
+
@kwargs.key?(method_sym) ? @kwargs[method_sym] : super
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Exception class for fundamental client failures
|
|
48
|
+
class ClientError < CiscoError
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# ConnectionRefused means the server isn't listening
|
|
52
|
+
class ConnectionRefused < ClientError
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# AuthenticationFailed means we were able to connect but not login
|
|
56
|
+
class AuthenticationFailed < ClientError
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Exception class for failures of a specific request to the client
|
|
60
|
+
class RequestFailed < CiscoError
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Extension of RequestFailed class specifically for CLI errors
|
|
64
|
+
class CliError < RequestFailed
|
|
65
|
+
def initialize(message=nil,
|
|
66
|
+
clierror: nil,
|
|
67
|
+
rejected_input: nil,
|
|
68
|
+
successful_input: [],
|
|
69
|
+
**kwargs)
|
|
70
|
+
unless message
|
|
71
|
+
if rejected_input.is_a?(Array)
|
|
72
|
+
if rejected_input.length > 1
|
|
73
|
+
message = "The following commands were rejected:\n"
|
|
74
|
+
message += " #{rejected_input.join("\n ")}\n"
|
|
75
|
+
else
|
|
76
|
+
message = "The command '#{rejected_input.first}' was rejected "
|
|
77
|
+
end
|
|
78
|
+
else
|
|
79
|
+
message = "The command '#{rejected_input}' was rejected "
|
|
80
|
+
end
|
|
81
|
+
message += "with error:\n#{clierror}"
|
|
82
|
+
end
|
|
83
|
+
super(message,
|
|
84
|
+
:clierror => clierror,
|
|
85
|
+
:rejected_input => rejected_input,
|
|
86
|
+
:successful_input => successful_input,
|
|
87
|
+
**kwargs)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Extension of RequestFailed class specifically for YANG errors
|
|
92
|
+
class YangError < RequestFailed
|
|
93
|
+
def initialize(message=nil,
|
|
94
|
+
error: nil,
|
|
95
|
+
rejected_input: nil,
|
|
96
|
+
successful_input: [],
|
|
97
|
+
**kwargs)
|
|
98
|
+
unless message
|
|
99
|
+
if rejected_input.is_a?(Array)
|
|
100
|
+
if rejected_input.length > 1
|
|
101
|
+
message = "The following configs were rejected:\n"
|
|
102
|
+
message += " #{rejected_input.join("\n ")}\n"
|
|
103
|
+
else
|
|
104
|
+
message = "The config '#{rejected_input.first}' was rejected "
|
|
105
|
+
end
|
|
106
|
+
else
|
|
107
|
+
message = "The config '#{rejected_input}' was rejected "
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
message += "with error:\n#{error}"
|
|
111
|
+
end
|
|
112
|
+
super(message,
|
|
113
|
+
:error => error,
|
|
114
|
+
:rejected_input => rejected_input,
|
|
115
|
+
:successful_input => successful_input,
|
|
116
|
+
**kwargs)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# RequestNotSupported means we made a request that was validly
|
|
121
|
+
# constructed but includes options that are unsupported.
|
|
122
|
+
#
|
|
123
|
+
# An example would be requesting structured output on a CLI command
|
|
124
|
+
# that only supports ASCII output.
|
|
125
|
+
class RequestNotSupported < RequestFailed
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Exception class raised by CommandReference to indicate that
|
|
129
|
+
# a particular feature/attribute is explicitly excluded on the given node.
|
|
130
|
+
class UnsupportedError < CiscoError
|
|
131
|
+
def initialize(feature, name, oper=nil, msg=nil)
|
|
132
|
+
message = "Feature '#{feature}'"
|
|
133
|
+
message += ", attribute '#{name}'" unless name.nil?
|
|
134
|
+
message += ", operation '#{oper}'" unless oper.nil?
|
|
135
|
+
message += ' is unsupported on this node'
|
|
136
|
+
message += ": #{msg}" unless msg.nil?
|
|
137
|
+
super(message, feature: feature, name: name, oper: oper)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NXAPI implementation of Fabricpath Global class
|
|
3
|
+
#
|
|
4
|
+
# November 2015, Deepak Cherian
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2015-2016 Cisco and/or its affiliates.
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
require_relative 'node_util'
|
|
21
|
+
require_relative 'vdc'
|
|
22
|
+
|
|
23
|
+
module Cisco
|
|
24
|
+
# node_utils class for fabricpath_global
|
|
25
|
+
class FabricpathGlobal < NodeUtil
|
|
26
|
+
attr_reader :name
|
|
27
|
+
|
|
28
|
+
def initialize(name, instantiate=true)
|
|
29
|
+
fail ArgumentError unless name.to_s == 'default'
|
|
30
|
+
@name = name.downcase
|
|
31
|
+
|
|
32
|
+
create if instantiate
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.globals
|
|
36
|
+
hash = {}
|
|
37
|
+
feature = config_get('fabricpath', 'feature')
|
|
38
|
+
return hash if feature.nil? || feature.to_sym != :enabled
|
|
39
|
+
hash['default'] = FabricpathGlobal.new('default', false)
|
|
40
|
+
hash
|
|
41
|
+
rescue Cisco::CliError => e
|
|
42
|
+
# cmd will syntax reject when feature is not enabled
|
|
43
|
+
raise unless e.clierror =~ /Syntax error/
|
|
44
|
+
return {}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.fabricpath_feature
|
|
48
|
+
fabricpath = config_get('fabricpath', 'feature')
|
|
49
|
+
return :disabled if fabricpath.nil?
|
|
50
|
+
fabricpath.to_sym
|
|
51
|
+
rescue Cisco::CliError => e
|
|
52
|
+
# cmd will syntax reject when feature is not enabled
|
|
53
|
+
raise unless e.clierror =~ /Syntax error/
|
|
54
|
+
return :disabled
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.fabricpath_enable
|
|
58
|
+
# TBD: Move to Feature provider
|
|
59
|
+
FabricpathGlobal.fabricpath_feature_set(:enabled) unless
|
|
60
|
+
FabricpathGlobal.fabricpath_feature == :enabled
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.fabricpath_feature_set(fabricpath_set)
|
|
64
|
+
curr = FabricpathGlobal.fabricpath_feature
|
|
65
|
+
return if curr == fabricpath_set
|
|
66
|
+
|
|
67
|
+
# NOTE: Add this in future if we want to automatically move only supported
|
|
68
|
+
# interfaces into the VDC
|
|
69
|
+
# if Vdc.vdc_support
|
|
70
|
+
# # For modular platforms, make sure to limit the feature to
|
|
71
|
+
# # modules which support this feature
|
|
72
|
+
# if fabricpath_set == :installed || fabricpath_set == :enabled
|
|
73
|
+
# v = Vdc.new('default')
|
|
74
|
+
# v.limit_resource_module_type =
|
|
75
|
+
# config_get('fabricpath', 'supported_modules')
|
|
76
|
+
# # exception will be raised for un-supported platforms/modules
|
|
77
|
+
# end
|
|
78
|
+
# end
|
|
79
|
+
|
|
80
|
+
case fabricpath_set
|
|
81
|
+
when :enabled
|
|
82
|
+
config_set('fabricpath', 'feature_install',
|
|
83
|
+
state: '') if curr == :uninstalled
|
|
84
|
+
config_set('fabricpath', 'feature', state: '')
|
|
85
|
+
when :disabled
|
|
86
|
+
config_set('fabricpath', 'feature', state: 'no') if curr == :enabled
|
|
87
|
+
return
|
|
88
|
+
when :installed
|
|
89
|
+
config_set('fabricpath', 'feature_install',
|
|
90
|
+
state: '') if curr == :uninstalled
|
|
91
|
+
when :uninstalled
|
|
92
|
+
config_set('fabricpath', 'feature', state: 'no') if curr == :enabled
|
|
93
|
+
config_set('fabricpath', 'feature_install', state: 'no')
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def create
|
|
98
|
+
FabricpathGlobal.fabricpath_enable
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def destroy
|
|
102
|
+
@name = nil
|
|
103
|
+
FabricpathGlobal.fabricpath_feature_set(:disabled)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def loadbalance_munge(property, set_val)
|
|
107
|
+
case property
|
|
108
|
+
when /loadbalance_algorithm/
|
|
109
|
+
val = config_get_default('fabricpath', property)
|
|
110
|
+
return val if (val == 'source-destination') && set_val[/symmetric|xor/]
|
|
111
|
+
set_val
|
|
112
|
+
when /loadbalance_.*_rotate/
|
|
113
|
+
return '' if set_val == ''
|
|
114
|
+
"rotate-amount 0x#{set_val.to_i.to_s(16)}"
|
|
115
|
+
else
|
|
116
|
+
set_val
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
########################################################
|
|
121
|
+
# PROPERTIES #
|
|
122
|
+
########################################################
|
|
123
|
+
|
|
124
|
+
def aggregate_multicast_routes
|
|
125
|
+
config_get('fabricpath', 'aggregate_multicast_routes')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def aggregate_multicast_routes=(val)
|
|
129
|
+
state = val ? '' : 'no'
|
|
130
|
+
config_set('fabricpath', 'aggregate_multicast_routes', state: state)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def default_aggregate_multicast_routes
|
|
134
|
+
config_get_default('fabricpath', 'aggregate_multicast_routes')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def allocate_delay
|
|
138
|
+
config_get('fabricpath', 'allocate_delay')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def allocate_delay=(val)
|
|
142
|
+
state = val ? '' : 'no'
|
|
143
|
+
delay = val ? val : ''
|
|
144
|
+
config_set('fabricpath', 'allocate_delay', state: state, delay: delay)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def default_allocate_delay
|
|
148
|
+
config_get_default('fabricpath', 'allocate_delay')
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def auto_switch_id
|
|
152
|
+
config_get('fabricpath', 'auto_switch_id')
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def graceful_merge
|
|
156
|
+
graceful_merge_conf = config_get('fabricpath', 'graceful_merge')
|
|
157
|
+
# opposite meaning with the cli
|
|
158
|
+
return :enable if graceful_merge_conf.nil?
|
|
159
|
+
graceful_merge_conf ? :disable : :enable
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def graceful_merge=(val)
|
|
163
|
+
state = val == :enable ? 'no' : ''
|
|
164
|
+
config_set('fabricpath', 'graceful_merge', state: state)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def default_graceful_merge
|
|
168
|
+
graceful_merge = config_get_default('fabricpath', 'graceful_merge')
|
|
169
|
+
graceful_merge.to_sym
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def linkup_delay
|
|
173
|
+
config_get('fabricpath', 'linkup_delay')
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def linkup_delay=(val)
|
|
177
|
+
state = val ? '' : 'no'
|
|
178
|
+
delay = val ? val : ''
|
|
179
|
+
config_set('fabricpath', 'linkup_delay', state: state, delay: delay)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def default_linkup_delay
|
|
183
|
+
config_get_default('fabricpath', 'linkup_delay')
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def linkup_delay_always
|
|
187
|
+
config_get('fabricpath', 'linkup_delay_always')
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def linkup_delay_always=(val)
|
|
191
|
+
if val == '' || val == true
|
|
192
|
+
state = ''
|
|
193
|
+
else
|
|
194
|
+
state = 'no'
|
|
195
|
+
end
|
|
196
|
+
config_set('fabricpath', 'linkup_delay_always', state: state)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def default_linkup_delay_always
|
|
200
|
+
config_get_default('fabricpath', 'linkup_delay_always')
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def linkup_delay_enable
|
|
204
|
+
delay = config_get('fabricpath', 'linkup_delay_enable')
|
|
205
|
+
return false if delay.nil?
|
|
206
|
+
delay
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def linkup_delay_enable=(val)
|
|
210
|
+
if val == '' || val == true
|
|
211
|
+
state = ''
|
|
212
|
+
else
|
|
213
|
+
state = 'no'
|
|
214
|
+
end
|
|
215
|
+
config_set('fabricpath', 'linkup_delay_enable', state: state)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def default_linkup_delay_enable
|
|
219
|
+
config_get_default('fabricpath', 'linkup_delay_enable')
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def loadbalance_algorithm_symmetric_support
|
|
223
|
+
config_get_default('fabricpath',
|
|
224
|
+
'loadbalance_algorithm_symmetric_support')
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def loadbalance_algorithm
|
|
228
|
+
algo = config_get('fabricpath', 'loadbalance_algorithm')
|
|
229
|
+
algo.downcase
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def loadbalance_algorithm=(val)
|
|
233
|
+
val = loadbalance_munge('loadbalance_algorithm', val)
|
|
234
|
+
state = val ? '' : 'no'
|
|
235
|
+
algo = val ? val : ''
|
|
236
|
+
config_set('fabricpath', 'loadbalance_algorithm', state: state,
|
|
237
|
+
algo: algo)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def default_loadbalance_algorithm
|
|
241
|
+
config_get_default('fabricpath', 'loadbalance_algorithm')
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def loadbalance_multicast_rotate
|
|
245
|
+
config_get('fabricpath', 'loadbalance_multicast_rotate')
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def loadbalance_multicast_has_vlan
|
|
249
|
+
val = config_get('fabricpath', 'loadbalance_multicast_has_vlan')
|
|
250
|
+
val.nil? ? false : val
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def loadbalance_multicast=(rotate, has_vlan)
|
|
254
|
+
if rotate == '' && (has_vlan == '' || has_vlan == false)
|
|
255
|
+
config_set('fabricpath', 'loadbalance_multicast_reset')
|
|
256
|
+
else
|
|
257
|
+
rotate = loadbalance_munge('loadbalance_multicast_rotate', rotate)
|
|
258
|
+
has_vlan = (has_vlan == true) ? 'include-vlan' : ''
|
|
259
|
+
config_set('fabricpath', 'loadbalance_multicast_set',
|
|
260
|
+
rotate: rotate, has_vlan: has_vlan)
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# default_loadbalance_multicast_rotate: n/a
|
|
265
|
+
|
|
266
|
+
def default_loadbalance_multicast_has_vlan
|
|
267
|
+
config_get_default('fabricpath', 'loadbalance_multicast_has_vlan')
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
def loadbalance_unicast_layer
|
|
271
|
+
unicast = config_get('fabricpath', 'loadbalance_unicast_layer')
|
|
272
|
+
return default_loadbalance_unicast_layer if unicast.nil?
|
|
273
|
+
case unicast
|
|
274
|
+
when /L4/
|
|
275
|
+
'layer4'
|
|
276
|
+
when /L3/
|
|
277
|
+
'layer3'
|
|
278
|
+
when /Mixed/
|
|
279
|
+
'mixed'
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def loadbalance_unicast_rotate
|
|
284
|
+
config_get('fabricpath', 'loadbalance_unicast_rotate')
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
def loadbalance_unicast_has_vlan
|
|
288
|
+
val = config_get('fabricpath', 'loadbalance_unicast_has_vlan')
|
|
289
|
+
val.nil? ? false : val
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
def split_loadbalance_unicast_layer=(val)
|
|
293
|
+
state = val ? '' : 'no'
|
|
294
|
+
layer = val ? val : ''
|
|
295
|
+
config_set('fabricpath', 'loadbalance_unicast_layer',
|
|
296
|
+
state: state, layer: layer)
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def split_loadbalance_unicast_has_vlan=(val)
|
|
300
|
+
if val == '' || val == false
|
|
301
|
+
state = 'no'
|
|
302
|
+
else
|
|
303
|
+
state = ''
|
|
304
|
+
end
|
|
305
|
+
config_set('fabricpath', 'loadbalance_unicast_has_vlan', state: state)
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def loadbalance_unicast=(layer, rotate, has_vlan)
|
|
309
|
+
support = config_get('fabricpath', 'loadbalance_unicast_support')
|
|
310
|
+
if support == 'combined'
|
|
311
|
+
if layer == '' && rotate == '' && (has_vlan == '' || has_vlan == false)
|
|
312
|
+
config_set('fabricpath', 'loadbalance_unicast_reset')
|
|
313
|
+
else
|
|
314
|
+
rotate = loadbalance_munge('loadbalance_unicast_rotate', rotate)
|
|
315
|
+
has_vlan = (has_vlan == true) ? 'include-vlan' : ''
|
|
316
|
+
config_set('fabricpath', 'loadbalance_unicast_set',
|
|
317
|
+
layer: layer, rotate: rotate, has_vlan: has_vlan)
|
|
318
|
+
end
|
|
319
|
+
else
|
|
320
|
+
self.split_loadbalance_unicast_layer = layer
|
|
321
|
+
self.split_loadbalance_unicast_has_vlan = has_vlan
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
def default_loadbalance_unicast_layer
|
|
326
|
+
config_get_default('fabricpath', 'loadbalance_unicast_layer')
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# default_loadbalance_unicast_rotate: n/a
|
|
330
|
+
|
|
331
|
+
def default_loadbalance_unicast_has_vlan
|
|
332
|
+
config_get_default('fabricpath', 'loadbalance_unicast_has_vlan')
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
def mode
|
|
336
|
+
config_get('fabricpath', 'mode')
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def mode=(val)
|
|
340
|
+
if val == '' || val == 'normal'
|
|
341
|
+
state = 'no'
|
|
342
|
+
else
|
|
343
|
+
state = ''
|
|
344
|
+
end
|
|
345
|
+
config_set('fabricpath', 'mode', state: state)
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def default_mode
|
|
349
|
+
config_get_default('fabricpath', 'mode')
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def switch_id
|
|
353
|
+
switch_id_conf = config_get('fabricpath', 'switch_id')
|
|
354
|
+
return auto_switch_id if switch_id_conf.nil?
|
|
355
|
+
switch_id_conf
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def switch_id=(val)
|
|
359
|
+
# There is no no-form for this command
|
|
360
|
+
config_set('fabricpath', 'switch_id', swid: val.to_s)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
def transition_delay
|
|
364
|
+
config_get('fabricpath', 'transition_delay')
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
def transition_delay=(val)
|
|
368
|
+
state = val ? '' : 'no'
|
|
369
|
+
delay = val ? val : ''
|
|
370
|
+
config_set('fabricpath', 'transition_delay', state: state, delay: delay)
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
def default_transition_delay
|
|
374
|
+
config_get_default('fabricpath', 'transition_delay')
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
def ttl_multicast
|
|
378
|
+
config_get('fabricpath', 'ttl_multicast')
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
def ttl_multicast=(val)
|
|
382
|
+
state = val ? '' : 'no'
|
|
383
|
+
ttl = val ? val : ''
|
|
384
|
+
config_set('fabricpath', 'ttl_multicast', state: state, ttl: ttl)
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def default_ttl_multicast
|
|
388
|
+
config_get_default('fabricpath', 'ttl_multicast')
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def ttl_unicast
|
|
392
|
+
config_get('fabricpath', 'ttl_unicast')
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
def ttl_unicast=(val)
|
|
396
|
+
state = val ? '' : 'no'
|
|
397
|
+
ttl = val ? val : ''
|
|
398
|
+
config_set('fabricpath', 'ttl_unicast', state: state, ttl: ttl)
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
def default_ttl_unicast
|
|
402
|
+
config_get_default('fabricpath', 'ttl_unicast')
|
|
403
|
+
end
|
|
404
|
+
end # class
|
|
405
|
+
end # module
|