{<img src="https://badge.fury.io/rb/brocadesan.svg" alt="Gem Version" />}[http://badge.fury.io/rb/brocadesan] = BrocadeSAN == What is BrocadeSAN? BrocadeSAN provides a simple wrapper API to communicate with Brocade SAN switches using SSH connection. You have option to either run the command manualy or query the switch with pre-defined set of methods. Additionally you can use Brocade::SAN::Provisioning::Agent for zoning provisioning tasks. == Basic Usage You can use BrocadeSAN in 2 different ways: === 1. Query the SAN switch directly using 1 connection per command query # this will query the switch name and version and open connection to switch twice switch=Brocade::SAN::Switch.new("address","user","password") switch.name switch.firmware === 2. Query the SAN switch in session block using 1 connection per session # this will query the switch name and version and open connection to switch only once switch=Brocade::SAN::Switch.new("address","user","password") switch.session do switch.name switch.firmare end == Special Usage If the API is not sufficient for your need you can always utilize the Brocade::SAN::Switch#query method to execute arbitrary commands # sends command to switch response=switch.query("portshow | grep Online ") # sends several commands to switch response=switch.query("switchshow","cfgshow") # calls interactive command and sends response along the way # the mode has to be set to interactive # the mode will persist across queries # change it back to :script when you want to run non-interactive command switch.set_mode :interactive response=switch.query("cfgsave","y") Response is type of Brocade::SAN::Switch::Response. You can get the data by calling +data+ and errors by calling +errors+. The data will be raw output from the switch with each cmd prefixed by defined/default prompt. == Provisioning This is wrapper API for provisioning tasks with added control. This wrapper expects some basic understanding of zoning provisioning tasks and should be used to build specialized provisioning clients. # creates a agent, user must have provisioning rights agent=Brocade::SAN::Provisoning::Agent.create("address","user","password") # create a zone instance with aliases zone = Brocade::SAN::Zone.new("host_array_zone") zone.add_member "host_alias" zone.add_member "array_alias" # gets effecive configuration (false gets name only without members) cfg=agent.effective_configuration(false) # creates zone and adds it to the configuration in transaction # transaction saves configuration at the end, it does not enable effective configuration # agent methods outside of transaction will save configuration immediately agent.transaction do agent.zone_create zone agent.cfg_add cfg, zone end # enable effective configuration agent.cfg_enable cfg == Download and Installation Installation *with* RubyGems: # gem install brocadesan == Author Written 2015 by Tomas Trnecka <mailto:trnecka@gmail.com>. == License Copyright (c) 2015 Tomas Trnecka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project
brocadesan
Gem to manipulate FABOS based devices
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Development
Dependencies
Project Readme