Class: ASA
- Inherits:
-
Oxidized::Model
- Object
- Oxidized::Model
- ASA
- Defined in:
- lib/oxidized/model/asa.rb
Constant Summary
Constants inherited from Oxidized::Model
Oxidized::Model::METADATA_DEFAULT
Instance Attribute Summary
Attributes inherited from Oxidized::Model
Instance Method Summary collapse
Methods inherited from Oxidized::Model
cfg, #cfg, cfgs, clean, cmd, #cmd, cmds, comment, #comment, #expect, expect, expects, #expects, #get, inherited, #interpolate_string, metadata, #metadata, #output, post, pre, prompt, #prompt, #screenscrape, #send, #xmlcomment
Methods included from Oxidized::Config::Vars
Instance Method Details
#multiple_context ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/oxidized/model/asa.rb', line 91 def multiple_context # Multiple context mode cmd 'changeto system' do |cfg| cmd 'show running-config' do |systemcfg| allcfg = "\n\n" + systemcfg + "\n\n" contexts = systemcfg.scan(/^context (\S+)$/) files = systemcfg.scan(/config-url (\S+)$/) contexts.each_with_index do |cont, i| allcfg = allcfg + "\n\n----------========== [ CONTEXT " + cont.join(" ") + " FILE " + files[i].join(" ") + " ] ==========----------\n\n" cmd "more " + files[i].join(" ") do |cfgcontext| allcfg = allcfg + "\n\n" + cfgcontext end end cfg = allcfg end cfg end end |
#single_context ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/oxidized/model/asa.rb', line 67 def single_context # Single context mode cmd 'more system:running-config' do |cfg| cfg = cfg.each_line.to_a[3..-1].join cfg.gsub! /^: [^\n]*\n/, '' # backup any xml referenced in the configuration. anyconnect_profiles = cfg.scan(Regexp.new('(\sdisk0:/.+\.xml)')).flatten anyconnect_profiles.each do |profile| cfg << (comment profile + "\n") cmd("more" + profile) do |xml| cfg << (comment xml) end end # if DAP is enabled, also backup dap.xml if cfg.rindex(/dynamic-access-policy-record\s(?!DfltAccessPolicy)/) cfg << (comment "disk0:/dap.xml\n") cmd "more disk0:/dap.xml" do |xml| cfg << (comment xml) end end cfg end end |