cisco_node_utils 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/lib/cisco_node_utils/bfd_global.rb +4 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +25 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +18 -18
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +4 -1
- data/lib/cisco_node_utils/cmd_ref/interface_evpn_multisite.yaml +1 -1
- data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +17 -15
- data/lib/cisco_node_utils/interface.rb +117 -118
- data/lib/cisco_node_utils/interface_channel_group.rb +17 -8
- data/lib/cisco_node_utils/interface_evpn_multisite.rb +15 -6
- data/lib/cisco_node_utils/interface_ospf.rb +126 -102
- data/lib/cisco_node_utils/itd_service.rb +8 -0
- data/lib/cisco_node_utils/node.rb +0 -1
- data/lib/cisco_node_utils/platform.rb +16 -32
- data/lib/cisco_node_utils/version.rb +1 -1
- data/lib/cisco_node_utils/vlan.rb +1 -2
- data/lib/cisco_node_utils/vxlan_vtep.rb +1 -1
- data/tests/test_interface.rb +74 -13
- data/tests/test_interface_bdi.rb +2 -2
- data/tests/test_interface_channel_group.rb +24 -17
- data/tests/test_interface_evpn_multisite.rb +35 -0
- data/tests/test_interface_ospf.rb +71 -3
- data/tests/test_itd_service.rb +16 -4
- data/tests/test_node_ext.rb +4 -1
- data/tests/test_portchannel_global.rb +3 -0
- data/tests/test_router_ospf_vrf.rb +2 -34
- data/tests/test_stp_global.rb +4 -0
- metadata +3 -6
- data/lib/cisco_node_utils/cmd_ref/DEPRECATED.yaml +0 -118
- data/lib/cisco_node_utils/interface_DEPRECATED.rb +0 -518
- data/lib/cisco_node_utils/vlan_DEPRECATED.rb +0 -108
@@ -1,108 +0,0 @@
|
|
1
|
-
# rubocop: disable Style/FileName
|
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
|
-
#
|
18
|
-
# WARNING! WARNING! WARNING!
|
19
|
-
#
|
20
|
-
# This file contains deprecated methods that will be removed with version 2.0.0
|
21
|
-
#
|
22
|
-
###############################################################################
|
23
|
-
|
24
|
-
require_relative 'node_util'
|
25
|
-
require 'logger'
|
26
|
-
|
27
|
-
module Cisco
|
28
|
-
# Vlan - node utility class for VLAN configuration management
|
29
|
-
class VlanDeprecated < NodeUtil
|
30
|
-
def deprecation_warning(method, new_prop=nil)
|
31
|
-
if new_prop.nil?
|
32
|
-
new_prop = ''
|
33
|
-
else
|
34
|
-
new_prop = "The new property name is '#{new_prop}'"
|
35
|
-
end
|
36
|
-
|
37
|
-
warn "
|
38
|
-
#########################################################################
|
39
|
-
WARNING: Method '#{method.to_s.delete('=')}'
|
40
|
-
is deprecated and should not be used.
|
41
|
-
#{new_prop}
|
42
|
-
#########################################################################
|
43
|
-
"
|
44
|
-
end
|
45
|
-
|
46
|
-
def private_vlan_type
|
47
|
-
return nil unless Feature.private_vlan_enabled?
|
48
|
-
config_get('DEPRECATED', 'private_vlan_type', id: @vlan_id)
|
49
|
-
end
|
50
|
-
|
51
|
-
def private_vlan_type=(type)
|
52
|
-
deprecation_warning(__method__, 'pvlan_type')
|
53
|
-
Feature.private_vlan_enable
|
54
|
-
fail TypeError unless type && type.is_a?(String)
|
55
|
-
|
56
|
-
if type == default_private_vlan_type
|
57
|
-
return if private_vlan_type.empty?
|
58
|
-
set_args_keys(state: 'no', type: private_vlan_type)
|
59
|
-
ignore_msg = 'Warning: Private-VLAN CLI removed'
|
60
|
-
else
|
61
|
-
set_args_keys(state: '', type: type)
|
62
|
-
ignore_msg = 'Warning: Private-VLAN CLI entered'
|
63
|
-
end
|
64
|
-
result = config_set('DEPRECATED', 'private_vlan_type', @set_args)
|
65
|
-
cli_error_check(result, ignore_msg)
|
66
|
-
end
|
67
|
-
|
68
|
-
def default_private_vlan_type
|
69
|
-
config_get_default('DEPRECATED', 'private_vlan_type')
|
70
|
-
end
|
71
|
-
|
72
|
-
def private_vlan_association
|
73
|
-
return nil unless Feature.private_vlan_enabled?
|
74
|
-
range = config_get('DEPRECATED', 'private_vlan_association', id: @vlan_id)
|
75
|
-
Utils.normalize_range_array(range)
|
76
|
-
end
|
77
|
-
|
78
|
-
def private_vlan_association=(range)
|
79
|
-
deprecation_warning(__method__, 'pvlan_association')
|
80
|
-
Feature.private_vlan_enable
|
81
|
-
is = Utils.dash_range_to_elements(private_vlan_association)
|
82
|
-
should = Utils.dash_range_to_elements(range)
|
83
|
-
association_delta(is, should)
|
84
|
-
end
|
85
|
-
|
86
|
-
def default_private_vlan_association
|
87
|
-
config_get_default('DEPRECATED', 'private_vlan_association')
|
88
|
-
end
|
89
|
-
|
90
|
-
# --------------------------
|
91
|
-
# association_delta is a helper function for the private_vlan_association
|
92
|
-
# property. It walks the delta hash and adds/removes each target private
|
93
|
-
# vlan.
|
94
|
-
def association_delta(is, should)
|
95
|
-
delta_hash = Utils.delta_add_remove(should, is)
|
96
|
-
Cisco::Logger.debug("association_delta: #{@vlan_id}: #{delta_hash}")
|
97
|
-
[:add, :remove].each do |action|
|
98
|
-
delta_hash[action].each do |vlans|
|
99
|
-
state = (action == :add) ? '' : 'no'
|
100
|
-
set_args_keys(state: state, vlans: vlans)
|
101
|
-
result = config_set('DEPRECATED',
|
102
|
-
'private_vlan_association', @set_args)
|
103
|
-
cli_error_check(result)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end # Class
|
108
|
-
end # Module
|