Getting Started

Verify System Version

Check your software version using one of the methods below.

Note

The minimum software version for running Python scripts:
  • Version 10.4 (Centos)

Warning

If you need help or instructions on how to update your software, contact us.

Verify using GUI:

In a browser, enter the IP Address of your SANBlaze system.

The home page shows your current version.

../_images/system_version_in_gui.png

Verify using the commandline:

$ cat /proc/vlun/config | head | grep Version

Sample output

>> Version=V10.4-64-Beta1-C8 built on Sep 13 2021 at 10:49:22

Note

The version in the example above is 10.4

Check Python Install

Confirm that the correct version of python is installed on your machine. This will be used to run SANBlaze python scrips.

$ sb_python -V

Expected output:

>> Python 3.9.x

Warning

If this command results in an error, something is wrong with your installation. Contact SANBlaze support for help..

Run A Script to Verify System Setup

"""
 HelloWorld.py -  Python test script for sb_testmgr

   Demonstrate best practices for interfacing with the SANBlaze testmanager framework
   Setup only, no testing is performed

   Copyright SANBlaze, 2021
   This script can be used as a template for Certified by SANBlaze scripts using the guide SBCert_Python_Scripting.pdf
   It demonstrates correct use of the interaction between python scripts and the SANBlaze testmanager framework

"""

from sanblaze_test_api import *


# The following section defines information that will be included in the report
# You must modify these these to describe the behavior of your script
# Detailed information about these parameters can be found in the Python Reference Manual

TITLE = "HelloWorld.py"
VERSION = '$Id: HelloWorld.py,v 1.17 2021/09/17 18:17:45 zallen Exp $'
DESCRIPTION = "An example framework for a user script for SBCert"
PASS_FAIL = "HelloWorld_IO.py will fail if any of the underlying IO tests fail"
MINIMUM_BASE_VERSION = "V8.3-64 05/15/2021"
HOMEDIR = "/virtualun/rest/scripts/ExampleScripts"

# Control Flags
NS_MGMT_REQUIRED = 0         # Namespace Management Support Requirement: 0 - Not Required, 1 - Required
PRESERVE_PREEXISTING_NS = 0  # 0 - Remove preexisting NS Before Test, 1 - Do not remove preexisting NS
RESTORE_NS_CONFIG = 1        # 0 - Do not return to preexisting configuration after test, 1 - Return to preexisting
PORTS = 1                    # Number of ports under test.  1 - Single Port, 2 - Dual Port
PORT_LOCKING = 1             # 0 - No Locking, 1 - Lock this port, 2 - Lock other port, 3 - Lock both Ports
ZONETYPE = 1                 # Bit mask. 1 - Conventional, 2 - Key/Value, 4 - ZNS (e.g. 7 - All types)
DEBUG = 0                    # 0 - Details, 1 - Info, 2 - All available information


def main(test_config):
    @setup(test_config)
    def test(dut):

        # Loop that runs once for each pass
        while keep_running():

            # Log a detail message
            logging.detail("Running Hello World")


# Start the main function of this program
if __name__ == '__main__':
    start_main(main, locals())
Add the test:
  1. Select the SBExpress Manager page

  2. Open the Example Scripts folder

  3. Select HelloWorld.py

  4. Add the test to the controller

../_images/SelectAnExampleScriptInGUI.png

Run the script in the GUI

Note

When adding a test between steps 1 & 2, you may need to click on the button ShowTestManager in order to see the example scripts folder.

Press the start button to run the test:

../_images/RunAnExampleScriptInTheGUI.png

A successful test:

../_images/PassAnExampleScriptInTheGUI.png

Run the script from the CLI

Adding a test as seen above will automatically place it into the REST tree. From the command line navigate to the test folder like so:

$ cd /REST/sanblazes/1/ports/0/targets/102/luns/1/tests/1
$ sb_python HelloWorld.py
> [root@vlun-100-106 1]# sb_python HelloWorld.py
> Thu Aug 19 13:56:25 2021 DETAIL: Running with SANBlaze_SBCert.py Version=V1.34
> Thu Aug 19 13:56:25 2021 DETAIL: initRESTVars setting pass to 0
> Thu Aug 19 13:56:27 2021 DETAIL: Running HelloWorld.py Version V1.13

Warning

Before attempting to run a script via the CLI, the script must be added using the GUI. In addition to adding the script to the proper location in the REST tree, several other behind the scenes setup actions are performed.