Class: GaiaOS

Inherits:
Oxidized::Model show all
Defined in:
lib/oxidized/model/gaiaos.rb

Instance Attribute Summary

Attributes inherited from Oxidized::Model

#input, #node

Instance Method Summary collapse

Methods inherited from Oxidized::Model

cfg, #cfg, cfgs, cmd, #cmd, cmds, comment, #comment, expect, #expect, expects, #expects, #get, inherited, #output, post, pre, prompt, #prompt, #screenscrape, #send, #xmlcomment

Methods included from Oxidized::Config::Vars

#vars

Instance Method Details

#multiple_contextObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/oxidized/model/gaiaos.rb', line 56

def multiple_context
  Oxidized.logger.debug 'Multi context tasks'
  cmd 'show virtual-system all' do |systems|
    vs_items = systems.scan(/^(?<VSID>\d+)\s+(?<VSNAME>.*[^\s])/)
    allcfg = ''
    vs_items.each do |item|
      allcfg += "\n\n\n#--------======== [ VS #{item[0]} - #{item[1]} ] ========--------\n\n"
      allcfg += "set virtual-system #{item[0]}\n\n"
      cmd "set virtual-system #{item[0]}" do |vs|
        Oxidized.logger.debug vs
        cmd 'show configuration' do |vscfg|
          vscfg.gsub! /^# Exported by \S+ on .*/, '# '
          allcfg += vscfg
        end
      end
    end
    allcfg
  end
end

#single_contextObject



48
49
50
51
52
53
54
# File 'lib/oxidized/model/gaiaos.rb', line 48

def single_context
  Oxidized.logger.debug 'Single context tasks'
  cmd 'show configuration' do |cfg|
    cfg.gsub! /^# Exported by \S+ on .*/, '# '
    cfg
  end
end