summaryrefslogtreecommitdiff
path: root/docs/Ruby-API.md
diff options
context:
space:
mode:
authorJason Ackley <jason@ackley.net>2018-04-24 10:11:24 -0500
committerJason Ackley <jason@ackley.net>2018-04-24 10:11:24 -0500
commitd1723993e6048621f6a2428bcba51c1cd17a124e (patch)
tree194b518bab523280b9c52ef1571b4e0222deedeb /docs/Ruby-API.md
parentb6f4c3665b773ae0ba95a9a6084392d47779e8fd (diff)
Ruby-API.md cleanups
Refer to things as 'device' versus 'switch' Add some example use case notes for post_login and pre_logout. MD highlight some items in the list for clarity misc text clarity adjustments.
Diffstat (limited to 'docs/Ruby-API.md')
-rw-r--r--docs/Ruby-API.md24
1 files changed, 14 insertions, 10 deletions
diff --git a/docs/Ruby-API.md b/docs/Ruby-API.md
index 8621870..a9963b3 100644
--- a/docs/Ruby-API.md
+++ b/docs/Ruby-API.md
@@ -6,7 +6,7 @@ The following objects exist in Oxidized.
* gets config from nodes
* must implement 'connect', 'get', 'cmd'
-* 'ssh', 'telnet, ftp, and tftp' implemented
+* 'ssh', 'telnet', 'ftp', and 'tftp' implemented
## Output
@@ -18,12 +18,12 @@ The following objects exist in Oxidized.
* gets list of nodes to poll
* must implement 'load'
-* source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt'
- * name - name of the devices
- * model - model to use ios/junos/xyz, model is loaded dynamically when needed (Also default in config file)
- * input - method to acquire config, loaded dynamically as needed (Also default in config file)
- * output - method to store config, loaded dynamically as needed (Also default in config file)
- * prompt - prompt used for node (Also default in config file, can be specified in model too)
+* source can have 'name', 'model', 'group', 'username', 'password', 'input', 'output', 'prompt' for each device.
+ * `name` - name of the device
+ * `model` - model to use ('ios', 'junos', etc).The model is loaded dynamically by the first node of that model type. (Also default in config file)
+ * `input` - method to acquire config, loaded dynamically as needed (Also default in config file)
+ * `output` - method to store config, loaded dynamically as needed (Also default in config file)
+ * `prompt` - prompt used for node (Also default in config file, can be specified in model too)
* 'sql', 'csv' and 'http' (supports any format with single entry per line, like router.db)
## Model
@@ -116,16 +116,20 @@ the password prompt. If not specified, the default of `/^Password/` is used.
#### `post_login`
Used inside `cfg` invocations to specify commands to run once Oxidized has
-logged in to the switch. Takes one argument that is either a block (taking zero
+logged in to the device. Takes one argument that is either a block (taking zero
parameters) or a string containing a command to execute.
+This allows `post_login` to be used for any model-specific items prior to running the regular commands. This could include disabling the output pager or timestamp outputs that would cause constant differences.
+
#### `pre_logout`
Used to specify commands to run before Oxidized closes the connection to the
-switch. Takes one argument that is either a block (taking zero parameters) or a
+device. Takes one argument that is either a block (taking zero parameters) or a
string containing a command to execute.
+This allows `pre_logout` to be used to 'undo' any changes that may have been needed via `post_login` (restore pager output, etc.)
+
#### `send`
Usually used inside `expect` or blocks passed to `post_login`/`pre_logout`.
-Takes a single parameter: a string to be sent to the switch.
+Takes a single parameter: a string to be sent to the device.