cisco_node_utils 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/CONTRIBUTING.md +2 -2
  4. data/README.md +2 -1
  5. data/cisco_node_utils.gemspec +1 -0
  6. data/docs/README-develop-node-utils-APIs.md +2 -1
  7. data/lib/cisco_node_utils/aaa_authentication_login_service.rb +2 -2
  8. data/lib/cisco_node_utils/ace.rb +2 -0
  9. data/lib/cisco_node_utils/bgp.rb +34 -91
  10. data/lib/cisco_node_utils/bridge_domain.rb +8 -13
  11. data/lib/cisco_node_utils/client/nxapi/client.rb +10 -3
  12. data/lib/cisco_node_utils/cmd_ref/DEPRECATED.yaml +12 -12
  13. data/lib/cisco_node_utils/cmd_ref/README_YAML.md +2 -1
  14. data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +1 -0
  15. data/lib/cisco_node_utils/cmd_ref/bfd_global.yaml +3 -3
  16. data/lib/cisco_node_utils/cmd_ref/bgp.yaml +5 -15
  17. data/lib/cisco_node_utils/cmd_ref/bgp_af.yaml +1 -1
  18. data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +1 -0
  19. data/lib/cisco_node_utils/cmd_ref/bridge_domain.yaml +14 -36
  20. data/lib/cisco_node_utils/cmd_ref/bridge_domain_vni.yaml +1 -1
  21. data/lib/cisco_node_utils/cmd_ref/dhcp_relay_global.yaml +5 -3
  22. data/lib/cisco_node_utils/cmd_ref/encapsulation.yaml +1 -1
  23. data/lib/cisco_node_utils/cmd_ref/fabricpath.yaml +1 -1
  24. data/lib/cisco_node_utils/cmd_ref/fabricpath_topology.yaml +1 -1
  25. data/lib/cisco_node_utils/cmd_ref/feature.yaml +3 -3
  26. data/lib/cisco_node_utils/cmd_ref/interface.yaml +25 -15
  27. data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +5 -0
  28. data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +6 -0
  29. data/lib/cisco_node_utils/cmd_ref/interface_service_vni.yaml +1 -1
  30. data/lib/cisco_node_utils/cmd_ref/inventory.yaml +9 -0
  31. data/lib/cisco_node_utils/cmd_ref/itd_device_group.yaml +1 -1
  32. data/lib/cisco_node_utils/cmd_ref/itd_service.yaml +1 -1
  33. data/lib/cisco_node_utils/cmd_ref/object_group.yaml +32 -0
  34. data/lib/cisco_node_utils/cmd_ref/ospf.yaml +1 -1
  35. data/lib/cisco_node_utils/cmd_ref/portchannel_global.yaml +9 -7
  36. data/lib/cisco_node_utils/cmd_ref/radius_global.yaml +7 -0
  37. data/lib/cisco_node_utils/cmd_ref/route_map.yaml +26 -25
  38. data/lib/cisco_node_utils/cmd_ref/show_version.yaml +11 -3
  39. data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +4 -0
  40. data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +5 -1
  41. data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +8 -8
  42. data/lib/cisco_node_utils/cmd_ref/syslog_server.yaml +3 -2
  43. data/lib/cisco_node_utils/cmd_ref/syslog_settings.yaml +21 -1
  44. data/lib/cisco_node_utils/cmd_ref/tacacs_global.yaml +7 -0
  45. data/lib/cisco_node_utils/cmd_ref/vdc.yaml +1 -1
  46. data/lib/cisco_node_utils/cmd_ref/vlan.yaml +5 -4
  47. data/lib/cisco_node_utils/cmd_ref/vpc.yaml +9 -9
  48. data/lib/cisco_node_utils/cmd_ref/vrf.yaml +1 -0
  49. data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +1 -0
  50. data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +3 -5
  51. data/lib/cisco_node_utils/command_reference.rb +11 -1
  52. data/lib/cisco_node_utils/interface.rb +46 -8
  53. data/lib/cisco_node_utils/interface_ospf.rb +2 -2
  54. data/lib/cisco_node_utils/interface_portchannel.rb +2 -2
  55. data/lib/cisco_node_utils/node.rb +9 -0
  56. data/lib/cisco_node_utils/ntp_auth_key.rb +1 -1
  57. data/lib/cisco_node_utils/object_group.rb +75 -0
  58. data/lib/cisco_node_utils/object_group_entry.rb +143 -0
  59. data/lib/cisco_node_utils/portchannel_global.rb +2 -2
  60. data/lib/cisco_node_utils/radius_global.rb +25 -1
  61. data/lib/cisco_node_utils/router_ospf.rb +3 -3
  62. data/lib/cisco_node_utils/syslog_server.rb +38 -42
  63. data/lib/cisco_node_utils/syslog_settings.rb +74 -3
  64. data/lib/cisco_node_utils/tacacs_global.rb +47 -14
  65. data/lib/cisco_node_utils/tacacs_server.rb +1 -5
  66. data/lib/cisco_node_utils/version.rb +1 -1
  67. data/lib/cisco_node_utils/vpc.rb +1 -4
  68. data/lib/cisco_node_utils/vtp.rb +4 -2
  69. data/spec/schema.yaml +3 -0
  70. data/tests/ciscotest.rb +16 -9
  71. data/tests/test_ace.rb +2 -0
  72. data/tests/test_bgp_af.rb +10 -2
  73. data/tests/test_bgp_neighbor_af.rb +6 -2
  74. data/tests/test_bridge_domain.rb +7 -0
  75. data/tests/test_feature.rb +2 -2
  76. data/tests/test_interface.rb +30 -4
  77. data/tests/test_node_ext.rb +2 -2
  78. data/tests/test_object_group.rb +122 -0
  79. data/tests/test_platform.rb +1 -1
  80. data/tests/test_portchannel_global.rb +1 -0
  81. data/tests/test_radius_global.rb +22 -2
  82. data/tests/test_route_map.rb +11 -8
  83. data/tests/test_router_bgp.rb +7 -132
  84. data/tests/test_router_ospf_area.rb +6 -6
  85. data/tests/test_snmpuser.rb +19 -11
  86. data/tests/test_syslog_server.rb +11 -31
  87. data/tests/test_syslog_settings.rb +46 -5
  88. data/tests/test_tacacs_global.rb +42 -18
  89. data/tests/test_vpc.rb +3 -0
  90. data/tests/test_vxlan_vtep_vni.rb +0 -3
  91. data/tests/yum_package.yaml +5 -0
  92. metadata +21 -3
