System Client

class pyCSM.clients.system_client.systemClient(server_address, server_port, username, password)

The systemClient class can be used to call various server level commands such as creating log packages, backing up the server, setting up active/standby support, etc. By using the systemClient 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.

approve_dual_control_request(id)

Approve a dual control request

Parameters
  • id (int) – ID of the request caller wants to approve.

  • getDualControlEvents. (ID from the 'requestid' field return from) –

Returns

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

backup_server()

Creates a zip backup of the CSM server data that can be used for restoring the server at a later date

Returns

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

backup_server_and_download(file_name)

Create and downloads a server backup.’

Parameters

file_name – The file to write the server backup to

Returns

Server backup data that is written to the specified file.

change_dual_control_state(enable)

Use this method to enable or disable dual control on the CSM server.

Parameters
  • enable (bool) – Set to ‘true’ if you want to enable dual control

  • disable. (or 'false' if you want to) –

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.

create_and_download_log_pkg(file_name)

This method will package all log files on the server into a .jar file that can be used for support - this call is a synchronous call and will not return to caller until package is complete. Call make take a while

Parameters

file_name – Name of the file to write the log package to

Returns

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

create_log_pkg()

This method will package all log files on the server into a .jar file

Returns

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

get_active_standby_status()

Get the current state of the active standby server connection

Returns

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

get_dual_control_requests()

Returns a list of dual control events waiting for approval or rejection

Returns

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

get_dual_control_state()

Use this method to determine if dual control is currently enabled of disabled on the server.

Returns

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

get_log_events(count, session=None)

get a list of the most recent log events

Parameters
  • count (int) – The number of messages to return

  • session (string) – (optional) filter messages on session

Returns

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

get_log_pkgs()

Gets a list of log packages and their location on the server

Returns

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

static get_properties()

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

get_server_backups()

Retrieves a list of all server backups.

Returns

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

get_server_version()

Get the version of the server being called

Returns

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

get_session_types()

Get supported session types

Returns

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

get_volume_counts()

Get a summary of the volume usage on the server

Returns

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

reconnect_active_standby_server()

Reconnect the active standby connection

Returns

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

reject_dual_control_request(id, comment)

Reject a dual control request

Parameters
  • id (int) – ID of the request caller wants to approve.

  • getDualControlEvents. (ID from the 'requestid' field return from) –

  • comment (str) – Comment to the creator of the event on why the

  • rejected. (request was) –

Returns

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

remove_active_or_standby_server(ha_server)

This method removes the alternate CSM server. If issued to the active server the standby will be removed.

Parameters

ha_server (str) – hostname of the server to remove

Returns

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

rest_delete(url, data, headers)

Method to call a REST delete call if one is needed but missing from the package.

url (str): url for the csm server and the rest call the user wants to run data (dict): Dictionary of variables used in the body of a REST call.

ex. params = {“type”: device_type, “deviceip”: device_ip, “deviceport”: device_port,}

headers (dict): Dictionary of variables used in the headers of a REST call except for the token
ex. headers = {“Accept-Language”: properties[“language”],

“Content-Type”: “application/x-www-form-urlencoded”}

rest_get(url, data, headers)

Method to call a REST get call if one is needed but missing from the package.

url (str): url for the csm server and the rest call the user wants to run data (dict): Dictionary of variables used in the body of a REST call.

ex. params = {“type”: device_type, “deviceip”: device_ip, “deviceport”: device_port,}

headers (dict): Dictionary of variables used in the headers of a REST call except for the token
ex. headers = {“Accept-Language”: properties[“language”],

“Content-Type”: “application/x-www-form-urlencoded”}

rest_post(url, data, headers)

Method to call a REST post call if one is needed but missing from the package.

url (str): url for the csm server and the rest call the user wants to run data (dict): Dictionary of variables used in the body of a REST call.

ex. params = {“type”: device_type, “deviceip”: device_ip, “deviceport”: device_port,}

headers (dict): Dictionary of variables used in the headers of a REST call except for the token
ex. headers = {“Accept-Language”: properties[“language”],

“Content-Type”: “application/x-www-form-urlencoded”}

rest_put(url, data, headers)

Method to call a REST put call if one is needed but missing from the package.

url (str): url for the csm server and the rest call the user wants to run data (dict): Dictionary of variables used in the body of a REST call.

ex. params = {“type”: device_type, “deviceip”: device_ip, “deviceport”: device_port,}

headers (dict): Dictionary of variables used in the headers of a REST call except for the token
ex. headers = {“Accept-Language”: properties[“language”],

“Content-Type”: “application/x-www-form-urlencoded”}

set_property(file, property_name, value)

This call will set the property provided to the value provide in the selected file

Parameters
  • file (str) – One of the following files can be specified. “server”, “bootstrap”, “essniclient” or “zosclient”

  • property_name (str) – name of the property to set ex. csm.server.extra_driver_debug

  • value (str) – value to set the property to

Returns

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

set_server_as_standby(active_server)

Issue this command to the server that you want to be the standby server. Sets the server passed in to be the active server. All data on the called server will be replaced with the data from the active server.

Parameters
  • active_server (str) – IP or hostname of the active server.

  • port. (This method will use the default) –

Returns

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

set_standby_server(standby_server, standby_username, standby_password)

Reconnect the active standby connection

Parameters
  • standby_server (str) – IP or hostname of the standby server

  • standby_username (str) – Username to create a connection to the standby server

  • standby_password (str) – Password for the user to create a connection to the standby server

Returns

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

takeover_standby_server()

Issues a takeover on the standby server making the standby server an active server

Returns

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