cisco_acl_intp 0.0.3 → 0.0.4
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 +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +2 -2
- data/.travis.yml +4 -2
- data/Gemfile +7 -6
- data/README.md +23 -18
- data/Rakefile +11 -13
- data/cisco_acl_intp.gemspec +7 -7
- data/lib/cisco_acl_intp/acc.rb +111 -0
- data/lib/cisco_acl_intp/{ace.rb → ace_base.rb} +9 -8
- data/lib/cisco_acl_intp/{extended_ace.rb → ace_extended.rb} +8 -10
- data/lib/cisco_acl_intp/{standard_ace.rb → ace_standard.rb} +5 -5
- data/lib/cisco_acl_intp/acespec_base.rb +15 -0
- data/lib/cisco_acl_intp/{ace_ip.rb → acespec_ip.rb} +14 -22
- data/lib/cisco_acl_intp/{ace_other_qualifiers.rb → acespec_other_qualifiers.rb} +7 -7
- data/lib/cisco_acl_intp/{ace_port.rb → acespec_port.rb} +10 -13
- data/lib/cisco_acl_intp/{ace_port_opr.rb → acespec_port_opr.rb} +75 -73
- data/lib/cisco_acl_intp/{ace_port_opr_base.rb → acespec_port_opr_base.rb} +49 -34
- data/lib/cisco_acl_intp/{ace_proto.rb → acespec_proto.rb} +4 -4
- data/lib/cisco_acl_intp/{ace_proto_base.rb → acespec_proto_base.rb} +8 -8
- data/lib/cisco_acl_intp/{ace_srcdst.rb → acespec_srcdst.rb} +9 -8
- data/lib/cisco_acl_intp/{ace_tcp_flags.rb → acespec_tcp_flags.rb} +4 -4
- data/lib/cisco_acl_intp/acl.rb +1 -1
- data/lib/cisco_acl_intp/acl_base.rb +108 -80
- data/lib/cisco_acl_intp/{mono_function_acl.rb → acl_category_base.rb} +5 -5
- data/lib/cisco_acl_intp/acl_utils.rb +1 -1
- data/lib/cisco_acl_intp/parser.rb +388 -406
- data/lib/cisco_acl_intp/parser.ry +8 -3
- data/lib/cisco_acl_intp/parser_api.rb +4 -4
- data/lib/cisco_acl_intp/scanner.rb +8 -10
- data/lib/cisco_acl_intp/scanner_special_token_handler.rb +3 -3
- data/lib/cisco_acl_intp/version.rb +1 -1
- data/spec/cisco_acl_intp/{extended_ace_spec.rb → ace_extended_spec.rb} +157 -128
- data/spec/cisco_acl_intp/ace_spec.rb +21 -19
- data/spec/cisco_acl_intp/{standard_ace_spec.rb → ace_standard_spec.rb} +7 -11
- data/spec/cisco_acl_intp/{ace_ip_spec.rb → acespec_ip_spec.rb} +34 -34
- data/spec/cisco_acl_intp/{ace_other_qualifier_spec.rb → acespec_other_qualifier_spec.rb} +18 -18
- data/spec/cisco_acl_intp/acespec_port_operator_spec.rb +331 -0
- data/spec/cisco_acl_intp/{ace_port_spec.rb → acespec_port_spec.rb} +33 -33
- data/spec/cisco_acl_intp/{ace_proto_spec.rb → acespec_proto_spec.rb} +61 -61
- data/spec/cisco_acl_intp/{ace_srcdst_spec.rb → acespec_srcdst_spec.rb} +113 -54
- data/spec/cisco_acl_intp/{ace_tcp_flags_spec.rb → acespec_tcp_flags_spec.rb} +10 -10
- data/spec/cisco_acl_intp/acl_base_spec.rb +14 -12
- data/spec/cisco_acl_intp/{extended_acl_spec.rb → acl_extended_spec.rb} +28 -28
- data/spec/cisco_acl_intp/{standard_acl_spec.rb → acl_standard_spec.rb} +24 -23
- data/spec/cisco_acl_intp/cisco_acl_intp_spec.rb +1 -1
- data/spec/cisco_acl_intp/parser_spec.rb +12 -12
- data/spec/cisco_acl_intp/scanner_spec.rb +31 -36
- data/spec/parser_fullfill_patterns.rb +6 -7
- data/spec/spec_helper.rb +6 -6
- data/tools/check_acl.rb +1 -1
- metadata +60 -59
- data/lib/cisco_acl_intp/single_acl_base.rb +0 -137
- data/spec/cisco_acl_intp/ace_port_operator_spec.rb +0 -340
@@ -10,15 +10,15 @@ describe AceTcpFlag do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should be make tcp flags' do
|
13
|
-
@flag.to_s.
|
13
|
+
expect(@flag.to_s).to be_aclstr('established')
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should be true when same flag' do
|
17
|
-
(@flag == @flag1).
|
17
|
+
expect(@flag == @flag1).to be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should not false when different flag' do
|
21
|
-
(@flag == @flag2).
|
21
|
+
expect(@flag == @flag2).to be_falsey
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -33,17 +33,17 @@ describe AceTcpFlagList do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should be size 0 when empty list' do
|
36
|
-
@list.size.
|
36
|
+
expect(@list.size).to be_zero
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should count-up size when added AceTcpFlag objects' do
|
40
40
|
@list.push @f1
|
41
|
-
@list.size.
|
41
|
+
expect(@list.size).to eq 1
|
42
42
|
@list.push @f2
|
43
|
-
@list.size.
|
43
|
+
expect(@list.size).to eq 2
|
44
44
|
@list.push @f3
|
45
|
-
@list.size.
|
46
|
-
@list.to_s.
|
45
|
+
expect(@list.size).to eq 3
|
46
|
+
expect(@list.to_s).to be_aclstr('syn ack established')
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -60,11 +60,11 @@ describe AceTcpFlagList do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'should be true when same list' do
|
63
|
-
(@list1 == @list2).
|
63
|
+
expect(@list1 == @list2).to be_truthy
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'should be false when different list' do
|
67
|
-
(@list1 == @list3).
|
67
|
+
expect(@list1 == @list3).to be_falsey
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -6,7 +6,7 @@ describe 'AclContainerBase' do
|
|
6
6
|
describe '#generate_tagged_str' do
|
7
7
|
before do
|
8
8
|
# test mock
|
9
|
-
class TestAclContainer <
|
9
|
+
class TestAclContainer < AccessControlContainer
|
10
10
|
def initialize(str)
|
11
11
|
@str = str
|
12
12
|
end
|
@@ -23,32 +23,34 @@ describe 'AclContainerBase' do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'shoud be cleaning whitespace' do
|
26
|
-
@mock.to_s_with_cleaning.
|
26
|
+
expect(@mock.to_s_with_cleaning).to eq 'foo bar baz'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should be same as raw string' do
|
30
|
-
|
31
|
-
@mock.to_s_with_tag(:port).
|
30
|
+
AccessControlContainer.color_mode = :none
|
31
|
+
expect(@mock.to_s_with_tag(:port)).to eq 'teststr'
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should be colored string when mode html' do
|
35
|
-
|
35
|
+
AccessControlContainer.color_mode = :html
|
36
36
|
tag = :header
|
37
37
|
matchstr = "span.*acltag_#{tag}.*teststr.*span"
|
38
|
-
@mock.to_s_with_tag(tag).
|
39
|
-
|
38
|
+
expect(@mock.to_s_with_tag(tag)).to match(/#{matchstr}/)
|
39
|
+
AccessControlContainer.color_mode = :none
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should be colored string when mode term' do
|
43
|
-
|
44
|
-
@mock.to_s_with_tag(:error).
|
45
|
-
|
43
|
+
AccessControlContainer.color_mode = :term
|
44
|
+
expect(@mock.to_s_with_tag(:error)).to match(
|
45
|
+
/\e\[0?\d+m.*teststr.*\e\[0?m/
|
46
|
+
)
|
47
|
+
AccessControlContainer.color_mode = :none
|
46
48
|
end
|
47
49
|
|
48
50
|
it 'should be raised NoMethodError when unknown tag' do
|
49
|
-
|
51
|
+
expect do
|
50
52
|
@cntr.to_s_with_tag(:hoge)
|
51
|
-
end.
|
53
|
+
end.to raise_error(NoMethodError)
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
@@ -8,9 +8,9 @@ describe NamedExtAcl do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should be zero when initialized' do
|
11
|
-
@acl.size.
|
12
|
-
@acl.named_acl
|
13
|
-
@acl.numbered_acl
|
11
|
+
expect(@acl.size).to be_zero
|
12
|
+
expect(@acl.named_acl?).to be_truthy
|
13
|
+
expect(@acl.numbered_acl?).to be_falsey
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should be size 1 and matches aclstr when added a acl entry' do
|
@@ -27,12 +27,12 @@ describe NamedExtAcl do
|
|
27
27
|
}
|
28
28
|
)
|
29
29
|
@acl.add_entry ea
|
30
|
-
@acl.size.
|
30
|
+
expect(@acl.size).to eq 1
|
31
31
|
aclstr = <<'EOL'
|
32
32
|
ip access-list extended test-ext-acl
|
33
33
|
permit udp 192.168.3.0 0.0.0.127 192.168.4.0 0.0.0.255
|
34
34
|
EOL
|
35
|
-
@acl.to_s.
|
35
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -68,7 +68,7 @@ EOL
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should be size 2' do
|
71
|
-
@acl.size.
|
71
|
+
expect(@acl.size).to eq 2
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'mutches aclstr' do
|
@@ -77,7 +77,7 @@ ip access-list extended test-ext-acl2
|
|
77
77
|
permit udp 192.168.3.0 0.0.0.127 192.168.4.0 0.0.0.255
|
78
78
|
deny tcp host 192.168.3.3 192.168.4.0 0.0.0.255 gt 32768
|
79
79
|
EOL
|
80
|
-
@acl.to_s.
|
80
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'mutches aclstr with remark' do
|
@@ -89,9 +89,8 @@ ip access-list extended test-ext-acl2
|
|
89
89
|
deny tcp host 192.168.3.3 192.168.4.0 0.0.0.255 gt 32768
|
90
90
|
remark this is remark!!
|
91
91
|
EOL
|
92
|
-
@acl.to_s.
|
92
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
93
93
|
end
|
94
|
-
|
95
94
|
end
|
96
95
|
|
97
96
|
describe '#find_aces_contains' do
|
@@ -129,7 +128,7 @@ EOL
|
|
129
128
|
src_operator: :eq, src_ip: '192.168.10.3', src_port: 64_332,
|
130
129
|
dst_operator: :eq, dst_ip: '192.168.4.5', dst_port: 32_889
|
131
130
|
)
|
132
|
-
ace.to_s.
|
131
|
+
expect(ace.to_s).to be_aclstr(
|
133
132
|
'deny tcp host 192.168.10.3 192.168.4.0 0.0.0.255 gt 32768'
|
134
133
|
)
|
135
134
|
end
|
@@ -140,15 +139,16 @@ EOL
|
|
140
139
|
src_operator: :eq, src_ip: '192.168.10.3', src_port: 64_332,
|
141
140
|
dst_operator: :eq, dst_ip: '10.0.0.3', dst_port: 33_890
|
142
141
|
)
|
143
|
-
ace.to_s.
|
142
|
+
expect(ace.to_s).to be_aclstr('deny ip any 10.0.0.0 0.0.0.255')
|
144
143
|
end
|
145
144
|
|
146
145
|
it 'should be nil if not found match entry' do
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
146
|
+
expect(
|
147
|
+
@acl.find_aces_contains(
|
148
|
+
protocol: 'udp',
|
149
|
+
src_operator: :eq, src_ip: '192.168.10.3', src_port: 62_223,
|
150
|
+
dst_operator: :eq, dst_ip: '11.0.0.3', dst_port: 33_333
|
151
|
+
)).to be_nil
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
@@ -156,14 +156,14 @@ end
|
|
156
156
|
describe NumberedAcl do
|
157
157
|
describe '#initialize' do
|
158
158
|
it 'should be error with acl no-integer-acl-number' do
|
159
|
-
|
159
|
+
expect do
|
160
160
|
@acl = NumberedAcl.new('a70')
|
161
|
-
end.
|
161
|
+
end.to raise_error(AclArgumentError)
|
162
162
|
end
|
163
163
|
it 'should be error with invalid number' do
|
164
|
-
|
164
|
+
expect do
|
165
165
|
@acl = NumberedAcl.new(33.3)
|
166
|
-
end.
|
166
|
+
end.to raise_error(AclArgumentError)
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
@@ -175,9 +175,9 @@ describe NumberedExtAcl do
|
|
175
175
|
end
|
176
176
|
|
177
177
|
it 'should be zero when initialized' do
|
178
|
-
@acl.size.
|
179
|
-
@acl.named_acl
|
180
|
-
@acl.numbered_acl
|
178
|
+
expect(@acl.size).to be_zero
|
179
|
+
expect(@acl.named_acl?).to be_falsey
|
180
|
+
expect(@acl.numbered_acl?).to be_truthy
|
181
181
|
end
|
182
182
|
|
183
183
|
it 'should be size 1 and matches aclstr when added a acl entry' do
|
@@ -194,11 +194,11 @@ describe NumberedExtAcl do
|
|
194
194
|
}
|
195
195
|
)
|
196
196
|
@acl.add_entry ea
|
197
|
-
@acl.size.
|
197
|
+
expect(@acl.size).to eq 1
|
198
198
|
aclstr = <<'EOL'
|
199
199
|
access-list 102 permit udp 192.168.3.0 0.0.0.127 192.168.4.0 0.0.0.255
|
200
200
|
EOL
|
201
|
-
@acl.to_s.
|
201
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
@@ -234,7 +234,7 @@ EOL
|
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'should be size 2' do
|
237
|
-
@acl.size.
|
237
|
+
expect(@acl.size).to eq 2
|
238
238
|
end
|
239
239
|
|
240
240
|
it 'mutches aclstr' do
|
@@ -242,7 +242,7 @@ EOL
|
|
242
242
|
access-list 104 permit udp 192.168.3.0 0.0.0.127 192.168.4.0 0.0.0.255
|
243
243
|
access-list 104 deny tcp host 192.168.3.3 192.168.4.0 0.0.0.255 gt 32768
|
244
244
|
EOL
|
245
|
-
@acl.to_s.
|
245
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
246
246
|
end
|
247
247
|
|
248
248
|
it 'mutches aclstr with remark' do
|
@@ -253,7 +253,7 @@ access-list 104 permit udp 192.168.3.0 0.0.0.127 192.168.4.0 0.0.0.255
|
|
253
253
|
access-list 104 deny tcp host 192.168.3.3 192.168.4.0 0.0.0.255 gt 32768
|
254
254
|
access-list 104 remark this is remark!!
|
255
255
|
EOL
|
256
|
-
@acl.to_s.
|
256
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
257
257
|
end
|
258
258
|
end
|
259
259
|
end
|
@@ -8,7 +8,7 @@ describe NamedStdAcl do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should be zero when initialized' do
|
11
|
-
@acl.size.
|
11
|
+
expect(@acl.size).to be_zero
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should be size 1 and matches aclstr when added a acl entry' do
|
@@ -20,12 +20,12 @@ describe NamedStdAcl do
|
|
20
20
|
}
|
21
21
|
)
|
22
22
|
@acl.add_entry sa
|
23
|
-
@acl.size.
|
23
|
+
expect(@acl.size).to eq 1
|
24
24
|
aclstr = <<'EOL'
|
25
25
|
ip access-list standard test-std-acl
|
26
26
|
permit 192.168.3.0 0.0.0.127
|
27
27
|
EOL
|
28
|
-
@acl.to_s.
|
28
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -49,7 +49,7 @@ EOL
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should be size 2' do
|
52
|
-
@acl.size.
|
52
|
+
expect(@acl.size).to eq 2
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'mutches aclstr' do
|
@@ -58,7 +58,7 @@ ip access-list standard test-std-acl2
|
|
58
58
|
permit 192.168.3.0 0.0.0.127
|
59
59
|
deny 192.168.4.0 0.0.0.255
|
60
60
|
EOL
|
61
|
-
@acl.to_s.
|
61
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'mutches aclstr with remark' do
|
@@ -70,7 +70,7 @@ ip access-list standard test-std-acl2
|
|
70
70
|
deny 192.168.4.0 0.0.0.255
|
71
71
|
remark this is remark!!
|
72
72
|
EOL
|
73
|
-
@acl.to_s.
|
73
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -99,7 +99,7 @@ EOL
|
|
99
99
|
protocol: 'tcp',
|
100
100
|
src_operator: :eq, src_ip: '192.168.10.3', src_port: 64_332
|
101
101
|
)
|
102
|
-
ace.to_s.
|
102
|
+
expect(ace.to_s).to be_aclstr('deny host 192.168.10.3')
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'should be last entry' do
|
@@ -107,14 +107,15 @@ EOL
|
|
107
107
|
protocol: 'tcp',
|
108
108
|
src_operator: :eq, src_ip: '10.0.0.3', src_port: 33_890
|
109
109
|
)
|
110
|
-
ace.to_s.
|
110
|
+
expect(ace.to_s).to be_aclstr('deny 10.0.0.0 0.0.0.255')
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'should be nil if not found match entry' do
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
114
|
+
expect(
|
115
|
+
@acl.find_aces_contains(
|
116
|
+
protocol: 'udp',
|
117
|
+
src_operator: :eq, src_ip: '11.0.0.3', src_port: 33_333
|
118
|
+
)).to be_nil
|
118
119
|
end
|
119
120
|
end
|
120
121
|
end
|
@@ -126,7 +127,7 @@ describe NumberedStdAcl do
|
|
126
127
|
end
|
127
128
|
|
128
129
|
it 'should be zero when initialized' do
|
129
|
-
@acl.size.
|
130
|
+
expect(@acl.size).to be_zero
|
130
131
|
end
|
131
132
|
|
132
133
|
it 'should be size 1 and matches aclstr when added a acl entry' do
|
@@ -138,11 +139,11 @@ describe NumberedStdAcl do
|
|
138
139
|
}
|
139
140
|
)
|
140
141
|
@acl.add_entry sa
|
141
|
-
@acl.size.
|
142
|
+
expect(@acl.size).to eq 1
|
142
143
|
aclstr = <<'EOL'
|
143
144
|
access-list 10 permit 192.168.3.0 0.0.0.127
|
144
145
|
EOL
|
145
|
-
@acl.to_s.
|
146
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
@@ -166,7 +167,7 @@ EOL
|
|
166
167
|
end
|
167
168
|
|
168
169
|
it 'should be size 2' do
|
169
|
-
@acl.size.
|
170
|
+
expect(@acl.size).to eq 2
|
170
171
|
end
|
171
172
|
|
172
173
|
it 'mutches aclstr' do
|
@@ -174,7 +175,7 @@ EOL
|
|
174
175
|
access-list 14 permit 192.168.3.0 0.0.0.127
|
175
176
|
access-list 14 deny 192.168.4.0 0.0.0.255
|
176
177
|
EOL
|
177
|
-
@acl.to_s.
|
178
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
178
179
|
end
|
179
180
|
|
180
181
|
it 'mutches aclstr with remark' do
|
@@ -185,7 +186,7 @@ access-list 14 permit 192.168.3.0 0.0.0.127
|
|
185
186
|
access-list 14 deny 192.168.4.0 0.0.0.255
|
186
187
|
access-list 14 remark this is remark!!
|
187
188
|
EOL
|
188
|
-
@acl.to_s.
|
189
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
189
190
|
end
|
190
191
|
end
|
191
192
|
|
@@ -202,7 +203,7 @@ EOL
|
|
202
203
|
it 'should has seq number by add_entry' do
|
203
204
|
@acl.renumber
|
204
205
|
@acl.reduce(10) do |num, each|
|
205
|
-
each.seq_number.
|
206
|
+
expect(each.seq_number).to eq num
|
206
207
|
num + 10
|
207
208
|
end
|
208
209
|
end
|
@@ -229,10 +230,10 @@ access-list 15 remark entry 4
|
|
229
230
|
access-list 15 remark entry 2
|
230
231
|
access-list 15 remark entry 3
|
231
232
|
EOL
|
232
|
-
@acl.name.
|
233
|
-
@acl.acl_type.
|
234
|
-
@acl.to_s.
|
235
|
-
acl_new.to_s.
|
233
|
+
expect(@acl.name).to eq acl_new.name
|
234
|
+
expect(@acl.acl_type).to eq acl_new.acl_type
|
235
|
+
expect(@acl.to_s).to be_aclstr(aclstr)
|
236
|
+
expect(acl_new.to_s).to be_aclstr(aclstr_new)
|
236
237
|
end
|
237
238
|
end
|
238
239
|
end
|
@@ -19,9 +19,9 @@ ip access-list extended FA8-OUT
|
|
19
19
|
!
|
20
20
|
EOL
|
21
21
|
@parser.parse_string(datastr)
|
22
|
-
@parser.contains_error
|
22
|
+
expect(@parser.contains_error?).to be_falsey
|
23
23
|
@parser.parse_string(StringIO.new(datastr))
|
24
|
-
@parser.contains_error
|
24
|
+
expect(@parser.contains_error?).to be_falsey
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should not be parsed acl' do
|
@@ -34,15 +34,15 @@ ip access-list extended FA8-OUT
|
|
34
34
|
!
|
35
35
|
EOL
|
36
36
|
@parser.parse_string(datastr)
|
37
|
-
@parser.contains_error
|
37
|
+
expect(@parser.contains_error?).to be_truthy
|
38
38
|
@parser.parse_string(StringIO.new(datastr))
|
39
|
-
@parser.contains_error
|
39
|
+
expect(@parser.contains_error?).to be_truthy
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should be error by NON-IO object' do
|
43
43
|
@parser.parse_string(123_456_789)
|
44
|
-
@parser.contains_error
|
45
|
-
@parser.error_list.shift.
|
44
|
+
expect(@parser.contains_error?).to be_truthy
|
45
|
+
expect(@parser.error_list.shift).to match(/acl error/)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -60,7 +60,7 @@ ip access-list extended FA8-OUT
|
|
60
60
|
!
|
61
61
|
EOL
|
62
62
|
@parser.parse_file(StringIO.new(datastr))
|
63
|
-
@parser.contains_error
|
63
|
+
expect(@parser.contains_error?).to be_falsey
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'should not be parsed acl' do
|
@@ -73,13 +73,13 @@ ip access-list extended FA8-OUT
|
|
73
73
|
!
|
74
74
|
EOL
|
75
75
|
@parser.parse_file(StringIO.new(datastr))
|
76
|
-
@parser.contains_error
|
76
|
+
expect(@parser.contains_error?).to be_truthy
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'should be error by NON-IO object' do
|
80
80
|
@parser.parse_file(123_456_789)
|
81
|
-
@parser.contains_error
|
82
|
-
@parser.error_list.shift.
|
81
|
+
expect(@parser.contains_error?).to be_truthy
|
82
|
+
expect(@parser.error_list.shift).to match(/Parse aborted/)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -111,12 +111,12 @@ EOL
|
|
111
111
|
if each_test[:correct]
|
112
112
|
it "should be parsed #{acl_file} with no error" do
|
113
113
|
@parser.parse_file(acl_file)
|
114
|
-
@parser.contains_error
|
114
|
+
expect(@parser.contains_error?).to be_falsey
|
115
115
|
end
|
116
116
|
else
|
117
117
|
it "should be parsed #{acl_file} with error" do
|
118
118
|
@parser.parse_file(acl_file)
|
119
|
-
@parser.contains_error
|
119
|
+
expect(@parser.contains_error?).to be_truthy
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|