@@ -103,7 +103,7 @@ class TestFeature < CiscoTestCase
103
103
  end
104
104
 
105
105
  def test_fabric_forwarding
106
- if node.product_id[/N(3)/]
106
+ if node.product_id[/N(3)/] && !node.product_id.include?('-F')
107
107
  assert_nil(Feature.fabric_forwarding_enabled?)
108
108
  assert_raises(Cisco::UnsupportedError) do
109
109
  Feature.fabric_forwarding_enable
@@ -126,7 +126,7 @@ class TestFeature < CiscoTestCase
126
126
  end
127
127
 
128
128
  def test_nv_overlay_evpn
129
- if node.product_id[/N(3)/]
129
+ if node.product_id[/N(3)/] && !node.product_id.include?('-F')
130
130
  assert_nil(Feature.nv_overlay_evpn_enabled?)
131
131
  assert_raises(Cisco::UnsupportedError) { Feature.nv_overlay_evpn_enable }
132
132
  return
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013-2016 Cisco and/or its affiliates.
1
+ # Copyright (c) 2013-2017 Cisco and/or its affiliates.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -629,7 +629,7 @@ class TestInterface < CiscoTestCase
629
629
  end
630
630
 
631
631
  def test_speed
632
- skip_legacy_defect?('7.0.3.I5.2', 'CSCvd41419')
632
+ skip_legacy_defect?('7.0.3.I5|7.0.3.F3', 'CSCvd41419')
633
633
  interface = Interface.new(interfaces[0])
634
634
  if validate_property_excluded?('interface', 'speed')
635
635
  assert_nil(interface.speed)
@@ -665,7 +665,7 @@ class TestInterface < CiscoTestCase
665
665
  end
666
666
 
667
667
  def test_duplex
668
- skip_legacy_defect?('7.0.3.I5.2', 'CSCvd41419')
668
+ skip_legacy_defect?('7.0.3.I5|7.0.3.F3', 'CSCvd41419')
669
669
  interface = Interface.new(interfaces[0])
