cisco_node_utils 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +66 -0
  4. data/Gemfile +1 -0
  5. data/README.md +44 -43
  6. data/bin/.rubocop.yml +18 -0
  7. data/bin/show_running_yang.rb +233 -0
  8. data/cisco_node_utils.gemspec +1 -1
  9. data/docs/README-maintainers.md +1 -0
  10. data/docs/README-utilities.md +14 -0
  11. data/lib/.rubocop.yml +1 -1
  12. data/lib/cisco_node_utils/aaa_authentication_login_service.rb +8 -3
  13. data/lib/cisco_node_utils/aaa_authorization_service.rb +6 -0
  14. data/lib/cisco_node_utils/bfd_global.rb +300 -0
  15. data/lib/cisco_node_utils/bgp.rb +6 -4
  16. data/lib/cisco_node_utils/bgp_af.rb +2 -0
  17. data/lib/cisco_node_utils/bgp_neighbor.rb +14 -0
  18. data/lib/cisco_node_utils/bgp_neighbor_af.rb +4 -1
  19. data/lib/cisco_node_utils/cisco_cmn_utils.rb +126 -0
  20. data/lib/cisco_node_utils/client/client.rb +6 -2
  21. data/lib/cisco_node_utils/client/grpc/client.rb +120 -36
  22. data/lib/cisco_node_utils/client/nxapi/client.rb +6 -2
  23. data/lib/cisco_node_utils/cmd_ref/DEPRECATED.yaml +118 -0
  24. data/lib/cisco_node_utils/cmd_ref/aaa_authorization_service.yaml +14 -0
  25. data/lib/cisco_node_utils/cmd_ref/bfd_global.yaml +117 -0
  26. data/lib/cisco_node_utils/cmd_ref/bgp.yaml +7 -7
  27. data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +7 -0
  28. data/lib/cisco_node_utils/cmd_ref/dhcp_relay_global.yaml +125 -0
  29. data/lib/cisco_node_utils/cmd_ref/feature.yaml +10 -0
  30. data/lib/cisco_node_utils/cmd_ref/interface.yaml +141 -49
  31. data/lib/cisco_node_utils/cmd_ref/interface_ospf.yaml +44 -0
  32. data/lib/cisco_node_utils/cmd_ref/interface_portchannel.yaml +6 -0
  33. data/lib/cisco_node_utils/cmd_ref/ospf.yaml +6 -0
  34. data/lib/cisco_node_utils/cmd_ref/ospf_area.yaml +91 -0
  35. data/lib/cisco_node_utils/cmd_ref/ospf_area_vlink.yaml +88 -0
  36. data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +0 -3
  37. data/lib/cisco_node_utils/cmd_ref/show_version.yaml +3 -3
  38. data/lib/cisco_node_utils/cmd_ref/snmp_community.yaml +39 -15
  39. data/lib/cisco_node_utils/cmd_ref/snmp_notification_receiver.yaml +43 -21
  40. data/lib/cisco_node_utils/cmd_ref/snmp_server.yaml +48 -19
  41. data/lib/cisco_node_utils/cmd_ref/snmp_user.yaml +0 -0
  42. data/lib/cisco_node_utils/cmd_ref/tacacs_global.yaml +30 -0
  43. data/lib/cisco_node_utils/cmd_ref/tacacs_server.yaml +18 -6
  44. data/lib/cisco_node_utils/cmd_ref/vdc.yaml +4 -0
  45. data/lib/cisco_node_utils/cmd_ref/virtual_service.yaml +1 -0
  46. data/lib/cisco_node_utils/cmd_ref/vlan.yaml +23 -10
  47. data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +8 -2
  48. data/lib/cisco_node_utils/cmd_ref/yang.yaml +7 -0
  49. data/lib/cisco_node_utils/cmd_ref/yum.yaml +10 -1
  50. data/lib/cisco_node_utils/constants.rb +8 -1
  51. data/lib/cisco_node_utils/dhcp_relay_global.rb +302 -0
  52. data/lib/cisco_node_utils/exceptions.rb +29 -0
  53. data/lib/cisco_node_utils/feature.rb +28 -0
  54. data/lib/cisco_node_utils/interface.rb +493 -402
  55. data/lib/cisco_node_utils/interface_DEPRECATED.rb +513 -0
  56. data/lib/cisco_node_utils/interface_ospf.rb +126 -0
  57. data/lib/cisco_node_utils/interface_portchannel.rb +16 -0
  58. data/lib/cisco_node_utils/logger.rb +3 -0
  59. data/lib/cisco_node_utils/node.rb +29 -1
  60. data/lib/cisco_node_utils/overlay_global.rb +1 -12
  61. data/lib/cisco_node_utils/pim.rb +1 -0
  62. data/lib/cisco_node_utils/pim_group_list.rb +1 -0
  63. data/lib/cisco_node_utils/pim_rp_address.rb +1 -0
  64. data/lib/cisco_node_utils/platform.rb +9 -2
  65. data/lib/cisco_node_utils/router_ospf.rb +1 -1
  66. data/lib/cisco_node_utils/router_ospf_area.rb +416 -0
  67. data/lib/cisco_node_utils/router_ospf_area_vlink.rb +313 -0
  68. data/lib/cisco_node_utils/router_ospf_vrf.rb +17 -0
  69. data/lib/cisco_node_utils/snmp_notification_receiver.rb +27 -9
  70. data/lib/cisco_node_utils/snmpcommunity.rb +34 -8
  71. data/lib/cisco_node_utils/snmpserver.rb +4 -4
  72. data/lib/cisco_node_utils/snmpuser.rb +0 -0
  73. data/lib/cisco_node_utils/tacacs_global.rb +102 -0
  74. data/lib/cisco_node_utils/tacacs_server.rb +8 -7
  75. data/lib/cisco_node_utils/vdc.rb +25 -7
  76. data/lib/cisco_node_utils/version.rb +1 -1
  77. data/lib/cisco_node_utils/vlan.rb +30 -56
  78. data/lib/cisco_node_utils/vlan_DEPRECATED.rb +108 -0
  79. data/lib/cisco_node_utils/yang.rb +160 -0
  80. data/lib/cisco_node_utils/yum.rb +25 -32
  81. data/tests/.rubocop.yml +3 -0
  82. data/tests/ciscotest.rb +136 -19
  83. data/tests/cmd_config_invalid.yaml +1 -1
  84. data/tests/noop.rb +7 -0
  85. data/tests/tacacs_server.yaml.example +6 -0
  86. data/tests/test_aaa_authentication_login.rb +24 -1
  87. data/tests/test_aaa_authentication_login_service.rb +9 -16
  88. data/tests/test_aaa_authorization_service.rb +111 -84
  89. data/tests/test_bfd_global.rb +278 -0
  90. data/tests/test_bgp_neighbor.rb +20 -0
  91. data/tests/test_bridge_domain_vni.rb +2 -9
  92. data/tests/test_cmn_utils.rb +76 -0
  93. data/tests/test_dhcp_relay_global.rb +284 -0
  94. data/tests/test_dns_domain.rb +4 -4
  95. data/tests/test_domain_name.rb +2 -2
  96. data/tests/test_encapsulation.rb +2 -4
  97. data/tests/test_evpn_vni.rb +14 -7
  98. data/tests/test_fabricpath_global.rb +12 -13
  99. data/tests/test_feature.rb +35 -17
  100. data/tests/test_interface.rb +352 -127
  101. data/tests/test_interface_bdi.rb +2 -2
  102. data/tests/test_interface_channel_group.rb +1 -1
  103. data/tests/test_interface_ospf.rb +153 -23
  104. data/tests/test_interface_portchannel.rb +15 -6
  105. data/tests/test_interface_private_vlan.rb +200 -576
  106. data/tests/test_interface_svi.rb +5 -52
  107. data/tests/test_interface_switchport.rb +80 -240
  108. data/tests/test_itd_device_group.rb +2 -2
  109. data/tests/test_itd_device_group_node.rb +2 -2
  110. data/tests/test_itd_service.rb +1 -1
  111. data/tests/test_name_server.rb +3 -3
  112. data/tests/test_node_ext.rb +15 -17
  113. data/tests/test_ntp_config.rb +1 -1
  114. data/tests/test_ntp_server.rb +3 -3
  115. data/tests/test_nxapi.rb +1 -0
  116. data/tests/test_overlay_global.rb +15 -19
  117. data/tests/test_pim.rb +5 -5
  118. data/tests/test_pim_group_list.rb +1 -37
  119. data/tests/test_pim_rp_address.rb +1 -1
  120. data/tests/test_platform.rb +9 -11
  121. data/tests/test_portchannel_global.rb +43 -3
  122. data/tests/test_radius_server.rb +1 -1
  123. data/tests/test_radius_server_group.rb +1 -1
  124. data/tests/test_router_bgp.rb +17 -30
  125. data/tests/test_router_ospf_area.rb +433 -0
  126. data/tests/test_router_ospf_area_vlink.rb +298 -0
  127. data/tests/test_router_ospf_vrf.rb +17 -0
  128. data/tests/test_snmp_notification_receiver.rb +11 -11
  129. data/tests/test_snmpcommunity.rb +177 -69
  130. data/tests/test_snmpgroup.rb +7 -7
  131. data/tests/test_snmpserver.rb +164 -253
  132. data/tests/test_snmpuser.rb +73 -69
  133. data/tests/test_stp_global.rb +15 -15
  134. data/tests/test_syslog_settings.rb +1 -1
  135. data/tests/test_tacacs_global.rb +80 -0
  136. data/tests/test_tacacs_server.rb +129 -51
  137. data/tests/test_tacacs_server_group.rb +3 -29
  138. data/tests/test_tacacs_server_host.rb +24 -27
  139. data/tests/test_vlan.rb +57 -59
  140. data/tests/test_vlan_private.rb +271 -284
  141. data/tests/test_vpc.rb +10 -4
  142. data/tests/test_vrf.rb +2 -0
  143. data/tests/test_vrf_af.rb +2 -5
  144. data/tests/test_vtp.rb +5 -2
  145. data/tests/test_vxlan_vtep.rb +20 -44
  146. data/tests/test_vxlan_vtep_vni.rb +23 -16
  147. data/tests/test_yang.rb +369 -0
  148. data/tests/test_yum.rb +34 -42
  149. data/tests/yum_package.yaml +35 -0
  150. metadata +31 -4
  151. data/tests/test_vlan_mt_full.rb +0 -85
