pyFOS - Python module for Brocade Fabric OS

 

I found Brocade (Broadcom) provides python module to access Fabric OS. This is experimental but it's

interesting approach for user land. I'm going to introduce a few examples.

As Feb/22/2018, version is 0.9.0 and experimental. You can obtain from gitHub with your own risk.

You can find following statements in README file when you pull,

     PyFOS - This is a prototype release of PyFOS. The code have only gone through developer unit testing only.

 

/***   Kanji document is also available   ***/

 

You need following environment to play with pyFOS.

1. Any Brocade switches running later than FOS 8.2.0.

2. Python 3.x environment (I use Debian 9.3 with python3 package)

 

How to install pyFOS:

     1. Get pyFOS copy from gitHub. (Current release is 0.9.0 - Feb/22/2018)

          You can get copy without git(1) envioronment bellow,

Download.png

     2. Unzip copy to your favorite directory.

     3. README file describes installation instructions bellow,

installation:

    1) create library directories

    mkdir ~<login>/python_lib

    mkdir ~<login>/python_lib/lib

    mkdir ~<login>/python_lib/lib/python3.5

    mkdir ~<login>/python_lib/lib/python3.5/site-packages

 

    2) set env variable for library directory

    setenv PYTHONPATH ~<login>/python_lib/lib/python3.5/site-packages

 

    3) install pyfos modules into the library path

    cd <pyfos directory>

    python3 setup.py install --prefix=~<login>/python_lib

 

          I experienced a problem at step 3.

          Set PYTHONUSERBASE environment variable same as PYTHONPATH. and ran,

               "python3 setup install --user"

          instead.       

 

1. Added pyFOS directory to os.path.

     pathAppend.png

2. Performed just "login" and "logout" without error handling. pyfos_auth module includes login and logout.

     loginlogout1.png

3. Getting switch information

     There are 2 classes - fabric_switch and fibrechannel_switch. Those 2 classes have similar members.

     fabric_switch class is read-only but fibrechannel_switch is read/write. pyfos_utils.response_print(response)

     reads all members and peek_xxxxx() for single member.

3-1. pyfos_utils.response_print(response)

3-1-1. fabric_switch class

     fabric_switch_reponsePrint.png

3-1-2. fibrechannel_switch class

     fibrechannel_switch_responsePrint.png

3-2. indivisual members (ie. DomainID, FOS version, switchModel)

          peek_model() for fabric_switch class got error because there are no members for model number in fabric_switch class.

     switch_peek.png

4. Get port information

     FC port class for ports information. It is maybe mainly used for setting each ports.

     Bellow example showed just read each members using pyfos_utils.reponse_print(response).

     fcport_responsePrint.png    

 

Let's enjoy with your own environment !