summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/iosxr.rb
diff options
context:
space:
mode:
authorAnton Aksola <anton.aksola@nebula.fi>2014-05-05 09:40:11 +0300
committerAnton Aksola <anton.aksola@nebula.fi>2014-05-05 09:40:11 +0300
commit16795edea8e14230b67b28e7e8503c2daffd69d2 (patch)
tree4005091b6167c400a59b309e28ee280423edce8f /lib/oxidized/model/iosxr.rb
parent34af261b7928ba7d62496d2d87fbe64b1badc930 (diff)
Introduce node and group level vars
Variables can now be fed to model from multiple locations. In order of preference: 1) node (from source) 2) group 3) global In a model vars should be accessed via 'vars' helper method though it is not required. Helper method ignores nil values so care needs to taken when designing model behaviour. Support for node level vars is currently available on sql source via 'vars_map' configuration. Following example populates node vars 'enable' and 'somevariable' from sql columns 'var_enable' and 'var_somevariable' sql: adapter: sqlite file: /home/aakso/.config/oxidized/sqrouter.db table: nodes map: name: hostname model: model group: node_group username: username password: password vars_map: enable: var_enablepw somevariable: var_somevariable
Diffstat (limited to 'lib/oxidized/model/iosxr.rb')
-rw-r--r--lib/oxidized/model/iosxr.rb4
1 files changed, 2 insertions, 2 deletions
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'