@@ -18,7 +18,7 @@ require_relative '../lib/cisco_node_utils/itd_device_group'
18
18
  include Cisco
19
19
  # TestInterface - Minitest for general functionality
20
20
  # of the ItdDeviceGroup class.
21
- class TestItdDeviceGroup < CiscoTestCase
21
+ class TestItdDevGrp < CiscoTestCase
22
22
  @skip_unless_supported = 'itd_device_group'
23
23
  # Tests
24
24
 
@@ -32,7 +32,7 @@ class TestItdDeviceGroup < CiscoTestCase
32
32
  super
33
33
  end
34
34
 
35
- def test_itd_device_group_create_destroy
35
+ def test_create_destroy
36
36
  skip_nexus_i2_image?
37
37
  i1 = ItdDeviceGroup.new('abc')
38
38
  i2 = ItdDeviceGroup.new('BCD')
@@ -18,7 +18,7 @@ require_relative '../lib/cisco_node_utils/itd_device_group_node'
18
18
  include Cisco
19
19
  # TestInterface - Minitest for general functionality
20
20
  # of the ItdDeviceGroup class.
21
- class TestItdDeviceGroupNode < CiscoTestCase
21
+ class TestItdDevGrpNode < CiscoTestCase
22
22
  @skip_unless_supported = 'itd_device_group'
