Sha256: b01e9cadaca344d2ea3474fc5558278b7a11a98af37cb50753f9d3beb0c88df7

Contents?: true

Size: 1.42 KB

Versions: 9

Compression:

Stored size: 1.42 KB

Contents

require 'palo_alto'
require "byebug"

xml = PaloAlto::XML.new(host: "panorama-test", port: "443", username: "admin", password: "Admin123!", debug: [:sent, :received, :statistics])

#rules=xml.config.devices.entry(name:'localhost.localdomain').device_group.entry(name: 'PLAYGROUND').pre_rulebase.security.rules.entry{(child(:source).child(:member).text=="VPN_Net_10.1.1.0-24").or(child(:destination).child(:member).text == 'VPN_Net_10.1.1.0-24')}.get_all

rules=xml.config.devices.entry(name:'localhost.localdomain').device_group.entry(name: 'PLAYGROUND').pre_rulebase.security.rules.entry{}.get_all

pp rules
pp rules.length




tag_name='vpn:test'

tag = xml.config.devices.entry(name:'localhost.localdomain').device_group.entry(name: dg).tag.entry(name:tag_name).create!
tag.color = "color23"
tag.push!



dg='PLAYGROUND'
rules=xml.config.devices.entry(name:'localhost.localdomain').device_group.entry(name: dg).pre_rulebase.security.rules.entry{}.get_all
rules.reject!{|rule| rule.api_attributes['loc'] != dg}

pp rules.first.api_attributes # attributes like uuid and loc
pp rules.first.values()

r = rules.first
r.tag.member = [tag.name]
r.group_tag = tag.name
r.description += "...."
r.push!

puts r.to_xpath
r.rename!("Test 1")
puts r.to_xpath
pp r.name

exit 0

# create a new template with persisted subclasses
new_template = xml.config.devices.entry(name:'localhost.localdomain').template.entry(name: 'testtemplate').create!
new_template.push!




Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
palo_alto-0.2.1 examples/test_config.rb
palo_alto-0.2.0 examples/test_config.rb
palo_alto-0.1.9 examples/test_config.rb
palo_alto-0.1.8 examples/test_config.rb
palo_alto-0.1.7 examples/test_config.rb
palo_alto-0.1.6 examples/test_config.rb
palo_alto-0.1.5 examples/test_config.rb
palo_alto-0.1.4 examples/test_config.rb
palo_alto-0.1.3 examples/test_config.rb