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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/lib/cisco_node_utils/bfd_global.rb +4 -0
  4. data/lib/cisco_node_utils/cisco_cmn_utils.rb +25 -0
  5. data/lib/cisco_node_utils/cmd_ref/interface.yaml +18 -18
  6. data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +4 -1
  7. data/lib/cisco_node_utils/cmd_ref/interface_evpn_multisite.yaml +1 -1
  8. data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +17 -15
  9. data/lib/cisco_node_utils/interface.rb +117 -118
  10. data/lib/cisco_node_utils/interface_channel_group.rb +17 -8
  11. data/lib/cisco_node_utils/interface_evpn_multisite.rb +15 -6
  12. data/lib/cisco_node_utils/interface_ospf.rb +126 -102
  13. data/lib/cisco_node_utils/itd_service.rb +8 -0
  14. data/lib/cisco_node_utils/node.rb +0 -1
  15. data/lib/cisco_node_utils/platform.rb +16 -32
  16. data/lib/cisco_node_utils/version.rb +1 -1
  17. data/lib/cisco_node_utils/vlan.rb +1 -2
  18. data/lib/cisco_node_utils/vxlan_vtep.rb +1 -1
  19. data/tests/test_interface.rb +74 -13
  20. data/tests/test_interface_bdi.rb +2 -2
  21. data/tests/test_interface_channel_group.rb +24 -17
  22. data/tests/test_interface_evpn_multisite.rb +35 -0
  23. data/tests/test_interface_ospf.rb +71 -3
  24. data/tests/test_itd_service.rb +16 -4
  25. data/tests/test_node_ext.rb +4 -1
  26. data/tests/test_portchannel_global.rb +3 -0
  27. data/tests/test_router_ospf_vrf.rb +2 -34
  28. data/tests/test_stp_global.rb +4 -0
  29. metadata +3 -6
  30. data/lib/cisco_node_utils/cmd_ref/DEPRECATED.yaml +0 -118
  31. data/lib/cisco_node_utils/interface_DEPRECATED.rb +0 -518
  32. data/lib/cisco_node_utils/vlan_DEPRECATED.rb +0 -108
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a05bb2305207d3df446759d870f0422c458539b
4
- data.tar.gz: c596cbf4b824b6ca0c07a90d89eeb8e6c7c2cd1f
3
+ metadata.gz: 25ab64767af23a6f2d3b6ae7e18df87fee6b1021
4
+ data.tar.gz: '0997f3d16c79fe25c8f9195cf8a16ba2a73d581e'
5
5
  SHA512:
