summaryrefslogtreecommitdiff
path: root/lib/oxidized
AgeCommit message (Collapse)Author
2014-07-09Require OpenStructSaku Ytti
How this works in ruby2.0 normally? What component has loaded this implicitly? Thanks to @RichiH for spotting.
2014-07-09Default to local listening for oxidized-webRichard Hartmann
2014-07-04match node[:name] to ipSaku Ytti
When running Oxidized via oxidized-script you want just one node, and you specify that as Nodes.new(:node=>x) however as router.db usually lacks 'ip' field, and only has 'name' field'. If you have router.db with IP in 'name' field, and you do Nodes.new(:node='192.0.2.1') it won't return anything, as '192.0.2.1' is matched against node[:ip] which does not exist. This change makes IP match against IP and Name.
2014-07-03Fix class name resolutionSaku Ytti
In new method, where we no long explicitly set loaded class name for later resolution we depend on file name being same as class name. However for File output, this is not true, because I didn't want plain File in code to resolve to Oxidized::File, and din't want to always write ::File, File ouput has class name OxFile. This change allows class names to start optionally with string 'Oxidized' if so, they still match.
2014-06-11Fix dynamic loading matchSaku Ytti
We can't use #match, if IOSXR is seen in source list before IOS, then IOS will #match on IOSXR class and wrong model is used for IOS devices. And obviously stupid to use regexp if you don't atbsolutely have to.
2014-06-11Change dynamic discover of file => class nameSaku Ytti
We needed this, because use of 'def inherited' not idempotent, in Oxidized::Script use case we may need to restart Oxidized, even though it's already loaded, and we won't get class names populated via 'def inherited' anymore. There are quite many optiosn to do this a) filename == class name + no discovery/mapping, very clean - user 'source' must give us model name in exactly right capitalization b) add 'self' at end of files, so eval will return class name + deterministic with arbitrary name - DSL cruft, DSL being light is our main value (can we do this via parent class? I couldn't find way) c) load in new module via Module.module_eval X + module will contain only consts we just created - but which one is the one we want? - if we use eval, load errors won't tell line error But at least now we got rid of 'inherited' methods and not adding too much cruft, hope it's better than before.
2014-06-11move :remove_secret to varsSamer Abdel-Hafez
2014-06-11add secrets removal code + bump versionSamer Abdel-Hafez
2014-06-06fix: node#last= didn't handle nilAnton Aksola
temporary fix. Maybe node#last should check the type or we shouldn't use last for the nodes#next in the first place
2014-06-06fix: handle group in output git#fetchAnton Aksola
2014-05-16don't store error Node raisedSaku Ytti
We may need this in future, but as we don't need this in oxidized-script now after all, I don't want something to be implemented just-in-case
2014-05-16store error node#run raisedSaku Ytti
2014-05-07Save stats/last status during Nodes#load0.0.58Saku Ytti
We probably should just axe Node#last, as Node#stats contains all it does and more. However it would need changing web views and I'm too lazy for that right now. Perhaps Nodes/Node also needs some unique ID so two instances of Nodes can be compared exactly. Right now copying the old stats relies on name being identical, but can we trust name to be unique? Even with groups support?
2014-05-07Add support for node stats0.0.57Saku Ytti
Bumpup gemspec
2014-05-07Stats for nodeSaku Ytti
So that we can easily check last time node failed/succceded etc
2014-05-06require config/vars earlier0.0.56Saku Ytti
- we need config/vars before model - some whitespace changes Bump up gemspec
2014-05-05missing editsAnton Aksola
2014-05-05Fixed crash if node vars_map not setAnton Aksola
in addition: - move vars helper to separate file - add csv support for node variables
2014-05-05Introduce node and group level varsAnton Aksola
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
2014-05-02Introduce group level configuration for authAnton Aksola
For rancid-like behaviour one can now set username and password for node groups. These parameters are considered in the following order: 1) node parameters (from source) 2) group level parameters 3) global level parameters example configuration for group 'testlab' groups: testlab: username: testuser password: testpassword
2014-04-22we can't lock 'del', it's called from locked 'next'0.0.55Saku Ytti
2014-04-22missing paranthesisSaku Ytti
2014-04-22more work to fix issue shown in 09dfc11b5dfdSaku Ytti
2014-04-22potential fix to race conditionSaku Ytti
1) ssh fails 2) user clicks 'update' 3) node is reset and moved head of queue 4) telnet fails 5) node last time is set to current net result, head of queue will block until interval has passed, even though below head there are nodes which need to be processed.
2014-04-17Asetus values will always be trueSaku Ytti
2014-04-16run cmd :secret blocks if CFG.remove_secret is setSaku Ytti
Model can inmplement something like cmd :secret do |cfg| cfg.sub! / secret (\d+) (\S+).*/, '\\1 SECRET' cfg end Which is called for all commands if CFG.remove_secret is set
2014-04-16We rescue 'LoadError' in ManagerSaku Ytti
Let's raise OxidizedError instead for known dependencies
2014-04-16Don't daemonize by default0.0.54Saku Ytti
It's useful to run interactively during startup, to get the helpful messages about missing stuff.
2014-04-16remove web APISaku Ytti
It is now separately in oxidized-web package
2014-04-15Remove dependency to sequel, sqlite3 and gritSaku Ytti
Not every installation will use git + sql. Try to give helpful error message on missing dependencies.
2014-04-15Change output to default file instead of gitSaku Ytti
Once web is moved to 'oxidized-web' package and sqlite+git dependencies are removed, it's lot easier to install 'oxidized-script' + 'oxidized' on other machines which actually don't intend to run oxidized to collect config Now as we depend on puma + sqlite we need to compile native extensions, which may be problematic and certainly unnecesassary just to run 'oxs'
2014-04-15Use String subclass in model#cmdSaku Ytti
Will allow convenience methods such as cmd :all do |cfg| cfg.pop.shift end instead of: cmd :all do |cfg| cfg.each_line.to_a[1..-2].join end And what ever convenience configs we come up with
2014-04-15the second to last line isn't always emptySaku Ytti
sh ip bgp | i foo and you won't see empty line before prompt, ergo, we cannot always remove it. But I'm not too surprised JunOS + IOS templates are still mostly exactly the same they were from my testing to see how Oxidized works over year ago, they need rework to be production quality.
2014-04-15Waittime => TimeoutSaku Ytti
Waittime is how long it waits for /more/ input /after/ matching to RE. This has been wrong always in Oxidized but only after changing default timeout to 30, it became apparent. When timeout was 5s, it just gave 5s delay to every command, now it gives 30s delay.
2014-04-15use Asetus#create to create missing config0.0.52Saku Ytti
2014-04-14update to newer asetus version0.0.51Saku Ytti
2014-04-14depend on AsetusSaku Ytti
Change models to Asetus syntax
2014-04-14Use 'asetus' for configuration filesSaku Ytti
Main benefits a) we get support for system wide configs b) we don't use symbols in config file, they're confusing to non-rubyist
2014-04-13IOS prompt now matches in config modeSaku Ytti
2014-04-13Subclass all errors from OxidizedErrorSaku Ytti
2014-04-13smarter match for IP address in nodesSaku Ytti
- add 'connnected?' method to ssh/telnet to query if or not we're connected - subclass OxidizedError from StandardError, all future OxidizedErrors should be subclasssed from this.
2014-04-12Don't define enablePW by defaultSaku Ytti
2014-04-12enable loading subset of all nodesSaku Ytti
potential use in perhaps upcoming CLI: [fisakytt@lan-login1 ~/projects/oxidized-cli]% ./oxi S-2250219.fi.cpe.tdc.net 'show ver' Dec 2 2009 00:19:01 Q.11.25 106 [fisakytt@lan-login1 ~/projects/oxidized-cli]% ./oxi 62.236.123.197 'show ver' Cisco IOS Software, C3560 Software (C3560-IPBASEK9-M), Version 12.2(55)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Thu 02-Dec-10 07:16 by prod_rel_team Image text-base: 0x01000000, data-base: 0x02D00000 ROM: Bootstrap program is C3560 boot loader BOOTLDR: C3560 Boot Loader (C3560-HBOOT-M) Version 12.2(35r)SE2, RELEASE SOFTWARE (fc1) S-1035880.fi uptime is 7 weeks, 3 days, 15 hours, 43 minutes System returned to ROM by power-on System restarted at 00:54:59 UTC Wed Feb 19 2014 System image file is "flash:c3560-ipbasek9-mz.122-55.SE1.bin" This product contains cryptographic features and is subject to United States and local country laws governing import, export, transfer and use. Delivery of Cisco cryptographic products does not imply third-party authority to import, export, distribute or use encryption. Importers, exporters, distributors and users are responsible for compliance with U.S. and local country laws. By using this product you agree to comply with applicable laws and regulations. If you are unable to comply with U.S. and local laws, return this product immediately. A summary of U.S. laws governing Cisco cryptographic products may be found at: http://www.cisco.com/wwl/export/crypto/tool/stqrg.html If you require further assistance please contact us by sending email to export@cisco.com. cisco WS-C3560-8PC (PowerPC405) processor (revision F0) with 131072K bytes of memory. Processor board ID FOC1449W2ZU Last reset from power-on 2 Virtual Ethernet interfaces 8 FastEthernet interfaces 1 Gigabit Ethernet interface The password-recovery mechanism is enabled. 512K bytes of flash-simulated non-volatile configuration memory. Base ethernet MAC Address : 10:8C:CF:F0:68:80 Motherboard assembly number : 73-10612-09 Power supply part number : 341-0207-02 Motherboard serial number : FOC14493DDW Power supply serial number : LIT14430ZXA Model revision number : F0 Motherboard revision number : A0 Model number : WS-C3560-8PC-S System serial number : FOC1449W2ZU Top Assembly Part Number : 800-28131-04 Top Assembly Revision Number : C0 Version ID : V04 CLEI Code Number : COML900ARA Hardware Board Revision Number : 0x01 Switch Ports Model SW Version SW Image ------ ----- ----- ---------- ---------- * 1 9 WS-C3560-8PC 12.2(55)SE1 C3560-IPBASEK9-M Configuration register is 0xF [fisakytt@lan-login1 ~/projects/oxidized-cli]% cat oxi require 'pry' require 'pp' require 'oxidized' require 'resolv' module Oxidized class Oxi def cmd command @model.cmd command end def disconnect @input.disconnect_cli end alias_method :close, :disconnect private def initialize node Oxidized.mgr = Manager.new @node = Nodes.new(:node=>node).first @model = @node.model @input = nil connect if block_given? yield self disconnect end end def connect @node.input.each do |input| begin @node.model.input = input.new @node.model.input.connect @node break rescue end end @input = @node.model.input @input.connect_cli end end end Oxidized::Oxi.new(ARGV[0]) do |cli| puts cli.cmd ARGV[1] end [fisakytt@lan-login1 ~/projects/oxidized-cli]% ls -la total 12 drwxrwxr-x 2 fisakytt fisakytt 4096 Apr 12 19:39 . drwxrwxr-x 7 fisakytt fisakytt 4096 Apr 12 17:52 .. -rwxr-xr-x 1 fisakytt fisakytt 820 Apr 12 19:39 oxi
2014-04-12allow running post_login separatelySaku Ytti
2014-04-09add model for ALU TiMOSAnton Aksola
tested on SR and SAS routers
2014-04-09add model for AOS7 (Omniswitch 6900/10k)Anton Aksola
supports virtual chassis for OS6900
2014-04-09fix telnet username promptAnton Aksola
2014-04-07minor fixAnton Aksola
2014-04-07add support for non-vdom-enabled environmentsAnton Aksola
2014-04-07add model for Fortinet FortiOS used in Fortigate firewalls. Should workAnton Aksola
at least from version 5 onwards