Hardware Client

class pyCSM.clients.hardware_client.hardwareClient(server_address, server_port, username, password)

The hardwareClient class can be used to call various hardware level commands such as adding device connections, removing device connections, getting lists of volumes, etc. By using the hardwareClient class you enter the username and password only when you instantiate the class which will obtain a token to the server that will be used on all calls using the class. In the event that the token expires, the client will automatically handle the error and retrieve a new token prior to retrying the call. The client makes RESTAPI calls to the server and returns the results. For more details on what is returned from a call, see the CSM Documentation for the specific release.

add_device(device_type, device_ip, device_username, device_password, device_port=None, second_ip=None, second_port=None, second_username=None, second_password=None)

Use this method to create a connection from the CSM server to a specified storage system

Parameters
  • device_type (str) – Type of storage device ex. ds8000 or svc.

  • device_ip (str) – IP address or hostname for the primary HMC for the storage system.

  • device_username (str) – Username for the storage system connection.

  • device_password (str) – Password for the storage system connection.

  • device_port (str) (OPTIONAL) – Port to use for the connection to the storage system.

  • second_ip (str) (OPTIONAL) – For DS8000 storage systems, the IP address or hostname of a secondary HMC.

  • second_port (str) (OPTIONAL) – Port to use for the connection to the secondary HMC.

  • second_username (str) (OPTIONAL) – Username for the connection to the secondary HMC.

  • second_password (str) (OPTIONAL) – Password for the connection to the secondary HMC.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

add_zos_cert(file_path)

This method will add a given cert to zos connection.

Parameters

file_path (str) – path for given certificate file.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

add_zos_device(device_id)

This method will add a storage system through the zoshost connection.

Parameters
  • device_id (str) – Storage system name in the format “DS8000:BOX:2107.KXZ91”.

  • connection_type (str) – type of connection

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

add_zos_host(host_ip, password, username, host_port)

This method will create a zos connection to the current IP

Parameters
  • host_ip (str) – Primary IP address for the zos system.

  • password (str) – Password for the zos system connection

  • username (str) – Username for the zos system connection

  • host_port (str) – Port for the zos system

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

static change_properties(property_dictionary)

Takes a dictionary of properties and the values that user wants to change and changes them in the file.

Parameters
  • property_dictionary (dict) – Dictionary of the keys and values that need

  • file. (to be changed in the) –

  • {"language" (ex.) – “en-UK”, “verify”:True}

Returns

Returns the new properties dictionary.

export_vol_writeio_history(session_name, start_time, end_time)

Exports a summary of the write i/o history for all volumes in a session to a csv file between the given times.

Parameters
  • session_name (str) – The name of the session.

  • start_time (str) – Start time YYYY-MM-DD.

  • end_time (str) – End time YYYY-MM-DD.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

get_devices(device_type)

Use this call to return the storage system for all storage systems of the passed in type.

Parameters

device_type (str) – Type of storage device ex. ds8000 or svc.

Returns

Returns JSON String representing the result of the command.

get_path_on_storage_system(system_id)

Query for all logical paths on the given DS8000 storage system.

Parameters

system_id (str) – The id of the storage system to be updated.

Returns

JSON String representing the result of the command.

get_paths()

Queries all the logical paths for all DS8000 storage systems connected to the CSM server.

Returns

JSON String representing the result of the command.

static get_properties()

Returns a dictionary of the current properties and their values set for the file.

get_svchosts(device_id)

Get the hosts defined on the SVC based storage system

Parameters

device_id (str) – The id of the storage system being used. (ex. “FAB3-DEV13”)

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

get_volumes(system_name)

Use this method to retrieve all volumes for a given storage system

Parameters

system_name (str) – The name of the storage system.

Returns

JSON String representing all the volumes for that storage system.

get_volumes_by_wwn(wwn_name)

Return the information for all volumes based on the list of WWNs passed in.

Parameters

wwn_name (str) – The volume wwn you would like to query or a subset of the volume wwn for a volume list

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

get_zos_candidate()

This method will query for the devices in REST that are attached to the zos system

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

get_zos_host()

This method will get the information for all zos host connections.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

map_volumes_to_host(device_id, force, hostname, is_host_cluster, volumes, scsi='')

Use this method to retrieve all volumes for a given storage system

Parameters
  • device_id (str) – The id for the storage device. (ex. “FAB3-DEV13”)

  • force (bool) – boolean of whether user would like to force command

  • hostname (str) – name of the host

  • is_host_cluster (bool) – boolean variable that indicates whether host is a cluster

  • scsi (str) –

  • volumes (str) List of volumes to map to the host (ex. ["mVol0_211115100540","mVol1_211115100540"]) –

Returns

JSON String representing all the volumes for that storage system.

refresh_config(system_id)

Refreshes the configuration for the given storage system. Issuing this command will force the CSM server to requery the hardware for any new or deleted volumes.

Parameters

system_id (str) – The id of the storage system to be refreshed.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

remove_device(system_id)

Use this method to remove the connection to the specified storage system

Parameters

system_id (str) – The id of the storage system to be removed.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

remove_zos_host(host_ip, host_port)

This method will create a zos connection to the current IP

Parameters
  • host_ip (str) – Primary IP address for the zos system.

  • host_port (str) – Port for the zos system

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

unmap_volumes_to_host(device_id, force, hostname, is_host_cluster, volumes)

Use this method to retrieve all volumes for a given storage system

Parameters
  • device_id (str) – The id for the storage device (ex. “FAB3-DEV13”)

  • force (bool) – boolean of whether user would like to force command

  • hostname (str) – name of the host

  • is_host_cluster (bool) – boolean variable that indicates whether host is a cluster

  • volumes (str) List of volumes to map to the host (ex. ["mVol0_211115100540","mVol1_211115100540"]) –

Returns

JSON String representing all the volumes for that storage system.

update_connection_info(device_ip, device_password, device_username, connection_name)

Update the userid/pw for a given storage system

Parameters
  • device_ip (str) – Primary IP address for the storage system.

  • device_password (str) – New password for the storage system connection

  • device_username (str) – New user name for the storage system connection

  • connection_name (str) – Name of the connection. ex. HMC:9.11.114.59

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.

update_device_site_location(system_id, location)

Set a user defined site location for a given storage system

Parameters
  • system_id (str) – The id of the storage system to be updated.

  • location (str) – The name of the location to set on the storage system.

Returns

JSON String representing the result of the command. ‘I’ = successful, ‘W’ = warning, ‘E’ = error.