class JunosConfig::Security::Policy

Attributes

application[RW]
config[RW]
destination_address[RW]
from_zone[RW]
name[RW]
raw[RW]
source_address[RW]
to_zone[RW]

Public Class Methods

new(config, raw, from_zone, to_zone) click to toggle source
# File lib/junos-config/security/policy.rb, line 13
def initialize(config, raw, from_zone, to_zone)
  @config    = config
  @raw       = raw
  @from_zone = from_zone
  @to_zone   = to_zone
  @name      = raw.match(/^\ {12}policy (\S+)\ \{$/)[1]
  
  raw.scan(/^\ {20}source\-address\ ([^;]+);/).each do |src|
    s = src[0].split(" ")
    s = s.slice(1,s.length-2) if s.length > 1
    @source_address =  s
  end
  raw.scan(/^\ {20}destination\-address\ ([^;]+);/).each do |dst|
    s = dst[0].split(" ")
    s = s.slice(1,s.length-2) if s.length > 1
    @destination_address = s
  end
  raw.scan(/^\ {20}application\ ([^;]+);/).each do |app|
    s = app[0].split(" ")
    s = s.slice(1,s.length-2) if s.length > 1
    @application = s
  end
end