cisco_acl_intp 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rubocop.yml +2 -2
  4. data/.travis.yml +4 -2
  5. data/Gemfile +7 -6
  6. data/README.md +23 -18
  7. data/Rakefile +11 -13
  8. data/cisco_acl_intp.gemspec +7 -7
  9. data/lib/cisco_acl_intp/acc.rb +111 -0
  10. data/lib/cisco_acl_intp/{ace.rb → ace_base.rb} +9 -8
  11. data/lib/cisco_acl_intp/{extended_ace.rb → ace_extended.rb} +8 -10
  12. data/lib/cisco_acl_intp/{standard_ace.rb → ace_standard.rb} +5 -5
  13. data/lib/cisco_acl_intp/acespec_base.rb +15 -0
  14. data/lib/cisco_acl_intp/{ace_ip.rb → acespec_ip.rb} +14 -22
  15. data/lib/cisco_acl_intp/{ace_other_qualifiers.rb → acespec_other_qualifiers.rb} +7 -7
  16. data/lib/cisco_acl_intp/{ace_port.rb → acespec_port.rb} +10 -13
  17. data/lib/cisco_acl_intp/{ace_port_opr.rb → acespec_port_opr.rb} +75 -73
  18. data/lib/cisco_acl_intp/{ace_port_opr_base.rb → acespec_port_opr_base.rb} +49 -34
  19. data/lib/cisco_acl_intp/{ace_proto.rb → acespec_proto.rb} +4 -4
  20. data/lib/cisco_acl_intp/{ace_proto_base.rb → acespec_proto_base.rb} +8 -8
  21. data/lib/cisco_acl_intp/{ace_srcdst.rb → acespec_srcdst.rb} +9 -8
  22. data/lib/cisco_acl_intp/{ace_tcp_flags.rb → acespec_tcp_flags.rb} +4 -4
  23. data/lib/cisco_acl_intp/acl.rb +1 -1
  24. data/lib/cisco_acl_intp/acl_base.rb +108 -80
  25. data/lib/cisco_acl_intp/{mono_function_acl.rb → acl_category_base.rb} +5 -5
  26. data/lib/cisco_acl_intp/acl_utils.rb +1 -1
  27. data/lib/cisco_acl_intp/parser.rb +388 -406
  28. data/lib/cisco_acl_intp/parser.ry +8 -3
  29. data/lib/cisco_acl_intp/parser_api.rb +4 -4
  30. data/lib/cisco_acl_intp/scanner.rb +8 -10
  31. data/lib/cisco_acl_intp/scanner_special_token_handler.rb +3 -3
  32. data/lib/cisco_acl_intp/version.rb +1 -1
  33. data/spec/cisco_acl_intp/{extended_ace_spec.rb → ace_extended_spec.rb} +157 -128
  34. data/spec/cisco_acl_intp/ace_spec.rb +21 -19
  35. data/spec/cisco_acl_intp/{standard_ace_spec.rb → ace_standard_spec.rb} +7 -11
  36. data/spec/cisco_acl_intp/{ace_ip_spec.rb → acespec_ip_spec.rb} +34 -34
  37. data/spec/cisco_acl_intp/{ace_other_qualifier_spec.rb → acespec_other_qualifier_spec.rb} +18 -18
  38. data/spec/cisco_acl_intp/acespec_port_operator_spec.rb +331 -0
  39. data/spec/cisco_acl_intp/{ace_port_spec.rb → acespec_port_spec.rb} +33 -33
  40. data/spec/cisco_acl_intp/{ace_proto_spec.rb → acespec_proto_spec.rb} +61 -61
  41. data/spec/cisco_acl_intp/{ace_srcdst_spec.rb → acespec_srcdst_spec.rb} +113 -54
  42. data/spec/cisco_acl_intp/{ace_tcp_flags_spec.rb → acespec_tcp_flags_spec.rb} +10 -10
  43. data/spec/cisco_acl_intp/acl_base_spec.rb +14 -12
  44. data/spec/cisco_acl_intp/{extended_acl_spec.rb → acl_extended_spec.rb} +28 -28
  45. data/spec/cisco_acl_intp/{standard_acl_spec.rb → acl_standard_spec.rb} +24 -23
  46. data/spec/cisco_acl_intp/cisco_acl_intp_spec.rb +1 -1
  47. data/spec/cisco_acl_intp/parser_spec.rb +12 -12
  48. data/spec/cisco_acl_intp/scanner_spec.rb +31 -36
  49. data/spec/parser_fullfill_patterns.rb +6 -7
  50. data/spec/spec_helper.rb +6 -6
  51. data/tools/check_acl.rb +1 -1
  52. metadata +60 -59
  53. data/lib/cisco_acl_intp/single_acl_base.rb +0 -137
  54. data/spec/cisco_acl_intp/ace_port_operator_spec.rb +0 -340
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60c56206a4b40ecdfc1b4cae9ddb3fa11da7e07e
4
- data.tar.gz: 25b304576447f136c1da714cf0205531318bac33
3
+ metadata.gz: e5041a1b8d078394186621c71ed182b1257b33c8
4
+ data.tar.gz: f2fc4398b666c6badaa73abce0169b9a624720c0
5
5
  SHA512:
6
- metadata.gz: 42749dd6747920756f5a5f2c0a87e0ecbbed20d59db964244446d6bfa136c3c714edd9f6371b86fd8f2b5c57254aed782ffb6e1080ef4b58d4f4ea1b4c7f8457
7
- data.tar.gz: 7cdd4c8d508a3bb271eef640636fc1f98bc7658d07f3ce718f1684719e5b943f5c5acf05c5ec2e44927bd3cb88b1f6c5f2e49a233dbd22f16d565b567a941b1d
6
+ metadata.gz: 789fc6c612a09c44ac2f81eaa13ba1d54196ac0ea5a44db071f9cc8c78db185d31405bb733effc58061541a94f80f9b6e2b336361c456e16200ab6d68b408aac
7
+ data.tar.gz: dc1964628b26a866671093a3a593a035f60e5852a2268b5a564da717a7afd8166d5ea50964dae122ec9c15c41737ed387e6e066defb703400100c421193c688f
data/.gitignore CHANGED
@@ -3,6 +3,8 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
+ .output
7
+ .idea/
6
8
  Gemfile.lock
7
9
  InstalledFiles
8
10
  _yardoc
@@ -12,6 +14,7 @@ lib/bundler/man
12
14
  pkg
13
15
  rdoc
14
16
  spec/reports
17
+ spec/data
15
18
  test/tmp
16
19
  test/version_tmp
17
20
  tmp
@@ -1,12 +1,12 @@
1
1
  AllCops:
2
- Includes:
2
+ Include:
3
3
  - lib/**/*.rb
4
4
  - tool/*.rb
5
5
  - spec/**/*.rb
6
6
  - Rakefile
7
7
  - Gemfile
8
8
  - cisco_acl_intp.gemspec
9
- Excludes:
9
+ Exclude:
10
10
  - lib/**/parser.rb