670
670
  if validate_property_excluded?('interface', 'duplex')
671
671
  assert_nil(interface.duplex)
@@ -820,7 +820,11 @@ class TestInterface < CiscoTestCase
820
820
  end
821
821
 
822
822
  def test_negotiate_auto_ethernet
823
- skip_legacy_defect?('7.0.3.I5.2', 'CSCvd41419')
823
+ # negotiate auto is LC dependent configuration.
824
+ # On some line cards it could fail with error for ex:
825
+ # Cisco::CliError: [interface ethernet8/1] The command 'no negotiate auto' was rejected with error:
826
+ # ERROR: Ethernet8/1: requested config change not allowed
827
+ skip_legacy_defect?('7.0.3.I5|7.0.3.F3', 'CSCvd41419')
824
828
  inf_name = interfaces[0]
825
829
  interface = Interface.new(inf_name)
826
830
 
@@ -1837,6 +1841,28 @@ class TestInterface < CiscoTestCase
1837
1841
  lb.destroy
1838
1842
  end
1839
1843
 
1844
+ def test_default_physical
1845
+ name = interfaces[0]
1846
+ int = Interface.new(name)
1847
+ int.switchport_mode = :disabled
1848
+
1849
+ # Verify l3 -> default
1850
+ int.description = 'default_pysical'
1851
+ int.ipv4_addr_mask_set('192.168.0.1', '24')
1852
+ refute(int.default?)
1853
+
1854
+ int.destroy
1855
+ assert(int.default?)
1856
+
1857
+ # Verify l2 trunk -> default
1858
+ int.switchport_mode = :access
1859
+ int.switchport_autostate_exclude = true
1860
+ refute(int.default?)
1861
+
1862
+ int.destroy
1863
+ assert(int.default?)
1864
+ end
1865
+
1840
1866
  def test_purge_config
1841
1867
  name = interfaces[0]
1842
1868
  int = Interface.new(name)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013-2016 Cisco and/or its affiliates.
1
+ # Copyright (c) 2013-2017 Cisco and/or its affiliates.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -141,7 +141,7 @@ class TestNodeExt < CiscoTestCase
141
141
  end
142
142
 
143
143
  def test_get_product_id
144
- # N9K Fretta product_id gets a '-F' appended so remove it for this check
144
+ # N3|9K Fretta product_id gets a '-F' appended so remove it for this check
145
145
  if Utils.image_version?(/7.0.3.F/)
146
146
  chassis = node.product_id.sub('-F', '')
147
147
  else
