Class: CiscoAclIntp::AcePortSpec
- Inherits:
-
AceSpecBase
- Object
- AccessControlContainer
- AceSpecBase
- CiscoAclIntp::AcePortSpec
- Extended by:
- Forwardable
- Defined in:
- lib/cisco_acl_intp/acespec_port.rb
Overview
IP(TCP/UDP) port number and operator container
Constant Summary collapse
- OPERATOR_CLASS =
Port set operator table
{ strict_any: AcePortOpStrictAny, any: AcePortOpAny, eq: AcePortOpEq, neq: AcePortOpNeq, lt: AcePortOpLt, gt: AcePortOpGt, range: AcePortOpRange }.freeze
Constants inherited from AccessControlContainer
CiscoAclIntp::AccessControlContainer::TERM_COLOR_TABLE
Instance Attribute Summary collapse
-
#operator ⇒ AcePortOperatorBase
readonly
Value Port-set operator.
Instance Method Summary collapse
- #==(other) ⇒ Boolean
-
#contains?(other) ⇒ Boolean
Check if self contains other port-set?.
-
#define_operator_and_ports ⇒ AcePortOperatorBase
private
Set instance variables.
-
#initialize(opts) ⇒ AcePortSpec
constructor
Constructor.
Methods inherited from AccessControlContainer
#clean_acl_string, disable_color, #generate_tag_footer, #generate_tag_header, #generate_tagged_str, #method_missing, #to_s
Constructor Details
#initialize(opts) ⇒ AcePortSpec
in ACL, can “eq/neq” receive port list? IOS15 later?
‘@begin_port’ and ‘@end_port’ should managed with port number and protocol name. it need the number when operate/compare protocol number, and need the name when stringize the object.
Constructor
30 31 32 33 34 35 36 37 |
# File 'lib/cisco_acl_intp/acespec_port.rb', line 30 def initialize(opts) if opts.key?(:operator) @options = opts define_operator_and_ports else raise AclArgumentError, 'Not specified port operator' end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CiscoAclIntp::AccessControlContainer
Instance Attribute Details
#operator ⇒ AcePortOperatorBase (readonly)
Returns value Port-set operator.
12 13 14 |
# File 'lib/cisco_acl_intp/acespec_port.rb', line 12 def operator @operator end |
Instance Method Details
#==(other) ⇒ Boolean
41 42 43 |
# File 'lib/cisco_acl_intp/acespec_port.rb', line 41 def ==(other) @operator == other.operator end |
#contains?(other) ⇒ Boolean
Check if self contains other port-set?
49 50 51 |
# File 'lib/cisco_acl_intp/acespec_port.rb', line 49 def contains?(other) @operator.contains?(other.operator) end |
#define_operator_and_ports ⇒ AcePortOperatorBase (private)
Set instance variables
69 70 71 72 73 74 75 76 |
# File 'lib/cisco_acl_intp/acespec_port.rb', line 69 def define_operator_and_ports opr = @options.key?(:operator) ? @options[:operator].intern : :any raise AclArgumentError, 'Unknown operator' unless OPERATOR_CLASS.key?(opr) @operator = OPERATOR_CLASS[opr].new( (@options[:port] || @options[:begin_port]), @options[:end_port] ) end |