Class: CiscoAclIntp::ExtendedAce
- Inherits:
-
StandardAce
- Object
- AccessControlContainer
- AceBase
- StandardAce
- CiscoAclIntp::ExtendedAce
- Defined in:
- lib/cisco_acl_intp/ace_extended.rb
Overview
ACE for extended access list
Constant Summary
Constants inherited from AceBase
Constants inherited from AccessControlContainer
AccessControlContainer::TERM_COLOR_TABLE
Instance Attribute Summary collapse
- #dst_spec ⇒ AceSrcDstSpec
- #protocol ⇒ AceIpProtoSpec
- #tcp_flags ⇒ AceTcpFlagList
- #tcp_other_qualifiers ⇒ AceOtherQualifierList
Attributes inherited from StandardAce
Attributes inherited from AceBase
Instance Method Summary collapse
- #==(other) ⇒ Boolean
-
#contains?(other) ⇒ Boolean
Search matched ACE.
-
#define_dst_spec ⇒ AceSrcDstSpec
private
Set instance variables.
-
#define_protocol ⇒ Object
private
Set instance variables return [AceIpProtoSpec] IP protocol object raise [AclArgumentError].
-
#define_tcp_flags ⇒ AceOtherQualifierList
private
Set instance variables.
-
#initialize(opts) ⇒ ExtendACE
constructor
Constructor.
-
#to_s ⇒ String
Generate string for Cisco IOS access list.
Methods inherited from StandardAce
#define_action, #define_log_spec, #define_src_spec
Methods inherited from AceBase
Methods inherited from AccessControlContainer
#clean_acl_string, disable_color, #generate_tag_footer, #generate_tag_header, #generate_tagged_str, #method_missing
Constructor Details
#initialize(opts) ⇒ ExtendACE
Constructor
51 52 53 54 55 56 57 58 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 51 def initialize(opts) super @options = opts @protocol = define_protocol @dst_spec = define_dst_spec @tcp_flags = define_tcp_flags @tcp_other_qualifiers = nil # not yet. end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CiscoAclIntp::AccessControlContainer
Instance Attribute Details
#dst_spec ⇒ AceSrcDstSpec
13 14 15 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 13 def dst_spec @dst_spec end |
#protocol ⇒ AceIpProtoSpec
9 10 11 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 9 def protocol @protocol end |
#tcp_flags ⇒ AceTcpFlagList
18 19 20 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 18 def tcp_flags @tcp_flags end |
#tcp_other_qualifiers ⇒ AceOtherQualifierList
23 24 25 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 23 def tcp_other_qualifiers @tcp_other_qualifiers end |
Instance Method Details
#==(other) ⇒ Boolean
62 63 64 65 66 67 68 69 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 62 def ==(other) @action == other.action && @protocol == other.protocol && @src_spec == other.src_spec && @dst_spec == other.dst_spec && @tcp_flags == other.tcp_flags ## does it need to compare? : tcp_other_qualifiers end |
#contains?(other) ⇒ Boolean
Search matched ACE
89 90 91 92 93 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 89 def contains?(other) super(other) && @protocol.contains?(other.protocol) && @dst_spec.contains?(other.dst_spec) end |
#define_dst_spec ⇒ AceSrcDstSpec (private)
Set instance variables
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 117 def define_dst_spec if @options.key?(:dst) dst = @options[:dst] case dst when Hash AceSrcDstSpec.new(dst) when AceSrcDstSpec dst else raise AclArgumentError, 'Dst spec: unknown class' end else raise AclArgumentError, 'Not specified dst spec' end end |
#define_protocol ⇒ Object (private)
Set instance variables return [AceIpProtoSpec] IP protocol object raise [AclArgumentError]
100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 100 def define_protocol if @options.key?(:protocol) protocol = @options[:protocol] case protocol when AceIpProtoSpec protocol else AceIpProtoSpec.new(protocol) end else raise AclArgumentError, 'Not specified IP protocol' end end |
#define_tcp_flags ⇒ AceOtherQualifierList (private)
Set instance variables
135 136 137 138 139 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 135 def define_tcp_flags return unless @protocol.name == 'tcp' && @options.key?(:tcp_flags_qualifier) @options[:tcp_flags_qualifier] end |
#to_s ⇒ String
Generate string for Cisco IOS access list
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cisco_acl_intp/ace_extended.rb', line 73 def to_s format( '%s %s %s %s %s %s', tag_action(@action.to_s), tag_protocol(@protocol.to_s), @src_spec, @dst_spec, @tcp_flags, @tcp_other_qualifiers ) end |