11
11
  - spec/data/*.rb
12
12
  MethodLength:
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
2
  script: 'rake travis'
3
+ before_install:
4
+ - gem install bundler
3
5
  rvm:
4
- - 1.9.3
5
- - 2.0.0
6
+ - 2.1
7
+ - 2.2
data/Gemfile CHANGED
@@ -7,12 +7,13 @@ gemspec
7
7
 
8
8
  group :development, :test do
9
9
  gem 'coveralls', require: false
10
- gem 'racc', '~> 1.4.11'
11
- gem 'rake', '~> 10.1.1'
12
- gem 'reek', '~> 1.3.6'
13
- gem 'rspec', '~> 2.14.1'
14
- gem 'rubocop', '~> 0.19.1' if RUBY_VERSION >= '1.9.0'
15
- gem 'simplecov', '~> 0.8.2' if RUBY_VERSION >= '1.9.0'
10
+ gem 'racc', '~> 1.4.14'
11
+ gem 'rake', '~> 11.1.2'
12
+ gem 'reek', '~> 4.0.0'
13
+ gem 'rspec', '~> 3.4.0'
14
+ gem 'rspec-core', '~> 3.4.4'
15
+ gem 'rubocop', '~> 0.39.0' if RUBY_VERSION >= '1.9.0'
16
+ gem 'simplecov', '~> 0.11.2' if RUBY_VERSION >= '1.9.0'
16
17
  gem 'yard', '~> 0.8.7'
17
18
  end
18
19
 
data/README.md CHANGED
@@ -13,7 +13,7 @@ CiscoAclIntp can...
13
13
  * parse ACL types of below
14
14
  * Numbered ACL (standard/extended)
15
15
  * Named ACL (standard/extended)
16
- * parse almost ACL syntaxes.
16
+ * parse almost ACL syntax.
17
17
  * basic IPv4 acl (protocol `ip`/`tcp`/`udp`)
18
18
 
19
19
  CiscoAclIntp *CANNOT*...
@@ -25,8 +25,8 @@ CiscoAclIntp *CANNOT*...
25
25
 
26
26
  Supports
27
27
 
28
- * Ruby/1.9 or later. (Development and testing is being conducted in
29
- Ruby/2.0.0 and *NOT* supported Ruby/1.8.x)
28
+ * Ruby/2.0.0 or later. (Development and testing is being conducted in
29
+ Ruby/2.0.0 and 2.1.1. It does *NOT* support Ruby/1.8.x and 1.9.x)
30
30
  * Racc/1.4.9 or later.
31
31
 
32
32
  ## Installation
@@ -211,21 +211,26 @@ See `NetAddr::CIDR#matches?` for CIDR subnet operation and
211
211
 
212
212
  ### Port Operation
213
213
 
214
- | User | any | eq X | neq X | lt X | gt X | range X1 X2 |
215
- |------------|------|--------|--------|--------|--------|---------------|
216
- | any | true | true | true | true | true | true |
217
- | strict_any | true | false | false | false | false | false |
218
- | eq P | true | P = X | P != X | P < X | X < P | X1 <= P <= X2 |
219
- | neq P | true | false | P = X | P = X = 65535 | P = X = 0 | (P=X1=0 and X2=65535) or (X1=0 and P=X2=65535) |
220
- | lt P | true | false | P <= X | P <= X | false | X1 = 0 and P < X2 |
221
- | gt P | true | false | X <= P | false | X <= P | X1 < P and X2 = 65535 |
222
- | range P1 P2| true | false | P2 < X or X < P1 | P2 < X | X < P1 | X1 <= P1 and P2 <= X2 |
223
-
224
- In above table, “User” column is the argment of `contains?`, and,
225
- operators at table header are receiver of `contains?`. For example,
226
- `[gt X].contains?([eq P])` will be `true` if port `X < P`. It means
227
- the ACL `[gt X]` permit (or deny) the flow `[eq P]`. You can search
228
- ACEs which matches a flows specified by search conditions.
214
+ In below table, "P" column is the argument of `#contains?`,
215
+ and operators at table header are receiver of `#contains?`.
216
+ The table shows case patterns with `port_X.contains?(port_P)`.
217
+ (`port_X` is a instance of `AceUnaryOpBase`
218
+ and it has port match operator and port number information.)
219
+
220
+ | P | strict_any | any | eq X | neq X | lt X | gt X | range X1 X2 |
221
+ |------------|------------|------|--------|--------|--------|--------|---------------|
222
+ | strict_any | true | true | false | false | false | false | false |
223
+ | any | true | true | false | false | false | false | X1=0 and X2=65535 |
224
+ | eq P | false | true | P = X | P != X | P < X | X < P | X1 <= P <= X2 |
225
+ | neq P | false | true | false | P = X | P = X = 65535 | P = X = 0 | (P=X1=0 and X2=65535) or (X1=0 and P=X2=65535) |
226
+ | lt P | false | true | false | P <= X | P <= X | false | X1 = 0 and P < X2 |
227
+ | gt P | false | true | false | X <= P | false | X <= P | X1 < P and X2 = 65535 |
228
+ | range P1 P2| false | true | false | P2 < X or X < P1 | P2 < X | X < P1 | X1 <= P1 and P2 <= X2 |
229
+
230
+
231
+ For example,`[gt X].contains?([eq P])` will be `true` if port `X < P`.
232
+ It means the ACL `[gt X]` permit (or deny) the flow `[eq P]`.
233
+ You can search ACEs which matches a flows specified by search conditions.
229
234
 
230
235
  `:strict_any` is a special operator to search acl, the operator is
231
236
  matches only `:any` operator.
data/Rakefile CHANGED
@@ -7,16 +7,16 @@ require 'yard'
7
7
  require 'yard/rake/yardoc_task'
8
8
  require 'reek/rake/task'
9
9
 
10
- LIB_DIR = './lib'
11
- PACKAGE_NAME = 'cisco_acl_intp'
12
- SPEC_ORIG_DIR = 'spec'
13
- SPEC_DIR = "#{SPEC_ORIG_DIR}/#{PACKAGE_NAME}/"
14
- SPEC_DATA_DIR = "#{SPEC_ORIG_DIR}/data"
15
- CLASS_DIR = "#{LIB_DIR}/#{PACKAGE_NAME}"
16
- CLASS_GRAPH_DOT = "doc/#{PACKAGE_NAME}.dot"
17
- CLASS_GRAPH_PNG = "doc/#{PACKAGE_NAME}.png"
18
- PARSER_RACC = "#{CLASS_DIR}/parser.ry"
19
- PARSER_RUBY = "#{CLASS_DIR}/parser.rb"
10
+ LIB_DIR = './lib'.freeze
11
+ PACKAGE_NAME = 'cisco_acl_intp'.freeze
12
+ SPEC_ORIG_DIR = 'spec'.freeze
13
+ SPEC_DIR = "#{SPEC_ORIG_DIR}/#{PACKAGE_NAME}/".freeze
14
+ SPEC_DATA_DIR = "#{SPEC_ORIG_DIR}/data".freeze
15
+ CLASS_DIR = "#{LIB_DIR}/#{PACKAGE_NAME}".freeze
16
+ CLASS_GRAPH_DOT = "doc/#{PACKAGE_NAME}.dot".freeze
17
+ CLASS_GRAPH_PNG = "doc/#{PACKAGE_NAME}.png".freeze
18
+ PARSER_RACC = "#{CLASS_DIR}/parser.ry".freeze
19
+ PARSER_RUBY = "#{CLASS_DIR}/parser.rb".freeze
20
20
 
21
21
  CLEAN.include(
22
22
  "#{SPEC_DATA_DIR}/*.*",
@@ -67,8 +67,6 @@ end
67
67
  Reek::Rake::Task.new do |t|
68
68
  t.fail_on_error = false
69
69
  t.verbose = false
70
- t.ruby_opts = ['-rubygems']
71
- t.reek_opts = '--quiet'
72
70
  t.source_files = FileList["#{LIB_DIR}/**/*.rb"].delete_if do |f|