6
- metadata.gz: 01221c8c8d2d9c99bc89abab9d6650975d5288fd93f4d87994333cea2cd6107d3cae973d3995cbb40a4134b4aeb619616642861c9294d470bb4f5b79695b9539
7
- data.tar.gz: 661b5c54fc64633b60b585c3aa1e5aa44dcc20b37272907d4ae599f6171986ee17f797b0e92fc7805d0149cb21a6dc2c8123a2a92f396cb062b01042deee58c7
6
+ metadata.gz: fecc5acce031898494571f1051cfde121631eabe8e4645fce634018a9192efd9a4cad0ab53618660c054ec79e2896c88021606ae69f48256ac96015a8727e3f8
7
+ data.tar.gz: bb4178e4b416a3f7ad3439db4e65801158e06463a75a271590f27b2faca2d279365d6e1f9594790fd452d81ede0cbfd84c4558e766593e0b163356a46e0d5907
@@ -1,6 +1,42 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## [v2.1.0]
5
+
6
+ ### Added
7
+
8
+ ### Changed
9
+
10
+ ### Removed
11
+ - Removal of deprecated `interface` `private-vlan` properties.
12
+
13
+ | Deprecated/Removed Name | New Name |
14
+ |:---|:---|
15
+ | `private_vlan_mapping` | `pvlan_mapping`
16
+ | `switchport_mode_private_vlan_host` | `switchport_pvlan_host`, `switchport_pvlan_promiscuous`,
17
+ | `switchport_mode_private_vlan_host_association` | `switchport_pvlan_host_association`
18
+ | `switchport_mode_private_vlan_host_promiscous` | `switchport_pvlan_mapping`
19
+ | `switchport_mode_private_vlan_trunk_promiscuous`| `switchport_pvlan_trunk_promiscuous`
20
+ | `switchport_mode_private_vlan_trunk_secondary` | `switchport_pvlan_trunk_secondary`
21
+ | `switchport_private_vlan_association_trunk` | `switchport_pvlan_trunk_association`
22
+ | `switchport_private_vlan_mapping_trunk` | `switchport_pvlan_mapping_trunk`
23
+ | `switchport_private_vlan_trunk_allowed_vlan` | `switchport_pvlan_trunk_allowed_vlan`
24
+ | `switchport_private_vlan_trunk_native_vlan` | `switchport_pvlan_trunk_native_vlan`
25
+
26
+ - Removal of deprecated `vlan` `private-vlan` properties.
27
+
28
+ | Deprecated/Removed Name | New Name |
29
+ |:---|:---|
30
+ | `private_vlan_association` | `pvlan_association`
31
+ | `private_vlan_type` | `pvlan_type`
32
+
33
+ - Removed interface attribute:
34
+ * `purge_config`
35
+
36
+ ### Issues Addressed
37
+
38
+ - [Very slow execution when managing interfaces #496](https://github.com/cisco/cisco-network-puppet-module/issues/496)
39
+
4
40
  ## [v2.0.2]
5
41
 
6
42
  ### Issues Addressed
@@ -621,6 +657,7 @@ Cisco::Environment.add_env('default', env)
621
657
  [git-flow]: https://github.com/petervanderdoes/gitflow-avh
622
658
  [SimpleCov]: https://github.com/colszowka/simplecov
623
659
 
660
+ [v2.1.0]: https://github.com/cisco/cisco-network-node-utils/compare/v2.0.2...v2.1.0
624
661
  [v2.0.2]: https://github.com/cisco/cisco-network-node-utils/compare/v2.0.1...v2.0.2
625
662
  [v2.0.1]: https://github.com/cisco/cisco-network-node-utils/compare/v2.0.0...v2.0.1
626
663
  [v2.0.0]: https://github.com/cisco/cisco-network-node-utils/compare/v1.10.0...v2.0.0
@@ -146,6 +146,8 @@ module Cisco
146
146
  end
147
147
 
148
148
  def ipv4_slow_timer=(val)
149
+ # Only set the value if it's not already configured and default
150
+ return if val == default_ipv4_slow_timer && val == ipv4_slow_timer
149
151
  set_args_keys(timer: val,
150
152
  state: val == default_ipv4_slow_timer ? 'no' : '')
151
153
  config_set('bfd_global', 'ipv4_slow_timer', @set_args)
@@ -160,6 +162,8 @@ module Cisco
160
162
  end
161
163
 
162
164
  def ipv6_slow_timer=(val)
165
+ # Only set the value if it's not already configured and default
166
+ return if val == default_ipv6_slow_timer && val == ipv6_slow_timer
163
167
  set_args_keys(timer: val,
164
168
  state: val == default_ipv6_slow_timer ? 'no' : '')
165
169
  config_set('bfd_global', 'ipv6_slow_timer', @set_args)
@@ -415,5 +415,30 @@ module Cisco
415
415
  prefix = prop.to_s if prefix.nil?
416
416
  val.to_s.empty? ? val : "#{prefix} #{val}"
417
417
  end
418
+
419
+ # Helper utility to normalize the interface name pattern to be filtered.
420
+ # This is only a problem on N7k which has to use a section filter
421
+ # due to a show run int bug (no 'all' keyword for some interfaces).
422
+ def self.normalize_intf_pattern(show_name)
423
+ return '' if show_name.nil? || show_name.empty?
424
+ require_relative 'platform'
425
+ return show_name unless Platform.hardware_type[/Nexus7/]
426
+ return show_name if show_name[-1] == '$' # already normalized
427
+ pat = show_name.downcase + '$'
428
+ case pat
429
+ when /ethernet/
430
+ pat.sub!(/ethernet/, 'Ethernet')
431
+ when /loopback/
432
+ pat.sub!(/loopback/, 'loopback')
433
+ when /port-channel/
434
+ pat.sub!(/port-channel/, 'port-channel')
435
+ when /vlan/
436
+ pat.sub!(/vlan/, 'Vlan')
437
+ else
438
+ # wildcard the first char of the name
439
+ pat.sub!(/./, '.')
440
+ end
441
+ pat
442
+ end
418
443
  end # class Utils
419
444
  end # module Cisco
@@ -3,9 +3,11 @@
3
3
  _template:
4
4
  context: ["interface <name>"]
5
5
  ios_xr:
6
- get_command: "show running interface"
6
+ get_command: "show running interface <name>"
7
7
  nexus:
8
- get_command: "show running interface all"
8
+ get_command: "show running interface <show_name> all"
9
+ N7k:
10
+ get_command: "show running interface all | section '^interface <show_name>'"
9
11
 
10
12
  access_vlan:
11
13
  _exclude: [ios_xr]
@@ -14,13 +16,20 @@ access_vlan:
14
16
  set_value: "switchport access vlan <vlan>"
15
17
  default_value: 1
16
18
 
19
+ all_count:
20
+ get_context: ~
21
+ get_command: "show running interface | incl ^interface | count"
22
+ get_value: '/\d+/'
23
+
17
24
  all_interfaces:
18
25
  multiple:
19
26
  ios_xr:
20
27
  get_command: 'show running all-interfaces'
21
28
  get_value: '/^interface (.*)/'
22
29
  nexus:
23
- get_command: "show running-config interface | section '^interface'"
30
+ get_command: "show running-config interface <show_name> | section '^interface'"
31
+ N7k:
32
+ get_command: "show running interface all | section '^interface <show_name>'"
24
33
  get_value: '/(.*)/'
25
34
  get_context: ~
26
35
 
@@ -35,7 +44,7 @@ capabilities:
35
44
  _exclude: [ios_xr]
36
45
  multiple:
37
46
  get_context: ["<name>"]
38
- get_command: "show interface capabilities"
47
+ get_command: "show interface <name> capabilities"
39
48
  get_value: '/(.*)/'
40
49
  default_value: [] # :raw default
41
50
 
@@ -377,15 +386,6 @@ pim_bfd:
377
386
  set_value: "<state> ip pim bfd-instance"
378
387
  default_value: false
379
388
 
380
- purge_config:
381
- _exclude: [ios_xr]
382
- multiple:
383
- set_context: ~
384
- set_value: "default interface <name>"
385
- get_command: "show running interface"
386
- get_value: '/(.*)/'
387
- default_value: ~
388
-
389
389
  pvlan_any:
390
390
  multiple:
391
391
  get_value: '/switchport private-vlan/'
@@ -498,14 +498,14 @@ stp_link_type:
498
498
 
499
499
  stp_mst_cost:
500
500
  multiple:
501
- get_command: "show running interface"
501
+ get_command: "show running interface <name>"
502
502
  get_value: '/^spanning-tree mst (.*) cost (.*)$/'
503
503
  set_value: "<state> spanning-tree mst <range> cost <val>"
504
504
  default_value: []
505
505
 
506
506
  stp_mst_port_priority:
507
507
  multiple:
508
- get_command: "show running interface"
508
+ get_command: "show running interface <name>"
509
509
  get_value: '/^spanning-tree mst (.*) port-priority (.*)$/'
510
510
  set_value: "<state> spanning-tree mst <range> port-priority <val>"
511
511
  default_value: []
@@ -522,21 +522,21 @@ stp_port_priority:
522
522
 
523
523
  stp_port_type:
524
524
  kind: string
525
- get_command: "show running interface"
525
+ get_command: "show running interface <name>"
526
526
  get_value: '/^spanning-tree port type (.*)$/'
527
527
  set_value: "<state> spanning-tree port type <type>"
528
528
  default_value: ~
529
529
 
530
530
  stp_vlan_cost:
531
531
  multiple:
532
- get_command: "show running interface"
532
+ get_command: "show running interface <name>"
533
533
  get_value: '/^spanning-tree vlan (.*) cost (.*)$/'
534
534
  set_value: "<state> spanning-tree vlan <range> cost <val>"
535
535
  default_value: []
536
536
 
537
537
  stp_vlan_port_priority:
538
538
  multiple:
539
- get_command: "show running interface"
539
+ get_command: "show running interface <name>"
540
540
  get_value: '/^spanning-tree vlan (.*) port-priority (.*)$/'
541
541
  set_value: "<state> spanning-tree vlan <range> port-priority <val>"
542
542
  default_value: []
@@ -5,7 +5,10 @@ _template:
5
5
  ios_xr:
6
6
  get_command: "show running interface"
7
7
  nexus:
8
- get_command: "show running interface all"
8
+ get_command: "show running interface <show_name> all"
9
+ N7k:
10
+ get_command: "show running interface all | section '^interface <show_name>'"
11
+
9
12
 
10
13
  all_interfaces:
11
14
  multiple:
@@ -3,7 +3,7 @@
3
3
  _exclude: [ios_xr, N3k, N3k-F, N5k, N6k, N7k, N9k-F]
4
4
 
5
5
  _template:
6
- get_command: "show running interface all"
6
+ get_command: "show running interface <show_name> all"
7
7
  context:
8
8
  - "interface <interface>"
9
9
 
@@ -3,8 +3,10 @@
3
3
  _exclude: [ios_xr]
4
4
 
5
5
  _template:
6
- get_command: 'show running interface all'
7
- context: ["interface %s"]
6
+ context: ['interface <name>']
7
+ get_command: 'show running interface <show_name> all'
8
+ N7k:
9
+ get_command: "show running interface all | section '^interface <show_name>'"
8
10
 
9
11
  all_interfaces:
10
12
  multiple:
@@ -13,7 +15,7 @@ all_interfaces:
13
15
 
14
16
  area:
15
17
  get_value: '/^\s*ip router ospf (\S+) area (\S+)/'
16
- set_value: "%s ip router ospf %s area %s"
18
+ set_value: '<state> ip router ospf <ospf_name> area <area>'
17
19
 
18
20
  bfd:
19
21
  # the config can be 'ip ospf bfd' or
@@ -22,31 +24,31 @@ bfd:
22
24
  # match to get the whole config for checking
23
25
  # the mode
24
26
  get_value: '/^\s*ip ospf bfd *(?:\S*)$/'
25
- set_value: '%s ip ospf bfd %s'
27
+ set_value: '<state> ip ospf bfd <disable>'
26
28
  default_value: ~
27
29
 
28
30
  cost:
29
31
  kind: int
30
32
  get_value: '/^\s*ip ospf cost (\d+)/'
31
- set_value: "%s ip ospf cost %s"
33
+ set_value: '<state> ip ospf cost <cost>'
32
34
  default_value: 0
33
35
 
34
36
  dead_interval:
35
37
  kind: int
36
38
  get_value: '/^\s*ip ospf dead-interval (\d+)/'
37
- set_value: "%s ip ospf dead-interval %s"
39
+ set_value: '<state> ip ospf dead-interval <interval>'
38
40
  default_value: 40
39
41
 
40
42
  hello_interval:
41
43
  kind: int
42
44
  get_value: '/^\s*ip ospf hello-interval (\d+)/'
43
- set_value: "%s ip ospf hello-interval %s"
45
+ set_value: '<state> ip ospf hello-interval <interval>'
44
46
  default_value: 10
45
47
 
46
48
  message_digest:
47
49
  kind: boolean
48
50
  get_value: '/^\s*ip ospf authentication message-digest/'
49
- set_value: "%s ip ospf authentication message-digest"
51
+ set_value: '<state> ip ospf authentication message-digest'
50
52
  default_value: false
51
53
 
52
54
  message_digest_alg_type:
@@ -63,7 +65,7 @@ message_digest_key_id:
63
65
  default_value: 0
64
66
 
65
67
  message_digest_key_set:
66
- set_value: "%s ip ospf message-digest-key %s %s %s %s"
68
+ set_value: '<state> ip ospf message-digest-key <keyid> <algtype> <enctype> <password>'
67
69
 
68
70
  message_digest_password:
69
71
  default_value: ~
@@ -72,12 +74,12 @@ message_digest_password:
72
74
  mtu_ignore:
73
75
  kind: boolean
74
76
  get_value: '/^\s*ip ospf mtu-ignore/'
75
- set_value: "%s ip ospf mtu-ignore"
77
+ set_value: '<state> ip ospf mtu-ignore'
76
78
  default_value: false
77
79
 
78
80
  network_type:
79
81
  get_value: '/^\s*ip ospf network (\S+)$/'
80
- set_value: "%s ip ospf network %s"
82
+ set_value: '<state> ip ospf network <network_type>'
81
83
 
82
84
  network_type_default:
83
85
  default_value: 'broadcast'
@@ -88,23 +90,23 @@ network_type_loopback_default:
88
90
  passive_interface:
89
91
  kind: boolean
90
92
  get_value: '/^\s*ip ospf passive-interface/'
91
- set_value: "%s ip ospf passive-interface"
93
+ set_value: '<state> ip ospf passive-interface'
92
94
  default_value: false
93
95
 
94
96
  priority:
95
97
  kind: int
96
98
  get_value: '/^\s*ip ospf priority (\d+)/'
97
- set_value: "%s ip ospf priority %s"
99
+ set_value: '<state> ip ospf priority <priority>'
98
100
  default_value: 1
99
101
 
100
102
  shutdown:
101
103
  kind: boolean
102
104
  get_value: '/^\s*ip ospf shutdown/'
103
- set_value: "%s ip ospf shutdown"
105
+ set_value: '<state> ip ospf shutdown'
104
106
  default_value: false
105
107
 
106
108
  transmit_delay:
107
109
  kind: int
108
110
  get_value: '/^\s*ip ospf transmit-delay (\d+)/'
109
- set_value: "%s ip ospf transmit-delay %s"
111
+ set_value: '<state> ip ospf transmit-delay <delay>'
110
112
  default_value: 1
@@ -18,7 +18,6 @@ require_relative 'cisco_cmn_utils'
18
18
  require_relative 'node_util'
19
19
  require_relative 'vrf'
20
20
  require_relative 'overlay_global'
21
- require_relative 'interface_DEPRECATED'
22
21
 
23
22
  # Cisco provider module
24
23
  module Cisco
@@ -31,16 +30,8 @@ module Cisco
31
30
  fabricpath: 'fabricpath',
32
31
  }
