cisco_node_utils 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -1
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/cisco_node_utils.gemspec +1 -1
- data/docs/README-develop-node-utils-APIs.md +2 -0
- data/docs/README-maintainers.md +45 -80
- data/lib/cisco_node_utils/ace.rb +24 -43
- data/lib/cisco_node_utils/bfd_global.rb +1 -0
- data/lib/cisco_node_utils/bgp_af_aggr_addr.rb +207 -0
- data/lib/cisco_node_utils/bgp_neighbor.rb +8 -5
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +8 -6
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +40 -0
- data/lib/cisco_node_utils/cmd_ref/bfd_global.yaml +1 -1
- data/lib/cisco_node_utils/cmd_ref/bgp.yaml +8 -4
- data/lib/cisco_node_utils/cmd_ref/bgp_af_aa.yaml +38 -0
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor.yaml +9 -4
- data/lib/cisco_node_utils/cmd_ref/bgp_neighbor_af.yaml +8 -3
- data/lib/cisco_node_utils/cmd_ref/dhcp_relay_global.yaml +2 -1
- data/lib/cisco_node_utils/cmd_ref/feature.yaml +5 -0
- data/lib/cisco_node_utils/cmd_ref/interface.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/interface_channel_group.yaml +7 -3
- data/lib/cisco_node_utils/cmd_ref/inventory.yaml +3 -3
- data/lib/cisco_node_utils/cmd_ref/ntp_auth_key.yaml +10 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_config.yaml +13 -0
- data/lib/cisco_node_utils/cmd_ref/ntp_server.yaml +10 -2
- data/lib/cisco_node_utils/cmd_ref/overlay_global.yaml +6 -1
- data/lib/cisco_node_utils/cmd_ref/route_map.yaml +8 -0
- data/lib/cisco_node_utils/cmd_ref/span_session.yaml +65 -0
- data/lib/cisco_node_utils/cmd_ref/stp_global.yaml +2 -1
- data/lib/cisco_node_utils/cmd_ref/vpc.yaml +22 -3
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep.yaml +2 -1
- data/lib/cisco_node_utils/cmd_ref/vxlan_vtep_vni.yaml +6 -3
- data/lib/cisco_node_utils/cmd_ref/yum.yaml +48 -4
- data/lib/cisco_node_utils/command_reference.rb +5 -2
- data/lib/cisco_node_utils/feature.rb +14 -1
- data/lib/cisco_node_utils/interface.rb +13 -0
- data/lib/cisco_node_utils/interface_channel_group.rb +33 -25
- data/lib/cisco_node_utils/itd_device_group.rb +17 -37
- data/lib/cisco_node_utils/itd_service.rb +9 -32
- data/lib/cisco_node_utils/node.rb +12 -4
- data/lib/cisco_node_utils/ntp_auth_key.rb +67 -0
- data/lib/cisco_node_utils/ntp_config.rb +19 -1
- data/lib/cisco_node_utils/ntp_server.rb +28 -27
- data/lib/cisco_node_utils/route_map.rb +33 -51
- data/lib/cisco_node_utils/snmpuser.rb +2 -2
- data/lib/cisco_node_utils/span_session.rb +149 -0
- data/lib/cisco_node_utils/upgrade.rb +21 -17
- data/lib/cisco_node_utils/version.rb +2 -2
- data/lib/cisco_node_utils/vlan.rb +1 -1
- data/lib/cisco_node_utils/vpc.rb +40 -0
- data/lib/cisco_node_utils/yum.rb +136 -13
- data/spec/schema.yaml +2 -0
- data/tests/ciscotest.rb +36 -0
- data/tests/test_ace.rb +6 -0
- data/tests/test_bfd_global.rb +1 -7
- data/tests/test_bgp_af.rb +2 -2
- data/tests/test_bgp_af_aa.rb +108 -0
- data/tests/test_bgp_neighbor.rb +2 -1
- data/tests/test_bgp_neighbor_af.rb +6 -6
- data/tests/test_dhcp_relay_global.rb +1 -0
- data/tests/test_interface.rb +18 -2
- data/tests/test_interface_channel_group.rb +47 -0
- data/tests/test_interface_svi.rb +1 -1
- data/tests/test_ntp_auth_key.rb +77 -0
- data/tests/test_ntp_config.rb +51 -4
- data/tests/test_ntp_server.rb +69 -9
- data/tests/test_overlay_global.rb +1 -0
- data/tests/test_route_map.rb +13 -24
- data/tests/test_router_bgp.rb +14 -9
- data/tests/test_span_session.rb +155 -0
- data/tests/test_stp_global.rb +1 -0
- data/tests/test_upgrade.rb +2 -3
- data/tests/test_vlan.rb +24 -3
- data/tests/test_vlan_private.rb +1 -1
- data/tests/test_vpc.rb +42 -17
- data/tests/test_vxlan_vtep.rb +1 -0
- data/tests/test_vxlan_vtep_vni.rb +5 -1
- data/tests/test_yum.rb +7 -30
- data/tests/yum_package.yaml +20 -0
- metadata +13 -3
data/tests/test_route_map.rb
CHANGED
@@ -20,12 +20,6 @@ def evergreen_or_later?
|
|
20
20
|
true
|
21
21
|
end
|
22
22
|
|
23
|
-
def older_n9k?
|
24
|
-
return true if Utils.image_version?(/7.0.3.I2|I3|I4/) &&
|
25
|
-
node.product_id[/N9K/]
|
26
|
-
false
|
27
|
-
end
|
28
|
-
|
29
23
|
def dplus_n9k?
|
30
24
|
return true if Utils.image_version?(/7.0.3.I4/) &&
|
31
25
|
node.product_id[/N9K/]
|
@@ -340,9 +334,9 @@ class TestRouteMap < CiscoTestCase
|
|
340
334
|
end
|
341
335
|
|
342
336
|
def test_match_metric
|
343
|
-
# bug CSCvc82934 on
|
344
|
-
skip('platform not supported for this test') if
|
345
|
-
|
337
|
+
# bug CSCvc82934 on n9k running dplus
|
338
|
+
skip('platform not supported for this test') if dplus_n9k?
|
339
|
+
skip_incompat_version?('route_map', 'match_metric')
|
346
340
|
rm = create_route_map
|
347
341
|
assert_equal(rm.default_match_metric, rm.match_metric)
|
348
342
|
metric = [%w(1 0), %w(8 0), %w(224 9), %w(23 0), %w(5 8), %w(6 0)]
|
@@ -430,7 +424,6 @@ class TestRouteMap < CiscoTestCase
|
|
430
424
|
end
|
431
425
|
|
432
426
|
def test_match_ospf_area
|
433
|
-
skip('platform not supported for this test') unless evergreen_or_later?
|
434
427
|
rm = create_route_map
|
435
428
|
if validate_property_excluded?('route_map', 'match_ospf_area')
|
436
429
|
assert_nil(rm.match_ospf_area)
|
@@ -439,6 +432,7 @@ class TestRouteMap < CiscoTestCase
|
|
439
432
|
end
|
440
433
|
return
|
441
434
|
end
|
435
|
+
skip_incompat_version?('route_map', 'match_ospf_area')
|
442
436
|
assert_equal(rm.default_match_ospf_area, rm.match_ospf_area)
|
443
437
|
array = %w(10 7 222)
|
444
438
|
rm.match_ospf_area = array
|
@@ -678,7 +672,7 @@ class TestRouteMap < CiscoTestCase
|
|
678
672
|
end
|
679
673
|
|
680
674
|
def test_set_ipv4_next_hop_redist
|
681
|
-
|
675
|
+
skip_incompat_version?('route_map', 'set_ipv4_next_hop_redist')
|
682
676
|
rm = lset_ip_next_hop_helper(v4red: true)
|
683
677
|
assert(rm.set_ipv4_next_hop_redist)
|
684
678
|
hash = {}
|
@@ -1001,9 +995,8 @@ class TestRouteMap < CiscoTestCase
|
|
1001
995
|
|
1002
996
|
def test_set_ipv4_next_hop_load_share
|
1003
997
|
# bug on fretta
|
1004
|
-
skip('platform not supported for this test') if node.product_id[/(N5|N6
|
1005
|
-
|
1006
|
-
skip('platform not supported for this test') if older_n9k?
|
998
|
+
skip('platform not supported for this test') if node.product_id[/(N5|N6)/]
|
999
|
+
skip_incompat_version?('route_map', 'set_ipv4_next_hop_load_share')
|
1007
1000
|
arr = %w(1.1.1.1 2.2.2.2 3.3.3.3)
|
1008
1001
|
rm = lset_ip_next_hop_helper(v4nh: arr)
|
1009
1002
|
assert_equal(arr, rm.set_ipv4_next_hop)
|
@@ -1034,7 +1027,7 @@ class TestRouteMap < CiscoTestCase
|
|
1034
1027
|
end
|
1035
1028
|
|
1036
1029
|
def test_set_ipv6_next_hop_redist
|
1037
|
-
|
1030
|
+
skip_incompat_version?('route_map', 'set_ipv6_next_hop_redist')
|
1038
1031
|
rm = lset_ip_next_hop_helper(v6red: true)
|
1039
1032
|
assert(rm.set_ipv6_next_hop_redist)
|
1040
1033
|
hash = {}
|
@@ -1102,9 +1095,8 @@ class TestRouteMap < CiscoTestCase
|
|
1102
1095
|
|
1103
1096
|
def test_set_ipv6_next_hop_load_share
|
1104
1097
|
# bug on fretta
|
1105
|
-
skip('platform not supported for this test') if node.product_id[/(N5|N6
|
1106
|
-
|
1107
|
-
skip('platform not supported for this test') if older_n9k?
|
1098
|
+
skip('platform not supported for this test') if node.product_id[/(N5|N6)/]
|
1099
|
+
skip_incompat_version?('route_map', 'set_ipv6_next_hop_load_share')
|
1108
1100
|
arr = %w(2000::1 2000::11 2000::22)
|
1109
1101
|
rm = lset_ip_next_hop_helper(v6nh: arr)
|
1110
1102
|
assert_equal(arr, rm.set_ipv6_next_hop)
|
@@ -1128,8 +1120,7 @@ class TestRouteMap < CiscoTestCase
|
|
1128
1120
|
def test_set_community_no_asn
|
1129
1121
|
# bug on n5/6k
|
1130
1122
|
skip('platform not supported for this test') if node.product_id[/(N5|N6)/]
|
1131
|
-
|
1132
|
-
skip('platform not supported for this test') if older_n9k?
|
1123
|
+
skip_incompat_version?('route_map', 'set_community')
|
1133
1124
|
rm = create_route_map
|
1134
1125
|
assert_equal(rm.default_set_community_additive,
|
1135
1126
|
rm.set_community_additive)
|
@@ -1228,8 +1219,7 @@ class TestRouteMap < CiscoTestCase
|
|
1228
1219
|
end
|
1229
1220
|
|
1230
1221
|
def test_set_community_asn
|
1231
|
-
|
1232
|
-
skip('platform not supported for this test') if older_n9k?
|
1222
|
+
skip_incompat_version?('route_map', 'set_community')
|
1233
1223
|
rm = create_route_map
|
1234
1224
|
none = false
|
1235
1225
|
noadv = true
|
@@ -1285,8 +1275,7 @@ class TestRouteMap < CiscoTestCase
|
|
1285
1275
|
end
|
1286
1276
|
|
1287
1277
|
def test_extcommunity_4bytes
|
1288
|
-
|
1289
|
-
skip('platform not supported for this test') if node.product_id[/N9.*-F/]
|
1278
|
+
skip_incompat_version?('route_map', 'set_extcommunity_4bytes')
|
1290
1279
|
rm = create_route_map
|
1291
1280
|
assert_equal(rm.default_set_extcommunity_4bytes_transitive,
|
1292
1281
|
rm.set_extcommunity_4bytes_transitive)
|
data/tests/test_router_bgp.rb
CHANGED
@@ -64,7 +64,7 @@ def newer_image_version?
|
|
64
64
|
new = true
|
65
65
|
new = false if Utils.image_version?(/7.0.3.I2|I3|I4/) ||
|
66
66
|
node.product_id[/(N5|N6|N7|N9.*-F)/]
|
67
|
-
new = true if Utils.image_version?(/8.0/)
|
67
|
+
new = true if Utils.image_version?(/8.0|8.1/)
|
68
68
|
new
|
69
69
|
end
|
70
70
|
|
@@ -503,7 +503,7 @@ class TestRouterBgp < CiscoTestCase
|
|
503
503
|
end
|
504
504
|
|
505
505
|
def test_disable_policy_batching_ipv4
|
506
|
-
if platform == :ios_xr || node.product_id[/N(5|6
|
506
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
507
507
|
b = RouterBgp.new(1)
|
508
508
|
assert_nil(b.disable_policy_batching_ipv4)
|
509
509
|
assert_nil(b.default_disable_policy_batching_ipv4)
|
@@ -512,6 +512,7 @@ class TestRouterBgp < CiscoTestCase
|
|
512
512
|
end
|
513
513
|
return
|
514
514
|
end
|
515
|
+
skip_incompat_version?('bgp', 'disable_policy_batching_ipv4')
|
515
516
|
bgp = setup_default
|
516
517
|
default = bgp.default_disable_policy_batching_ipv4
|
517
518
|
assert_equal(default, bgp.disable_policy_batching_ipv4,
|
@@ -532,7 +533,7 @@ class TestRouterBgp < CiscoTestCase
|
|
532
533
|
end
|
533
534
|
|
534
535
|
def test_disable_policy_batching_ipv6
|
535
|
-
if platform == :ios_xr || node.product_id[/N(5|6
|
536
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
536
537
|
b = RouterBgp.new(1)
|
537
538
|
assert_nil(b.disable_policy_batching_ipv6)
|
538
539
|
assert_nil(b.default_disable_policy_batching_ipv6)
|
@@ -541,6 +542,7 @@ class TestRouterBgp < CiscoTestCase
|
|
541
542
|
end
|
542
543
|
return
|
543
544
|
end
|
545
|
+
skip_incompat_version?('bgp', 'disable_policy_batching_ipv6')
|
544
546
|
bgp = setup_default
|
545
547
|
default = bgp.default_disable_policy_batching_ipv6
|
546
548
|
assert_equal(default, bgp.disable_policy_batching_ipv6,
|
@@ -669,7 +671,7 @@ class TestRouterBgp < CiscoTestCase
|
|
669
671
|
assert_equal('false', bgp.event_history_errors)
|
670
672
|
bgp.event_history_errors = 'size_small'
|
671
673
|
assert_equal('size_small', bgp.event_history_errors) unless
|
672
|
-
Utils.image_version?(/8.0/)
|
674
|
+
Utils.image_version?(/8.0|8.1/)
|
673
675
|
bgp.event_history_errors = 'size_large'
|
674
676
|
assert_equal('size_large', bgp.event_history_errors)
|
675
677
|
bgp.event_history_errors = 'size_medium'
|
@@ -756,7 +758,7 @@ class TestRouterBgp < CiscoTestCase
|
|
756
758
|
bgp.event_history_periodic)
|
757
759
|
bgp.event_history_periodic = 'false'
|
758
760
|
assert_equal('false', bgp.event_history_periodic) unless
|
759
|
-
Utils.image_version?(/8.0/)
|
761
|
+
Utils.image_version?(/8.0|8.1/)
|
760
762
|
bgp.event_history_periodic = 'size_small'
|
761
763
|
assert_equal('size_small', bgp.event_history_periodic)
|
762
764
|
bgp.event_history_periodic = 'size_large'
|
@@ -775,7 +777,7 @@ class TestRouterBgp < CiscoTestCase
|
|
775
777
|
bgp.event_history_periodic = 'true'
|
776
778
|
if newer_image_version?
|
777
779
|
assert_equal('true', bgp.event_history_periodic) unless
|
778
|
-
Utils.image_version?(/8.0/)
|
780
|
+
Utils.image_version?(/8.0|8.1/)
|
779
781
|
else
|
780
782
|
assert_equal(bgp.default_event_history_periodic,
|
781
783
|
bgp.event_history_periodic)
|
@@ -1148,7 +1150,7 @@ class TestRouterBgp < CiscoTestCase
|
|
1148
1150
|
end
|
1149
1151
|
|
1150
1152
|
def test_neighbor_down_fib_accelerate
|
1151
|
-
if platform == :ios_xr || node.product_id[/N(5|6
|
1153
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
1152
1154
|
b = RouterBgp.new(1)
|
1153
1155
|
assert_nil(b.neighbor_down_fib_accelerate)
|
1154
1156
|
assert_nil(b.default_neighbor_down_fib_accelerate)
|
@@ -1157,6 +1159,7 @@ class TestRouterBgp < CiscoTestCase
|
|
1157
1159
|
end
|
1158
1160
|
return
|
1159
1161
|
end
|
1162
|
+
skip_incompat_version?('bgp', 'neighbor_down_fib_accelerate')
|
1160
1163
|
%w(test_default test_vrf).each do |t|
|
1161
1164
|
if t == 'test_default'
|
1162
1165
|
bgp = setup_default
|
@@ -1184,7 +1187,7 @@ class TestRouterBgp < CiscoTestCase
|
|
1184
1187
|
end
|
1185
1188
|
|
1186
1189
|
def test_reconnect_interval
|
1187
|
-
if platform == :ios_xr || node.product_id[/N(5|6
|
1190
|
+
if platform == :ios_xr || node.product_id[/N(5|6)/]
|
1188
1191
|
b = RouterBgp.new(1)
|
1189
1192
|
assert_nil(b.reconnect_interval)
|
1190
1193
|
assert_nil(b.default_reconnect_interval)
|
@@ -1193,6 +1196,7 @@ class TestRouterBgp < CiscoTestCase
|
|
1193
1196
|
end
|
1194
1197
|
return
|
1195
1198
|
end
|
1199
|
+
skip_incompat_version?('bgp', 'reconnect_interval')
|
1196
1200
|
%w(test_default test_vrf).each do |t|
|
1197
1201
|
if t == 'test_default'
|
1198
1202
|
bgp = setup_default
|
@@ -1221,6 +1225,7 @@ class TestRouterBgp < CiscoTestCase
|
|
1221
1225
|
assert_nil(bgp.reconnect_interval,
|
1222
1226
|
'reconnect_interval should return nil on XR')
|
1223
1227
|
else
|
1228
|
+
skip_incompat_version?('bgp', 'reconnect_interval')
|
1224
1229
|
assert_equal(bgp.default_reconnect_interval, bgp.reconnect_interval,
|
1225
1230
|
"reconnect_interval should be set to default value of '60'")
|
1226
1231
|
bgp.destroy
|
@@ -1315,7 +1320,7 @@ class TestRouterBgp < CiscoTestCase
|
|
1315
1320
|
end
|
1316
1321
|
|
1317
1322
|
def test_suppress_fib_pending
|
1318
|
-
skip_legacy_defect?('7.0.3.I4
|
1323
|
+
skip_legacy_defect?('7.0.3.I4',
|
1319
1324
|
'CSCvd41536: Unable to remove suppress-fib-pending')
|
1320
1325
|
bgp = setup_default
|
1321
1326
|
if validate_property_excluded?('bgp', 'suppress_fib_pending')
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require_relative 'ciscotest'
|
2
|
+
require_relative '../lib/cisco_node_utils/span_session'
|
3
|
+
require_relative '../lib/cisco_node_utils/interface'
|
4
|
+
require_relative '../lib/cisco_node_utils/vlan'
|
5
|
+
require_relative '../lib/cisco_node_utils/cisco_cmn_utils'
|
6
|
+
|
7
|
+
include Cisco
|
8
|
+
|
9
|
+
# TestSpanSession - Minitest for SPAN session node utility
|
10
|
+
class TestSpanSession < CiscoTestCase
|
11
|
+
@skip_unless_supported = 'span_session'
|
12
|
+
@@cleaned = false # rubocop:disable Style/ClassVars
|
13
|
+
|
14
|
+
def setup
|
15
|
+
super
|
16
|
+
cleanup unless @@cleaned
|
17
|
+
@@cleaned = true # rubocop:disable Style/ClassVars
|
18
|
+
end
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
cleanup
|
22
|
+
end
|
23
|
+
|
24
|
+
def cleanup
|
25
|
+
SpanSession.sessions.each do |_session, obj|
|
26
|
+
obj.destroy
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_create_new_session
|
31
|
+
span = SpanSession.new(1)
|
32
|
+
|
33
|
+
assert_equal(span.session_id, 1)
|
34
|
+
assert_equal(span.type, 'local') # default session type
|
35
|
+
assert(span.shutdown)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_remove_session
|
39
|
+
span = SpanSession.new(1)
|
40
|
+
span.destroy
|
41
|
+
refute(span.session_id, 'Session was not cleaned up correctly...')
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_create_session_invalid_id
|
45
|
+
e = assert_raises(CliError) { SpanSession.new(33) }
|
46
|
+
assert_match(/Invalid value.range/, e.message)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_session_type
|
50
|
+
span = SpanSession.new(2)
|
51
|
+
erspan_type = 'erspan-source'
|
52
|
+
span.type = erspan_type
|
53
|
+
assert_equal(span.type, erspan_type)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_session_description
|
57
|
+
span = SpanSession.new(3)
|
58
|
+
desc = 'SPAN session 1'
|
59
|
+
span.description = desc
|
60
|
+
assert_equal(span.description, desc)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_session_source_interfaces
|
64
|
+
span = SpanSession.new(4)
|
65
|
+
po_int = Interface.new('port-channel1')
|
66
|
+
int1 = interfaces[0]
|
67
|
+
int2 = interfaces[1]
|
68
|
+
int3 = interfaces[2]
|
69
|
+
|
70
|
+
# Test default case
|
71
|
+
assert_equal(span.default_source_interfaces, span.source_interfaces)
|
72
|
+
|
73
|
+
# Non-default case
|
74
|
+
intla = { int1 => 'rx',
|
75
|
+
int2 => 'tx',
|
76
|
+
'port-channel1' => 'both',
|
77
|
+
'sup-eth0' => 'rx' }
|
78
|
+
|
79
|
+
span.source_interfaces = intla
|
80
|
+
assert_equal(intla.to_a.sort, span.source_interfaces.sort)
|
81
|
+
|
82
|
+
# intla and intlb are identical
|
83
|
+
intlb = { int1 => 'rx',
|
84
|
+
int2 => 'tx',
|
85
|
+
'port-channel1' => 'both',
|
86
|
+
'sup-eth0' => 'rx' }
|
87
|
+
|
88
|
+
span.source_interfaces = intlb
|
89
|
+
assert_equal(intlb.to_a.sort, span.source_interfaces.sort)
|
90
|
+
|
91
|
+
# intla/c same size but 1 element different
|
92
|
+
intlc = { int2 => 'both',
|
93
|
+
int1 => 'rx',
|
94
|
+
'port-channel1' => 'both',
|
95
|
+
'sup-eth0' => 'rx' }
|
96
|
+
|
97
|
+
span.source_interfaces = intlc
|
98
|
+
assert_equal(intlc.to_a.sort, span.source_interfaces.sort)
|
99
|
+
|
100
|
+
# intla/d different sizes and diff/same elements
|
101
|
+
intld = { int2 => 'tx',
|
102
|
+
int1 => 'both',
|
103
|
+
'port-channel1' => 'both' }
|
104
|
+
|
105
|
+
span.source_interfaces = intld
|
106
|
+
assert_equal(intld.to_a.sort, span.source_interfaces.sort)
|
107
|
+
|
108
|
+
# Empty list
|
109
|
+
intle = {}
|
110
|
+
|
111
|
+
span.source_interfaces = intle
|
112
|
+
assert_equal(intle.to_a.sort, span.source_interfaces.sort)
|
113
|
+
|
114
|
+
# intlf is larger then intla
|
115
|
+
intlf = { int3 => 'both',
|
116
|
+
int1 => 'rx',
|
117
|
+
int2 => 'tx',
|
118
|
+
'port-channel1' => 'both',
|
119
|
+
'sup-eth0' => 'rx' }
|
120
|
+
|
121
|
+
span.source_interfaces = intlf
|
122
|
+
assert_equal(intlf.to_a.sort, span.source_interfaces.sort)
|
123
|
+
|
124
|
+
po_int.destroy
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_session_source_vlans
|
128
|
+
span = SpanSession.new(5)
|
129
|
+
|
130
|
+
# Default case
|
131
|
+
assert_equal(span.source_vlans, span.default_source_vlans)
|
132
|
+
|
133
|
+
# Non-default case
|
134
|
+
vlans = %w(1 2-5 6)
|
135
|
+
span.source_vlans = { vlans: vlans, direction: 'rx' }
|
136
|
+
assert_equal(%w(1-6), span.source_vlans[0])
|
137
|
+
assert_equal('rx', span.source_vlans[1])
|
138
|
+
|
139
|
+
vlans = %w(1 3-4 6)
|
140
|
+
span.source_vlans = { vlans: vlans, direction: 'rx' }
|
141
|
+
assert_equal(%w(1 3-4 6), span.source_vlans[0])
|
142
|
+
assert_equal('rx', span.source_vlans[1])
|
143
|
+
|
144
|
+
# Set back to default
|
145
|
+
span.source_vlans = { vlans: [], direction: '' }
|
146
|
+
assert_equal(span.source_vlans, span.default_source_vlans)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_session_destination_int
|
150
|
+
span = SpanSession.new(6)
|
151
|
+
dest_int = interfaces[2]
|
152
|
+
span.destination = dest_int
|
153
|
+
assert_equal(span.destination, dest_int)
|
154
|
+
end
|
155
|
+
end
|
data/tests/test_stp_global.rb
CHANGED
data/tests/test_upgrade.rb
CHANGED
@@ -80,8 +80,7 @@ class TestUpgrade < CiscoTestCase
|
|
80
80
|
|
81
81
|
def test_upgrade
|
82
82
|
image_info = preconfig_upgrade_info
|
83
|
-
|
84
|
-
Upgrade.upgrade(version, image_info['install_image'], image_info['install_uri'])
|
83
|
+
Upgrade.upgrade(image_info['install_image'], image_info['install_uri'])
|
85
84
|
# Wait 15 seconds for device to start rebooting
|
86
85
|
# TODO : Consider getting the sleep value dynamically
|
87
86
|
sleep 15
|
@@ -100,7 +99,7 @@ class TestUpgrade < CiscoTestCase
|
|
100
99
|
image = image_uri.split('/')[-1]
|
101
100
|
uri = image_uri.split('/')[0]
|
102
101
|
skip('Boot image not on bootflash:') unless uri == 'bootflash:'
|
103
|
-
Upgrade.upgrade(
|
102
|
+
Upgrade.upgrade(image, uri)
|
104
103
|
assert(Upgrade.upgraded?)
|
105
104
|
end
|
106
105
|
end
|
data/tests/test_vlan.rb
CHANGED
@@ -127,7 +127,7 @@ class TestVlan < CiscoTestCase
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def test_name_zero_length
|
130
|
-
skip_legacy_defect?('7.0.3.I5.2',
|
130
|
+
skip_legacy_defect?('7.0.3.I5.2|7.0.3.I5.3',
|
131
131
|
'CSCvd09257: Configuration of vlan name via nxapi should be noop')
|
132
132
|
v = Vlan.new(1000)
|
133
133
|
v.vlan_name = ''
|
@@ -161,6 +161,27 @@ class TestVlan < CiscoTestCase
|
|
161
161
|
config 'no system vlan long-name'
|
162
162
|
end
|
163
163
|
|
164
|
+
def test_id_similar
|
165
|
+
config 'system vlan long-name'
|
166
|
+
v2 = Vlan.new(2)
|
167
|
+
v102 = Vlan.new(102)
|
168
|
+
v222 = Vlan.new(222)
|
169
|
+
|
170
|
+
v2.vlan_name = 'NEW_YORK_OFFICE'
|
171
|
+
v102.vlan_name = 'RALEIGH_OFFICE'
|
172
|
+
long_name = 'LONG_NAME' + ('E' * 119)
|
173
|
+
v222.vlan_name = long_name
|
174
|
+
|
175
|
+
assert_equal('NEW_YORK_OFFICE', v2.vlan_name)
|
176
|
+
assert_equal('RALEIGH_OFFICE', v102.vlan_name)
|
177
|
+
assert_equal(long_name, v222.vlan_name)
|
178
|
+
|
179
|
+
v2.destroy
|
180
|
+
v102.destroy
|
181
|
+
v222.destroy
|
182
|
+
config 'no system vlan long-name'
|
183
|
+
end
|
184
|
+
|
164
185
|
def test_state_invalid
|
165
186
|
v = Vlan.new(1000)
|
166
187
|
assert_raises(CliError) do
|
@@ -186,7 +207,7 @@ class TestVlan < CiscoTestCase
|
|
186
207
|
|
187
208
|
def test_shutdown_extended
|
188
209
|
v = Vlan.new(2000)
|
189
|
-
assert_raises(
|
210
|
+
assert_raises(CliError, 'vlan misconfig did not raise CliError') do
|
190
211
|
v.shutdown = 'shutdown'
|
191
212
|
end
|
192
213
|
v.destroy
|
@@ -317,7 +338,7 @@ class TestVlan < CiscoTestCase
|
|
317
338
|
assert(vlan.fabric_control)
|
318
339
|
another_vlan = Vlan.new(101)
|
319
340
|
|
320
|
-
assert_raises(
|
341
|
+
assert_raises(CliError,
|
321
342
|
'VLAN misconfig did not raise CliError') do
|
322
343
|
another_vlan.fabric_control = true
|
323
344
|
end
|