cisco_node_utils 1.9.0 → 1.10.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 +34 -0
- data/README.md +14 -0
- data/ext/mkrf_conf.rb +1 -1
- data/lib/cisco_node_utils/ace.rb +142 -7
- data/lib/cisco_node_utils/banner.rb +63 -0
- data/lib/cisco_node_utils/bridge_domain.rb +1 -1
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +1 -1
- data/lib/cisco_node_utils/client/utils.rb +20 -10
- data/lib/cisco_node_utils/cmd_ref/acl.yaml +1 -1
- data/lib/cisco_node_utils/cmd_ref/banner.yaml +7 -0
- data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +2 -2
- data/lib/cisco_node_utils/cmd_ref/hostname.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +20 -12
- data/lib/cisco_node_utils/cmd_ref/interface_hsrp_group.yaml +3 -3
- data/lib/cisco_node_utils/cmd_ref/ip_multicast.yaml +6 -2
- data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +4 -1
- data/lib/cisco_node_utils/cmd_ref/syslog_facility.yaml +10 -0
- data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +3 -3
- data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +16 -0
- data/lib/cisco_node_utils/cmd_ref/tacacs_server_host.yaml +2 -2
- data/lib/cisco_node_utils/environment.rb +8 -1
- data/lib/cisco_node_utils/hostname.rb +62 -0
- data/lib/cisco_node_utils/interface.rb +59 -2
- data/lib/cisco_node_utils/interface_DEPRECATED.rb +5 -0
- data/lib/cisco_node_utils/interface_hsrp_group.rb +17 -6
- data/lib/cisco_node_utils/ip_multicast.rb +13 -9
- data/lib/cisco_node_utils/node.rb +4 -1
- data/lib/cisco_node_utils/syslog_facility.rb +64 -0
- data/lib/cisco_node_utils/syslog_server.rb +18 -13
- data/lib/cisco_node_utils/syslog_settings.rb +43 -1
- data/lib/cisco_node_utils/version.rb +1 -1
- data/lib/cisco_node_utils/vlan.rb +1 -1
- data/lib/cisco_node_utils/vxlan_vtep_vni.rb +21 -8
- data/spec/environment_spec.rb +107 -0
- data/tests/ciscotest.rb +8 -1
- data/tests/test_ace.rb +60 -3
- data/tests/test_banner.rb +85 -0
- data/tests/test_bgp_af.rb +1 -1
- data/tests/test_hostname.rb +64 -0
- data/tests/test_interface.rb +22 -1
- data/tests/test_interface_hsrp_group.rb +12 -24
- data/tests/test_ip_multicast.rb +32 -21
- data/tests/test_nxapi.rb +8 -4
- data/tests/test_syslog_facility.rb +80 -0
- data/tests/test_syslog_server.rb +3 -2
- data/tests/test_syslog_settings.rb +16 -1
- data/tests/yum_package.yaml +5 -0
- metadata +12 -3
@@ -82,7 +82,7 @@ loadbalance_multicast_has_vlan:
|
|
82
82
|
_exclude: [N5k, N6k]
|
83
83
|
kind: boolean
|
84
84
|
auto_default: false
|
85
|
-
get_command: "show fabricpath load-balance | begin Ftag"
|
85
|
+
get_command: "show fabricpath load-balance | begin ignore-case Ftag"
|
86
86
|
get_value: '/^Use VLAN: TRUE/'
|
87
87
|
default_value: true
|
88
88
|
|
@@ -93,7 +93,7 @@ loadbalance_multicast_reset:
|
|
93
93
|
loadbalance_multicast_rotate:
|
94
94
|
_exclude: [N5k, N6k]
|
95
95
|
kind: int
|
96
|
-
get_command: "show fabricpath load-balance | begin Ftag"
|
96
|
+
get_command: "show fabricpath load-balance | begin ignore-case Ftag"
|
97
97
|
get_value: '/^Rotate amount: (\d+)/'
|
98
98
|
# default_value: n/a. The default rotate amount is randomized to avoid polarization.
|
99
99
|
|
@@ -127,7 +127,7 @@ hsrp_mac_refresh:
|
|
127
127
|
kind: int
|
128
128
|
get_value: '/^hsrp mac-refresh (\d+)$/'
|
129
129
|
set_value: '<state> hsrp mac-refresh <timeout>'
|
130
|
-
default_value:
|
130
|
+
default_value: ~
|
131
131
|
|
132
132
|
hsrp_use_bia:
|
133
133
|
_exclude: [ios_xr, N5k, N6k]
|
@@ -137,7 +137,7 @@ hsrp_use_bia:
|
|
137
137
|
# optional match to get the whole config
|
138
138
|
get_value: '/^hsrp use-bia(?:\s+\S+\s+\S+)?$/'
|
139
139
|
set_value: '<state> hsrp use-bia<scope>'
|
140
|
-
default_value:
|
140
|
+
default_value: ~
|
141
141
|
|
142
142
|
hsrp_version:
|
143
143
|
_exclude: [ios_xr, N5k, N6k]
|
@@ -211,7 +211,7 @@ ipv4_dhcp_relay_src_intf:
|
|
211
211
|
_exclude: [ios_xr]
|
212
212
|
get_value: '/^ip dhcp relay source-interface (.*)$/'
|
213
213
|
set_value: "<state> ip dhcp relay source-interface <intf>"
|
214
|
-
default_value:
|
214
|
+
default_value: ~
|
215
215
|
|
216
216
|
ipv4_dhcp_relay_subnet_broadcast:
|
217
217
|
_exclude: [ios_xr]
|
@@ -258,7 +258,7 @@ ipv4_proxy_arp:
|
|
258
258
|
ipv4_redirects_loopback:
|
259
259
|
kind: boolean
|
260
260
|
nexus:
|
261
|
-
default_only:
|
261
|
+
default_only: ~
|
262
262
|
ios_xr:
|
263
263
|
get_value: '/^((?:no )?ipv4 redirects)$/'
|
264
264
|
set_value: "<state> ipv4 redirects"
|
@@ -304,7 +304,14 @@ ipv6_dhcp_relay_src_intf:
|
|
304
304
|
_exclude: [ios_xr]
|
305
305
|
get_value: '/^ipv6 dhcp relay source-interface (.*)$/'
|
306
306
|
set_value: "<state> ipv6 dhcp relay source-interface <intf>"
|
307
|
-
default_value:
|
307
|
+
default_value: ~
|
308
|
+
|
309
|
+
ipv6_redirects:
|
310
|
+
_exclude: [ios_xr]
|
311
|
+
kind: boolean
|
312
|
+
get_value: '/^((?:no )?ipv6 redirects)$/'
|
313
|
+
set_value: "<state> ipv6 redirects"
|
314
|
+
default_value: true
|
308
315
|
|
309
316
|
load_interval_counter_1_delay:
|
310
317
|
_exclude: [ios_xr]
|
@@ -329,7 +336,7 @@ load_interval_counter_3_delay:
|
|
329
336
|
kind: int
|
330
337
|
get_value: '/^load-interval counter 3 (\d+)$/'
|
331
338
|
set_value: "<state> load-interval counter 3 <delay>"
|
332
|
-
default_value:
|
339
|
+
default_value: ~
|
333
340
|
|
334
341
|
mtu_loopback:
|
335
342
|
kind: boolean
|
@@ -377,6 +384,7 @@ purge_config:
|
|
377
384
|
set_value: "default interface <name>"
|
378
385
|
get_command: "show running interface"
|
379
386
|
get_value: '/(.*)/'
|
387
|
+
default_value: ~
|
380
388
|
|
381
389
|
pvlan_any:
|
382
390
|
multiple:
|
@@ -462,13 +470,13 @@ stp_bpdufilter:
|
|
462
470
|
kind: string
|
463
471
|
get_value: '/^spanning-tree bpdufilter (.*)$/'
|
464
472
|
set_value: "<state> spanning-tree bpdufilter <filter>"
|
465
|
-
default_value:
|
473
|
+
default_value: ~
|
466
474
|
|
467
475
|
stp_bpduguard:
|
468
476
|
kind: string
|
469
477
|
get_value: '/^spanning-tree bpduguard (.*)$/'
|
470
478
|
set_value: "<state> spanning-tree bpduguard <guard>"
|
471
|
-
default_value:
|
479
|
+
default_value: ~
|
472
480
|
|
473
481
|
stp_cost:
|
474
482
|
kind: string
|
@@ -480,7 +488,7 @@ stp_guard:
|
|
480
488
|
kind: string
|
481
489
|
get_value: '/^spanning-tree guard (.*)$/'
|
482
490
|
set_value: "<state> spanning-tree guard <guard>"
|
483
|
-
default_value:
|
491
|
+
default_value: ~
|
484
492
|
|
485
493
|
stp_link_type:
|
486
494
|
kind: string
|
@@ -517,7 +525,7 @@ stp_port_type:
|
|
517
525
|
get_command: "show running interface"
|
518
526
|
get_value: '/^spanning-tree port type (.*)$/'
|
519
527
|
set_value: "<state> spanning-tree port type <type>"
|
520
|
-
default_value:
|
528
|
+
default_value: ~
|
521
529
|
|
522
530
|
stp_vlan_cost:
|
523
531
|
multiple:
|
@@ -625,7 +633,7 @@ switchport_pvlan_trunk_allowed_vlan:
|
|
625
633
|
multiple: true
|
626
634
|
get_value: '/^switchport private-vlan trunk allowed vlan (?:add )?(\S+)$/'
|
627
635
|
set_value: "switchport private-vlan trunk allowed vlan <range>"
|
628
|
-
default_value:
|
636
|
+
default_value: none
|
629
637
|
|
630
638
|
switchport_pvlan_trunk_association:
|
631
639
|
_exclude: [ios_xr, N3k, N3k-F, N9k-F]
|
@@ -728,7 +736,7 @@ vpc_id:
|
|
728
736
|
kind: int
|
729
737
|
get_value: '/^vpc (\d+)$/'
|
730
738
|
set_value: '<state> vpc <id>'
|
731
|
-
default_value:
|
739
|
+
default_value: ~
|
732
740
|
|
733
741
|
vpc_peer_link:
|
734
742
|
kind: boolean
|
@@ -23,14 +23,14 @@ authentication_enc_type:
|
|
23
23
|
default_value: '0'
|
24
24
|
|
25
25
|
authentication_key_type:
|
26
|
-
default_value:
|
26
|
+
default_value: ~
|
27
27
|
|
28
28
|
authentication_string:
|
29
|
-
default_value:
|
29
|
+
default_value: ~
|
30
30
|
|
31
31
|
authentication_timeout:
|
32
32
|
kind: int
|
33
|
-
default_value:
|
33
|
+
default_value: ~
|
34
34
|
|
35
35
|
group_name:
|
36
36
|
get_value: '/^name (\S+)/'
|
@@ -7,12 +7,16 @@ _template:
|
|
7
7
|
|
8
8
|
overlay_distributed_dr:
|
9
9
|
context: ~
|
10
|
+
kind: boolean
|
10
11
|
get_value: '^ip multicast overlay-distributed-dr$'
|
11
12
|
set_value: "<state> ip multicast overlay-distributed-dr"
|
12
13
|
default_value: false
|
13
14
|
|
14
15
|
overlay_spt_only:
|
15
16
|
context: ~
|
16
|
-
|
17
|
+
kind: boolean
|
18
|
+
auto_default: false
|
19
|
+
get_command: "show fabric multicast globals"
|
20
|
+
get_value: '^Overlay spt-only:\s+TRUE$'
|
17
21
|
set_value: "<state> ip multicast overlay-spt-only"
|
18
|
-
default_value:
|
22
|
+
default_value: true
|
@@ -62,7 +62,10 @@ packet_size:
|
|
62
62
|
# the n3|9k behavior when the issue is resolved.
|
63
63
|
default_value: 0
|
64
64
|
N6k: *n5k_default_packet_size
|
65
|
-
|
65
|
+
# On recent versions, packet size is fixed,
|
66
|
+
# so this change will take care of the fix but
|
67
|
+
# it could still fail in the older versions.
|
68
|
+
N7k: *n3k_default_packet_size
|
66
69
|
# On recent versions, packet size is fixed,
|
67
70
|
# so this change will take care of the fix but
|
68
71
|
# it could still fail in the older versions.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# syslog_facility
|
2
|
+
---
|
3
|
+
_exclude: [ios_xr]
|
4
|
+
|
5
|
+
facility:
|
6
|
+
multiple: true
|
7
|
+
get_command: "show running-config | include '^logging level'"
|
8
|
+
# Returns <facility>, <level>
|
9
|
+
get_value: '/^(?:logging level)\s+(.*)\s+([0-7])/'
|
10
|
+
set_value: '<state> logging level <facility> <level>'
|
@@ -15,9 +15,9 @@ server:
|
|
15
15
|
multiple: true
|
16
16
|
nexus:
|
17
17
|
get_command: "show running-config all | include '^logging server'"
|
18
|
-
# Returns <ip>, <level>, <port>, <vrf>
|
19
|
-
get_value: '/^(?:logging server )([^\s]+)(?: (\d+))?(?: port (\d+))?(?: use-vrf (\S+))?/'
|
20
|
-
set_value: '<state> logging server <ip> <level> <port> <vrf>'
|
18
|
+
# Returns <ip>, <level>, <port>, <vrf>, <facility>
|
19
|
+
get_value: '/^(?:logging server )([^\s]+)(?: (\d+))?(?: port (\d+))?(?: use-vrf (\S+))?(?: facility (\S+))?/'
|
20
|
+
set_value: '<state> logging server <ip> <level> <port> <vrf> <facility>'
|
21
21
|
ios_xr:
|
22
22
|
get_command: "show running-config logging"
|
23
23
|
get_value: '/^logging (\S+).*/'
|
@@ -9,6 +9,22 @@ console:
|
|
9
9
|
get_value: '/^(no)?\s*logging console\s*(\d)?/'
|
10
10
|
set_value: '<state> logging console <severity>'
|
11
11
|
|
12
|
+
logfile_name:
|
13
|
+
get_command: "show running-config all | include 'logging'"
|
14
|
+
# Returns <state> and <name>
|
15
|
+
get_value: '/^(no)?\s*logging logfile\s(\S*)\s*?/'
|
16
|
+
set_value: '<state> logging logfile <logname> <severity> <size>'
|
17
|
+
|
18
|
+
logfile_severity_level:
|
19
|
+
get_command: "show running-config all | include 'logging'"
|
20
|
+
# Returns <state> and <severity>
|
21
|
+
get_value: '/^(no)?\s*logging logfile\s\S*\s*(\d)?/'
|
22
|
+
|
23
|
+
logfile_size:
|
24
|
+
get_command: "show running-config all | include 'logging'"
|
25
|
+
# Returns <state> and <size>
|
26
|
+
get_value: '/^(no)?\s*logging logfile.*size\s(\d*)/'
|
27
|
+
|
12
28
|
monitor:
|
13
29
|
default_value: 5
|
14
30
|
get_command: "show running-config all | include 'logging'"
|
@@ -48,7 +48,7 @@ hosts:
|
|
48
48
|
port:
|
49
49
|
default_value: 49
|
50
50
|
kind: int
|
51
|
-
get_value: '/^tacacs-server host <ip
|
51
|
+
get_value: '/^tacacs-server host <ip>\s.*port (\d+).*$/'
|
52
52
|
nexus:
|
53
53
|
set_value: "tacacs-server host <ip> port <port>"
|
54
54
|
|
@@ -56,7 +56,7 @@ timeout:
|
|
56
56
|
default_value: 0
|
57
57
|
kind: int
|
58
58
|
nexus:
|
59
|
-
get_value: '/^tacacs-server host <ip
|
59
|
+
get_value: '/^tacacs-server host <ip>\s.*timeout (\d+)/'
|
60
60
|
set_value: "<state> tacacs-server host <ip> timeout <timeout>"
|
61
61
|
ios_xr:
|
62
62
|
context: ["tacacs-server host <ip> port <port>"]
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# August 2018
|
1
2
|
# March 2016, Glenn F. Matthews
|
2
3
|
#
|
3
|
-
# Copyright (c) 2016 Cisco and/or its affiliates.
|
4
|
+
# Copyright (c) 2016-2018 Cisco and/or its affiliates.
|
4
5
|
#
|
5
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
7
|
# you may not use this file except in compliance with the License.
|
@@ -90,6 +91,12 @@ module Cisco
|
|
90
91
|
{}
|
91
92
|
end
|
92
93
|
|
94
|
+
def self.add_env(env_name, env_hash)
|
95
|
+
fail ArgumentError, 'empty environment name' if env_name.empty?
|
96
|
+
fail TypeError, 'invalid environment hash' unless env_hash.is_a?(Hash)
|
97
|
+
@environments[env_name] = env_hash
|
98
|
+
end
|
99
|
+
|
93
100
|
def self.strings_to_symbols(hash)
|
94
101
|
Hash[hash.map { |k, v| [k.to_sym, v] }]
|
95
102
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Hostname provider class
|
2
|
+
#
|
3
|
+
# September 2018
|
4
|
+
#
|
5
|
+
# Copyright (c) 2014-2018 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 'node_util'
|
20
|
+
|
21
|
+
module Cisco
|
22
|
+
# Hostname- node utility class for hostname configuration
|
23
|
+
class HostName < NodeUtil
|
24
|
+
attr_reader :name
|
25
|
+
|
26
|
+
def initialize(name, instantiate=true)
|
27
|
+
@name = name
|
28
|
+
create if instantiate
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.hostname
|
32
|
+
hash = {}
|
33
|
+
hostname = config_get('hostname', 'name')
|
34
|
+
hash[hostname] = HostName.new(hostname, false)
|
35
|
+
hash
|
36
|
+
end
|
37
|
+
|
38
|
+
def hostname=(host)
|
39
|
+
if host
|
40
|
+
config_set(
|
41
|
+
'hostname', 'name',
|
42
|
+
state: '', name: host)
|
43
|
+
else
|
44
|
+
config_set(
|
45
|
+
'hostname', 'name',
|
46
|
+
state: 'no', name: '')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def ==(other)
|
51
|
+
name == other.name
|
52
|
+
end
|
53
|
+
|
54
|
+
def create
|
55
|
+
config_set('hostname', 'name', state: '', name: @name)
|
56
|
+
end
|
57
|
+
|
58
|
+
def destroy
|
59
|
+
config_set('hostname', 'name', state: 'no', name: @name)
|
60
|
+
end
|
61
|
+
end # class
|
62
|
+
end # module
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# November 2015, Chris Van Heuveln
|
2
2
|
#
|
3
|
-
# Copyright (c) 2015-
|
3
|
+
# Copyright (c) 2015-2018 Cisco and/or its affiliates.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -192,6 +192,7 @@ module Cisco
|
|
192
192
|
# are left untouched.
|
193
193
|
|
194
194
|
def access_vlan
|
195
|
+
return nil if switchport_mode == :disabled
|
195
196
|
config_get('interface', 'access_vlan', name: @name)
|
196
197
|
end
|
197
198
|
|
@@ -275,6 +276,7 @@ module Cisco
|
|
275
276
|
end
|
276
277
|
|
277
278
|
def fabric_forwarding_anycast_gateway=(state)
|
279
|
+
return if fabric_forwarding_anycast_gateway == state
|
278
280
|
no_cmd = (state ? '' : 'no')
|
279
281
|
config_set('interface',
|
280
282
|
'fabric_forwarding_anycast_gateway',
|
@@ -325,6 +327,7 @@ module Cisco
|
|
325
327
|
end
|
326
328
|
|
327
329
|
def hsrp_delay_minimum
|
330
|
+
return nil if switchport_mode != :disabled || @name[/loop/i]
|
328
331
|
minimum, _reload = hsrp_delay
|
329
332
|
minimum.nil? ? default_hsrp_delay_minimum : minimum
|
330
333
|
end
|
@@ -342,6 +345,7 @@ module Cisco
|
|
342
345
|
end
|
343
346
|
|
344
347
|
def hsrp_delay_reload
|
348
|
+
return nil if switchport_mode != :disabled || @name[/loop/i]
|
345
349
|
_minimum, reload = hsrp_delay
|
346
350
|
reload.nil? ? default_hsrp_delay_reload : reload
|
347
351
|
end
|
@@ -413,6 +417,7 @@ module Cisco
|
|
413
417
|
end
|
414
418
|
|
415
419
|
def hsrp_version
|
420
|
+
return nil if switchport_mode != :disabled || @name[/loop/i]
|
416
421
|
config_get('interface', 'hsrp_version', name: @name)
|
417
422
|
end
|
418
423
|
|
@@ -604,6 +609,7 @@ module Cisco
|
|
604
609
|
end
|
605
610
|
|
606
611
|
def ipv4_dhcp_relay_info_trust
|
612
|
+
return nil if @name[/loop/i] || switchport_mode != :disabled
|
607
613
|
config_get('interface', 'ipv4_dhcp_relay_info_trust', name: @name)
|
608
614
|
end
|
609
615
|
|
@@ -654,6 +660,7 @@ module Cisco
|
|
654
660
|
end
|
655
661
|
|
656
662
|
def ipv4_dhcp_relay_subnet_broadcast
|
663
|
+
return nil if @name[/loop/i] || switchport_mode != :disabled
|
657
664
|
config_get('interface', 'ipv4_dhcp_relay_subnet_broadcast', name: @name)
|
658
665
|
end
|
659
666
|
|
@@ -669,6 +676,7 @@ module Cisco
|
|
669
676
|
end
|
670
677
|
|
671
678
|
def ipv4_dhcp_smart_relay
|
679
|
+
return nil if @name[/loop/i] || switchport_mode != :disabled
|
672
680
|
config_get('interface', 'ipv4_dhcp_smart_relay', name: @name)
|
673
681
|
end
|
674
682
|
|
@@ -698,6 +706,7 @@ module Cisco
|
|
698
706
|
end
|
699
707
|
|
700
708
|
def ipv4_pim_sparse_mode
|
709
|
+
return nil unless switchport_mode == :disabled
|
701
710
|
config_get('interface', 'ipv4_pim_sparse_mode', name: @name)
|
702
711
|
end
|
703
712
|
|
@@ -713,6 +722,7 @@ module Cisco
|
|
713
722
|
end
|
714
723
|
|
715
724
|
def ipv4_proxy_arp
|
725
|
+
return nil if @name[/loop/i] || switchport_mode != :disabled
|
716
726
|
config_get('interface', 'ipv4_proxy_arp', name: @name)
|
717
727
|
end
|
718
728
|
|
@@ -736,6 +746,7 @@ module Cisco
|
|
736
746
|
end
|
737
747
|
|
738
748
|
def ipv4_redirects
|
749
|
+
return nil unless switchport_mode == :disabled
|
739
750
|
config_get('interface', ipv4_redirects_lookup_string, name: @name)
|
740
751
|
end
|
741
752
|
|
@@ -834,6 +845,22 @@ module Cisco
|
|
834
845
|
config_get_default('interface', 'ipv6_dhcp_relay_src_intf')
|
835
846
|
end
|
836
847
|
|
848
|
+
def ipv6_redirects
|
849
|
+
return nil if @name[/loop/i] || switchport_mode != :disabled
|
850
|
+
config_get('interface', 'ipv6_redirects', name: @name)
|
851
|
+
end
|
852
|
+
|
853
|
+
def ipv6_redirects=(redirects)
|
854
|
+
check_switchport(:disabled)
|
855
|
+
no_cmd = (redirects ? '' : 'no')
|
856
|
+
config_set('interface', 'ipv6_redirects',
|
857
|
+
name: @name, state: no_cmd)
|
858
|
+
end
|
859
|
+
|
860
|
+
def default_ipv6_redirects
|
861
|
+
config_get_default('interface', 'ipv6_redirects')
|
862
|
+
end
|
863
|
+
|
837
864
|
def feature_lacp?
|
838
865
|
config_get('interface', 'feature_lacp')
|
839
866
|
end
|
@@ -913,6 +940,7 @@ module Cisco
|
|
913
940
|
end
|
914
941
|
|
915
942
|
def mtu=(val)
|
943
|
+
return if mtu == val
|
916
944
|
check_switchport(:disabled)
|
917
945
|
config_set('interface', mtu_lookup_string,
|
918
946
|
name: @name, state: '', mtu: val)
|
@@ -923,6 +951,7 @@ module Cisco
|
|
923
951
|
end
|
924
952
|
|
925
953
|
def speed
|
954
|
+
return nil if @name[/loop|vlan/i]
|
926
955
|
config_get('interface', 'speed', name: @name)
|
927
956
|
end
|
928
957
|
|
@@ -935,6 +964,7 @@ module Cisco
|
|
935
964
|
end
|
936
965
|
|
937
966
|
def duplex
|
967
|
+
return nil if @name[/loop|vlan/i]
|
938
968
|
config_get('interface', 'duplex', name: @name)
|
939
969
|
end
|
940
970
|
|
@@ -958,6 +988,7 @@ module Cisco
|
|
958
988
|
end
|
959
989
|
|
960
990
|
def negotiate_auto
|
991
|
+
return nil if @name[/loop|vlan/]
|
961
992
|
config_get('interface', negotiate_auto_lookup_string, name: @name)
|
962
993
|
end
|
963
994
|
|
@@ -1032,10 +1063,12 @@ module Cisco
|
|
1032
1063
|
end
|
1033
1064
|
|
1034
1065
|
def storm_control_broadcast
|
1066
|
+
return nil if @name[/loop|vlan/i]
|
1035
1067
|
config_get('interface', 'storm_control_broadcast', name: @name)
|
1036
1068
|
end
|
1037
1069
|
|
1038
1070
|
def storm_control_broadcast=(val)
|
1071
|
+
return if val == storm_control_broadcast
|
1039
1072
|
state = val == default_storm_control_broadcast ? 'no' : ''
|
1040
1073
|
level = val == default_storm_control_broadcast ? '' : val
|
1041
1074
|
config_set('interface', 'storm_control_broadcast',
|
@@ -1047,10 +1080,12 @@ module Cisco
|
|
1047
1080
|
end
|
1048
1081
|
|
1049
1082
|
def storm_control_multicast
|
1083
|
+
return nil if @name[/loop|vlan/i]
|
1050
1084
|
config_get('interface', 'storm_control_multicast', name: @name)
|
1051
1085
|
end
|
1052
1086
|
|
1053
1087
|
def storm_control_multicast=(val)
|
1088
|
+
return if val == storm_control_broadcast
|
1054
1089
|
state = val == default_storm_control_multicast ? 'no' : ''
|
1055
1090
|
level = val == default_storm_control_multicast ? '' : val
|
1056
1091
|
config_set('interface', 'storm_control_multicast',
|
@@ -1062,10 +1097,12 @@ module Cisco
|
|
1062
1097
|
end
|
1063
1098
|
|
1064
1099
|
def storm_control_unicast
|
1100
|
+
return nil if @name[/loop|vlan/i]
|
1065
1101
|
config_get('interface', 'storm_control_unicast', name: @name)
|
1066
1102
|
end
|
1067
1103
|
|
1068
1104
|
def storm_control_unicast=(val)
|
1105
|
+
return if val == storm_control_broadcast
|
1069
1106
|
state = val == default_storm_control_unicast ? 'no' : ''
|
1070
1107
|
level = val == default_storm_control_unicast ? '' : val
|
1071
1108
|
config_set('interface', 'storm_control_unicast',
|
@@ -1116,6 +1153,7 @@ module Cisco
|
|
1116
1153
|
end
|
1117
1154
|
|
1118
1155
|
def stp_cost
|
1156
|
+
return nil if switchport_mode == :disabled
|
1119
1157
|
cost = config_get('interface', 'stp_cost', name: @name)
|
1120
1158
|
cost == 'auto' ? cost : cost.to_i
|
1121
1159
|
end
|
@@ -1150,6 +1188,7 @@ module Cisco
|
|
1150
1188
|
end
|
1151
1189
|
|
1152
1190
|
def stp_link_type
|
1191
|
+
return nil if switchport_mode == :disabled
|
1153
1192
|
config_get('interface', 'stp_link_type', name: @name)
|
1154
1193
|
end
|
1155
1194
|
|
@@ -1163,6 +1202,7 @@ module Cisco
|
|
1163
1202
|
end
|
1164
1203
|
|
1165
1204
|
def stp_port_priority
|
1205
|
+
return nil if switchport_mode == :disabled
|
1166
1206
|
config_get('interface', 'stp_port_priority', name: @name)
|
1167
1207
|
end
|
1168
1208
|
|
@@ -1294,6 +1334,7 @@ module Cisco
|
|
1294
1334
|
|
1295
1335
|
# switchport_autostate_exclude is exclusive to switchport interfaces
|
1296
1336
|
def switchport_autostate_exclude
|
1337
|
+
return nil if switchport_mode == :disabled
|
1297
1338
|
config_get('interface',
|
1298
1339
|
'switchport_autostate_exclude', name: @name)
|
1299
1340
|
end
|
@@ -1384,6 +1425,7 @@ module Cisco
|
|
1384
1425
|
end
|
1385
1426
|
|
1386
1427
|
def switchport_trunk_allowed_vlan
|
1428
|
+
return nil if switchport_mode == :disabled
|
1387
1429
|
vlans = config_get('interface', 'switchport_trunk_allowed_vlan',
|
1388
1430
|
name: @name)
|
1389
1431
|
vlans = vlans.join(',') if vlans.is_a?(Array)
|
@@ -1406,6 +1448,7 @@ module Cisco
|
|
1406
1448
|
end
|
1407
1449
|
|
1408
1450
|
def switchport_trunk_native_vlan
|
1451
|
+
return nil if switchport_mode == :disabled
|
1409
1452
|
config_get('interface', 'switchport_trunk_native_vlan', name: @name)
|
1410
1453
|
end
|
1411
1454
|
|
@@ -1442,6 +1485,7 @@ module Cisco
|
|
1442
1485
|
# --------------------------
|
1443
1486
|
# <state> switchport mode private-vlan host
|
1444
1487
|
def switchport_pvlan_host
|
1488
|
+
return nil if switchport_mode == :disabled
|
1445
1489
|
config_get('interface', 'switchport_pvlan_host', name: @name)
|
1446
1490
|
end
|
1447
1491
|
|
@@ -1458,6 +1502,7 @@ module Cisco
|
|
1458
1502
|
# --------------------------
|
1459
1503
|
# <state> switchport mode private-vlan promiscuous
|
1460
1504
|
def switchport_pvlan_promiscuous
|
1505
|
+
return nil if switchport_mode == :disabled
|
1461
1506
|
config_get('interface', 'switchport_pvlan_promiscuous', name: @name)
|
1462
1507
|
end
|
1463
1508
|
|
@@ -1650,6 +1695,7 @@ module Cisco
|
|
1650
1695
|
# --------------------------
|
1651
1696
|
# <state> switchport mode private-vlan trunk promiscuous
|
1652
1697
|
def switchport_pvlan_trunk_promiscuous
|
1698
|
+
return nil if switchport_mode == :disabled
|
1653
1699
|
config_get('interface', 'switchport_pvlan_trunk_promiscuous', name: @name)
|
1654
1700
|
end
|
1655
1701
|
|
@@ -1666,6 +1712,7 @@ module Cisco
|
|
1666
1712
|
# --------------------------
|
1667
1713
|
# <state> switchport mode private-vlan trunk secondary
|
1668
1714
|
def switchport_pvlan_trunk_secondary
|
1715
|
+
return nil if switchport_mode == :disabled
|
1669
1716
|
config_get('interface', 'switchport_pvlan_trunk_secondary', name: @name)
|
1670
1717
|
end
|
1671
1718
|
|
@@ -1684,6 +1731,7 @@ module Cisco
|
|
1684
1731
|
# Note that range is handled as a string because the entire range is
|
1685
1732
|
# replaced instead of individually adding or removing vlans from the range.
|
1686
1733
|
def switchport_pvlan_trunk_allowed_vlan
|
1734
|
+
return nil if switchport_mode == :disabled
|
1687
1735
|
vlans = config_get('interface', 'switchport_pvlan_trunk_allowed_vlan',
|
1688
1736
|
name: @name)
|
1689
1737
|
vlans = vlans.join(',') if vlans.is_a?(Array)
|
@@ -1708,6 +1756,7 @@ module Cisco
|
|
1708
1756
|
# --------------------------
|
1709
1757
|
# <state> switchport trunk native vlan <vlan>
|
1710
1758
|
def switchport_pvlan_trunk_native_vlan
|
1759
|
+
return nil if switchport_mode == :disabled
|
1711
1760
|
config_get('interface', 'switchport_pvlan_trunk_native_vlan', name: @name)
|
1712
1761
|
end
|
1713
1762
|
|
@@ -1971,10 +2020,12 @@ module Cisco
|
|
1971
2020
|
end
|
1972
2021
|
|
1973
2022
|
def vpc_peer_link
|
2023
|
+
return nil unless @name[/port-channel/i] && switchport_mode != :disabled
|
1974
2024
|
config_get('interface', 'vpc_peer_link', name: @name)
|
1975
2025
|
end
|
1976
2026
|
|
1977
2027
|
def vpc_peer_link=(state)
|
2028
|
+
return if vpc_peerlink == state
|
1978
2029
|
no_cmd = (state ? '' : 'no')
|
1979
2030
|
config_set('interface', 'vpc_peer_link', name: @name, state: no_cmd)
|
1980
2031
|
end
|
@@ -2037,8 +2088,14 @@ module Cisco
|
|
2037
2088
|
end
|
2038
2089
|
|
2039
2090
|
def purge_config
|
2091
|
+
# This getter is only supported on ethernet interfaces
|
2092
|
+
return nil unless @name[/ethernet/]
|
2040
2093
|
state = config_get('interface', 'purge_config', name: @name)
|
2041
|
-
state.nil? ? true :
|
2094
|
+
state.nil? ? true : default_purge_config
|
2095
|
+
end
|
2096
|
+
|
2097
|
+
def default_purge_config
|
2098
|
+
config_get_default('interface', 'purge_config')
|
2042
2099
|
end
|
2043
2100
|
end # Class
|
2044
2101
|
end # Module
|