33
32
 
34
- # REMOVE THIS HASH WITH RELEASE 2.0.0
35
- IF_DEPRECATED = {
36
- host: 'host',
37
- promiscuous: 'promiscuous',
38
- secondary: 'secondary',
39
- }
40
- IF_SWITCHPORT_MODE.merge!(IF_DEPRECATED)
41
-
42
33
  # Interface - node utility class for general interface config management
43
- class Interface < Cisco::InterfaceDeprecated
34
+ class Interface < NodeUtil
44
35
  # Regexp to match various Ethernet interface variants:
45
36
  # Ethernet
46
37
  # GigabitEthernet
@@ -51,12 +42,18 @@ module Cisco
51
42
  # Regexp to match various link bundle interface variants
52
43
  PORTCHANNEL = Regexp.new('(port-channel|Bundle-Ether)', Regexp::IGNORECASE)
53
44
 
54
- attr_reader :name, :state_default
45
+ attr_reader :name, :state_default, :show_name
55
46
 
56
- def initialize(name, instantiate=true, default_state=false)
47
+ def initialize(name, instantiate=true, default_state=false, show_name=nil)
57
48
  fail TypeError unless name.is_a?(String)
58
49
  fail ArgumentError unless name.length > 0
50
+
51
+ # @name is used for context: keys only
52
+ # @show_name is used for get_command: keys; allows callers to limit
53
+ # show command to a single interface
59
54
  @name = name.downcase
55
+ @show_name = show_name.nil? ? '' : Utils.normalize_intf_pattern(show_name)
56
+ @get_args = { name: @name, show_name: @show_name }
60
57
  @smr = config_get('interface', 'stp_mst_range')
61
58
  @svr = config_get('interface', 'stp_vlan_range')
62
59
  @match_found = false
@@ -74,28 +71,43 @@ module Cisco
74
71
  "interface #{name}"
75
72
  end
76
73
 
77
- def self.interfaces(opt=nil)
74
+ def self.interface_count
75
+ config_get('interface', 'all_count').to_i
76
+ end
77
+
78
+ def self.interfaces(opt=nil, show_name=nil)
78
79
  hash = {}
79
- intf_list = config_get('interface', 'all_interfaces')
80
+ show_name = Utils.normalize_intf_pattern(show_name)
81
+ begin
82
+ intf_list = config_get('interface', 'all_interfaces',
83
+ show_name: show_name)
84
+ rescue CliError => e
85
+ raise unless show_name
86
+ # ignore logical interfaces that do not exist
87
+ debug 'Interface.interfaces ignoring CliError => ' + e.to_s
88
+ end
80
89
  return hash if intf_list.nil?
81
90
 
82
- # Massage intf_list data into an array that is easy
83
- # to work with.
91
+ # Massage intf_list data into an array that is easy to work with.
92
+ # Use a MARKER to hide pesky 'interface' substrings
84
93
  intf_list.collect! { |x| x.strip || x }
85
94
  intf_list.delete('')
