summaryrefslogtreecommitdiff
path: root/lib/oxidized/model
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r--lib/oxidized/model/acos.rb4
-rw-r--r--lib/oxidized/model/ios.rb6
-rw-r--r--lib/oxidized/model/iosxr.rb4
-rw-r--r--lib/oxidized/model/model.rb4
4 files changed, 10 insertions, 8 deletions
diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb
index f06bc93..75fbacf 100644
--- a/lib/oxidized/model/acos.rb
+++ b/lib/oxidized/model/acos.rb
@@ -55,10 +55,10 @@ class ACOS < Oxidized::Model
cfg :telnet, :ssh do
# preferred way to handle additional passwords
- if CFG.vars.enable?
+ if vars :enable
post_login do
send "enable\n"
- send CFG.vars.enable + "\n"
+ send vars(:enable) + "\n"
end
end
post_login 'terminal length 0'
diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb
index c0994c2..e557469 100644
--- a/lib/oxidized/model/ios.rb
+++ b/lib/oxidized/model/ios.rb
@@ -12,7 +12,7 @@ class IOS < Oxidized::Model
# non-preferred way to handle additional PW prompt
#expect /^[\w.]+>$/ do |data|
# send "enable\n"
- # send CFG.vars.enable + "\n"
+ # send vars(:enable) + "\n"
# data
#end
@@ -45,10 +45,10 @@ class IOS < Oxidized::Model
post_login 'terminal length 0'
post_login 'terminal width 0'
# preferred way to handle additional passwords
- if CFG.vars.enable?
+ if vars :enable
post_login do
send "enable\n"
- send CFG.vars.enable + "\n"
+ send vars(:enable) + "\n"
end
end
pre_logout 'exit'
diff --git a/lib/oxidized/model/iosxr.rb b/lib/oxidized/model/iosxr.rb
index 023dcca..1129a0c 100644
--- a/lib/oxidized/model/iosxr.rb
+++ b/lib/oxidized/model/iosxr.rb
@@ -29,10 +29,10 @@ class IOSXR < Oxidized::Model
cfg :telnet, :ssh do
post_login 'terminal length 0'
post_login 'terminal width 0'
- if CFG.vars.enable?
+ if vars :enable
post_login do
send "enable\n"
- send CFG.vars.enable + "\n"
+ send vars(:enable) + "\n"
end
end
pre_logout 'exit'
diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb
index 6e44039..277a01b 100644
--- a/lib/oxidized/model/model.rb
+++ b/lib/oxidized/model/model.rb
@@ -1,5 +1,7 @@
module Oxidized
class Model
+ include Oxidized::Config::Vars
+
class << self
def inherited klass
klass.instance_variable_set '@cmd', Hash.new { |h,k| h[k] = [] }
@@ -71,7 +73,7 @@ module Oxidized
end
end
- attr_accessor :input
+ attr_accessor :input, :node
def cmd string, &block
out = @input.cmd string