23
23
  # Tests
24
24
 
@@ -32,7 +32,7 @@ class TestItdDeviceGroupNode < CiscoTestCase
32
32
  super
33
33
  end
34
34
 
35
- def test_itd_device_group_node_create_destroy
35
+ def test_create_destroy
36
36
  skip_nexus_i2_image?
37
37
  itddg1 = ItdDeviceGroup.new('abc')
38
38
  n1 = ItdDeviceGroupNode.new(itddg1.name, '1.1.1.1', 'ip')
@@ -19,7 +19,7 @@ require_relative '../lib/cisco_node_utils/itd_service'
19
19
  include Cisco
20
20
  # TestInterface - Minitest for general functionality
21
21
  # of the ItdService class.
22
- class TestItdService < CiscoTestCase
22
+ class TestItdSvc < CiscoTestCase
23
23
  @skip_unless_supported = 'itd_service'
24
24
  # Tests
25
25
 
@@ -49,7 +49,7 @@ class TestNameServer < CiscoTestCase
49
49
 
50
50
  # TESTS
51
51
 
52
- def test_nameserver_create_destroy_single_ipv4
52
+ def test_ipv4
53
53
  id = '7.7.7.7'
54
54
  refute_includes(Cisco::NameServer.nameservers, id)
55
55
 