95
+ intf_list.collect! { |x| (x.sub('interface', '~!MARKER!~') unless x[/^interface /]) || x } # rubocop:disable Metrics/LineLength
86
96
  intf_list = intf_list.join(' ').split('interface')
87
97
  intf_list.delete('')
98
+ # Restore 'interface' substrings
99
+ intf_list.collect! { |x| x.sub('~!MARKER!~', 'interface') }
88
100
 
89
101
  intf_list.each do |id|
90
102
  int_data = id.strip.split(' ')
91
103
  next if int_data[0].nil?
92
104
  id = int_data[0].downcase
93
- next if opt && filter(opt, id)
105
+ next if opt && filter(opt, id, show_name)
94
106
  # If there are any additional options associated
95
107
  # with this interface then it's in a non-default
96
108
  # state.
97
109
  default_state = int_data.size > 1 ? false : true
98
- hash[id] = Interface.new(id, false, default_state)
110
+ hash[id] = Interface.new(id, false, default_state, show_name)
99
111
  end
100
112
  hash
101
113
  end
@@ -103,11 +115,13 @@ module Cisco
103
115
  # General-purpose filter for Interface.interfaces().
104
116
  # filter: This may be overloaded in the future to allow a hash of filters.
105
117
  # id: The interface name
118
+ # show_name: needed for get_command: <show_name>
106
119
  # Return: true if the interface should be filtered out, false to keep it.
107
- def self.filter(filter, id)
120
+ def self.filter(filter, id, show_name)
108
121
  case filter
109
122
  when :pvlan_any
110
- return false if config_get('interface', 'pvlan_any', name: id)
123
+ return false if config_get('interface', 'pvlan_any',
124
+ name: id, show_name: show_name)
111
125
 
112
126
  else
113
127
  # Just a basic pattern filter (:ethernet, :loopback, etc)
@@ -132,7 +146,12 @@ module Cisco
132
146
  # {"Model"=>"N7K-M132XP-12L", "Type"=>"10Gbase-SR", "Speed"=>"10,100,1000"}
133
147
  #
134
148
  def self.capabilities(intf, mode=:hash)
135
- array = config_get('interface', 'capabilities', name: intf)
149
+ array = []
150
+ begin
151
+ array = config_get('interface', 'capabilities', name: intf)
152
+ rescue CliError => e
153
+ raise unless e.clierror[/(Invalid command|Cmd exec error)/]
154
+ end
136
155
  return array if mode == :raw
137
156
  hash = {}
138
157
  if array
@@ -169,7 +188,7 @@ module Cisco
169
188
  end
170
189
 
171
190
  def default?
172
- state = config_get('interface', 'default', name: @name)
191
+ state = config_get('interface', 'default', @get_args)
173
192
  state.nil? ? true : false
174
193
  end
175
194
 
@@ -193,7 +212,7 @@ module Cisco
193
212
 
194
213
  def access_vlan
195
214
  return nil if switchport_mode == :disabled
196
- config_get('interface', 'access_vlan', name: @name)
215
+ config_get('interface', 'access_vlan', @get_args)
197
216
  end
198
217
 
199
218
  def access_vlan=(vlan)
@@ -207,7 +226,7 @@ module Cisco
207
226
  def bfd_echo
208
227
  return nil unless Feature.bfd_enabled?
209
228
  return nil if @name[/loop/i]
210
- config_get('interface', 'bfd_echo', name: @name)
229
+ config_get('interface', 'bfd_echo', @get_args)
211
230
  end
212
231
 
213
232
  def bfd_echo=(val)
@@ -227,7 +246,7 @@ module Cisco
227
246
  end
228
247
 
229
248
  def description
230
- config_get('interface', 'description', name: @name)
249
+ config_get('interface', 'description', @get_args)
231
250
  end
232
251
 
233
252
  def description=(desc)
@@ -246,7 +265,7 @@ module Cisco
246
265
  end
247
266
 
248
267
  def encapsulation_dot1q
249
- config_get('interface', 'encapsulation_dot1q', name: @name)
268
+ config_get('interface', 'encapsulation_dot1q', @get_args)
250
269
  end
251
270
 
252
271
  def encapsulation_dot1q=(val)
@@ -272,7 +291,7 @@ module Cisco
272
291
  end
273
292
 
274
293
  def fabric_forwarding_anycast_gateway
275
- config_get('interface', 'fabric_forwarding_anycast_gateway', name: @name)
294
+ config_get('interface', 'fabric_forwarding_anycast_gateway', @get_args)
276
295
  end
277
296
 
278
297
  def fabric_forwarding_anycast_gateway=(state)
@@ -298,7 +317,7 @@ module Cisco
298
317
  end
299
318
 
300
319
  def hsrp_bfd
301
- config_get('interface', 'hsrp_bfd', name: @name)
320
+ config_get('interface', 'hsrp_bfd', @get_args)
302
321
  end
303
322
 
304
323
  def hsrp_bfd=(val)
@@ -318,7 +337,7 @@ module Cisco
318
337
  # hsrp delay minimum and reload are in the same CLI
319
338
  # hsrp delay minimum 0 reload 0
320
339
  def hsrp_delay
321
- match = config_get('interface', 'hsrp_delay', name: @name)
340
+ match = config_get('interface', 'hsrp_delay', @get_args)
322
341
  match.nil? ? default_hsrp_delay : match.collect(&:to_i)
323
342
  end
324
343
 
@@ -363,7 +382,7 @@ module Cisco
363
382
  end
364
383
 
365
384
  def hsrp_mac_refresh
366
- config_get('interface', 'hsrp_mac_refresh', name: @name)
385
+ config_get('interface', 'hsrp_mac_refresh', @get_args)
367
386
  end
368
387
 
369
388
  def hsrp_mac_refresh=(val)
@@ -379,7 +398,7 @@ module Cisco
379
398
  end
380
399
 
381
400
  def hsrp_use_bia
382
- match = config_get('interface', 'hsrp_use_bia', name: @name)
401
+ match = config_get('interface', 'hsrp_use_bia', @get_args)
383
402
  return default_hsrp_use_bia unless match
384
403
  match.include?('scope') ? :use_bia_intf : :use_bia
385
404
  end
@@ -418,7 +437,7 @@ module Cisco
418
437
 
419
438
  def hsrp_version
420
439
  return nil if switchport_mode != :disabled || @name[/loop/i]
421
- config_get('interface', 'hsrp_version', name: @name)
440
+ config_get('interface', 'hsrp_version', @get_args)
422
441
  end
423
442
 
424
443
  def hsrp_version=(val)
@@ -431,7 +450,7 @@ module Cisco
431
450
  end
432
451
 
433
452
  def ipv4_acl_in
434
- config_get('interface', 'ipv4_acl_in', name: @name)
453
+ config_get('interface', 'ipv4_acl_in', @get_args)
435
454
  end
436
455
 
437
456
  def ipv4_acl_in=(val)
@@ -452,7 +471,7 @@ module Cisco
452
471
  end
453
472
 
454
473
  def ipv4_acl_out
455
- config_get('interface', 'ipv4_acl_out', name: @name)
474
+ config_get('interface', 'ipv4_acl_out', @get_args)
456
475
  end
457
476
 
458
477
  def ipv4_acl_out=(val)
@@ -494,7 +513,7 @@ module Cisco
494
513
  end
