The cinder.volume.drivers.netapp.dataontap.client.api Module

The cinder.volume.drivers.netapp.dataontap.client.api Module

NetApp API for Data ONTAP and OnCommand DFM.

Contains classes required to issue API calls to Data ONTAP and OnCommand DFM.

exception NaApiError(code='unknown', message='unknown')

Bases: exceptions.Exception

Base exception class for NetApp API errors.

class NaElement(name)

Bases: object

Class wraps basic building block for NetApp API request.

add_attr(name, value)

Add the attribute to the element.

add_attrs(**attrs)

Add multiple attributes to the element.

add_child_elem(na_element)

Add the child element to the element.

add_new_child(name, content, convert=False)

Add child with tag name and content.

Convert replaces entity refs to chars.

add_node_with_children(node, **children)

Creates named node with children.

static create_node_with_children(node, **children)

Creates and returns named node with children.

get_attr(name)

Get the attribute with the given name.

get_attr_names()

Returns the list of attribute names.

get_child_by_name(name)

Get the child element by the tag name.

get_child_content(name)

Get the content of the child.

get_children()

Get the children for the element.

get_content()

Get the text for the element.

get_name()

Returns the tag name of the element.

has_attr(name)

Checks whether element has attribute.

set_content(text)

Set the text string for the element.

to_string(pretty=False, method='xml', encoding='UTF-8')

Prints the element to string.

translate_struct(data_struct)

Convert list, tuple, dict to NaElement and appends.

Example usage:

<root>
    <elem1>vl1</elem1>
    <elem2>vl2</elem2>
    <elem3>vl3</elem3>
</root>

The above can be achieved by doing

root = NaElement('root')
root.translate_struct({'elem1': 'vl1', 'elem2': 'vl2',
                       'elem3': 'vl3'})
<root>
    <elem1>vl1</elem1>
    <elem2>vl2</elem2>
    <elem1>vl3</elem1>
</root>

The above can be achieved by doing

root = NaElement('root')
root.translate_struct([{'elem1': 'vl1', 'elem2': 'vl2'},
                       {'elem1': 'vl3'}])
class NaServer(host, server_type='filer', transport_type='http', style='basic_auth', username=None, password=None, port=None)

Bases: object

Encapsulates server connection logic.

NETAPP_NS = 'http://www.netapp.com/filer/admin'
SERVER_TYPE_DFM = 'dfm'
SERVER_TYPE_FILER = 'filer'
STYLE_CERTIFICATE = 'certificate_auth'
STYLE_LOGIN_PASSWORD = 'basic_auth'
TRANSPORT_TYPE_HTTP = 'http'
TRANSPORT_TYPE_HTTPS = 'https'
URL_DFM = 'apis/XMLrequest'
URL_FILER = 'servlets/netapp.servlets.admin.XMLrequest_filer'
get_api_version()

Gets the API version tuple.

invoke_successfully(na_element, enable_tunneling=False)

Invokes API and checks execution status as success.

Need to set enable_tunneling to True explicitly to achieve it. This helps to use same connection instance to enable or disable tunneling. The vserver or vfiler should be set before this call otherwise tunneling remains disabled.

send_http_request(*args, **kwargs)

Invoke the API on the server.

set_api_version(major, minor)

Set the API version.

set_port(port)

Set the server communication port.

set_server_type(server_type)

Set the target server type.

Supports filer and dfm server types.

set_style(style)

Set the authorization style for communicating with the server.

Supports basic_auth for now. Certificate_auth mode to be done.

set_timeout(seconds)

Sets the timeout in seconds.

set_transport_type(transport_type)

Set the transport type protocol for API.

Supports http and https transport types.

set_vfiler(vfiler)

Set the vfiler to use if tunneling gets enabled.

set_vserver(vserver)

Set the vserver to use if tunneling gets enabled.

class SSHUtil(host, username, password, port=22)

Bases: object

Encapsulates connection logic and command execution for SSH client.

CONNECTION_KEEP_ALIVE = 600
MAX_CONCURRENT_SSH_CONNECTIONS = 5
RECV_TIMEOUT = 3
WAIT_ON_STDOUT_TIMEOUT = 3
execute_command(client, command_text, timeout=3)
execute_command_with_prompt(client, command, expected_prompt_text, prompt_response, timeout=3)
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.