@@ -61,7 +61,7 @@ class TestNameServer < CiscoTestCase
61
61
  refute_includes(Cisco::NameServer.nameservers, id)
62
62
  end
63
63
 
64
- def test_nameserver_create_destroy_single_ipv6
64
+ def test_ipv6
65
65
  id = '2001:4860:4860::7777'
66
66
  refute_includes(Cisco::NameServer.nameservers, id)
67
67
 
@@ -73,7 +73,7 @@ class TestNameServer < CiscoTestCase
73
73
  refute_includes(Cisco::NameServer.nameservers, id)
74
74
  end
75
75
 
76
- def test_router_create_destroy_multiple
76
+ def test_multiple
77
77
  id1 = '7.7.7.7'
78
78
  id2 = '2001:4860:4860::7777'
79
79
  refute_includes(Cisco::NameServer.nameservers, id1)
@@ -326,12 +326,9 @@ class TestNodeExt < CiscoTestCase
326
326
  def test_get_last_reset_time
327
327
  if validate_property_excluded?('show_version', 'last_reset_time')
328
328
  assert_nil(node.last_reset_time)
329
- return
329
+ else
330
+ refute_nil(node.last_reset_time)
330
331
  end
331
- assert_output_check(command: 'show version',
332
- pattern: /.*\nLast reset at \d+ usecs after (.*)\n/,
333
- check: node.last_reset_time,
334
- msg: 'Error, Last reset time does not match')
335
332
  end
336
333
 
337
334
  def test_get_last_reset_reason
@@ -348,16 +345,9 @@ class TestNodeExt < CiscoTestCase
348
345
  def test_get_system_cpu_utilization
349
346
  if validate_property_excluded?('system', 'resources')
350
347
  assert_nil(node.system_cpu_utilization)
351
- return
348
+ else
349
+ refute_nil(node.system_cpu_utilization)
352
350
  end
353
- cpu_utilization = node.system_cpu_utilization
354
- md = assert_show_match(
355
- command: 'show system resources',
356
- pattern: /.*CPU states : (\d+\.\d+)% user, (\d+\.\d+)% kernel/)
357
- observed_cpu_utilization = md[1].to_f + md[2].to_f
358
- delta = cpu_utilization - observed_cpu_utilization
359
- assert(delta > -15.0 && delta < 15.0,
360
- "Error: delta #{delta}, not +- 15.0")
361
351
  end
362
352
 
363
353
  def test_get_boot
@@ -379,7 +369,7 @@ class TestNodeExt < CiscoTestCase
379
369
  end
380
370
 
381
371
  def test_get_system
382
- if validate_property_excluded?('system', 'resources')
372
+ if validate_property_excluded?('show_version', 'system_image')
383
373
  assert_nil(node.system)
384
374
  return
385
375
  end
@@ -388,9 +378,17 @@ class TestNodeExt < CiscoTestCase
388
378
  # system image file is: bootflash:///n7000-s2-kickstart.7.3.0.D1.1.bin
389
379
  # /N(3|8|9)/
390
380
  # NXOS image file is: bootflash:///nxos.7.0.3.I3.1.bin
381
+ # /ios_xr/
382
+ # xrv9k-xr-6.1.1.19I version=6.1.1.19I [Boot image]
391
383
 
