Skip to content

Commit b44613b

Browse files
Merge pull request #391 from chrisvanheuveln/test_f3_deps
vxlan/f3 test dependencies
2 parents 5e6f5d4 + 63009f2 commit b44613b

5 files changed

+33
-25
lines changed

tests/ciscotest.rb

+14
Original file line numberDiff line numberDiff line change
@@ -329,4 +329,18 @@ def restore_resolv_file(filename, context='bash')
329329
shell_command("sudo cp #{filename} /etc/resolv.conf", context)
330330
shell_command("rm #{filename}", context)
331331
end
332+
333+
# VDC helper for features that require a specific linecard.
334+
# Allows caller to get current state or change it to a new value.
335+
def vdc_lc_state(type=nil)
336+
return unless node.product_id[/N7/]
337+
vxlan_linecard? if type && type[/F3/i]
338+
v = Vdc.new('default')
339+
if type
340+
# This action may be time consuming, use only if necessary.
341+
v.limit_resource_module_type = type
342+
else
343+
v.limit_resource_module_type
344+
end
345+
end
332346
end

tests/test_feature.rb

+8-25
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,6 @@ class TestFeature < CiscoTestCase
2626
# Helpers #
2727
###########
2828

29-
# VDC helper for features that require a specific linecard.
30-
# Allows caller to get current state or change it to a new value.
31-
def vdc_lc_state(type=nil)
32-
v = Vdc.new('default')
33-
if type
34-
# This action may be time consuming, use only if necessary.
35-
v.limit_resource_module_type = type
36-
else
37-
v.limit_resource_module_type
38-
end
39-
end
40-
4129
# feature test helper
4230
def feature(feat)
4331
# Get the feature name string from the yaml
@@ -97,8 +85,12 @@ def test_nv_overlay
9785
assert_raises(Cisco::UnsupportedError) { Feature.nv_overlay_enable }
9886
return
9987
end
88+
89+
# Dependency setup
10090
vxlan_linecard?
91+
vdc_lc_state('f3')
10192
config_no_warn('no feature-set fabricpath')
93+
10294
feature('nv_overlay')
10395
end
10496

@@ -108,8 +100,8 @@ def test_nv_overlay_evpn
108100
assert_raises(Cisco::UnsupportedError) { Feature.nv_overlay_evpn_enable }
109101
return
110102
end
111-
vdc_current = node.product_id[/N7/] ? vdc_lc_state : nil
112-
vdc_lc_state('f3') if vdc_current
103+
vxlan_linecard?
104+
vdc_lc_state('f3')
113105

114106
# nv_overlay_evpn can't use the 'feature' helper so test it explicitly here
115107
# Get current state of feature, then disable it
@@ -125,10 +117,6 @@ def test_nv_overlay_evpn
125117
Feature.nv_overlay_evpn_enable
126118
assert(Feature.nv_overlay_evpn_enabled?,
127119
"(#{feat_str}) is not enabled")
128-
129-
# Return testbed to pre-clean state
130-
config("no #{feat_str}") unless pre_clean_enabled
131-
vdc_lc_state(vdc_current) if vdc_current
132120
end
133121

134122
def test_ospf
@@ -156,9 +144,9 @@ def test_vn_segment_vlan_based
156144
end
157145

158146
def test_vni
147+
# Dependency setup
159148
vxlan_linecard?
160-
vdc_current = node.product_id[/N7/] ? vdc_lc_state : nil
161-
vdc_lc_state('f3') if vdc_current
149+
vdc_lc_state('f3')
162150

163151
if node.product_id[/N(5|6)/]
164152
Feature.nv_overlay_enable
@@ -167,7 +155,6 @@ def test_vni
167155
config_no_warn('no feature nv overlay')
168156
end
169157
feature('vni')
170-
vdc_lc_state(vdc_current) if vdc_current
171158
rescue RuntimeError => e
172159
hardware_supports_feature?(e.message)
173160
end
@@ -190,10 +177,7 @@ def test_feature_set_fabric
190177
# Get current state of the feature-set
191178
feature_set_installed = Feature.fabric_installed?
192179
feature_enabled = Feature.fabric_enabled?
193-
vdc_current = node.product_id[/N7/] ? vdc_lc_state : nil
194180

195-
# clean
196-
vdc_lc_state('f3') if vdc_current
197181
config("no #{fs} ; no install #{fs}") if feature_set_installed
198182
refute_show_match(
199183
command: "show running | i '^install #{fs}$'",
@@ -207,7 +191,6 @@ def test_feature_set_fabric
207191
# Return testbed to pre-clean state
208192
config("no #{fs}") unless feature_enabled
209193
config("no install #{fs}") unless feature_set_installed
210-
vdc_lc_state(vdc_current) if vdc_current
211194
end
212195

213196
def test_feature_set_fex

tests/test_overlay_global.rb

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class TestOverlayGlobal < CiscoTestCase
2525

2626
def setup
2727
super
28+
vxlan_linecard?
29+
vdc_lc_state('f3')
2830
config_no_warn('no feature fabric forwarding')
2931
config_no_warn('no nv overlay evpn')
3032
config_no_warn('l2rib dup-host-mac-detection default')

tests/test_vrf.rb

+4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ def test_vni
194194

195195
def test_route_distinguisher
196196
skip_nexus_i2_image?
197+
# Check for compatible linecard (if platform requires it) and set it up
198+
vxlan_linecard?
199+
vdc_lc_state('f3')
200+
197201
v = Vrf.new('green')
198202
if validate_property_excluded?('vrf', 'route_distinguisher')
199203
# Must be configured under BGP in IOS XR

tests/test_vrf_af.rb

+5
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ def test_route_target
115115
end
116116

117117
def route_target(af)
118+
#
119+
# TBD: The evpn parts of this test need to check for compatible linecards to
120+
# skip the evpn portions. Don't use vxlan_linecard? as that will cause all
121+
# tests to be skipped.
122+
#
118123
# Common tester for route-target properties. Tests evpn and non-evpn.
119124
# route_target_both_auto
120125
# route_target_both_auto_evpn

0 commit comments

Comments
 (0)