495
514
 
496
515
  def ipv4_addr_mask
497
- val = config_get('interface', 'ipv4_addr_mask', name: @name)
516
+ val = config_get('interface', 'ipv4_addr_mask', @get_args)
498
517
  if val && platform == :ios_xr
499
518
  # IOS XR reports address as <address> <bitmask> [secondary] but we
500
519
  # want <address>/<length> [secondary]
@@ -569,7 +588,7 @@ module Cisco
569
588
  end
570
589
 
571
590
  def ipv4_arp_timeout
572
- config_get('interface', ipv4_arp_timeout_lookup_string, name: @name)
591
+ config_get('interface', ipv4_arp_timeout_lookup_string, @get_args)
573
592
  end
574
593
 
575
594
  def ipv4_arp_timeout=(timeout)
@@ -585,7 +604,7 @@ module Cisco
585
604
  end
586
605
 
587
606
  def ipv4_dhcp_relay_addr
588
- config_get('interface', 'ipv4_dhcp_relay_addr', name: @name)
607
+ config_get('interface', 'ipv4_dhcp_relay_addr', @get_args)
589
608
  end
590
609
 
591
610
  def ipv4_dhcp_relay_addr=(list)
@@ -610,7 +629,7 @@ module Cisco
610
629
 
611
630
  def ipv4_dhcp_relay_info_trust
612
631
  return nil if @name[/loop/i] || switchport_mode != :disabled
613
- config_get('interface', 'ipv4_dhcp_relay_info_trust', name: @name)
632
+ config_get('interface', 'ipv4_dhcp_relay_info_trust', @get_args)
614
633
  end
615
634
 
616
635
  def ipv4_dhcp_relay_info_trust=(state)
@@ -625,7 +644,7 @@ module Cisco
625
644
  end
626
645
 
627
646
  def ipv4_dhcp_relay_src_addr_hsrp
628
- config_get('interface', 'ipv4_dhcp_relay_src_addr_hsrp', name: @name)
647
+ config_get('interface', 'ipv4_dhcp_relay_src_addr_hsrp', @get_args)
629
648
  end
630
649
 
631
650
  def ipv4_dhcp_relay_src_addr_hsrp=(state)
@@ -640,7 +659,7 @@ module Cisco
640
659
  end
641
660
 
642
661
  def ipv4_dhcp_relay_src_intf
643
- intf = config_get('interface', 'ipv4_dhcp_relay_src_intf', name: @name)
662
+ intf = config_get('interface', 'ipv4_dhcp_relay_src_intf', @get_args)
644
663
  # Normalize by downcasing and removing white space
645
664
  intf = intf.downcase.delete(' ') if intf
646
665
  intf
@@ -661,7 +680,7 @@ module Cisco
661
680
 
662
681
  def ipv4_dhcp_relay_subnet_broadcast
663
682
  return nil if @name[/loop/i] || switchport_mode != :disabled
664
- config_get('interface', 'ipv4_dhcp_relay_subnet_broadcast', name: @name)
683
+ config_get('interface', 'ipv4_dhcp_relay_subnet_broadcast', @get_args)
665
684
  end
666
685
 
667
686
  def ipv4_dhcp_relay_subnet_broadcast=(state)
@@ -677,7 +696,7 @@ module Cisco
677
696
 
678
697
  def ipv4_dhcp_smart_relay
679
698
  return nil if @name[/loop/i] || switchport_mode != :disabled
680
- config_get('interface', 'ipv4_dhcp_smart_relay', name: @name)
699
+ config_get('interface', 'ipv4_dhcp_smart_relay', @get_args)
681
700
  end
682
701
 
683
702
  def ipv4_dhcp_smart_relay=(state)
@@ -692,7 +711,7 @@ module Cisco
692
711
  end
693
712
 
694
713
  def ipv4_forwarding
695
- config_get('interface', 'ipv4_forwarding', name: @name)
714
+ config_get('interface', 'ipv4_forwarding', @get_args)
696
715
  end
697
716
 
698
717
  def ipv4_forwarding=(state)
@@ -707,7 +726,7 @@ module Cisco
707
726
 
708
727
  def ipv4_pim_sparse_mode
709
728
  return nil unless switchport_mode == :disabled
710
- config_get('interface', 'ipv4_pim_sparse_mode', name: @name)
729
+ config_get('interface', 'ipv4_pim_sparse_mode', @get_args)
711
730
  end
712
731
 
713
732
  def ipv4_pim_sparse_mode=(state)
@@ -723,7 +742,7 @@ module Cisco
723
742
 
724
743
  def ipv4_proxy_arp
725
744
  return nil if @name[/loop/i] || switchport_mode != :disabled
726
- config_get('interface', 'ipv4_proxy_arp', name: @name)
745
+ config_get('interface', 'ipv4_proxy_arp', @get_args)
727
746
  end
728
747
 
729
748
  def ipv4_proxy_arp=(proxy_arp)
@@ -747,7 +766,7 @@ module Cisco
747
766
 
748
767
  def ipv4_redirects
749
768
  return nil unless switchport_mode == :disabled
750
- config_get('interface', ipv4_redirects_lookup_string, name: @name)
769
+ config_get('interface', ipv4_redirects_lookup_string, @get_args)
751
770
  end
752
771
 
753
772
  def ipv4_redirects=(redirects)
@@ -762,7 +781,7 @@ module Cisco
762
781
  end
763
782
 
764
783
  def ipv6_acl_in
765
- config_get('interface', 'ipv6_acl_in', name: @name)
784
+ config_get('interface', 'ipv6_acl_in', @get_args)
766
785
  end
767
786
 
768
787
  def ipv6_acl_in=(val)
@@ -782,7 +801,7 @@ module Cisco
782
801
  end
783
802
 
784
803
  def ipv6_acl_out
785
- config_get('interface', 'ipv6_acl_out', name: @name)
804
+ config_get('interface', 'ipv6_acl_out', @get_args)
786
805
  end
787
806
 
788
807
  def ipv6_acl_out=(val)
@@ -802,7 +821,7 @@ module Cisco
802
821
  end
803
822
 
804
823
  def ipv6_dhcp_relay_addr
805
- config_get('interface', 'ipv6_dhcp_relay_addr', name: @name)
824
+ config_get('interface', 'ipv6_dhcp_relay_addr', @get_args)
806
825
  end
807
826
 
808
827
  def ipv6_dhcp_relay_addr=(list)
@@ -826,7 +845,7 @@ module Cisco
826
845
  end
827
846
 
828
847
  def ipv6_dhcp_relay_src_intf
829
- intf = config_get('interface', 'ipv6_dhcp_relay_src_intf', name: @name)
848
+ intf = config_get('interface', 'ipv6_dhcp_relay_src_intf', @get_args)
830
849
  # Normalize by downcasing and removing white space
831
850
  intf = intf.downcase.delete(' ') if intf
832
851
  intf
@@ -847,7 +866,7 @@ module Cisco
847
866
 
848
867
  def ipv6_redirects
849
868
  return nil if @name[/loop/i] || switchport_mode != :disabled
850
- config_get('interface', 'ipv6_redirects', name: @name)
869
+ config_get('interface', 'ipv6_redirects', @get_args)
851
870
  end
852
871
 
