Class: JunosConfig::Security::Policy
- Inherits:
-
Object
- Object
- JunosConfig::Security::Policy
- Defined in:
- lib/junos-config/security/policy.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#config ⇒ Object
Returns the value of attribute config.
-
#destination_address ⇒ Object
Returns the value of attribute destination_address.
-
#from_zone ⇒ Object
Returns the value of attribute from_zone.
-
#name ⇒ Object
Returns the value of attribute name.
-
#raw ⇒ Object
Returns the value of attribute raw.
-
#source_address ⇒ Object
Returns the value of attribute source_address.
-
#to_zone ⇒ Object
Returns the value of attribute to_zone.
Instance Method Summary collapse
-
#initialize(config, raw, from_zone, to_zone) ⇒ Policy
constructor
A new instance of Policy.
Constructor Details
#initialize(config, raw, from_zone, to_zone) ⇒ Policy
Returns a new instance of Policy.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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 |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def application @application end |
#config ⇒ Object
Returns the value of attribute config.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def config @config end |
#destination_address ⇒ Object
Returns the value of attribute destination_address.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def destination_address @destination_address end |
#from_zone ⇒ Object
Returns the value of attribute from_zone.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def from_zone @from_zone end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def name @name end |
#raw ⇒ Object
Returns the value of attribute raw.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def raw @raw end |
#source_address ⇒ Object
Returns the value of attribute source_address.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def source_address @source_address end |
#to_zone ⇒ Object
Returns the value of attribute to_zone.
4 5 6 |
# File 'lib/junos-config/security/policy.rb', line 4 def to_zone @to_zone end |