73
71
  f =~ /parser.rb/
74
72
  end
@@ -77,7 +75,7 @@ end
77
75
  if RUBY_VERSION >= '1.9.0'
78
76
  task quality: :rubocop
79
77
  require 'rubocop/rake_task'
80
- Rubocop::RakeTask.new do |task|
78
+ RuboCop::RakeTask.new do |task|
81
79
  # file patterns in ".rubocop.yml"
82
80
  task.fail_on_error = false
83
81
  end
@@ -9,19 +9,19 @@ Gem::Specification.new do |spec|
9
9
  spec.version = CiscoAclIntp::VERSION
10
10
  spec.authors = ['stereocat']
11
11
  spec.email = ['stereocat@gmail.com']
12
- spec.description = %q(Cisco ACL Interpreter)
13
- spec.summary = %q(Cisco IOS Access Control List Interpreter)
12
+ spec.description = 'Cisco ACL Interpreter'
13
+ spec.summary = 'Cisco IOS Access Control List Interpreter'
14
14
  spec.homepage = 'https://github.com/stereocat/cisco_acl_intp'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files`.split("\n")
18
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
18
+ spec.executables = spec.files.grep(%r{^bin\/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)\/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_runtime_dependency 'netaddr', '~> 1.5.0'
23
- spec.add_runtime_dependency 'term-ansicolor', '~> 1.3.0'
24
- spec.add_development_dependency 'bundler', '~> 1.5.3'
22
+ spec.add_runtime_dependency 'netaddr', '~> 1.5.1'
23
+ spec.add_runtime_dependency 'term-ansicolor', '~> 1.3.2'
24
+ spec.add_development_dependency 'bundler', '~> 1.1l.2'
25
25
  end
26
26
 
27
27
  ### Local variables:
@@ -0,0 +1,111 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'term/ansicolor'
4
+
5
+ module CiscoAclIntp
6
+ # Standard Error Handler of CiscoAclParser
7
+ class AclError < StandardError; end
8
+
9
+ # Argument Error Handler of CiscoAclParser
10
+ class AclArgumentError < AclError; end
11
+
12
+ # AccessControlContainer: abstract class of whole elements of ACL.
13
+ # It contains utility functions to stringify element and management status.
14
+ class AccessControlContainer
15
+ class << self
16
+ # Color mode: defined as a class instance variable
17
+ attr_accessor :color_mode
18
+ end
19
+
20
+ # Disables coloring
21
+ def self.disable_color
22
+ @color_mode = :none
23
+ end
24
+
25
+ # Generate string for Cisco IOS access list
26
+ # @abstract
27
+ # @return [String]
28
+ def to_s
29
+ raise AclError, 'Not overridden AclContainerBase::to_s'
30
+ end
31
+
32
+ private
33
+
34
+ # Table of ACL Tag color codes for terminal
35
+ TERM_COLOR_TABLE = {
36
+ header: Term::ANSIColor.on_blue,
37
+ type: Term::ANSIColor.underline,
38
+ action: Term::ANSIColor.intense_magenta,
39
+ name: Term::ANSIColor.bold,
40
+ remark: Term::ANSIColor.blink,
41
+ ip: [Term::ANSIColor.green, Term::ANSIColor.underline].join,
42
+ mask: Term::ANSIColor.yellow,
43
+ protocol: Term::ANSIColor.cyan,
44
+ port: Term::ANSIColor.cyan,
45
+ other_qualifier: Term::ANSIColor.green,
46
+ error: [Term::ANSIColor.red, Term::ANSIColor.bold].join
47
+ }.freeze
48
+
49
+ # Generate header of ACL tag
50
+ # @param [Symbol] tag Tag symbol.
51
+ # @return [String] Tagged string.
52
+ def generate_tag_header(tag)
53
+ case AccessControlContainer.color_mode
54
+ when :term
55
+ TERM_COLOR_TABLE[tag]
56
+ when :html
57
+ %(<span class="acltag_#{tag}">)
58
+ else
59
+ ''
60
+ end
61
+ end
62
+
63
+ # Generate footer of ACL tag
64
+ # @return [String] Tagged string.
65
+ def generate_tag_footer
66
+ case AccessControlContainer.color_mode
67
+ when :term
68
+ Term::ANSIColor.clear
69
+ when :html
70
+ '</span>'
71
+ else
72
+ ''
73
+ end
74
+ end
75
+
76
+ # Generate tagged ACL string.
77
+ # @param [Symbol] tag Tag symbol.
78
+ # @param [Array] args Array of argments.
79
+ # @return [String] Tagged string.
80
+ def generate_tagged_str(tag, *args)
81
+ tag_head = generate_tag_header(tag)
82
+ tag_body = args.join
83
+ tag_foot = generate_tag_footer
84
+ [tag_head, tag_body, tag_foot].join
85
+ end
86
+
87
+ # acl string clean-up
88
+ # @param [String] str ACL string.
89
+ # @return [String]
90
+ def clean_acl_string(str)
91
+ str.strip.gsub(/\s+/, ' ')
92
+ end
93
+
94
+ # Generate tagging method dynamically.
95
+ # @raise [NoMethodError]
96
+ def method_missing(name, *args)
97
+ name.to_s =~ /^tag_(.+)$/ && tag = Regexp.last_match(1).intern
98
+ if TERM_COLOR_TABLE.key?(tag)
99
+ generate_tagged_str(tag, *args)
100
+ else
101
+ super
102
+ end
103
+ end
104
+ end
105
+ end
106
+
107
+ ### Local variables:
108
+ ### mode: Ruby
109
+ ### coding: utf-8-unix
110
+ ### indent-tabs-mode: nil
111
+ ### End:
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
- require 'cisco_acl_intp/ace_srcdst'
2
+ require 'cisco_acl_intp/acespec_srcdst'
3
3
 
4
4
  module CiscoAclIntp
5
- # Access control entry base model
6
- class AceBase < AclContainerBase
5
+ # AceBase: Base class of ACE(Access Control Entry).
6
+ # ACE is composed of each types of AceSpecs.
7
+ class AceBase < AccessControlContainer
7
8
  include Comparable
8
9
 
9
10
  # @param [Integer] value ACL sequence number
@@ -87,9 +88,9 @@ module CiscoAclIntp
87
88
  end
88
89
 
89
90
  # Search matched ACE
90
- # @param [Hash] opts Options
91
+ # @param [Hash] _opts Options
91
92
  # return [Boolean] false, Remark does not match anithyng.
92
- def contains?(opts = nil)
93
+ def contains?(_opts = nil)
93
94
  false
94
95
  end
95
96
  end
@@ -119,7 +120,7 @@ module CiscoAclIntp
119
120
  if @options.key?(:recursive_name)
120
121
  @options[:recursive_name]
121
122
  else
122
- fail AclArgumentError, 'name not specified'
123
+ raise AclArgumentError, 'name not specified'
123
124
  end
124
125
  end
125
126
 
@@ -136,10 +137,10 @@ module CiscoAclIntp
136
137
  end
137
138
 
138
139
  # Search matched ACE
139
- # @param [Hash] opts Options
140
+ # @param [Hash] _opts Options
140
141
  # return [Boolean]
141
142
  # @todo for Recursive name matching is not implemented yet
142
- def contains?(opts = nil)
143
+ def contains?(_opts = nil)
143
144
  false
144
145
  end
145
146
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- require 'cisco_acl_intp/standard_ace'
2
+ require 'cisco_acl_intp/ace_standard'
3
3
 
4
4
  module CiscoAclIntp
5
5
  # ACE for extended access list
@@ -79,7 +79,7 @@ module CiscoAclIntp
79
79
  @dst_spec,
80
80
  @tcp_flags,
81
81
  @tcp_other_qualifiers
82
- )
82
+ )
83
83
  end
84
84
 
85
85
  # Search matched ACE
@@ -107,7 +107,7 @@ module CiscoAclIntp
107
107
  AceIpProtoSpec.new(protocol)
108
108
  end
109
109
  else
110
- fail AclArgumentError, 'Not specified IP protocol'
110
+ raise AclArgumentError, 'Not specified IP protocol'
111
111
  end
112
112
  end
113
113
 
@@ -123,21 +123,19 @@ module CiscoAclIntp
123
123
  when AceSrcDstSpec
124
124
  dst
125
125
  else
126
- fail AclArgumentError, 'Dst spec: unknown class'
126
+ raise AclArgumentError, 'Dst spec: unknown class'
127
127
  end
128
128
  else
129
- fail AclArgumentError, 'Not specified dst spec'
129
+ raise AclArgumentError, 'Not specified dst spec'
130
130
  end
131
131
  end
132
132
 
133
133
  # Set instance variables
134
134
  # @return [AceOtherQualifierList]
135
135
  def define_tcp_flags
136
- if @protocol.name == 'tcp' && @options.key?(:tcp_flags_qualifier)
137
- @options[:tcp_flags_qualifier]
138
- else
139
- nil
140
- end
136
+ return unless @protocol.name == 'tcp' &&
137
+ @options.key?(:tcp_flags_qualifier)
138
+ @options[:tcp_flags_qualifier]
141
139
  end
142
140
  end
143
141
  end # module
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- require 'cisco_acl_intp/ace'
2
+ require 'cisco_acl_intp/ace_base'
3
3
 
4
4
  module CiscoAclIntp
5
5
  # ACE for standard access list
@@ -53,7 +53,7 @@ module CiscoAclIntp
53
53
  # @param [StandardAce] other Target ACE
54
54
  # @return [Boolean] Matched or not
55
55
  def contains?(other)
56
- other.kind_of?(StandardAce) &&
56
+ other.is_a?(StandardAce) &&
57
57
  @src_spec.contains?(other.src_spec)
58
58
  end
59
59
 
@@ -66,7 +66,7 @@ module CiscoAclIntp
66
66
  if @options.key?(:action)
67
67
  @options[:action]
68
68
  else
69
- fail AclArgumentError, 'Not specified action'
69
+ raise AclArgumentError, 'Not specified action'
70
70
  end
71
71
  end
72
72
 
@@ -82,10 +82,10 @@ module CiscoAclIntp
82
82
  when AceSrcDstSpec
83
83
  src
84
84
  else
85
- fail AclArgumentError, 'src spec: unknown class'
85
+ raise AclArgumentError, 'src spec: unknown class'
86
86
  end
87
87
  else
88
- fail AclArgumentError, 'Not specified src spec'
88
+ raise AclArgumentError, 'Not specified src spec'
89
89
  end
90
90
  end
91
91