853
872
  def ipv6_redirects=(redirects)
@@ -872,7 +891,7 @@ module Cisco
872
891
 
873
892
  def load_interval_counter_1_delay
874
893
  return nil if @name[/loop/] || @name[/ethernet.*\S+\.\d+$/]
875
- config_get('interface', 'load_interval_counter_1_delay', name: @name)
894
+ config_get('interface', 'load_interval_counter_1_delay', @get_args)
876
895
  end
877
896
 
878
897
  def load_interval_counter_1_delay=(val)
@@ -894,7 +913,7 @@ module Cisco
894
913
 
895
914
  def load_interval_counter_2_delay
896
915
  return nil if @name[/loop/] || @name[/ethernet.*\S+\.\d+$/]
897
- config_get('interface', 'load_interval_counter_2_delay', name: @name)
916
+ config_get('interface', 'load_interval_counter_2_delay', @get_args)
898
917
  end
899
918
 
900
919
  def load_interval_counter_2_delay=(val)
@@ -910,7 +929,7 @@ module Cisco
910
929
 
911
930
  def load_interval_counter_3_delay
912
931
  return nil if @name[/loop/] || @name[/ethernet.*\S+\.\d+$/]
913
- config_get('interface', 'load_interval_counter_3_delay', name: @name)
932
+ config_get('interface', 'load_interval_counter_3_delay', @get_args)
914
933
  end
915
934
 
916
935
  def load_interval_counter_3_delay=(val)
@@ -936,7 +955,7 @@ module Cisco
936
955
  end
937
956
 
938
957
  def mtu
939
- config_get('interface', mtu_lookup_string, name: @name)
958
+ config_get('interface', mtu_lookup_string, @get_args)
940
959
  end
941
960
 
942
961
  def mtu=(val)
@@ -952,7 +971,7 @@ module Cisco
952
971
 
953
972
  def speed
954
973
  return nil if @name[/loop|vlan/i]
955
- config_get('interface', 'speed', name: @name)
974
+ config_get('interface', 'speed', @get_args)
956
975
  end
957
976
 
958
977
  def speed=(val)
@@ -965,7 +984,7 @@ module Cisco
965
984
 
966
985
  def duplex
967
986
  return nil if @name[/loop|vlan/i]
968
- config_get('interface', 'duplex', name: @name)
987
+ config_get('interface', 'duplex', @get_args)
969
988
  end
970
989
 
971
990
  def duplex=(val)
@@ -989,7 +1008,7 @@ module Cisco
989
1008
 
990
1009
  def negotiate_auto
991
1010
  return nil if @name[/loop|vlan/]
992
- config_get('interface', negotiate_auto_lookup_string, name: @name)
1011
+ config_get('interface', negotiate_auto_lookup_string, @get_args)
993
1012
  end
994
1013
 
995
1014
  def negotiate_auto=(negotiate_auto)
@@ -1003,7 +1022,7 @@ module Cisco
1003
1022
  end
1004
1023
 
1005
1024
  def shutdown
1006
- config_get('interface', 'shutdown', name: @name)
1025
+ config_get('interface', 'shutdown', @get_args)
1007
1026
  end
1008
1027
 
1009
1028
  def shutdown=(state)
@@ -1045,7 +1064,7 @@ module Cisco
1045
1064
  end
1046
1065
 
1047
1066
  def pim_bfd
1048
- config_get('interface', 'pim_bfd', name: @name)
1067
+ config_get('interface', 'pim_bfd', @get_args)
1049
1068
  end
1050
1069
 
1051
1070
  def pim_bfd=(val)
@@ -1064,7 +1083,7 @@ module Cisco
1064
1083
 
1065
1084
  def storm_control_broadcast
1066
1085
  return nil if @name[/loop|vlan/i]
1067
- config_get('interface', 'storm_control_broadcast', name: @name)
1086
+ config_get('interface', 'storm_control_broadcast', @get_args)
1068
1087
  end
1069
1088
 
1070
1089
  def storm_control_broadcast=(val)
@@ -1081,7 +1100,7 @@ module Cisco
1081
1100
 
1082
1101
  def storm_control_multicast
1083
1102
  return nil if @name[/loop|vlan/i]
1084
- config_get('interface', 'storm_control_multicast', name: @name)
1103
+ config_get('interface', 'storm_control_multicast', @get_args)
1085
1104
  end
1086
1105
 
1087
1106
  def storm_control_multicast=(val)
@@ -1098,7 +1117,7 @@ module Cisco
1098
1117
 
1099
1118
  def storm_control_unicast
1100
1119
  return nil if @name[/loop|vlan/i]
1101
- config_get('interface', 'storm_control_unicast', name: @name)
1120
+ config_get('interface', 'storm_control_unicast', @get_args)
1102
1121
  end
1103
1122
 
1104
1123
  def storm_control_unicast=(val)
@@ -1114,7 +1133,7 @@ module Cisco
1114
1133
  end
1115
1134
 
1116
1135
  def stp_bpdufilter
1117
- config_get('interface', 'stp_bpdufilter', name: @name)
1136
+ config_get('interface', 'stp_bpdufilter', @get_args)
1118
1137
  end
1119
1138
 
1120
1139
  def stp_bpdufilter=(val)
@@ -1134,7 +1153,7 @@ module Cisco
1134
1153
  end
1135
1154
 
1136
1155
  def stp_bpduguard
1137
- config_get('interface', 'stp_bpduguard', name: @name)
1156
+ config_get('interface', 'stp_bpduguard', @get_args)
1138
1157
  end
1139
1158
 
1140
1159
  def stp_bpduguard=(val)
@@ -1154,7 +1173,7 @@ module Cisco
1154
1173
 
1155
1174
  def stp_cost
1156
1175
  return nil if switchport_mode == :disabled
1157
- cost = config_get('interface', 'stp_cost', name: @name)
1176
+ cost = config_get('interface', 'stp_cost', @get_args)
1158
1177
  cost == 'auto' ? cost : cost.to_i
1159
1178
  end
1160
1179
 
@@ -1168,7 +1187,7 @@ module Cisco
1168
1187
  end
1169
1188
 
1170
1189
  def stp_guard
1171
- config_get('interface', 'stp_guard', name: @name)
1190
+ config_get('interface', 'stp_guard', @get_args)
1172
1191
  end
1173
1192
 
1174
1193
  def stp_guard=(val)
@@ -1189,7 +1208,7 @@ module Cisco
1189
1208
 
1190
1209
  def stp_link_type
1191
1210
  return nil if switchport_mode == :disabled
1192
- config_get('interface', 'stp_link_type', name: @name)
1211
+ config_get('interface', 'stp_link_type', @get_args)
1193
1212
  end
1194
1213
 
1195
1214
  def stp_link_type=(val)
@@ -1203,7 +1222,7 @@ module Cisco
1203
1222
 
1204
1223
  def stp_port_priority
1205
1224
  return nil if switchport_mode == :disabled
1206
- config_get('interface', 'stp_port_priority', name: @name)
1225
+ config_get('interface', 'stp_port_priority', @get_args)
1207
1226
  end
1208
1227
 
1209
1228
  def stp_port_priority=(val)
@@ -1222,7 +1241,7 @@ module Cisco
1222
1241
  # array: [['0,2-4,6,8-12', '1000'], ['4000-4020', '2568']]
