Class: CiscoAclIntp::NamedAcl

Inherits:
AclBase show all
Defined in:
lib/cisco_acl_intp/acl_category_base.rb

Overview

Named ACL container base

Direct Known Subclasses

NamedExtAcl, NamedStdAcl

Constant Summary

Constants inherited from AclBase

AclBase::SEQ_NUM_DIV

Constants inherited from AccessControlContainer

AccessControlContainer::TERM_COLOR_TABLE

Instance Attribute Summary

Attributes inherited from AclBase

#acl_type, #list, #name, #name_type

Instance Method Summary collapse

Methods inherited from AclBase

#==, #add_entry, #clean_acl_string, #dup_with_list, #find_aces_contained, #find_aces_contains, #find_aces_with, #initialize, #renumber

Methods included from AceSearchUtility

#generate_port_obj, generate_port_obj, #port_spec_by_protocol, port_spec_by_protocol, ptkey, #ptkey, search_conditions, #search_conditions, select_proto_class, #select_proto_class, slice_contains_opts, #slice_contains_opts, #srcdst_condition, srcdst_condition, #target_ace, target_ace

Methods inherited from AccessControlContainer

#clean_acl_string, disable_color, #generate_tag_footer, #generate_tag_header, #generate_tagged_str, #method_missing

Constructor Details

This class inherits a constructor from CiscoAclIntp::AclBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CiscoAclIntp::AccessControlContainer

Instance Method Details

#header_stringString

Generate ACL header string

Returns:

  • (String)

    ACL header string



51
52
53
54
55
56
57
58
# File 'lib/cisco_acl_intp/acl_category_base.rb', line 51

def header_string
  format(
    '%s %s %s',
    tag_header('ip access-list'),
    tag_type(@acl_type),
    tag_name(@name)
  )
end

#line_string(entry) ⇒ Object

Generate ACL line string

Parameters:



62
63
64
65
# File 'lib/cisco_acl_intp/acl_category_base.rb', line 62

def line_string(entry)
  # add indent
  format ' %s', clean_acl_string(entry.to_s)
end

#named_acl?Boolean

check acl type,Named ACL or not?

Returns:

  • (Boolean)


39
40
41
# File 'lib/cisco_acl_intp/acl_category_base.rb', line 39

def named_acl?
  true
end

#numbered_acl?Boolean

check acl type, Numbered ACL or not?

Returns:

  • (Boolean)


45
46
47
# File 'lib/cisco_acl_intp/acl_category_base.rb', line 45

def numbered_acl?
  false
end

#to_sString

Generate string for Cisco IOS access list

Returns:

  • (String)


69
70
71
72
73
74
# File 'lib/cisco_acl_intp/acl_category_base.rb', line 69

def to_s
  strings = @list.each_with_object([header_string]) do |entry, strlist|
    strlist.push line_string(entry)
  end
  strings.join("\n")
end