392
- pattern = /(?:system|NXOS) image file is:\s+(.*)$/
393
- assert_output_check(command: 'show version',
384
+ if platform[/ios_xr/]
385
+ cmd = 'show install active'
386
+ pattern = /^\s*(\S*)\s*version.*\[Boot image\]$/
387
+ else
388
+ cmd = 'show version'
389
+ pattern = /(?:system|NXOS) image file is:\s+(.*)$/
390
+ end
391
+ assert_output_check(command: cmd,
394
392
  pattern: pattern,
395
393
  check: node.system,
396
394
  msg: 'Error, System Image does not match')
@@ -37,7 +37,7 @@ class TestNtpConfig < CiscoTestCase
37
37
 
38
38
  # TESTS
39
39
 
40
- def test_ntpconfig_create_destroy_single
40
+ def test_create_destroy
41
41
  id = 'default'
42
42
 
43
43
  ntp = Cisco::NtpConfig.new(id)
@@ -40,7 +40,7 @@ class TestNtpServer < CiscoTestCase
40
40
 
41
41
  # TESTS
42
42
 
43
- def test_ntpserver_create_destroy_single_ipv4
43
+ def test_ipv4
44
44
  id = '130.88.203.12'
45
45
  refute_includes(Cisco::NtpServer.ntpservers, id)
46
46
 
@@ -52,7 +52,7 @@ class TestNtpServer < CiscoTestCase
52
52
  refute_includes(Cisco::NtpServer.ntpservers, id)
53
53
  end
54
54
 
55
- def test_ntpserver_create_destroy_single_ipv6
55
+ def test_ipv6
56
56
  id = '2003::5'
57
57
  refute_includes(Cisco::NtpServer.ntpservers, id)
58
58
 
@@ -64,7 +64,7 @@ class TestNtpServer < CiscoTestCase
64
64
  refute_includes(Cisco::NtpServer.ntpservers, id)
65
65
  end
66
66
 
67
- def test_ntpserver_create_destroy_multiple
67
+ def test_multiple
68
68
  id1 = '130.88.203.12'
69
69
  id2 = '2003::5'
70
70
  refute_includes(Cisco::NtpServer.ntpservers, id1)
data/tests/test_nxapi.rb CHANGED
@@ -44,6 +44,7 @@ class TestNxapi < TestCase
44
44
  end
45
45
 
46
46
  def cleanup
47
+ return if Cisco::Environment.environment[:port]
47
48
  config_no_warn('no interface loopback41', 'no interface loopback42')
48
49
  end
49
50
 
@@ -25,11 +25,15 @@ class TestOverlayGlobal < CiscoTestCase
25
25
 
26
26
  def setup
27
27
  super
28
- vxlan_linecard?
29
- vdc_lc_state('f3')
28
+ vdc_limit_f3_no_intf_needed(:set)
30
29
  config_no_warn('no feature fabric forwarding')
31
30
  config_no_warn('no nv overlay evpn')
32
- config_no_warn('l2rib dup-host-mac-detection default')
31
+ end
32
+
33
+ def teardown
34
+ config_no_warn('no feature fabric forwarding')
35
+ config_no_warn('no nv overlay evpn')
36
+ vdc_limit_f3_no_intf_needed(:clear) if first_or_last_teardown
33
37
  end
34
38
 
35
39
  def test_dup_host_ip_addr_detection
@@ -42,9 +46,10 @@ class TestOverlayGlobal < CiscoTestCase
42
46
  return
43
47
  end
44
48
 
45
- # Before enabling 'nv overlay evpn', these properties do not exist
46
- assert_nil(o.dup_host_ip_addr_detection_host_moves)
47
- assert_nil(o.dup_host_ip_addr_detection_timeout)
49
+ assert_equal(o.default_dup_host_ip_addr_detection_host_moves,
50
+ o.dup_host_ip_addr_detection_host_moves)
51
+ assert_equal(o.default_dup_host_ip_addr_detection_timeout,
52
+ o.dup_host_ip_addr_detection_timeout)
48
53
 
49
54
  # Set them to the default value and they should now be present
50
55
  default = [o.default_dup_host_ip_addr_detection_host_moves,
@@ -64,11 +69,6 @@ class TestOverlayGlobal < CiscoTestCase
64
69
 
65
70
  def test_dup_host_mac_detection
66
71
  o = OverlayGlobal.new
67
- # These properties always exist, even without 'nv overlay evpn'
68
- default = [o.default_dup_host_mac_detection_host_moves,
69
- o.default_dup_host_mac_detection_timeout]
70
- assert_equal(default, o.dup_host_mac_detection)
71
- refute(Feature.nv_overlay_evpn_enabled?)
72
72
 
73
73
  # Set to a non-default value
74
74
  val = [160, 16]
@@ -76,12 +76,9 @@ class TestOverlayGlobal < CiscoTestCase
76
76
  assert_equal(val, o.dup_host_mac_detection)
77
77
  refute(Feature.nv_overlay_evpn_enabled?)
78
78
 
79
- # Use the special defaulter method
80
- o.dup_host_mac_detection_default
81
- assert_equal(default, o.dup_host_mac_detection)
82
- refute(Feature.nv_overlay_evpn_enabled?)
83
-
84
- # Set explicitly to default too
79
+ # These properties always exist, even without 'nv overlay evpn'
80
+ default = [o.default_dup_host_mac_detection_host_moves,
81
+ o.default_dup_host_mac_detection_timeout]
85
82
  o.dup_host_mac_detection_set(*default)
86
83
  assert_equal(default, o.dup_host_mac_detection)
87
84
  refute(Feature.nv_overlay_evpn_enabled?)
@@ -94,8 +91,7 @@ class TestOverlayGlobal < CiscoTestCase
94
91
  return
95
92
  end
96
93
 
97
- # Before enabling 'nv overlay evpn', this property does not exist
98
- assert_nil(o.anycast_gateway_mac)
94
+ assert_equal(o.default_anycast_gateway_mac, o.anycast_gateway_mac)
99
95
 
100
96
  # Explicitly set to default and it should be enabled
101
97
  o.anycast_gateway_mac = o.default_anycast_gateway_mac
data/tests/test_pim.rb CHANGED
@@ -81,7 +81,7 @@ class TestPim < CiscoTestCase
81
81
 
82
82
  # Tests single ssm range none under default vrf
83
83
  #-----------------------------------------------
84
- def test_single_ssm_range_single_vrf
84
+ def test_ssm_range
85
85
  %w(ipv4).each do |afi|
86
86
  create_single_ssm_range_single_vrf(afi)
87
87
  end
@@ -98,7 +98,7 @@ class TestPim < CiscoTestCase
98
98
 
99
99
  # Tests single ssm range none under default vrf
100
100
  #-----------------------------------------------
101
- def test_single_ssm_range_none_single_vrf
101
+ def test_ssm_range_none
102
102
  %w(ipv4).each do |afi|
103
103
  create_single_ssm_range_none_single_vrf(afi)
104
104
  end
@@ -123,7 +123,7 @@ class TestPim < CiscoTestCase
123
123
 
124
124
  # Tests multiple ssm ranges under different vrfs
125
125
  #-----------------------------------------------
126
- def test_multiple_ssm_range_multiple_vrfs
126
+ def test_ssm_range_multiple
127
127
  %w(ipv4).each do |afi|
128
128
  create_multiple_ssm_range_multiple_vrfs(afi)
129
129
  end
@@ -153,7 +153,7 @@ class TestPim < CiscoTestCase
153
153
 
154
154
  # Tests multiple ssm ranges overwrite under different vrfs
155
155
  #-----------------------------------------------
156
- def test_multiple_ssm_range_overwrite_multiple_vrfs
156
+ def test_ssm_range_multiple_overwrite
157
157
  %w(ipv4).each do |afi|
158
158
  create_multiple_ssm_range_overwrite_multiple_vrfs(afi)
159
159
  end
@@ -171,7 +171,7 @@ class TestPim < CiscoTestCase
171
171
 
172
172
  # Tests single invalid ssm range under vrf default
173
173
  #---------------------------------------------------
174
- def test_single_invalid_ssm_range_single_vrf
174
+ def test_ssm_range_inv
175
175
  %w(ipv4).each do |afi|
176
176
  create_single_invalid_ssm_range_single_vrf(afi)
177
177
  end
@@ -31,7 +31,7 @@ require_relative '../lib/cisco_node_utils/pim_group_list'
31
31
  include Cisco
32
32
 
33
33
  # TestPim - Minitest for PimGrouplist
34
- class TestPimGroupList < CiscoTestCase
34
+ class TestPimGrpLst < CiscoTestCase
35
35
  @skip_unless_supported = 'pim'
36
36
 
37
37
  # Enables feature pim
@@ -144,40 +144,4 @@ class TestPimGroupList < CiscoTestCase
144
144
  all_group_lists(afi)
145
145
  end
146
146
  end
147
-
148
- # Creates single invalid rp address single grouplist vrf default
149
- #---------------------------------------------------------------
150
- def create_single_invalid_rpaddr_single_grouplist_single_vrf(afi)
151
- rp_addr = '256.256.256.256'
152
- grouplist = '224.0.0.0/8'
153
- assert_raises(CliError) do
154
- PimGroupList.new(afi, 'default', rp_addr, grouplist)
155
- end
156
- end
157
-
158
- # Tests single invalid rp address single grouplist vrf default
159
- #---------------------------------------------------------------
160
- def test_single_invalid_rpaddr_single_grouplist_single_vrf
161
- %w(ipv4).each do |afi|
162
- create_single_invalid_rpaddr_single_grouplist_single_vrf(afi)
163
- end
164
- end
165
-
166
- # Creates single rp address single invalid grouplist single vrf
167
- #---------------------------------------------------------------
168
- def create_single_rpaddr_single_invalid_grouplist_single_vrf(afi)
169
- rp_addr = '25.25.25.25'
170
- grouplist = '25.0.0.0/8'
171
- assert_raises(CliError) do
172
- PimGroupList.new(afi, 'red', rp_addr, grouplist)
173
- end
174
- end
175
-
176
- # Tests single rp address single invalid grouplist single vrf
177
- #---------------------------------------------------------------
178
- def test_single_rpaddr_single_invalid_grouplist_single_vrf
179
- %w(ipv4).each do |afi|
180
- create_single_rpaddr_single_invalid_grouplist_single_vrf(afi)
181
- end
182
- end
183
147
  end
@@ -147,7 +147,7 @@ class TestPimRpAddress < CiscoTestCase
147
147
 
148
148
  # Tests single invalid rp address under vrf default
149
149
  #---------------------------------------------------
150
- def test_single_invalid_rpaddr_single_vrf
150
+ def test_rpaddr
151
151
  %w(ipv4).each do |afi|
152
152
  create_single_invalid_rpaddr_single_vrf(afi)
153
153
  end
@@ -42,7 +42,7 @@ class TestPlatform < CiscoTestCase
42
42
  if platform == :ios_xr
43
43
  assert_nil(Platform.system_image)
44
44
  elsif platform == :nexus
45
- s = @device.cmd('show version | i image').scan(/ (\S+)$/).flatten.first
45
+ s = @device.cmd('show version | inc image | exc kickstart').scan(/ (\S+)$/).flatten.first
46
46
  assert_equal(s, Platform.system_image)
47
47
  end
48
48
  end
@@ -115,16 +115,6 @@ class TestPlatform < CiscoTestCase
115
115
  assert_equal(s.gsub(/\d+ sec/, ''), Platform.uptime.gsub(/\d+ sec/, ''))
116
116
  end
117
117
 
118
- def test_last_reset
119
- s = @device.cmd('sh ver').scan(/usecs after\s+(.*)/).flatten.first
120
- if Utils.nexus_i2_image
121
- # Platform issue CSCuy72214, uncertain if this will ever be fixed in I2
122
- assert_nil(Platform.last_reset)
123
- else
124
- assert_equal(s, Platform.last_reset)
125
- end
126
- end
127
-
128
118
  def test_reset_reason
129
119
  s = @device.cmd('sh ver').scan(/Reason: (.*)/).flatten.first
130
120
  assert_equal(s, Platform.reset_reason)
@@ -221,6 +211,14 @@ class TestPlatform < CiscoTestCase
221
211
  end
222
212
 
223
213
  def test_virtual_services
214
+ if validate_property_excluded?('virtual_service', 'services')
215
+ assert_nil(node.config_get('virtual_service', 'services'))
216
+ return
217
+ end
218
+ # Only run this test if a virtual-service is installed
219
+ if config('show virtual-service global')[/services installed : 0$/]
220
+ skip('This test requires a virtual-service to be installed')
221
+ end
224
222
  # this would be beyond ugly to parse from ascii, utilize config_get
225
223
  vir_arr = node.config_get('virtual_service', 'services')
226
224
  vir_arr = [vir_arr] if vir_arr.is_a? Hash
@@ -14,6 +14,7 @@
14
14
 
15
15
  require_relative 'ciscotest'
16
16
  require_relative '../lib/cisco_node_utils/portchannel_global'
17
+ require_relative '../lib/cisco_node_utils/platform'
17
18
 
18
19
  # TestX__CLASS_NAME__X - Minitest for X__CLASS_NAME__X node utility class
19
20
  class TestPortchannelGlobal < CiscoTestCase
@@ -37,13 +38,18 @@ class TestPortchannelGlobal < CiscoTestCase
37
38
  config_no_warn "no port-channel load-balance #{ethernet}"
38
39
  end
39
40
 
41
+ def n3k_is_t2?
42
+ return unless /N3/ =~ node.product_id
43
+ Platform.chassis['descr'][/(Nexus3000 C31|Nexus 31)/] ? true : false
44
+ end
45
+
40
46
  def n3k_in_n3k_mode?
41
47
  return unless /N3/ =~ node.product_id
42
48
  mode = config('show system switch-mode')
43
49
  # note: an n3k in n9k mode displays: 'system switch-mode n9k'
44
50
  patterns = ['system switch-mode n3k',
45
- 'Switch mode configuration is not not applicable']
46
- mode[Regexp.union(patterns)] ? true : false
51
+ 'Switch mode configuration is not.*applicable']
52
+ mode.match("#{patterns[0]}|#{patterns[1]}") ? true : false
47
53
  end
48
54
 
49
55
  def create_portchannel_global(name=DEFAULT_NAME)
@@ -113,11 +119,45 @@ class TestPortchannelGlobal < CiscoTestCase
113
119
  global.resilient = global.default_resilient
114
120
  assert_equal(global.default_resilient, global.resilient)
115
121
  end
122
+ rescue Cisco::CliError => e
123
+ check_and_raise_error(e, 'This feature is not supported on this platform')
116
124
  end
117
125
 
118
- def test_load_balance_no_rotate
126
+ def test_load_balance_no_rotate_no_symmetry
119
127
  skip('Test not supported on this platform') unless n3k_in_n3k_mode?
120
128
 
129
+ global = create_portchannel_global
130
+ global.send(:port_channel_load_balance=,
131
+ 'src-dst', 'ip-only', nil, nil, false, nil, nil)
132
+ assert_equal('src-dst',
133
+ global.bundle_select)
134
+ assert_equal('ip-only',
135
+ global.bundle_hash)
136
+ assert_equal(false, global.symmetry)
137
+ global.send(
138
+ :port_channel_load_balance=,
139
+ global.default_bundle_select,
140
+ global.default_bundle_hash,
141
+ nil,
142
+ nil,
143
+ global.default_symmetry,
144
+ nil,
145
+ nil)
146
+ assert_equal(
147
+ global.default_bundle_select,
148
+ global.bundle_select)
149
+ assert_equal(
150
+ global.default_bundle_hash,
151
+ global.bundle_hash)
152
+ assert_equal(
153
+ global.default_symmetry,
154
+ global.symmetry)
155
+ end
156
+
157
+ def test_load_balance_no_rotate
158
+ skip('Test not supported on this platform') unless
159
+ n3k_is_t2? && n3k_in_n3k_mode?
160
+
121
161
  global = create_portchannel_global
122
162
  global.send(:port_channel_load_balance=,
123
163
  'src-dst', 'ip-only', nil, nil, true, nil, nil)