1223
1242
  #
1224
1243
  def stp_mst_cost
1225
- config_get('interface', 'stp_mst_cost', name: @name)
1244
+ config_get('interface', 'stp_mst_cost', @get_args)
1226
1245
  end
1227
1246
 
1228
1247
  def stp_mst_cost=(list)
@@ -1244,7 +1263,7 @@ module Cisco
1244
1263
  # array: [['0,2-4,6,8-12', '64'], ['4000-4020', '160']]
1245
1264
  #
1246
1265
  def stp_mst_port_priority
1247
- config_get('interface', 'stp_mst_port_priority', name: @name)
1266
+ config_get('interface', 'stp_mst_port_priority', @get_args)
1248
1267
  end
1249
1268
 
1250
1269
  def stp_mst_port_priority=(list)
@@ -1260,7 +1279,7 @@ module Cisco
1260
1279
  end
1261
1280
 
1262
1281
  def stp_port_type
1263
- config_get('interface', 'stp_port_type', name: @name)
1282
+ config_get('interface', 'stp_port_type', @get_args)
1264
1283
  end
1265
1284
 
1266
1285
  def stp_port_type=(val)
@@ -1286,7 +1305,7 @@ module Cisco
1286
1305
  # array: [['1-4,6,8-12', '1000'], ['3000-3960', '2568']]
1287
1306
  #
1288
1307
  def stp_vlan_cost
1289
- config_get('interface', 'stp_vlan_cost', name: @name)
1308
+ config_get('interface', 'stp_vlan_cost', @get_args)
1290
1309
  end
1291
1310
 
1292
1311
  def stp_vlan_cost=(list)
@@ -1308,7 +1327,7 @@ module Cisco
1308
1327
  # array: [['1-4,6,8-12', '64'], ['3000-3960', '160']]
1309
1328
  #
1310
1329
  def stp_vlan_port_priority
1311
- config_get('interface', 'stp_vlan_port_priority', name: @name)
1330
+ config_get('interface', 'stp_vlan_port_priority', @get_args)
1312
1331
  end
1313
1332
 
1314
1333
  def stp_vlan_port_priority=(list)
@@ -1325,7 +1344,7 @@ module Cisco
1325
1344
 
1326
1345
  def switchport
1327
1346
  # This is "switchport", not "switchport mode"
1328
- config_get('interface', 'switchport', name: @name)
1347
+ config_get('interface', 'switchport', @get_args)
1329
1348
  end
1330
1349
 
1331
1350
  def switchport_enable(val=true)
@@ -1335,8 +1354,7 @@ module Cisco
1335
1354
  # switchport_autostate_exclude is exclusive to switchport interfaces
1336
1355
  def switchport_autostate_exclude
1337
1356
  return nil if switchport_mode == :disabled
1338
- config_get('interface',
1339
- 'switchport_autostate_exclude', name: @name)
1357
+ config_get('interface', 'switchport_autostate_exclude', @get_args)
1340
1358
  end
1341
1359
 
1342
1360
  def switchport_autostate_exclude=(val)
@@ -1367,7 +1385,7 @@ module Cisco
1367
1385
 
1368
1386
  def switchport_mode
1369
1387
  return nil if platform == :ios_xr
1370
- mode = config_get('interface', switchport_mode_lookup_string, name: @name)
1388
+ mode = config_get('interface', switchport_mode_lookup_string, @get_args)
1371
1389
 
1372
1390
  return mode.nil? ? :disabled : IF_SWITCHPORT_MODE.key(mode)
1373
1391
 
@@ -1427,7 +1445,7 @@ module Cisco
1427
1445
  def switchport_trunk_allowed_vlan
1428
1446
  return nil if switchport_mode == :disabled
1429
1447
  vlans = config_get('interface', 'switchport_trunk_allowed_vlan',
1430
- name: @name)
1448
+ @get_args)
1431
1449
  vlans = vlans.join(',') if vlans.is_a?(Array)
1432
1450
  vlans = Utils.normalize_range_array(vlans, :string) unless vlans == 'none'
1433
1451
  vlans
@@ -1449,7 +1467,7 @@ module Cisco
1449
1467
 
1450
1468
  def switchport_trunk_native_vlan
1451
1469
  return nil if switchport_mode == :disabled
1452
- config_get('interface', 'switchport_trunk_native_vlan', name: @name)
1470
+ config_get('interface', 'switchport_trunk_native_vlan', @get_args)
1453
1471
  end
1454
1472
 
1455
1473
  def switchport_trunk_native_vlan=(val)
@@ -1486,7 +1504,7 @@ module Cisco
1486
1504
  # <state> switchport mode private-vlan host
1487
1505
  def switchport_pvlan_host
1488
1506
  return nil if switchport_mode == :disabled
1489
- config_get('interface', 'switchport_pvlan_host', name: @name)
1507
+ config_get('interface', 'switchport_pvlan_host', @get_args)
1490
1508
  end
1491
1509
 
1492
1510
  def switchport_pvlan_host=(state)
@@ -1503,7 +1521,7 @@ module Cisco
1503
1521
  # <state> switchport mode private-vlan promiscuous
1504
1522
  def switchport_pvlan_promiscuous
1505
1523
  return nil if switchport_mode == :disabled
1506
- config_get('interface', 'switchport_pvlan_promiscuous', name: @name)
1524
+ config_get('interface', 'switchport_pvlan_promiscuous', @get_args)
1507
1525
  end
1508
1526
 
1509
1527
  def switchport_pvlan_promiscuous=(state)
@@ -1520,7 +1538,7 @@ module Cisco
1520
1538
  # <state> switchport private-vlan host-association <pri> <sec>
1521
1539
  # Note this is NOT a multiple, unlike trunk association.
1522
1540
  def switchport_pvlan_host_association
1523
- config_get('interface', 'switchport_pvlan_host_association', name: @name)
1541
+ config_get('interface', 'switchport_pvlan_host_association', @get_args)
1524
1542
  end
1525
1543
 
1526
1544
  # Input: An array of primary and secondary vlans: ['44', '244']
@@ -1541,7 +1559,7 @@ module Cisco
1541
1559
  # --------------------------
1542
1560
  # <state> switchport private-vlan mapping <primary> <vlan>
1543
1561
  def switchport_pvlan_mapping
1544
- config_get('interface', 'switchport_pvlan_mapping', name: @name)
1562
+ config_get('interface', 'switchport_pvlan_mapping', @get_args)
1545
1563
  end
1546
1564
 
1547
1565
  # Input: An array of primary vlan and range of vlans: ['44', '3-4,6']
@@ -1605,7 +1623,7 @@ module Cisco
1605
1623
  # --------------------------
1606
1624
  # <state> switchport private-vlan mapping trunk <primary> <vlan>
1607
1625
  def switchport_pvlan_mapping_trunk
1608
- config_get('interface', 'switchport_pvlan_mapping_trunk', name: @name)
1626
+ config_get('interface', 'switchport_pvlan_mapping_trunk', @get_args)
1609
1627
  end
1610
1628
 
1611
1629
  # Input: A nested array of primary vlan and range of vlans:
@@ -1656,7 +1674,7 @@ module Cisco
1656
1674
  # <state> switchport private-vlan association trunk <pri> <sec>