@@ -0,0 +1,122 @@
1
+ # Copyright (c) 2017 Cisco and/or its affiliates.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require_relative 'ciscotest'
16
+ require_relative '../lib/cisco_node_utils/object_group'
17
+ require_relative '../lib/cisco_node_utils/object_group_entry'
18
+
19
+ # TestObject_group - Minitest for Object_group
20
+ # node utility class
21
+ class TestObjectGroup < CiscoTestCase
22
+ @skip_unless_supported = 'object_group'
23
+ @@pre_clean_needed = true # rubocop:disable Style/ClassVars
24
+
25
+ def setup
26
+ super
27
+ @og_name_v4 = 'test-my-v4'
28
+ @og_name_v6 = 'test-my-v6'
29
+ @og_name_port = 'test-my-port'
30
+ remove_all_object_groups if @@pre_clean_needed
31
+ @@pre_clean_needed = false # rubocop:disable Style/ClassVars
32
+ end
33
+
34
+ def teardown
35
+ remove_all_object_groups
36
+ super
37
+ end
38
+
39
+ def remove_all_object_groups
40
+ ObjectGroup.object_groups.each do |_afis, types|
41
+ types.each do |_type, grps|
42
+ grps.values.each(&:destroy)
43
+ end
44
+ end
45
+ end
46
+
47
+ def test_create_object_group
48
+ %w(ipv4 ipv6).each do |afi|
49
+ og_name = afi[/ipv6/] ? @og_name_v6 : @og_name_v4
50
+ og = ObjectGroup.new(afi, 'address', og_name)
51
+ assert(ObjectGroup.object_groups[afi]['address'].key?(og_name))
52
+ og.destroy
53
+ assert_nil(ObjectGroup.object_groups[afi])
54
+ end
55
+ og_name = @og_name_port
56
+ og = ObjectGroup.new('ipv4', 'port', og_name)
57
+ assert(ObjectGroup.object_groups['ipv4']['port'].key?(og_name))
58
+ og.destroy
59
+ assert_nil(ObjectGroup.object_groups['ipv4'])
60
+ end
61
+
62
+ def entry_helper(afi, type, name, props=nil)
63
+ test_hash = {
64
+ address: 'host 1.1.1.1',
65
+ port: 'eq 200',
66
+ }
67
+ test_hash.merge!(props) unless props.nil?
68
+
69
+ ObjectGroup.new(afi, type, name)
70
+ e = ObjectGroupEntry.new(afi, type, name, 10)
71
+ e.entry_set(test_hash)
72
+ e
73
+ end
74
+
75
+ def test_ipv4_address_host
76
+ e = entry_helper('ipv4', 'address', @og_name_v4, port: nil)
77
+ assert_equal('host 1.1.1.1', e.address)
78
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: 'host 2.2.2.2', port: nil)
79
+ assert_equal('host 2.2.2.2', e.address)
80
+ end
81
+
82
+ def test_ipv4_address_prefix
83
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '2.2.2.2/17', port: nil)
84
+ assert_equal('2.2.2.2/17', e.address)
85
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '3.3.3.3/31', port: nil)
86
+ assert_equal('3.3.3.3/31', e.address)
87
+ end
88
+
89
+ def test_ipv4_address_netmask
90
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '2.2.2.2 255.255.255.0', port: nil)
91
+ assert_equal('2.2.2.2 255.255.255.0', e.address)
92
+ e = entry_helper('ipv4', 'address', @og_name_v4, address: '3.3.3.3 10.11.12.13', port: nil)
93
+ assert_equal('3.3.3.3 10.11.12.13', e.address)
94
+ end
95
+
96
+ def test_ipv6_address_host
97
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: 'host 2000::1', port: nil)
98
+ assert_equal('host 2000::1', e.address)
99
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: 'host 2001::2', port: nil)
100
+ assert_equal('host 2001::2', e.address)
101
+ end
102
+
103
+ def test_ipv6_address_prefix
104
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: '2000::1/127', port: nil)
105
+ assert_equal('2000::1/127', e.address)
106
+ e = entry_helper('ipv6', 'address', @og_name_v6, address: '2001::10/64', port: nil)
107
+ assert_equal('2001::10/64', e.address)
108
+ end
109
+
110
+ def test_ipv4_port
111
+ e = entry_helper('ipv4', 'port', @og_name_port, address: nil)
112
+ assert_equal('eq 200', e.port)
113
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'lt 100', address: nil)
114
+ assert_equal('lt 100', e.port)
115
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'neq 150', address: nil)
116
+ assert_equal('neq 150', e.port)
117
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'gt 350', address: nil)
118
+ assert_equal('gt 350', e.port)
119
+ e = entry_helper('ipv4', 'port', @og_name_port, port: 'range 400 1000', address: nil)
120
+ assert_equal('range 400 1000', e.port)
121
+ end
122
+ end
@@ -110,7 +110,7 @@ class TestPlatform < CiscoTestCase
110
110
  end
111
111
 
112
112
  def test_uptime
113
- s = @device.cmd('sh ver').scan(/uptime is (.*)/).flatten.first
113
+ s = @device.cmd('sh system uptime').scan(/Kernel uptime:\s+(.*)/).flatten.first
114
114
  # compare without seconds
115
115
  assert_equal(s.gsub(/\d+ sec/, ''), Platform.uptime.gsub(/\d+ sec/, ''))
116
116
  end
@@ -45,6 +45,7 @@ class TestPortchannelGlobal < CiscoTestCase
45
45
 
46
46
  def n3k_in_n3k_mode?
47
47
  return unless /N3/ =~ node.product_id
48
+ return if node.product_id.include?('-F')
48
49
  mode = config('show system switch-mode')
49
50
  # note: an n3k in n9k mode displays: 'system switch-mode n9k'
