cisco_node_utils 1.0.1 → 1.1.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.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +81 -1
- data/.travis.yml +9 -0
- data/CHANGELOG.md +72 -6
- data/CONTRIBUTING.md +32 -7
- data/README.md +70 -7
- data/Rakefile +17 -0
- data/bin/check_metric_limits.rb +109 -0
- data/bin/git/hooks/commit-msg/enforce_style +81 -0
- data/bin/git/hooks/hook_lib +108 -0
- data/bin/git/hooks/hooks-wrapper +38 -0
- data/bin/git/hooks/post-flow-hotfix-start/update-version +24 -0
- data/bin/git/hooks/post-flow-release-finish/update-version +29 -0
- data/bin/git/hooks/post-flow-release-start/update-version +19 -0
- data/bin/git/hooks/post-merge/update-hooks +6 -0
- data/bin/git/hooks/post-rewrite/update-hooks +6 -0
- data/bin/git/hooks/pre-commit/rubocop +20 -0
- data/bin/git/hooks/pre-commit/validate-diffs +31 -0
- data/bin/git/hooks/pre-push/check-changelog +24 -0
- data/bin/git/hooks/pre-push/rubocop +7 -0
- data/bin/git/update-hooks +65 -0
- data/cisco_node_utils.gemspec +9 -3
- data/docs/README-develop-best-practices.md +404 -0
- data/docs/README-develop-node-utils-APIs.md +215 -365
- data/docs/README-maintainers.md +33 -3
- data/docs/template-router.rb +89 -91
- data/docs/template-test_router.rb +52 -55
- data/lib/.rubocop.yml +18 -0
- data/lib/cisco_node_utils.rb +2 -19
- data/lib/cisco_node_utils/README_YAML.md +1 -9
- data/lib/cisco_node_utils/bgp.rb +664 -0
- data/lib/cisco_node_utils/bgp_af.rb +530 -0
- data/lib/cisco_node_utils/bgp_neighbor.rb +425 -0
- data/lib/cisco_node_utils/bgp_neighbor_af.rb +709 -0
- data/lib/cisco_node_utils/cisco_cmn_utils.rb +59 -25
- data/lib/cisco_node_utils/command_reference.rb +72 -74
- data/lib/cisco_node_utils/command_reference_common.yaml +174 -9
- data/lib/cisco_node_utils/command_reference_common_bgp.yaml +535 -0
- data/lib/cisco_node_utils/command_reference_n7k.yaml +4 -0
- data/lib/cisco_node_utils/command_reference_n9k.yaml +0 -9
- data/lib/cisco_node_utils/configparser_lib.rb +152 -147
- data/lib/cisco_node_utils/dns_domain.rb +79 -0
- data/lib/cisco_node_utils/domain_name.rb +71 -0
- data/lib/cisco_node_utils/interface.rb +167 -161
- data/lib/cisco_node_utils/interface_ospf.rb +78 -81
- data/lib/cisco_node_utils/name_server.rb +64 -0
- data/lib/cisco_node_utils/node.rb +154 -198
- data/lib/cisco_node_utils/node_util.rb +61 -0
- data/lib/cisco_node_utils/ntp_config.rb +65 -0
- data/lib/cisco_node_utils/ntp_server.rb +76 -0
- data/lib/cisco_node_utils/platform.rb +174 -165
- data/lib/cisco_node_utils/radius_global.rb +146 -0
- data/lib/cisco_node_utils/radius_server.rb +295 -0
- data/lib/cisco_node_utils/router_ospf.rb +59 -63
- data/lib/cisco_node_utils/router_ospf_vrf.rb +226 -210
- data/lib/cisco_node_utils/snmpcommunity.rb +52 -58
- data/lib/cisco_node_utils/snmpgroup.rb +22 -23
- data/lib/cisco_node_utils/snmpserver.rb +99 -103
- data/lib/cisco_node_utils/snmpuser.rb +294 -274
- data/lib/cisco_node_utils/syslog_server.rb +92 -0
- data/lib/cisco_node_utils/syslog_settings.rb +69 -0
- data/lib/cisco_node_utils/tacacs_server.rb +137 -133
- data/lib/cisco_node_utils/tacacs_server_host.rb +84 -87
- data/lib/cisco_node_utils/version.rb +2 -1
- data/lib/cisco_node_utils/vlan.rb +28 -31
- data/lib/cisco_node_utils/vrf.rb +80 -0
- data/lib/cisco_node_utils/vtp.rb +100 -97
- data/lib/cisco_node_utils/yum.rb +15 -17
- data/tests/.rubocop.yml +15 -0
- data/tests/basetest.rb +81 -36
- data/tests/ciscotest.rb +38 -78
- data/{lib/cisco_node_utils → tests}/platform_info.rb +12 -8
- data/{lib/cisco_node_utils → tests}/platform_info.yaml +1 -1
- data/tests/test_bgp_af.rb +920 -0
- data/tests/test_bgp_neighbor.rb +403 -0
- data/tests/test_bgp_neighbor_af.rb +589 -0
- data/tests/test_command_config.rb +65 -62
- data/tests/test_command_reference.rb +31 -45
- data/tests/test_dns_domain.rb +113 -0
- data/tests/test_domain_name.rb +86 -0
- data/tests/test_interface.rb +424 -548
- data/tests/test_interface_ospf.rb +248 -432
- data/tests/test_interface_svi.rb +56 -79
- data/tests/test_interface_switchport.rb +196 -272
- data/tests/test_name_server.rb +85 -0
- data/tests/test_node.rb +7 -6
- data/tests/test_node_ext.rb +133 -186
- data/tests/test_ntp_config.rb +49 -0
- data/tests/test_ntp_server.rb +74 -0
- data/tests/test_platform.rb +58 -37
- data/tests/test_radius_global.rb +78 -0
- data/tests/test_radius_server.rb +185 -0
- data/tests/test_router_bgp.rb +838 -0
- data/tests/test_router_ospf.rb +49 -80
- data/tests/test_router_ospf_vrf.rb +274 -392
- data/tests/test_snmpcommunity.rb +128 -172
- data/tests/test_snmpgroup.rb +12 -14
- data/tests/test_snmpserver.rb +160 -189
- data/tests/test_snmpuser.rb +568 -717
- data/tests/test_syslog_server.rb +88 -0
- data/tests/test_syslog_settings.rb +54 -0
- data/tests/test_tacacs_server.rb +113 -148
- data/tests/test_tacacs_server_host.rb +108 -161
- data/tests/test_vlan.rb +63 -79
- data/tests/test_vrf.rb +92 -0
- data/tests/test_vtp.rb +108 -126
- data/tests/test_yum.rb +47 -41
- metadata +92 -56
- data/.rubocop_todo.yml +0 -293
- data/docs/.rubocop.yml +0 -13
- data/docs/template-feature.rb +0 -45
- data/docs/template-test_feature.rb +0 -51
- data/tests/test_all_cisco.rb +0 -46
data/tests/test_router_ospf.rb
CHANGED
|
@@ -12,153 +12,122 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/router_ospf'
|
|
17
17
|
|
|
18
|
+
# TestRouterOspf - Minitest for the RouterOspf node utility class.
|
|
18
19
|
class TestRouterOspf < CiscoTestCase
|
|
19
|
-
def
|
|
20
|
-
|
|
20
|
+
def setup
|
|
21
|
+
super
|
|
22
|
+
@default_show_command = "show run | include '^router ospf .*'"
|
|
21
23
|
end
|
|
22
24
|
|
|
23
|
-
def
|
|
24
|
-
|
|
25
|
-
cmd = "router ospf"
|
|
26
|
-
line = /#{cmd}\s#{name}/.match(s)
|
|
25
|
+
def routerospf_routers_destroy(routers)
|
|
26
|
+
routers.each_value(&:destroy)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def test_routerospf_collection_empty
|
|
30
|
-
|
|
31
|
-
s = @device.cmd("no feature ospf")
|
|
32
|
-
s = @device.cmd("end")
|
|
33
|
-
node.cache_flush
|
|
30
|
+
config('no feature ospf')
|
|
34
31
|
routers = RouterOspf.routers
|
|
35
|
-
assert_equal(true, routers.empty
|
|
36
|
-
|
|
32
|
+
assert_equal(true, routers.empty?,
|
|
33
|
+
'RouterOspf collection is not empty')
|
|
37
34
|
end
|
|
38
35
|
|
|
39
36
|
def test_routerospf_collection_not_empty
|
|
40
|
-
|
|
41
|
-
s = @device.cmd("feature ospf")
|
|
42
|
-
s = @device.cmd("router ospf TestOSPF")
|
|
43
|
-
s = @device.cmd("router ospf 100")
|
|
44
|
-
s = @device.cmd("end")
|
|
45
|
-
node.cache_flush
|
|
37
|
+
config('feature ospf', 'router ospf TestOSPF', 'router ospf 100')
|
|
46
38
|
routers = RouterOspf.routers
|
|
47
|
-
assert_equal(false, routers.empty
|
|
48
|
-
|
|
39
|
+
assert_equal(false, routers.empty?,
|
|
40
|
+
'RouterOspf collection is empty')
|
|
49
41
|
# validate the collection
|
|
50
|
-
routers.
|
|
51
|
-
|
|
52
|
-
assert_equal(false, line.nil?)
|
|
42
|
+
routers.each_key do |name|
|
|
43
|
+
assert_show_match(pattern: /router ospf #{name}/)
|
|
53
44
|
end
|
|
54
45
|
routerospf_routers_destroy(routers)
|
|
55
|
-
routers=nil
|
|
56
46
|
end
|
|
57
47
|
|
|
58
48
|
def test_routerospf_create_name_zero_length
|
|
59
49
|
assert_raises(ArgumentError) do
|
|
60
|
-
|
|
50
|
+
RouterOspf.new('')
|
|
61
51
|
end
|
|
62
52
|
end
|
|
63
53
|
|
|
64
54
|
def test_routerospf_create_valid
|
|
65
|
-
name =
|
|
55
|
+
name = 'ospfTest'
|
|
66
56
|
ospf = RouterOspf.new(name)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
assert_equal(false, line.nil?,
|
|
70
|
-
"Error: 'router ospf ospfTest' not configured")
|
|
57
|
+
assert_show_match(pattern: /router ospf #{name}/,
|
|
58
|
+
msg: "'router ospf ospfTest' not configured")
|
|
71
59
|
ospf.destroy
|
|
72
60
|
end
|
|
73
61
|
|
|
74
62
|
def test_routerospf_create_valid_no_feature
|
|
75
|
-
name =
|
|
63
|
+
name = 'ospfTest'
|
|
76
64
|
ospf = RouterOspf.new(name)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
assert_equal(false, line.nil?,
|
|
80
|
-
"Error: 'router ospf ospfTest' not configured")
|
|
65
|
+
assert_show_match(pattern: /router ospf #{name}/,
|
|
66
|
+
msg: "'router ospf ospfTest' not configured")
|
|
81
67
|
ospf.destroy
|
|
82
68
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
assert_equal(true, line.nil?,
|
|
87
|
-
"Error: 'feature ospf' still configured")
|
|
69
|
+
refute_show_match(command: 'show run all | no-more',
|
|
70
|
+
pattern: /feature ospf/,
|
|
71
|
+
msg: "Error: 'feature ospf' still configured")
|
|
88
72
|
end
|
|
89
73
|
|
|
90
74
|
def test_routerospf_create_valid_multiple
|
|
91
|
-
name =
|
|
75
|
+
name = 'ospfTest_1'
|
|
92
76
|
ospf_1 = RouterOspf.new(name)
|
|
93
|
-
|
|
94
|
-
# puts "cfg line: #{line}"
|
|
95
|
-
assert_equal(false, line.nil?,
|
|
96
|
-
"Error: 'router ospf ospfTest_1' not configured")
|
|
77
|
+
assert_show_match(pattern: /router ospf #{name}/)
|
|
97
78
|
|
|
98
|
-
name =
|
|
79
|
+
name = 'ospfTest_2'
|
|
99
80
|
ospf_2 = RouterOspf.new(name)
|
|
100
|
-
|
|
101
|
-
# puts "cfg line: #{line}"
|
|
102
|
-
assert_equal(false, line.nil?,
|
|
103
|
-
"Error: 'router ospf ospfTest_1' not configured")
|
|
81
|
+
assert_show_match(pattern: /router ospf #{name}/)
|
|
104
82
|
|
|
105
83
|
ospf_1.destroy
|
|
106
84
|
ospf_2.destroy
|
|
107
85
|
end
|
|
108
86
|
|
|
109
87
|
def test_routerospf_get_name
|
|
110
|
-
name =
|
|
88
|
+
name = 'ospfTest'
|
|
111
89
|
ospf = RouterOspf.new(name)
|
|
112
|
-
line =
|
|
113
|
-
|
|
114
|
-
name = line.to_s.split(" ").last
|
|
90
|
+
line = assert_show_match(pattern: /router ospf #{name}/)
|
|
91
|
+
name = line.to_s.split(' ').last
|
|
115
92
|
# puts "name from cli: #{name}"
|
|
116
93
|
# puts "name from get: #{routerospf.name}"
|
|
117
94
|
assert_equal(name, ospf.name,
|
|
118
|
-
|
|
95
|
+
'Error: router name not correct')
|
|
119
96
|
ospf.destroy
|
|
120
97
|
end
|
|
121
98
|
|
|
122
99
|
def test_routerospf_destroy
|
|
123
|
-
name =
|
|
100
|
+
name = 'ospfTest'
|
|
124
101
|
ospf = RouterOspf.new(name)
|
|
125
102
|
ospf.destroy
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
assert_equal(true, line.nil?,
|
|
129
|
-
"Error: 'router ospf ospfTest' not destroyed")
|
|
103
|
+
refute_show_match(pattern: /router ospf #{name}/,
|
|
104
|
+
msg: "'router ospf ospfTest' not destroyed")
|
|
130
105
|
end
|
|
131
106
|
|
|
132
107
|
def test_routerospf_create_valid_multiple_delete_one
|
|
133
|
-
name =
|
|
108
|
+
name = 'ospfTest_1'
|
|
134
109
|
ospf_1 = RouterOspf.new(name)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
assert_equal(false, line.nil?,
|
|
138
|
-
"Error: #{name}, not configured")
|
|
110
|
+
assert_show_match(pattern: /router ospf #{name}/,
|
|
111
|
+
msg: "Error: #{name}, not configured")
|
|
139
112
|
|
|
140
|
-
name =
|
|
113
|
+
name = 'ospfTest_2'
|
|
141
114
|
ospf_2 = RouterOspf.new(name)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
assert_equal(false, line.nil?,
|
|
145
|
-
"Error: #{name}, not configured")
|
|
115
|
+
assert_show_match(pattern: /router ospf #{name}/,
|
|
116
|
+
msg: "Error: #{name}, not configured")
|
|
146
117
|
|
|
147
118
|
ospf_1.destroy
|
|
148
119
|
|
|
149
120
|
# Remove one router then check that we only have one router left
|
|
150
121
|
routers = RouterOspf.routers
|
|
151
|
-
assert_equal(false, routers.empty
|
|
152
|
-
|
|
153
|
-
assert_equal(1, routers.size
|
|
154
|
-
|
|
122
|
+
assert_equal(false, routers.empty?,
|
|
123
|
+
'Error: RouterOspf collection is empty')
|
|
124
|
+
assert_equal(1, routers.size,
|
|
125
|
+
'Error: RouterOspf collection is not one')
|
|
155
126
|
assert_equal(true, routers.key?(name),
|
|
156
127
|
"Error: #{name}, not found in the collection")
|
|
157
128
|
# validate the collection
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"Error: #{name}, instance not found")
|
|
129
|
+
assert_show_match(pattern: /router ospf #{name}/,
|
|
130
|
+
msg: "Error: #{name}, instance not found")
|
|
161
131
|
ospf_2.destroy
|
|
162
|
-
routers = nil
|
|
163
132
|
end
|
|
164
133
|
end
|
|
@@ -12,234 +12,188 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
require_relative 'ciscotest'
|
|
16
|
+
require_relative '../lib/cisco_node_utils/router_ospf'
|
|
17
|
+
require_relative '../lib/cisco_node_utils/router_ospf_vrf'
|
|
18
18
|
|
|
19
|
+
# TestRouterOspfVrf - Minitest for RouterOspfVrf node utility class
|
|
19
20
|
class TestRouterOspfVrf < CiscoTestCase
|
|
20
21
|
def setup
|
|
21
22
|
# Disable feature ospf before each test to ensure we
|
|
22
23
|
# are starting with a clean slate for each test.
|
|
23
24
|
super
|
|
24
|
-
|
|
25
|
-
@device.cmd("no feature ospf")
|
|
26
|
-
@device.cmd("end")
|
|
27
|
-
node.cache_flush
|
|
25
|
+
config('no feature ospf')
|
|
28
26
|
end
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
router.destroy
|
|
34
|
-
}
|
|
28
|
+
def teardown
|
|
29
|
+
config('no feature ospf')
|
|
30
|
+
super
|
|
35
31
|
end
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def ospf_vrfs_destroy(vrfs, routername)
|
|
40
|
-
vrfs[routername].each { |name, vrf|
|
|
41
|
-
vrf.destroy if vrf.name != "default"
|
|
42
|
-
}
|
|
33
|
+
def assert_match_vrf_line(routername, vrfname, cmd=nil)
|
|
34
|
+
match_vrf_line(routername, vrfname, cmd, true)
|
|
43
35
|
end
|
|
44
36
|
|
|
45
|
-
def
|
|
46
|
-
|
|
47
|
-
cmd = "router ospf"
|
|
48
|
-
pattern = /#{cmd}\s#{router}/
|
|
49
|
-
# no match found, return nil
|
|
50
|
-
return nil if (md = pattern.match(s)).nil?
|
|
51
|
-
|
|
52
|
-
# match found but default vrf
|
|
53
|
-
return "default" if (vrfname == "default")
|
|
54
|
-
|
|
55
|
-
# assign post match
|
|
56
|
-
s = md.post_match
|
|
57
|
-
# non default case, check vf exist
|
|
58
|
-
s.each_line do | line |
|
|
59
|
-
next unless (/^\s+$/).match(line).nil?
|
|
60
|
-
|
|
61
|
-
# check whether we in 2 space
|
|
62
|
-
ml = (/^\s+(.*)/).match(line)
|
|
63
|
-
return nil if ml.nil?
|
|
64
|
-
|
|
65
|
-
# check wether we found vrf
|
|
66
|
-
ml = (/vrf\s#{vrfname}/).match(line)
|
|
67
|
-
return ml unless ml.nil?
|
|
68
|
-
end # s.each
|
|
37
|
+
def refute_match_vrf_line(routername, vrfname, cmd=nil)
|
|
38
|
+
match_vrf_line(routername, vrfname, cmd, false)
|
|
69
39
|
end
|
|
70
40
|
|
|
71
|
-
def
|
|
72
|
-
s = @device.cmd(
|
|
73
|
-
|
|
74
|
-
pattern
|
|
41
|
+
def match_vrf_line(routername, vrfname, cmd=nil, match_cmd=true)
|
|
42
|
+
s = @device.cmd('show run ospf all | sec "router ospf" | no-more')
|
|
43
|
+
pattern = /router ospf #{routername}/
|
|
44
|
+
assert_match(pattern, s)
|
|
75
45
|
vrf_found = false
|
|
46
|
+
# If no vrf or cmd, just finding the router is enough
|
|
47
|
+
return true if vrfname == 'default' && cmd.nil?
|
|
48
|
+
|
|
49
|
+
# Else, look for the vrf and/or cmd
|
|
50
|
+
pattern.match(s).post_match.each_line do |line|
|
|
51
|
+
# Skip blank lines
|
|
52
|
+
next if /^\s*$/.match(line)
|
|
53
|
+
if !vrf_found && vrfname != 'default'
|
|
54
|
+
# Have to find the VRF before checking for cmd
|
|
55
|
+
assert_match(/^\s+(.*)/, line,
|
|
56
|
+
"Exited 'router ospf #{routername}' submode "\
|
|
57
|
+
"before finding 'vrf #{vrfname}'. Output:\n#{s}")
|
|
58
|
+
vrf_found = true if /vrf\s#{vrfname}/ =~ line
|
|
59
|
+
return true if cmd.nil?
|
|
60
|
+
next
|
|
61
|
+
end
|
|
76
62
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
# if line is empty then move on to next line
|
|
84
|
-
next unless (/^\s+$/).match(line).nil?
|
|
85
|
-
|
|
86
|
-
# check whether we in 2 space
|
|
87
|
-
ml = (/^\s+(.*)/).match(line)
|
|
88
|
-
return nil if ml.nil?
|
|
89
|
-
|
|
90
|
-
# for default vrf we do not expect any vrfname present
|
|
91
|
-
# on the device, hence return nil.
|
|
92
|
-
if (vrfname == "default")
|
|
93
|
-
ml = (/vrf\s(.*)$/).match(line)
|
|
94
|
-
return nil unless ml.nil?
|
|
63
|
+
# If we get here, either we found the VRF we want or we want no VRF
|
|
64
|
+
if !match_cmd
|
|
65
|
+
# If we find a new VRF, we're done
|
|
66
|
+
return true if /vrf\s.*/ =~ line
|
|
67
|
+
# Fail if we find the unwanted command
|
|
68
|
+
refute_match(cmd, line)
|
|
95
69
|
else
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
else
|
|
102
|
-
# This is new vrf, hence return nil
|
|
103
|
-
ml = (/vrf\s(.*)$/).match(line)
|
|
104
|
-
return nil unless ml.nil?
|
|
105
|
-
end
|
|
70
|
+
# Fail if we hit a VRF before finding our cmd
|
|
71
|
+
refute_match(/vrf\s.*/, line,
|
|
72
|
+
"Found vrf line before finding #{cmd} under vrf default")
|
|
73
|
+
# We're done if we found the command
|
|
74
|
+
return true if cmd =~ line
|
|
106
75
|
end
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def example_test_match_line
|
|
115
|
-
puts "vrf 1: #{get_routerospfvrf_match_line("ospfTest", "default")}"
|
|
116
|
-
puts "next vrf!!!!!!!!!!!!!"
|
|
117
|
-
puts "vrf 2: #{get_routerospfvrf_match_line("TestOSPF", "vrftest")}"
|
|
118
|
-
puts "next vrf!!!!!!!!!!!!!"
|
|
119
|
-
puts "vrf 3: #{get_routerospfvrf_match_line("TestOSPF", "testvrf")}"
|
|
120
|
-
puts "next vrf!!!!!!!!!!!!!"
|
|
121
|
-
puts "vrf 4: #{get_routerospfvrf_match_line("ospfTest", "testvrf")}"
|
|
76
|
+
end
|
|
77
|
+
if !vrf_found && vrfname != 'default'
|
|
78
|
+
flunk("Ran out of output before finding 'vrf #{vrfname}':\n#{s}")
|
|
79
|
+
elsif cmd && match_cmd
|
|
80
|
+
flunk("Ran out of output before finding #{cmd}:\n#{s}")
|
|
81
|
+
end
|
|
122
82
|
end
|
|
123
83
|
|
|
124
|
-
def
|
|
125
|
-
|
|
126
|
-
puts "vrf submode timer lsa: #{get_routerospfvrf_match_submode_line("ospfTest", "default", pattern)}"
|
|
127
|
-
puts "vrf submode timer lsa: #{get_routerospfvrf_match_submode_line("TestOSPF", "vrftest1", pattern)}"
|
|
128
|
-
puts "vrf submode timer spf1: #{get_routerospfvrf_match_submode_line("ospftest", "vrftest", pattern)}"
|
|
129
|
-
pattern = (/\s+router-id (.*)/)
|
|
130
|
-
puts "vrf submode: #{get_routerospfvrf_match_submode_line("ospfTest", "testvrf", pattern)}"
|
|
84
|
+
def create_routerospf(ospfname='ospfTest')
|
|
85
|
+
RouterOspf.new(ospfname)
|
|
131
86
|
end
|
|
132
87
|
|
|
133
|
-
def
|
|
134
|
-
|
|
88
|
+
def create_routerospfvrf(router='Wolfpack', name='default')
|
|
89
|
+
RouterOspfVrf.new(router, name)
|
|
135
90
|
end
|
|
136
91
|
|
|
137
|
-
def
|
|
138
|
-
|
|
92
|
+
def config_from_hash(hash)
|
|
93
|
+
config('feature ospf')
|
|
94
|
+
cfg = []
|
|
95
|
+
hash.each do |k, v|
|
|
96
|
+
# Assuming all values are in hash
|
|
97
|
+
cfg << "router ospf #{k}"
|
|
98
|
+
v.each do |k1, v1|
|
|
99
|
+
cfg << "vrf #{v1[:vrf]}" if (k1 != 'default')
|
|
100
|
+
cfg << "auto-cost reference-bandwidth #{v1[:cov]}"
|
|
101
|
+
cfg << "default-metric #{v1[:dm]}"
|
|
102
|
+
cfg << "router-id #{v1[:id]}"
|
|
103
|
+
cfg << "timers throttle lsa #{v1[:l1]} #{v1[:l2]} #{v1[:l3]}"
|
|
104
|
+
cfg << "timers throttle spf #{v1[:s1]} #{v1[:s2]} #{v1[:s3]}"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
config(*cfg)
|
|
139
108
|
end
|
|
140
109
|
|
|
141
110
|
def test_routerospfvrf_collection_size
|
|
142
|
-
create_routerospfvrf(
|
|
111
|
+
create_routerospfvrf('green')
|
|
143
112
|
vrfs = RouterOspfVrf.vrfs
|
|
144
|
-
assert_equal(1, vrfs.size
|
|
145
|
-
|
|
146
|
-
create_routerospfvrf("green", "NC_State")
|
|
113
|
+
assert_equal(1, vrfs.size, 'Error: Collection is not one')
|
|
114
|
+
create_routerospfvrf('green', 'NC_State')
|
|
147
115
|
vrfs = RouterOspfVrf.vrfs
|
|
148
|
-
assert_equal(2, vrfs[
|
|
149
|
-
|
|
150
|
-
create_routerospfvrf(
|
|
151
|
-
create_routerospfvrf("green", "Carolina")
|
|
116
|
+
assert_equal(2, vrfs['green'].size, 'Error: Collection is not two')
|
|
117
|
+
create_routerospfvrf('green', 'Duke')
|
|
118
|
+
create_routerospfvrf('green', 'Carolina')
|
|
152
119
|
vrfs = RouterOspfVrf.vrfs
|
|
153
|
-
assert_equal(4, vrfs[
|
|
154
|
-
|
|
155
|
-
ospf_routers_destroy(RouterOspf.routers)
|
|
120
|
+
assert_equal(4, vrfs['green'].size, 'Error: Collection is not four')
|
|
121
|
+
RouterOspf.routers.each_value(&:destroy)
|
|
156
122
|
vrfs = RouterOspfVrf.vrfs
|
|
157
|
-
|
|
158
|
-
"Error: Collection is not zero")
|
|
123
|
+
assert_empty(vrfs, 'Error: Collection is not empty')
|
|
159
124
|
end
|
|
160
125
|
|
|
126
|
+
# rubocop:disable Style/AlignHash
|
|
127
|
+
MULTIPLE_OSPFS = Hash.new { |h, k| h[k] = {} }.merge(
|
|
128
|
+
'ospfTest' => {
|
|
129
|
+
'default' => {
|
|
130
|
+
vrf: 'default', cov: 90,
|
|
131
|
+
cot: RouterOspfVrf::OSPF_AUTO_COST[:mbps], dm: 15_000,
|
|
132
|
+
id: '9.0.0.2', l1: 130, l2: 530, l3: 1030, s1: 300,
|
|
133
|
+
s2: 600, s3: 1100
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
'bxb300' => {
|
|
137
|
+
'default' => {
|
|
138
|
+
vrf: 'default', cov: 200,
|
|
139
|
+
cot: RouterOspfVrf::OSPF_AUTO_COST[:mbps], dm: 10_000,
|
|
140
|
+
id: '10.0.0.3', l1: 130, l2: 530, l3: 1030, s1: 300,
|
|
141
|
+
s2: 600, s3: 1100
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
)
|
|
145
|
+
# rubocop:enable Style/AlignHash
|
|
146
|
+
|
|
161
147
|
def test_routerospfvrf_collection_not_empty_valid
|
|
162
|
-
ospf_h = Hash.new { |h, k| h[k] = {} }
|
|
163
|
-
ospf_h["ospfTest"] = {
|
|
164
|
-
:vrf => "default", :cov => 90,
|
|
165
|
-
:cot => RouterOspfVrf::OSPF_AUTO_COST[:mbps], :dm => 15000,
|
|
166
|
-
:id => "9.0.0.2", :l1=>130, :l2 => 530, :l3 => 1030, :s1 => 300,
|
|
167
|
-
:s2 => 600, :s3 => 1100
|
|
168
|
-
}
|
|
169
|
-
ospf_h["bxb300"] = {
|
|
170
|
-
:vrf => "default", :cov => 200,
|
|
171
|
-
:cot => RouterOspfVrf::OSPF_AUTO_COST[:mbps], :dm => 10000,
|
|
172
|
-
:id => "10.0.0.3", :l1=>130, :l2 => 530, :l3 => 1030, :s1 => 300,
|
|
173
|
-
:s2 => 600, :s3 => 1100
|
|
174
|
-
}
|
|
175
148
|
# pre-populate values
|
|
176
|
-
|
|
177
|
-
# Assuming all values are in hash
|
|
178
|
-
s = @device.cmd("configure terminal")
|
|
179
|
-
s = @device.cmd("feature ospf")
|
|
180
|
-
s = @device.cmd("router ospf #{k}")
|
|
181
|
-
s = @device.cmd("vrf #{v[:vrf]}")
|
|
182
|
-
s = @device.cmd("auto-cost reference-bandwidth #{v[:cov]}")
|
|
183
|
-
s = @device.cmd("default-metric #{v[:dm]}")
|
|
184
|
-
s = @device.cmd("router-id #{v[:id]}")
|
|
185
|
-
s = @device.cmd("timers throttle lsa #{v[:l1]} #{v[:l2]} #{v[:l3]}")
|
|
186
|
-
s = @device.cmd("timers throttle spf #{v[:s1]} #{v[:s2]} #{v[:s3]}")
|
|
187
|
-
s = @device.cmd("end")
|
|
188
|
-
node.cache_flush
|
|
189
|
-
end
|
|
149
|
+
config_from_hash(MULTIPLE_OSPFS)
|
|
190
150
|
|
|
191
151
|
routers = RouterOspf.routers
|
|
192
152
|
# validate the collection
|
|
193
|
-
routers.
|
|
153
|
+
routers.each_key do |routername|
|
|
194
154
|
vrfs = RouterOspfVrf.vrfs
|
|
195
|
-
refute_empty(vrfs,
|
|
196
|
-
hv =
|
|
155
|
+
refute_empty(vrfs, 'Error: Collection is empty')
|
|
156
|
+
hv = MULTIPLE_OSPFS.fetch(routername.to_s)
|
|
197
157
|
next if hv.nil?
|
|
198
|
-
|
|
158
|
+
hv = hv['default']
|
|
159
|
+
vrfs[routername].each_value do |vrf|
|
|
199
160
|
auto_cost_value = [] << hv[:cov] << hv[:cot]
|
|
200
161
|
assert_equal(hv[:vrf], vrf.name,
|
|
201
|
-
|
|
162
|
+
'Error: Collection, vrf name')
|
|
202
163
|
assert_equal(auto_cost_value, vrf.auto_cost,
|
|
203
|
-
|
|
164
|
+
'Error: Collection, auto cost')
|
|
204
165
|
assert_equal(hv[:dm], vrf.default_metric,
|
|
205
|
-
|
|
166
|
+
'Error: Collection, default metric')
|
|
206
167
|
assert_equal(hv[:id], vrf.router_id,
|
|
207
|
-
|
|
168
|
+
'Error: Collection, router id')
|
|
208
169
|
lsa = [] << hv[:l1] << hv[:l2] << hv[:l3]
|
|
209
170
|
assert_equal(lsa, vrf.timer_throttle_lsa,
|
|
210
|
-
|
|
171
|
+
'Error: Collection, timer throttle lsa')
|
|
211
172
|
spf = [] << hv[:s1] << hv[:s2] << hv[:s3]
|
|
212
173
|
assert_equal(spf, vrf.timer_throttle_spf,
|
|
213
|
-
|
|
174
|
+
'Error: Collection, timer throttle spf')
|
|
214
175
|
end
|
|
215
|
-
ospf_vrfs_destroy(vrfs, routername)
|
|
216
|
-
vrfs=nil
|
|
217
176
|
end
|
|
218
|
-
ospf_routers_destroy(routers)
|
|
219
|
-
routers=nil
|
|
220
177
|
end
|
|
221
178
|
|
|
222
179
|
def test_routerospfvrf_create_vrf_nil
|
|
223
|
-
assert_raises(TypeError)
|
|
224
|
-
routerospf = RouterOspfVrf.new(nil, "testvrf")
|
|
225
|
-
end
|
|
180
|
+
assert_raises(TypeError) { RouterOspfVrf.new(nil, 'testvrf') }
|
|
226
181
|
end
|
|
227
182
|
|
|
228
183
|
def test_routerospfvrf_create_name_zero_length
|
|
229
|
-
routerospf = RouterOspf.new(
|
|
184
|
+
routerospf = RouterOspf.new('testOspf')
|
|
230
185
|
assert_raises(ArgumentError) do
|
|
231
|
-
|
|
186
|
+
RouterOspfVrf.new('testOspf', '')
|
|
232
187
|
end
|
|
233
188
|
routerospf.destroy
|
|
234
189
|
end
|
|
235
190
|
|
|
236
191
|
def test_routerospfvrf_create_valid
|
|
237
|
-
ospfname =
|
|
192
|
+
ospfname = 'ospfTest'
|
|
238
193
|
# routerospf = RouterOspf.new(ospfname)
|
|
239
|
-
vrfname =
|
|
194
|
+
vrfname = 'default'
|
|
240
195
|
vrf = RouterOspfVrf.new(ospfname, vrfname)
|
|
241
|
-
|
|
242
|
-
refute_nil(line, "Error: #{vrfname} vrf, does not exist in CLI")
|
|
196
|
+
assert_match_vrf_line(ospfname, vrfname)
|
|
243
197
|
assert_equal(vrfname, vrf.name,
|
|
244
198
|
"Error: #{vrfname} vrf, create failed")
|
|
245
199
|
vrf.parent.destroy
|
|
@@ -249,69 +203,59 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
249
203
|
routerospf = create_routerospf
|
|
250
204
|
vrf = create_routerospfvrf(routerospf.name)
|
|
251
205
|
assert_equal(routerospf.name, vrf.parent.name,
|
|
252
|
-
|
|
206
|
+
'Error: Parent value is not correct')
|
|
253
207
|
routerospf.destroy
|
|
254
208
|
end
|
|
255
209
|
|
|
256
210
|
def test_routerospfvrf_get_name
|
|
257
|
-
vrfname =
|
|
258
|
-
vrf = create_routerospfvrf(
|
|
259
|
-
|
|
260
|
-
assert_equal(vrfname, line,
|
|
261
|
-
"Error: #{vrfname} vrf,name mismatch")
|
|
211
|
+
vrfname = 'default'
|
|
212
|
+
vrf = create_routerospfvrf('green')
|
|
213
|
+
assert_match_vrf_line('green', vrfname)
|
|
262
214
|
assert_equal(vrfname, vrf.name,
|
|
263
215
|
"Error: #{vrfname} vrf, name get value mismatch")
|
|
264
216
|
vrf.parent.destroy
|
|
265
217
|
end
|
|
266
218
|
|
|
267
219
|
def test_routerospfvrf_destroy
|
|
268
|
-
vrfname =
|
|
220
|
+
vrfname = 'default'
|
|
269
221
|
vrf = create_routerospfvrf
|
|
270
222
|
assert_raises(RuntimeError) do
|
|
271
223
|
vrf.destroy
|
|
272
224
|
end
|
|
273
|
-
|
|
274
|
-
assert_equal(vrfname, line,
|
|
275
|
-
"Error: #{vrfname} vrf, destroy failed")
|
|
225
|
+
assert_match_vrf_line(vrf.parent.name, vrfname)
|
|
276
226
|
vrf.parent.destroy
|
|
277
227
|
end
|
|
278
228
|
|
|
279
229
|
def test_routerospfvrf_auto_cost
|
|
280
230
|
vrf = create_routerospfvrf
|
|
281
|
-
auto_cost_value = [
|
|
231
|
+
auto_cost_value = [400_000, RouterOspfVrf::OSPF_AUTO_COST[:mbps]]
|
|
282
232
|
# set auto-cost
|
|
283
233
|
vrf.auto_cost_set(auto_cost_value[0], :mbps)
|
|
284
|
-
pattern =
|
|
285
|
-
|
|
286
|
-
vrf.name, pattern)
|
|
287
|
-
refute_nil(line, "Error: auto-cost, missing in CLI")
|
|
234
|
+
pattern = /\s+auto-cost reference-bandwidth #{auto_cost_value[0]}/
|
|
235
|
+
assert_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
288
236
|
assert_equal(auto_cost_value, vrf.auto_cost,
|
|
289
|
-
|
|
237
|
+
'Error: auto-cost, get value mismatch')
|
|
290
238
|
vrf.parent.destroy
|
|
291
239
|
end
|
|
292
240
|
|
|
293
241
|
def test_routerospfvrf_auto_cost_multiple_vrf
|
|
294
242
|
routerospf = create_routerospf
|
|
295
243
|
vrf = create_routerospfvrf(routerospf.name)
|
|
296
|
-
vrf1 = create_routerospfvrf(routerospf.name,
|
|
297
|
-
auto_cost_value = [
|
|
244
|
+
vrf1 = create_routerospfvrf(routerospf.name, 'testvrf')
|
|
245
|
+
auto_cost_value = [600_000, RouterOspfVrf::OSPF_AUTO_COST[:mbps]]
|
|
298
246
|
# set auto-cost
|
|
299
247
|
vrf.auto_cost_set(auto_cost_value[0], :mbps)
|
|
300
|
-
pattern =
|
|
301
|
-
|
|
302
|
-
vrf.name, pattern)
|
|
303
|
-
refute_nil(line, "Error: #{vrf.name} vrf, auto-cost missing in CLI")
|
|
248
|
+
pattern = /\s+auto-cost reference-bandwidth #{auto_cost_value[0]}/
|
|
249
|
+
assert_match_vrf_line(routerospf.name, vrf.name, pattern)
|
|
304
250
|
assert_equal(auto_cost_value, vrf.auto_cost,
|
|
305
251
|
"Error: #{vrf.name} vrf, auto-cost get value mismatch")
|
|
306
252
|
|
|
307
253
|
# vrf 1
|
|
308
|
-
auto_cost_value = [
|
|
309
|
-
pattern = (/\s+auto-cost reference-bandwidth #{auto_cost_value[0]}/)
|
|
254
|
+
auto_cost_value = [500_000, RouterOspfVrf::OSPF_AUTO_COST[:mbps]]
|
|
310
255
|
# set cost
|
|
311
256
|
vrf1.auto_cost_set(auto_cost_value[0], :mbps)
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
refute_nil(line, "Error: #{vrf1.name} vrf, auto-cost missing in CLI")
|
|
257
|
+
pattern = /\s+auto-cost reference-bandwidth #{auto_cost_value[0]}/
|
|
258
|
+
assert_match_vrf_line(routerospf.name, vrf1.name, pattern)
|
|
315
259
|
assert_equal(auto_cost_value, vrf1.auto_cost,
|
|
316
260
|
"Error: #{vrf1.name} vrf, auto-cost get value mismatch")
|
|
317
261
|
routerospf.destroy
|
|
@@ -322,52 +266,43 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
322
266
|
# NXOS specific
|
|
323
267
|
auto_cost_value = [40, RouterOspfVrf::OSPF_AUTO_COST[:gbps]]
|
|
324
268
|
assert_equal(auto_cost_value, vrf.default_auto_cost,
|
|
325
|
-
|
|
269
|
+
'Error: default auto-cost get value mismatch')
|
|
326
270
|
assert_equal(auto_cost_value, vrf.auto_cost,
|
|
327
|
-
|
|
271
|
+
'Error: auto-cost get value default mismatch')
|
|
328
272
|
vrf.parent.destroy
|
|
329
273
|
end
|
|
330
274
|
|
|
331
275
|
def test_routerospfvrf_default_metric
|
|
332
276
|
vrf = create_routerospfvrf
|
|
333
|
-
metric =
|
|
277
|
+
metric = 30_000
|
|
334
278
|
vrf.default_metric = metric
|
|
335
|
-
pattern =
|
|
336
|
-
|
|
337
|
-
vrf.name, pattern)
|
|
338
|
-
refute_nil(line, "Error: #{vrf.name} vrf, default-metric missing in CLI")
|
|
279
|
+
pattern = /\s+default-metric #{metric}/
|
|
280
|
+
assert_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
339
281
|
assert_equal(metric, vrf.default_metric,
|
|
340
282
|
"Error: #{vrf.name} vrf, default-metric get value mismatch")
|
|
341
283
|
# set default metric
|
|
342
284
|
vrf.default_metric = vrf.default_default_metric
|
|
343
|
-
|
|
344
|
-
vrf.name, pattern)
|
|
345
|
-
assert_nil(line,
|
|
346
|
-
"Error: #{vrf.name}] vrf, default default-metric set failed")
|
|
285
|
+
refute_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
347
286
|
vrf.parent.destroy
|
|
348
287
|
end
|
|
349
288
|
|
|
350
289
|
def test_routerospfvrf_default_metric_multiple_vrf
|
|
351
290
|
routerospf = create_routerospf
|
|
352
291
|
vrf = create_routerospfvrf(routerospf.name)
|
|
353
|
-
vrf1 = create_routerospfvrf(routerospf.name,
|
|
354
|
-
metric =
|
|
292
|
+
vrf1 = create_routerospfvrf(routerospf.name, 'testvrf')
|
|
293
|
+
metric = 35_000
|
|
355
294
|
# set metric
|
|
356
295
|
vrf.default_metric = metric
|
|
357
|
-
pattern =
|
|
358
|
-
|
|
359
|
-
vrf.name, pattern)
|
|
360
|
-
refute_nil(line, "Error: #{vrf.name} vrf, default-metric missing in CLI")
|
|
296
|
+
pattern = /\s+default-metric #{metric}/
|
|
297
|
+
assert_match_vrf_line(routerospf.name, vrf.name, pattern)
|
|
361
298
|
assert_equal(metric, vrf.default_metric,
|
|
362
299
|
"Error: #{vrf.name} vrf, default-metric get value mismatch")
|
|
363
300
|
|
|
364
301
|
# vrf 1
|
|
365
|
-
metric =
|
|
302
|
+
metric = 25_000
|
|
366
303
|
vrf1.default_metric = metric
|
|
367
|
-
pattern =
|
|
368
|
-
|
|
369
|
-
vrf1.name, pattern)
|
|
370
|
-
refute_nil(line, "Error: #{vrf1.name} vrf, default-metric missing in CLI")
|
|
304
|
+
pattern = /\s+default-metric #{metric}/
|
|
305
|
+
assert_match_vrf_line(routerospf.name, vrf1.name, pattern)
|
|
371
306
|
assert_equal(metric, vrf1.default_metric,
|
|
372
307
|
"Error: #{vrf1.name} vrf, default-metric get value mismatch")
|
|
373
308
|
|
|
@@ -378,56 +313,44 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
378
313
|
vrf = create_routerospfvrf
|
|
379
314
|
|
|
380
315
|
assert_equal(:none, vrf.log_adjacency,
|
|
381
|
-
|
|
316
|
+
'Error: log-adjacency get value mismatch')
|
|
382
317
|
|
|
383
318
|
vrf.log_adjacency = :log
|
|
384
|
-
pattern =
|
|
385
|
-
|
|
386
|
-
vrf.name, pattern)
|
|
387
|
-
refute_nil(line, "Error: log-adjacency missing in CLI")
|
|
319
|
+
pattern = /\s+log-adjacency-changes/
|
|
320
|
+
assert_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
388
321
|
assert_equal(:log, vrf.log_adjacency,
|
|
389
|
-
|
|
322
|
+
'Error: log-adjacency get value mismatch')
|
|
390
323
|
|
|
391
324
|
vrf.log_adjacency = :detail
|
|
392
|
-
pattern =
|
|
393
|
-
|
|
394
|
-
vrf.name, pattern)
|
|
395
|
-
refute_nil(line,
|
|
396
|
-
"Error: #{vrf.name} vrf, log-adjacency detail missing in CLI")
|
|
325
|
+
pattern = /\s+log-adjacency-changes detail/
|
|
326
|
+
assert_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
397
327
|
assert_equal(:detail, vrf.log_adjacency,
|
|
398
|
-
|
|
328
|
+
"Error: #{vrf.name} vrf, " \
|
|
329
|
+
'log-adjacency detail get value mismatch')
|
|
399
330
|
|
|
400
331
|
# set default log adjacency
|
|
401
332
|
vrf.log_adjacency = vrf.default_log_adjacency
|
|
402
|
-
pattern =
|
|
403
|
-
|
|
404
|
-
vrf.name, pattern)
|
|
405
|
-
assert_nil(line, "Error: #{vrf.name} vrf, default log-adjacency set failed")
|
|
333
|
+
pattern = /\s+log-adjacency-changes(.*)/
|
|
334
|
+
refute_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
406
335
|
vrf.parent.destroy
|
|
407
336
|
end
|
|
408
337
|
|
|
409
338
|
def test_routerospfvrf_log_adjacency_multiple_vrf
|
|
410
339
|
routerospf = create_routerospf
|
|
411
340
|
vrf = create_routerospfvrf(routerospf.name)
|
|
412
|
-
vrf1 = create_routerospfvrf(routerospf.name,
|
|
341
|
+
vrf1 = create_routerospfvrf(routerospf.name, 'testvrf')
|
|
413
342
|
# set log_adjacency
|
|
414
343
|
vrf.log_adjacency = :log
|
|
415
|
-
pattern =
|
|
416
|
-
|
|
417
|
-
vrf.name, pattern)
|
|
418
|
-
|
|
419
|
-
refute_nil(line, "Error: #{vrf.name} vrf, log-adjacency missing in CLI")
|
|
344
|
+
pattern = /\s+log-adjacency-changes/
|
|
345
|
+
assert_match_vrf_line(routerospf.name, vrf.name, pattern)
|
|
420
346
|
assert_equal(:log, vrf.log_adjacency,
|
|
421
347
|
"Error: #{vrf.name} vrf, log-adjacency get value mismatch")
|
|
422
348
|
|
|
423
349
|
# vrf 1
|
|
424
350
|
# set log_adjacency
|
|
425
351
|
vrf1.log_adjacency = :detail
|
|
426
|
-
pattern =
|
|
427
|
-
|
|
428
|
-
vrf1.name, pattern)
|
|
429
|
-
|
|
430
|
-
refute_nil(line, "Error: #{vrf1.name} vrf, log-adjacency missing in CLI")
|
|
352
|
+
pattern = /\s+log-adjacency-changes/
|
|
353
|
+
assert_match_vrf_line(routerospf.name, vrf1.name, pattern)
|
|
431
354
|
assert_equal(:detail, vrf1.log_adjacency,
|
|
432
355
|
"Error: #{vrf1.name} vrf, log-adjacency get value mismatch")
|
|
433
356
|
|
|
@@ -437,66 +360,56 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
437
360
|
def test_routerospfvrf_log_adjacency_multiple_vrf_2
|
|
438
361
|
routerospf = create_routerospf
|
|
439
362
|
vrf_default = create_routerospfvrf(routerospf.name)
|
|
440
|
-
vrf1 = create_routerospfvrf(routerospf.name,
|
|
363
|
+
vrf1 = create_routerospfvrf(routerospf.name, 'testvrf')
|
|
441
364
|
# DO NOT set log_adjacency for default vrf
|
|
442
365
|
# DO set log_adjacency for non-default vrf
|
|
443
366
|
# set log_adjacency
|
|
444
367
|
vrf1.log_adjacency = :detail
|
|
445
|
-
pattern =
|
|
446
|
-
|
|
447
|
-
vrf1.name, pattern)
|
|
448
|
-
|
|
449
|
-
refute_nil(line, "Error: #{vrf1.name} vrf, log-adjacency missing in CLI")
|
|
368
|
+
pattern = /\s+log-adjacency-changes/
|
|
369
|
+
assert_match_vrf_line(routerospf.name, vrf1.name, pattern)
|
|
450
370
|
assert_equal(:detail, vrf1.log_adjacency,
|
|
451
|
-
|
|
371
|
+
"Error: #{vrf1.name} vrf, log-adjacency get value mismatch")
|
|
452
372
|
|
|
453
373
|
# Make sure default vrf is set to :none
|
|
454
374
|
assert_equal(:none, vrf_default.log_adjacency,
|
|
455
|
-
|
|
375
|
+
"Error: #{vrf_default.name} vrf_default, " \
|
|
376
|
+
'log-adjacency get value mismatch')
|
|
456
377
|
|
|
457
378
|
routerospf.destroy
|
|
458
379
|
end
|
|
459
380
|
|
|
460
381
|
def test_routerospfvrf_router_id
|
|
461
382
|
vrf = create_routerospfvrf
|
|
462
|
-
id =
|
|
383
|
+
id = '8.1.1.3'
|
|
463
384
|
vrf.router_id = id
|
|
464
|
-
pattern =
|
|
465
|
-
|
|
466
|
-
vrf.name, pattern)
|
|
467
|
-
refute_nil(line, "Error: #{vrf.name} vrf, router-id missing in CLI")
|
|
385
|
+
pattern = /\s+router-id #{id}/
|
|
386
|
+
assert_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
468
387
|
assert_equal(id, vrf.router_id,
|
|
469
388
|
"Error: #{vrf.name} vrf, router-id get value mismatch")
|
|
470
389
|
# set default router id
|
|
471
390
|
vrf.router_id = vrf.default_router_id
|
|
472
|
-
|
|
473
|
-
vrf.name, pattern)
|
|
474
|
-
assert_nil(line, "Error: #{vrf.name} vrf, set default router-id failed")
|
|
391
|
+
refute_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
475
392
|
vrf.parent.destroy
|
|
476
393
|
end
|
|
477
394
|
|
|
478
395
|
def test_routerospfvrf_router_id_multiple_vrf
|
|
479
396
|
routerospf = create_routerospf
|
|
480
397
|
vrf = create_routerospfvrf(routerospf.name)
|
|
481
|
-
vrf1 = create_routerospfvrf(routerospf.name,
|
|
482
|
-
id =
|
|
398
|
+
vrf1 = create_routerospfvrf(routerospf.name, 'testvrf')
|
|
399
|
+
id = '8.1.1.3'
|
|
483
400
|
# set id
|
|
484
401
|
vrf.router_id = id
|
|
485
|
-
pattern =
|
|
486
|
-
|
|
487
|
-
vrf.name, pattern)
|
|
488
|
-
refute_nil(line, "Error: #{vrf.name} vrf, router-id missing in CLI")
|
|
402
|
+
pattern = /\s+router-id #{id}/
|
|
403
|
+
assert_match_vrf_line(routerospf.name, vrf.name, pattern)
|
|
489
404
|
assert_equal(id, vrf.router_id,
|
|
490
405
|
"Error: #{vrf.name} vrf, router-id get value mismatch")
|
|
491
406
|
|
|
492
407
|
# vrf 1
|
|
493
|
-
id =
|
|
408
|
+
id = '10.1.1.3'
|
|
494
409
|
# set id
|
|
495
410
|
vrf1.router_id = id
|
|
496
|
-
pattern =
|
|
497
|
-
|
|
498
|
-
vrf1.name, pattern)
|
|
499
|
-
refute_nil(line, "Error: #{vrf1.name} vrf, router-id missing in CLI")
|
|
411
|
+
pattern = /\s+router-id #{id}/
|
|
412
|
+
assert_match_vrf_line(routerospf.name, vrf1.name, pattern)
|
|
500
413
|
assert_equal(id, vrf1.router_id,
|
|
501
414
|
"Error: #{vrf1.name} vrf, router-id get value mismatch")
|
|
502
415
|
|
|
@@ -505,46 +418,40 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
505
418
|
|
|
506
419
|
def test_routerospfvrf_timer_throttle_lsa
|
|
507
420
|
vrf = create_routerospfvrf
|
|
508
|
-
lsa = [] << 100 <<
|
|
421
|
+
lsa = [] << 100 << 500 << 1000
|
|
509
422
|
vrf.timer_throttle_lsa_set(lsa[0], lsa[1], lsa[2])
|
|
510
423
|
# vrf.send(:timer_throttle_lsa=, lsa[0], lsa[1], lsa[2])
|
|
511
|
-
pattern =
|
|
512
|
-
|
|
513
|
-
vrf.name, pattern)
|
|
514
|
-
refute_nil(line,
|
|
515
|
-
"Error: #{vrf.name} vrf, timer throttle lsa missing in CLI")
|
|
424
|
+
pattern = /\s+timers throttle lsa #{lsa[0]} #{lsa[1]} #{lsa[2]}/
|
|
425
|
+
assert_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
516
426
|
assert_equal(lsa, vrf.timer_throttle_lsa,
|
|
517
|
-
|
|
427
|
+
"Error: #{vrf.name} vrf, timer throttle lsa " \
|
|
428
|
+
'get values mismatch')
|
|
518
429
|
vrf.parent.destroy
|
|
519
430
|
end
|
|
520
431
|
|
|
521
432
|
def test_routerospfvrf_timer_throttle_lsa_multiple_vrf
|
|
522
433
|
routerospf = create_routerospf
|
|
523
434
|
vrf = create_routerospfvrf(routerospf.name)
|
|
524
|
-
vrf1 = create_routerospfvrf(routerospf.name,
|
|
525
|
-
lsa = [] << 100 <<
|
|
435
|
+
vrf1 = create_routerospfvrf(routerospf.name, 'testvrf')
|
|
436
|
+
lsa = [] << 100 << 500 << 1000
|
|
526
437
|
# set lsa
|
|
527
438
|
vrf.timer_throttle_lsa_set(lsa[0], lsa[1], lsa[2])
|
|
528
439
|
# vrf.send(:timer_throttle_lsa=, lsa[0], lsa[1], lsa[2])
|
|
529
|
-
pattern =
|
|
530
|
-
|
|
531
|
-
vrf.name, pattern)
|
|
532
|
-
refute_nil(line,
|
|
533
|
-
"Error: #{vrf.name} vrf, timer throttle lsa missing in CLI")
|
|
440
|
+
pattern = /\s+timers throttle lsa #{lsa[0]} #{lsa[1]} #{lsa[2]}/
|
|
441
|
+
assert_match_vrf_line(routerospf.name, vrf.name, pattern)
|
|
534
442
|
assert_equal(lsa, vrf.timer_throttle_lsa,
|
|
535
|
-
|
|
443
|
+
"Error: #{vrf.name} vrf, timer throttle lsa " \
|
|
444
|
+
'get values mismatch')
|
|
536
445
|
|
|
537
|
-
lsa = [] << 300 <<
|
|
446
|
+
lsa = [] << 300 << 700 << 2000
|
|
538
447
|
# set lsa
|
|
539
448
|
vrf1.timer_throttle_lsa_set(lsa[0], lsa[1], lsa[2])
|
|
540
449
|
# vrf1.send(:timer_throttle_lsa=, lsa[0], lsa[1], lsa[2])
|
|
541
|
-
pattern =
|
|
542
|
-
|
|
543
|
-
vrf1.name, pattern)
|
|
544
|
-
refute_nil(line,
|
|
545
|
-
"Error: #{vrf1.name} vrf, timer throttle lsa missing in CLI")
|
|
450
|
+
pattern = /\s+timers throttle lsa #{lsa[0]} #{lsa[1]} #{lsa[2]}/
|
|
451
|
+
assert_match_vrf_line(routerospf.name, vrf1.name, pattern)
|
|
546
452
|
assert_equal(lsa, vrf1.timer_throttle_lsa,
|
|
547
|
-
|
|
453
|
+
"Error: #{vrf1.name} vrf, timer throttle lsa " \
|
|
454
|
+
'get values mismatch')
|
|
548
455
|
|
|
549
456
|
routerospf.destroy
|
|
550
457
|
end
|
|
@@ -553,17 +460,17 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
553
460
|
vrf = create_routerospfvrf
|
|
554
461
|
lsa = [0, 5000, 5000]
|
|
555
462
|
assert_equal(lsa[0], vrf.timer_throttle_lsa_start,
|
|
556
|
-
|
|
463
|
+
"Error: #{vrf.name} vrf, timer throttle lsa start not correct")
|
|
557
464
|
assert_equal(lsa[1], vrf.timer_throttle_lsa_hold,
|
|
558
|
-
|
|
465
|
+
"Error: #{vrf.name} vrf, timer throttle lsa hold not correct")
|
|
559
466
|
assert_equal(lsa[2], vrf.timer_throttle_lsa_max,
|
|
560
|
-
|
|
467
|
+
"Error: #{vrf.name} vrf, timer throttle lsa max not correct")
|
|
561
468
|
assert_equal(lsa[0], vrf.default_timer_throttle_lsa_start,
|
|
562
|
-
|
|
469
|
+
'Error: default timer throttle lsa start not correct')
|
|
563
470
|
assert_equal(lsa[1], vrf.default_timer_throttle_lsa_hold,
|
|
564
|
-
|
|
471
|
+
'Error: default timer throttle lsa hold not correct')
|
|
565
472
|
assert_equal(lsa[2], vrf.default_timer_throttle_lsa_max,
|
|
566
|
-
|
|
473
|
+
'Error: default timer throttle lsa max not correct')
|
|
567
474
|
vrf.parent.destroy
|
|
568
475
|
end
|
|
569
476
|
|
|
@@ -572,43 +479,37 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
572
479
|
spf = [250, 500, 1000]
|
|
573
480
|
# vrf.send(:timer_throttle_spf=, spf[0], spf[1], spf[2])
|
|
574
481
|
vrf.timer_throttle_spf_set(spf[0], spf[1], spf[2])
|
|
575
|
-
pattern =
|
|
576
|
-
|
|
577
|
-
vrf.name, pattern)
|
|
578
|
-
refute_nil(line,
|
|
579
|
-
"Error: #{vrf.name} vrf, timer throttle spf missing in CLI")
|
|
482
|
+
pattern = /\s+timers throttle spf #{spf[0]} #{spf[1]} #{spf[2]}/
|
|
483
|
+
assert_match_vrf_line(vrf.parent.name, vrf.name, pattern)
|
|
580
484
|
assert_equal(spf, vrf.timer_throttle_spf,
|
|
581
|
-
|
|
485
|
+
"Error: #{vrf.name} vrf, timer throttle spf " \
|
|
486
|
+
'get values mismatch')
|
|
582
487
|
vrf.parent.destroy
|
|
583
488
|
end
|
|
584
489
|
|
|
585
490
|
def test_routerospfvrf_timer_throttle_spf_multiple_vrf
|
|
586
491
|
routerospf = create_routerospf
|
|
587
492
|
vrf = create_routerospfvrf(routerospf.name)
|
|
588
|
-
vrf1 = create_routerospfvrf(routerospf.name,
|
|
589
|
-
spf = [] << 250 <<
|
|
493
|
+
vrf1 = create_routerospfvrf(routerospf.name, 'testvrf')
|
|
494
|
+
spf = [] << 250 << 500 << 1000
|
|
590
495
|
# set spf
|
|
591
496
|
vrf.timer_throttle_spf_set(spf[0], spf[1], spf[2])
|
|
592
497
|
# vrf.send(:timer_throttle_spf=, spf[0], spf[1], spf[2])
|
|
593
|
-
pattern =
|
|
594
|
-
|
|
595
|
-
vrf.name, pattern)
|
|
596
|
-
refute_nil(line,
|
|
597
|
-
"Error: #{vrf.name} vrf, timer throttle spf missing in CLI")
|
|
498
|
+
pattern = /\s+timers throttle spf #{spf[0]} #{spf[1]} #{spf[2]}/
|
|
499
|
+
assert_match_vrf_line(routerospf.name, vrf.name, pattern)
|
|
598
500
|
assert_equal(spf, vrf.timer_throttle_spf,
|
|
599
|
-
|
|
501
|
+
"Error: #{vrf.name} vrf, timer throttle spf " \
|
|
502
|
+
'get values mismatch')
|
|
600
503
|
|
|
601
|
-
spf = [] << 300 <<
|
|
504
|
+
spf = [] << 300 << 700 << 2000
|
|
602
505
|
# set spf
|
|
603
506
|
vrf1.timer_throttle_spf_set(spf[0], spf[1], spf[2])
|
|
604
507
|
# vrf1.send(:timer_throttle_spf=, spf[0], spf[1], spf[2])
|
|
605
|
-
pattern =
|
|
606
|
-
|
|
607
|
-
vrf1.name, pattern)
|
|
608
|
-
refute_nil(line,
|
|
609
|
-
"Error: #{vrf1.name} vrf, timer throttle spf missing in CLI")
|
|
508
|
+
pattern = /\s+timers throttle spf #{spf[0]} #{spf[1]} #{spf[2]}/
|
|
509
|
+
assert_match_vrf_line(routerospf.name, vrf1.name, pattern)
|
|
610
510
|
assert_equal(spf, vrf1.timer_throttle_spf,
|
|
611
|
-
|
|
511
|
+
"Error: #{vrf1.name} vrf, timer throttle spf " \
|
|
512
|
+
'get values mismatch')
|
|
612
513
|
|
|
613
514
|
routerospf.destroy
|
|
614
515
|
end
|
|
@@ -617,27 +518,29 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
617
518
|
vrf = create_routerospfvrf
|
|
618
519
|
spf = [200, 1000, 5000]
|
|
619
520
|
assert_equal(spf[0], vrf.default_timer_throttle_spf_start,
|
|
620
|
-
|
|
521
|
+
'Error: default timer throttle spf not correct')
|
|
621
522
|
assert_equal(spf[1], vrf.default_timer_throttle_spf_hold,
|
|
622
|
-
|
|
523
|
+
'Error: default timer throttle hold not correct')
|
|
623
524
|
assert_equal(spf[2], vrf.default_timer_throttle_spf_max,
|
|
624
|
-
|
|
525
|
+
'Error: default timer throttle max not correct')
|
|
625
526
|
assert_equal(spf[0], vrf.timer_throttle_spf_start,
|
|
626
|
-
|
|
527
|
+
"Error: #{vrf.name} vrf, " \
|
|
528
|
+
'default timer throttle spf not correct')
|
|
627
529
|
assert_equal(spf[1], vrf.timer_throttle_spf_hold,
|
|
628
|
-
|
|
530
|
+
"Error: #{vrf.name} vrf, " \
|
|
531
|
+
'default timer throttle hold not correct')
|
|
629
532
|
assert_equal(spf[2], vrf.timer_throttle_spf_max,
|
|
630
|
-
|
|
533
|
+
"Error: #{vrf.name} vrf, " \
|
|
534
|
+
'default timer throttle max not correct')
|
|
631
535
|
vrf.parent.destroy
|
|
632
536
|
end
|
|
633
537
|
|
|
634
538
|
def test_routerospfvrf_create_valid_destroy_default
|
|
635
|
-
ospfname =
|
|
539
|
+
ospfname = 'ospfTest'
|
|
636
540
|
routerospf = RouterOspf.new(ospfname)
|
|
637
|
-
vrfname =
|
|
541
|
+
vrfname = 'default'
|
|
638
542
|
vrf = RouterOspfVrf.new(routerospf.name, vrfname)
|
|
639
|
-
|
|
640
|
-
refute_nil(line, "Error: #{vrfname} vrf, does not exist in CLI")
|
|
543
|
+
assert_match_vrf_line(ospfname, vrfname)
|
|
641
544
|
assert_equal(vrfname, vrf.name,
|
|
642
545
|
"Error: #{vrfname} vrf, create failed")
|
|
643
546
|
assert_raises(RuntimeError) do
|
|
@@ -646,96 +549,75 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
646
549
|
routerospf.destroy
|
|
647
550
|
end
|
|
648
551
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
:
|
|
654
|
-
:
|
|
655
|
-
:
|
|
656
|
-
:
|
|
552
|
+
# rubocop:disable Style/AlignHash
|
|
553
|
+
MULTIPLE_OSPFS_MULTIPLE_VRFS = Hash.new { |h, k| h[k] = {} }.merge(
|
|
554
|
+
'ospfTest' => {
|
|
555
|
+
'default' => {
|
|
556
|
+
vrf: 'default', cov: 90,
|
|
557
|
+
cot: RouterOspfVrf::OSPF_AUTO_COST[:mbps], dm: 15_000,
|
|
558
|
+
id: '9.0.0.2', l1: 130, l2: 530, l3: 1030, s1: 300,
|
|
559
|
+
s2: 600, s3: 1100
|
|
657
560
|
},
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
:
|
|
663
|
-
:
|
|
664
|
-
:
|
|
665
|
-
:s2 => 600, :s3 => 1100
|
|
561
|
+
},
|
|
562
|
+
'bxb300' => {
|
|
563
|
+
'default' => {
|
|
564
|
+
vrf: 'default', cov: 200,
|
|
565
|
+
cot: RouterOspfVrf::OSPF_AUTO_COST[:mbps], dm: 10_000,
|
|
566
|
+
id: '10.0.0.3', l1: 130, l2: 530, l3: 1030, s1: 300,
|
|
567
|
+
s2: 600, s3: 1100
|
|
666
568
|
},
|
|
667
|
-
|
|
668
|
-
:
|
|
669
|
-
:
|
|
670
|
-
:
|
|
671
|
-
:
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
s = @device.cmd("feature ospf")
|
|
677
|
-
s = @device.cmd("end")
|
|
678
|
-
# pre-populate values
|
|
679
|
-
ospf_h.each do | k, v|
|
|
680
|
-
# Assuming all values are in hash
|
|
681
|
-
s = @device.cmd("configure terminal")
|
|
682
|
-
s = @device.cmd("router ospf #{k}")
|
|
683
|
-
v.each do | k1, v1|
|
|
684
|
-
# puts "!!!!!k1: v1 vrf: #{k1} : !!!#{v1[:vrf]}"
|
|
685
|
-
s = @device.cmd("vrf #{v1[:vrf]}") if (k1 != "default")
|
|
686
|
-
s = @device.cmd("auto-cost reference-bandwidth #{v1[:cov]}")
|
|
687
|
-
s = @device.cmd("default-metric #{v1[:dm]}")
|
|
688
|
-
s = @device.cmd("router-id #{v1[:id]}")
|
|
689
|
-
s = @device.cmd("timers throttle lsa #{v1[:l1]} #{v1[:l2]} #{v1[:l3]}")
|
|
690
|
-
s = @device.cmd("timers throttle spf #{v1[:s1]} #{v1[:s2]} #{v1[:s3]}")
|
|
691
|
-
s = @device.cmd("exit") if (k1 != "default")
|
|
692
|
-
end
|
|
693
|
-
s = @device.cmd("end")
|
|
694
|
-
end
|
|
695
|
-
node.cache_flush
|
|
569
|
+
'nondefault' => {
|
|
570
|
+
vrf: 'nondefault', cov: 300,
|
|
571
|
+
cot: RouterOspfVrf::OSPF_AUTO_COST[:mbps], dm: 30_000,
|
|
572
|
+
id: '10.0.0.4', l1: 230, l2: 730, l3: 2030, s1: 400,
|
|
573
|
+
s2: 700, s3: 2100
|
|
574
|
+
},
|
|
575
|
+
},
|
|
576
|
+
)
|
|
577
|
+
# rubocop:enable Style/AlignHash
|
|
696
578
|
|
|
579
|
+
def test_routerospfvrf_collection_router_multi_vrfs
|
|
580
|
+
config_from_hash(MULTIPLE_OSPFS_MULTIPLE_VRFS)
|
|
697
581
|
routers = RouterOspf.routers
|
|
698
582
|
# validate the collection
|
|
699
|
-
routers.
|
|
583
|
+
routers.each_key do |routername|
|
|
700
584
|
vrfs = RouterOspfVrf.vrfs
|
|
701
|
-
refute_empty(vrfs,
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
585
|
+
refute_empty(vrfs, 'Error: Collection is empty')
|
|
586
|
+
unless MULTIPLE_OSPFS_MULTIPLE_VRFS.key?(routername)
|
|
587
|
+
puts "%Error: hash does not have hash key #{routername}"
|
|
588
|
+
end
|
|
589
|
+
ospfh = MULTIPLE_OSPFS_MULTIPLE_VRFS.fetch(routername)
|
|
590
|
+
vrfs[routername].each do |name, vrf|
|
|
705
591
|
puts "%Error: hash key #{routername} not found" unless ospfh.key?(name)
|
|
706
592
|
hv = ospfh.fetch(name)
|
|
707
593
|
auto_cost_value = [] << hv[:cov] << hv[:cot]
|
|
708
594
|
assert_equal(hv[:vrf], vrf.name,
|
|
709
|
-
|
|
595
|
+
'Error: Collection, vrf name')
|
|
710
596
|
assert_equal(auto_cost_value, vrf.auto_cost,
|
|
711
|
-
|
|
597
|
+
'Error: Collection, auto cost')
|
|
712
598
|
assert_equal(hv[:dm], vrf.default_metric,
|
|
713
|
-
|
|
599
|
+
'Error: Collection, default metric')
|
|
714
600
|
assert_equal(hv[:id], vrf.router_id,
|
|
715
|
-
|
|
601
|
+
'Error: Collection, router id')
|
|
716
602
|
lsa = [] << hv[:l1] << hv[:l2] << hv[:l3]
|
|
717
603
|
assert_equal(lsa, vrf.timer_throttle_lsa,
|
|
718
|
-
|
|
604
|
+
'Error: Collection, timer throttle lsa')
|
|
719
605
|
spf = [] << hv[:s1] << hv[:s2] << hv[:s3]
|
|
720
606
|
assert_equal(spf, vrf.timer_throttle_spf,
|
|
721
|
-
|
|
607
|
+
'Error: Collection, timer throttle spf')
|
|
722
608
|
end
|
|
723
|
-
ospf_vrfs_destroy(vrfs, routername)
|
|
724
|
-
vrfs=nil
|
|
725
609
|
end
|
|
726
|
-
ospf_routers_destroy(routers)
|
|
727
|
-
routers=nil
|
|
728
610
|
end
|
|
729
611
|
|
|
730
612
|
def test_routerospfvrf_timer_throttle_lsa_start_hold_max
|
|
731
613
|
vrf = create_routerospfvrf
|
|
732
614
|
vrf.timer_throttle_lsa_set(250, 900, 5001)
|
|
733
615
|
assert_equal(250, vrf.timer_throttle_lsa_start,
|
|
734
|
-
|
|
616
|
+
"Error: #{vrf.name} vrf, start timer throttle lsa not correct")
|
|
735
617
|
assert_equal(900, vrf.timer_throttle_lsa_hold,
|
|
736
|
-
|
|
618
|
+
"Error: #{vrf.name} vrf, hold timer throttle lsa not correct")
|
|
737
619
|
assert_equal(5001, vrf.timer_throttle_lsa_max,
|
|
738
|
-
|
|
620
|
+
"Error: #{vrf.name} vrf, max timer throttle lsa not correct")
|
|
739
621
|
vrf.parent.destroy
|
|
740
622
|
end
|
|
741
623
|
|
|
@@ -743,17 +625,17 @@ class TestRouterOspfVrf < CiscoTestCase
|
|
|
743
625
|
vrf = create_routerospfvrf
|
|
744
626
|
vrf.timer_throttle_spf_set(250, 900, 5001)
|
|
745
627
|
assert_equal(250, vrf.timer_throttle_spf_start,
|
|
746
|
-
|
|
628
|
+
"Error: #{vrf.name} vrf, start timer throttle spf not correct")
|
|
747
629
|
assert_equal(900, vrf.timer_throttle_spf_hold,
|
|
748
|
-
|
|
630
|
+
"Error: #{vrf.name} vrf, hold timer throttle spf not correct")
|
|
749
631
|
assert_equal(5001, vrf.timer_throttle_spf_max,
|
|
750
|
-
|
|
632
|
+
"Error: #{vrf.name} vrf, max timer throttle spf not correct")
|
|
751
633
|
vrf.parent.destroy
|
|
752
634
|
end
|
|
753
635
|
|
|
754
636
|
def test_routerospfvrf_noninstantiated
|
|
755
637
|
routerospf = create_routerospf
|
|
756
|
-
vrf = RouterOspfVrf.new(
|
|
638
|
+
vrf = RouterOspfVrf.new('absent', 'absent', false)
|
|
757
639
|
vrf.auto_cost
|
|
758
640
|
vrf.default_metric
|
|
759
641
|
vrf.log_adjacency
|