1657
1675
  # Supports multiple.
1658
1676
  def switchport_pvlan_trunk_association
1659
- config_get('interface', 'switchport_pvlan_trunk_association', name: @name)
1677
+ config_get('interface', 'switchport_pvlan_trunk_association', @get_args)
1660
1678
  end
1661
1679
 
1662
1680
  # Input: A nested array of primary and secondary vlans:
@@ -1696,7 +1714,7 @@ module Cisco
1696
1714
  # <state> switchport mode private-vlan trunk promiscuous
1697
1715
  def switchport_pvlan_trunk_promiscuous
1698
1716
  return nil if switchport_mode == :disabled
1699
- config_get('interface', 'switchport_pvlan_trunk_promiscuous', name: @name)
1717
+ config_get('interface', 'switchport_pvlan_trunk_promiscuous', @get_args)
1700
1718
  end
1701
1719
 
1702
1720
  def switchport_pvlan_trunk_promiscuous=(state)
@@ -1713,7 +1731,7 @@ module Cisco
1713
1731
  # <state> switchport mode private-vlan trunk secondary
1714
1732
  def switchport_pvlan_trunk_secondary
1715
1733
  return nil if switchport_mode == :disabled
1716
- config_get('interface', 'switchport_pvlan_trunk_secondary', name: @name)
1734
+ config_get('interface', 'switchport_pvlan_trunk_secondary', @get_args)
1717
1735
  end
1718
1736
 
1719
1737
  def switchport_pvlan_trunk_secondary=(state)
@@ -1733,7 +1751,7 @@ module Cisco
1733
1751
  def switchport_pvlan_trunk_allowed_vlan
1734
1752
  return nil if switchport_mode == :disabled
1735
1753
  vlans = config_get('interface', 'switchport_pvlan_trunk_allowed_vlan',
1736
- name: @name)
1754
+ @get_args)
1737
1755
  vlans = vlans.join(',') if vlans.is_a?(Array)
1738
1756
  vlans = Utils.normalize_range_array(vlans, :string) unless vlans == 'none'
1739
1757
  vlans
@@ -1757,7 +1775,7 @@ module Cisco
1757
1775
  # <state> switchport trunk native vlan <vlan>
1758
1776
  def switchport_pvlan_trunk_native_vlan
1759
1777
  return nil if switchport_mode == :disabled
1760
- config_get('interface', 'switchport_pvlan_trunk_native_vlan', name: @name)
1778
+ config_get('interface', 'switchport_pvlan_trunk_native_vlan', @get_args)
1761
1779
  end
1762
1780
 
1763
1781
  def switchport_pvlan_trunk_native_vlan=(vlan)
@@ -1775,7 +1793,7 @@ module Cisco
1775
1793
  # <state> private-vlan mapping <range> # ex. range = ['2-4,9']
1776
1794
  # Always returns an array.
1777
1795
  def pvlan_mapping
1778
- range = config_get('interface', 'pvlan_mapping', name: @name)
1796
+ range = config_get('interface', 'pvlan_mapping', @get_args)
1779
1797
  return default_pvlan_mapping if range.nil?
1780
1798
  range.empty? ? range : [range.delete(' ')]
1781
1799
  end
@@ -1828,7 +1846,7 @@ module Cisco
1828
1846
  end
1829
1847
 
1830
1848
  def vlan_mapping
1831
- match = config_get('interface', 'vlan_mapping', name: @name)
1849
+ match = config_get('interface', 'vlan_mapping', @get_args)
1832
1850
  match.each(&:compact!) unless match.nil?
1833
1851
  match
1834
1852
  end
@@ -1860,7 +1878,7 @@ module Cisco
1860
1878
  end
1861
1879
 
1862
1880
  def vlan_mapping_enable
1863
- config_get('interface', 'vlan_mapping_enable', name: @name)
1881
+ config_get('interface', 'vlan_mapping_enable', @get_args)
1864
1882
  end
1865
1883
 
1866
1884
  def vlan_mapping_enable=(state)
@@ -1911,7 +1929,7 @@ module Cisco
1911
1929
 
1912
1930
  def switchport_vtp
1913
1931
  return nil unless switchport_vtp_mode_capable?
1914
- config_get('interface', 'vtp', name: @name)
1932
+ config_get('interface', 'vtp', @get_args)
1915
1933
  end
1916
1934
 
1917
1935
  def switchport_vtp=(vtp_set)
@@ -1931,7 +1949,7 @@ module Cisco
1931
1949
  # svi_autostate is exclusive to svi interfaces
1932
1950
  def svi_autostate
1933
1951
  return nil unless @name[/^vlan/i]
1934
- config_get('interface', 'svi_autostate', name: @name)
1952
+ config_get('interface', 'svi_autostate', @get_args)
1935
1953
  end
1936
1954
 
1937
1955
  def svi_autostate=(val)
@@ -1959,7 +1977,7 @@ module Cisco
1959
1977
  # svi_management is exclusive to svi interfaces
1960
1978
  def svi_management
1961
1979
  return nil unless @name[/^vlan/i]
1962
- config_get('interface', 'svi_management', name: @name)
1980
+ config_get('interface', 'svi_management', @get_args)
1963
1981
  end
1964
1982
 
1965
1983
  def svi_management=(val)
@@ -2002,7 +2020,7 @@ module Cisco
2002
2020
  end
2003
2021
 
2004
2022
  def vpc_id
2005
- config_get('interface', 'vpc_id', name: @name)
2023
+ config_get('interface', 'vpc_id', @get_args)
2006
2024
  end
2007
2025
 
2008
2026
  def vpc_id=(num)
@@ -2021,7 +2039,7 @@ module Cisco
2021
2039
 
2022
2040
  def vpc_peer_link
2023
2041
  return nil unless @name[/port-channel/i] && switchport_mode != :disabled
2024
- config_get('interface', 'vpc_peer_link', name: @name)
2042
+ config_get('interface', 'vpc_peer_link', @get_args)
2025
2043
  end
2026
2044
 
2027
2045
  def vpc_peer_link=(state)
@@ -2035,7 +2053,7 @@ module Cisco
2035
2053
  end
2036
2054
 
2037
2055
  def vrf
2038
- config_get('interface', 'vrf', name: @name)
2056
+ config_get('interface', 'vrf', @get_args)
2039
2057
  end
2040
2058
 
2041
2059
  def vrf=(v)
@@ -2078,24 +2096,5 @@ module Cisco
2078
2096
  end
2079
2097
  end
2080
2098
  end
2081
-
2082
- def purge_config=(val)
2083
- return unless val
2084
- fail ArgumentError,
2085
- 'purge_config is only supported on Ethernet interfaces' unless
2086
- @name[/ethernet/]
2087
- config_set('interface', 'purge_config', name: @name) if val
2088
- end
2089
-
2090
- def purge_config
2091
- # This getter is only supported on ethernet interfaces
2092
- return nil unless @name[/ethernet/]
2093
- state = config_get('interface', 'purge_config', name: @name)
2094
- state.nil? ? true : default_purge_config
2095
- end
2096
-
2097
- def default_purge_config
2098
- config_get_default('interface', 'purge_config')
2099
- end
2100
2099
  end # Class
2101
2100
  end # Module