50
51
  patterns = ['system switch-mode n3k',
@@ -70,6 +70,12 @@ class TestRadiusGlobal < CiscoTestCase
70
70
  global.key_set(key, nil)
71
71
  assert_match(/#{key}/, global.key)
72
72
  assert_match(/#{key}/, Cisco::RadiusGlobal.radius_global[id].key)
73
+ assert_equal(7, global.key_format)
74
+ # Change to type 6
75
+ key = 'JDYkqyIFWeBvzpljSfWmRZrmRSRE8'
76
+ global.key_set(key, 6)
77
+ assert_match(/#{key}/, global.key)
78
+ assert_equal(6, global.key_format)
73
79
  elsif platform == :ios_xr
74
80
  global.key_set('QsEfThUkO', nil)
75
81
  assert(!global.key.nil?)
@@ -77,9 +83,23 @@ class TestRadiusGlobal < CiscoTestCase
77
83
  end
78
84
 
79
85
  # Setting back to default and re-checking
80
- global.timeout = global.default_timeout
81
- global.retransmit_count = global.default_retransmit_count
86
+ global.timeout = nil
87
+ global.retransmit_count = nil
88
+ global.key_set(nil, nil)
82
89
  assert_equal(global.timeout, global.default_timeout)
83
90
  assert_equal(global.retransmit_count, global.default_retransmit_count)
91
+ assert_nil(global.key)
92
+
93
+ # Default source interface
94
+ assert_nil(global.source_interface)
95
+
96
+ # Set source interface
97
+ interface = 'loopback0'
98
+ global.source_interface = interface
99
+ assert_equal(interface, global.source_interface)
100
+
101
+ # Remove source interface
102
+ global.source_interface = nil
103
+ assert_nil(global.source_interface)
84
104
  end
85
105
  end
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  def dplus_n9k?
24
24
  return true if Utils.image_version?(/7.0.3.I4/) &&
25
- node.product_id[/N9K/]
25
+ product_tag[/n9k/]
26
26
  false
27
27
  end
28
28
 
@@ -154,7 +154,9 @@ class TestRouteMap < CiscoTestCase
154
154
  assert_equal(rm.default_match_src_proto, rm.match_src_proto)
155
155
  array = %w(tcp udp igmp)
156
156
  rm.match_src_proto = array
157
- assert_equal(array, rm.match_src_proto)
157
+ # Protocol order not maintained in running config starting Greensboro.
158
+ # Sorting arrays to check equality.
159
+ assert_equal(array.sort, rm.match_src_proto.sort)
158
160
  rm.match_src_proto = rm.default_match_src_proto
159
161
  assert_equal(rm.default_match_src_proto, rm.match_src_proto)
160
162
  end
@@ -962,7 +964,7 @@ class TestRouteMap < CiscoTestCase
962
964
  end
963
965
 
964
966
  def test_set_ipv4_default_next_hop
965
- skip('platform not supported for this test') if node.product_id[/(N5|N6|N9|N9.*-F)/]
967
+ skip('platform not supported for this test') if product_tag[/(n35|n5k|n6k|n9k|n9k-f|n3k-f)/]
966
968
  arr = %w(1.1.1.1 2.2.2.2 3.3.3.3)
967
969
  rm = lset_ip_next_hop_helper(v4dnh: arr)
968
970
  assert_equal(arr, rm.set_ipv4_default_next_hop)
@@ -995,7 +997,7 @@ class TestRouteMap < CiscoTestCase
995
997
 
996
998
  def test_set_ipv4_next_hop_load_share
997
999
  # bug on fretta
998
- skip('platform not supported for this test') if node.product_id[/(N5|N6)/]
1000
+ skip('platform not supported for this test') if product_tag[/(n5k|n6k)/]
999
1001
  skip_incompat_version?('route_map', 'set_ipv4_next_hop_load_share')
1000
1002
  arr = %w(1.1.1.1 2.2.2.2 3.3.3.3)
1001
1003
  rm = lset_ip_next_hop_helper(v4nh: arr)
@@ -1062,7 +1064,7 @@ class TestRouteMap < CiscoTestCase
1062
1064
  end
1063
1065
 
1064
1066
  def test_set_ipv6_default_next_hop
1065
- skip('platform not supported for this test') if node.product_id[/(N5|N6|N9|N9.*-F)/]
1067
+ skip('platform not supported for this test') if product_tag[/(n35|n5k|n6k|n9k|n9k-f|n3k-f)/]
1066
1068
  arr = %w(2000::1 2000::11 2000::22)
1067
1069
  rm = lset_ip_next_hop_helper(v6dnh: arr)
1068
1070
  assert_equal(arr, rm.set_ipv6_default_next_hop)
@@ -1095,7 +1097,7 @@ class TestRouteMap < CiscoTestCase
1095
1097
 
1096
1098
  def test_set_ipv6_next_hop_load_share
1097
1099
  # bug on fretta
1098
- skip('platform not supported for this test') if node.product_id[/(N5|N6)/]
1100
+ skip('platform not supported for this test') if product_tag[/(n5k|n6k)/]
1099
1101
  skip_incompat_version?('route_map', 'set_ipv6_next_hop_load_share')
1100
1102
  arr = %w(2000::1 2000::11 2000::22)
1101
1103
  rm = lset_ip_next_hop_helper(v6nh: arr)
@@ -1119,7 +1121,7 @@ class TestRouteMap < CiscoTestCase
1119
1121
 
1120
1122
  def test_set_community_no_asn
1121
1123
  # bug on n5/6k
1122
- skip('platform not supported for this test') if node.product_id[/(N5|N6)/]
1124
+ skip('platform not supported for this test') if product_tag[/(n5k|n6k)/]
1123
1125
  skip_incompat_version?('route_map', 'set_community')
1124
1126
  rm = create_route_map
1125
1127
  assert_equal(rm.default_set_community_additive,
@@ -1336,7 +1338,8 @@ class TestRouteMap < CiscoTestCase
1336
1338
 
1337
1339
  def test_extcommunity_rt
1338
1340
  # bug CSCvc92395 on fretta and n9k
1339
- skip('platform not supported for this test') if node.product_id[/N9/]
1341
+ skip('platform not supported for this test') if
1342
+ product_tag[/n9k/] || product_tag[/n3k-f/]
1340
1343
  rm = create_route_map
1341
1344
  assert_equal(rm.default_set_extcommunity_rt_additive,
1342
1345
  rm.set_extcommunity_rt_additive)
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # Mike Wiebe, June, 2015
5
5
  #
6
- # Copyright (c) 2015-2016 Cisco and/or its affiliates.
6
+ # Copyright (c) 2015-2017 Cisco and/or its affiliates.
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
9
9
  # you may not use this file except in compliance with the License.
@@ -60,14 +60,6 @@ def setup_vrf
60
60
  create_bgp_vrf(@asnum, @vrf)
61
61
  end
62
62
 
63
- def newer_image_version?
64
- new = true
65
- new = false if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
66
- node.product_id[/(N5|N6|N7|N9.*-F)/]
67
- new = true if Utils.image_version?(/8.0|8.1/)
68
- new
69
- end
70
-
71
63
  # TestRouterBgp - Minitest for RouterBgp class
72
64
  class TestRouterBgp < CiscoTestCase
73
65
  @@pre_clean_needed = true # rubocop:disable Style/ClassVars
@@ -595,31 +587,12 @@ class TestRouterBgp < CiscoTestCase
595
587
  if validate_property_excluded?('bgp', 'event_history_cli')
596
588
  assert_nil(bgp.event_history_cli)
597
589
  assert_raises(Cisco::UnsupportedError) do
598
- bgp.event_history_cli = 'true'
590
+ bgp.event_history_cli = 'size_large'
599
591
  end
600
592
  return
601
593
  end
602
- assert_equal(bgp.default_event_history_cli, bgp.event_history_cli)
603
- bgp.event_history_cli = 'true'
604
- assert_equal(bgp.default_event_history_cli, bgp.event_history_cli)
605
- bgp.event_history_cli = 'false'
606
- assert_equal('false', bgp.event_history_cli)
607
- bgp.event_history_cli = 'size_small'
608
- assert_equal('size_small', bgp.event_history_cli)
609
594
  bgp.event_history_cli = 'size_large'
610
595
  assert_equal('size_large', bgp.event_history_cli)
611
- bgp.event_history_cli = 'size_medium'
612
- assert_equal('size_medium', bgp.event_history_cli)
613
- bgp.event_history_cli = 'size_disable'
614
- if newer_image_version?
615
- assert_equal('false', bgp.event_history_cli)
616
- else
617
- assert_equal('size_disable', bgp.event_history_cli)
618
- end
619
- bgp.event_history_cli = '100000'
620
- assert_equal('100000', bgp.event_history_cli)
621
- bgp.event_history_cli = bgp.default_event_history_cli
622
- assert_equal(bgp.default_event_history_cli, bgp.event_history_cli)
623
596
  end
624
597
 
625
598
  def test_event_history_detail
@@ -627,31 +600,12 @@ class TestRouterBgp < CiscoTestCase
627
600
  if validate_property_excluded?('bgp', 'event_history_detail')
628
601
  assert_nil(bgp.event_history_detail)
629
602
  assert_raises(Cisco::UnsupportedError) do
630
- bgp.event_history_detail = 'true'
603
+ bgp.event_history_detail = 'size_large'
631
604
  end
632
605
  return
633
606
  end
634
- assert_equal(bgp.default_event_history_detail, bgp.event_history_detail)
635
- bgp.event_history_detail = 'true'
636
- assert_equal('true', bgp.event_history_detail)
637
- bgp.event_history_detail = 'false'
638
- assert_equal(bgp.default_event_history_detail, bgp.event_history_detail)
639
- bgp.event_history_detail = 'size_small'
640
- assert_equal('size_small', bgp.event_history_detail)
641
607
  bgp.event_history_detail = 'size_large'
642
608
  assert_equal('size_large', bgp.event_history_detail)
643
- bgp.event_history_detail = 'size_medium'
644
- assert_equal('size_medium', bgp.event_history_detail)
645
- bgp.event_history_detail = 'size_disable'
646
- if newer_image_version?
647
- assert_equal('false', bgp.event_history_detail)
648
- else
649
- assert_equal('size_disable', bgp.event_history_detail)
650
- end
651
- bgp.event_history_detail = '100000'
652
- assert_equal('100000', bgp.event_history_detail)
653
- bgp.event_history_detail = bgp.default_event_history_detail
654
- assert_equal(bgp.default_event_history_detail, bgp.event_history_detail)
655
609
  end
656
610
 
657
611
  def test_event_history_errors
@@ -663,25 +617,9 @@ class TestRouterBgp < CiscoTestCase
663
617
  end
664
618
  return
665
619
  end
666
- skip('platform not supported for this test') unless newer_image_version?
667
- assert_equal(bgp.default_event_history_errors, bgp.event_history_errors)
668
- bgp.event_history_errors = 'true'
669
- assert_equal(bgp.default_event_history_errors, bgp.event_history_errors)
670
- bgp.event_history_errors = 'false'
671
- assert_equal('false', bgp.event_history_errors)
672
- bgp.event_history_errors = 'size_small'
673
- assert_equal('size_small', bgp.event_history_errors) unless
674
- Utils.image_version?(/8.0|8.1/)
620
+ skip_incompat_version?('bgp', 'event_history_errors')
675
621
  bgp.event_history_errors = 'size_large'
676
622
  assert_equal('size_large', bgp.event_history_errors)
677
- bgp.event_history_errors = 'size_medium'
678
- assert_equal('size_medium', bgp.event_history_errors)
679
- bgp.event_history_errors = 'size_disable'
680
- assert_equal('false', bgp.event_history_errors)
681
- bgp.event_history_errors = '100000'
682
- assert_equal('100000', bgp.event_history_errors)
683
- bgp.event_history_errors = bgp.default_event_history_errors
684
- assert_equal(bgp.default_event_history_errors, bgp.event_history_errors)
685
623
  end
686
624
 
687
625
  def test_event_history_events
@@ -689,31 +627,12 @@ class TestRouterBgp < CiscoTestCase
689
627
  if validate_property_excluded?('bgp', 'event_history_events')
690
628
  assert_nil(bgp.event_history_events)
691
629
  assert_raises(Cisco::UnsupportedError) do
692
- bgp.event_history_events = 'true'
630
+ bgp.event_history_events = 'size_medium'
693
631
  end
694
632
  return
695
633
  end
696
- assert_equal(bgp.default_event_history_events, bgp.event_history_events)
697
- bgp.event_history_events = 'true'
698
- assert_equal(bgp.default_event_history_events, bgp.event_history_events)
699
- bgp.event_history_events = 'false'
700
- assert_equal('false', bgp.event_history_events)
701
- bgp.event_history_events = 'size_small'
702
- assert_equal('size_small', bgp.event_history_events)
703
- bgp.event_history_events = 'size_large'
704
- assert_equal('size_large', bgp.event_history_events)
705
634
  bgp.event_history_events = 'size_medium'
706
635
  assert_equal('size_medium', bgp.event_history_events)
707
- bgp.event_history_events = 'size_disable'
708
- if newer_image_version?
709
- assert_equal('false', bgp.event_history_events)
710
- else
711
- assert_equal('size_disable', bgp.event_history_events)
712
- end
713
- bgp.event_history_events = '100000'
714
- assert_equal('100000', bgp.event_history_events)
715
- bgp.event_history_events = bgp.default_event_history_events
716
- assert_equal(bgp.default_event_history_events, bgp.event_history_events)
717
636
  end
718
637
 
719
638
  def test_event_history_objstore
@@ -725,24 +644,9 @@ class TestRouterBgp < CiscoTestCase
725
644
  end
726
645
  return
727
646
  end
728
- skip('platform not supported for this test') unless newer_image_version?
729
- assert_equal(bgp.default_event_history_objstore, bgp.event_history_objstore)
730
- bgp.event_history_objstore = 'true'
731
- assert_equal('true', bgp.event_history_objstore)
732
- bgp.event_history_objstore = 'false'
733
- assert_equal(bgp.default_event_history_objstore, bgp.event_history_objstore)
734
- bgp.event_history_objstore = 'size_small'
735
- assert_equal('size_small', bgp.event_history_objstore)
736
- bgp.event_history_objstore = 'size_large'
737
- assert_equal('size_large', bgp.event_history_objstore)
647
+ skip_incompat_version?('bgp', 'event_history_objstore')
738
648
  bgp.event_history_objstore = 'size_medium'
739
649
  assert_equal('size_medium', bgp.event_history_objstore)
740
- bgp.event_history_objstore = 'size_disable'
741
- assert_equal('false', bgp.event_history_objstore)
742
- bgp.event_history_objstore = '100000'
743
- assert_equal('100000', bgp.event_history_objstore)
744
- bgp.event_history_objstore = bgp.default_event_history_objstore
745
- assert_equal(bgp.default_event_history_objstore, bgp.event_history_objstore)
746
650
  end
747
651
 
748
652
  def test_event_history_periodic
@@ -750,41 +654,12 @@ class TestRouterBgp < CiscoTestCase
750
654
  if validate_property_excluded?('bgp', 'event_history_periodic')
751
655
  assert_nil(bgp.event_history_periodic)
752
656
  assert_raises(Cisco::UnsupportedError) do
753
- bgp.event_history_periodic = 'true'
657
+ bgp.event_history_periodic = 'size_large'
754
658
  end
755
659
  return
756
660
  end
757
- assert_equal(bgp.default_event_history_periodic,
758
- bgp.event_history_periodic)
759
- bgp.event_history_periodic = 'false'
760
- assert_equal('false', bgp.event_history_periodic) unless
761
- Utils.image_version?(/8.0|8.1/)
762
- bgp.event_history_periodic = 'size_small'
763
- assert_equal('size_small', bgp.event_history_periodic)
764
661
  bgp.event_history_periodic = 'size_large'
765
662
  assert_equal('size_large', bgp.event_history_periodic)
766
- bgp.event_history_periodic = 'size_medium'
767
- assert_equal('size_medium', bgp.event_history_periodic)
768
- bgp.event_history_periodic = '100000'
769
- assert_equal('100000', bgp.event_history_periodic)
770
- bgp.event_history_periodic = 'size_disable'
771
- if newer_image_version?
772
- assert_equal(bgp.default_event_history_periodic,
773
- bgp.event_history_periodic)
774
- else
775
- assert_equal('size_disable', bgp.event_history_periodic)
776
- end
777
- bgp.event_history_periodic = 'true'
778
- if newer_image_version?
779
- assert_equal('true', bgp.event_history_periodic) unless
780
- Utils.image_version?(/8.0|8.1/)
781
- else
782
- assert_equal(bgp.default_event_history_periodic,
783
- bgp.event_history_periodic)
784
- end
785
- bgp.event_history_periodic = bgp.default_event_history_periodic
786
- assert_equal(bgp.default_event_history_periodic,
787
- bgp.event_history_periodic)
788
663
  end
789
664
 
790
665
  def test_fast_external_fallover