Usage¶
Quickstart¶
Wry’s functionality is exposed through the AMTDevice class. Initialize it as such:
>>> from wry import AMTDevice
>>> dev = AMTDevice.AMTDevice(address, False, username, password)
You can then access different aspects of device functionality, through aspect-specific namespaces. For example:
>>> dev.power.turn_on()
>>> dev.power.state
StateMap(state='on', sub_state=None)
Currently, the following namespaces are implemented:
- dev.power, via
wry.AMTPower.AMTPower
, provides access to:
- Power state and control
- dev.boot, via
wry.AMTBoot.AMTBoot
, provides access to:
- Boot configuration
- Boot medium selection
- dev.vnc, via
wry.AMTKVM.AMTKVM
, provides access to:
- Remote KVM (VNC) state and configuration
- Setting of [additonal] user opt-in policy for KVM
- dev.opt_in, via
wry.AMTOptIn.AMTOptIn
, provides access to:
- Setting of opt-in policies for KVM, Serial-over-LAN and media redirection
- dev.redirection, via
wry.AMTRedirection.AMTRedirection
, provides access to:
- State and control of media redirection (IDER)
- State and control of Serial-over-LAN (SOL)
You can click on a class name above, to see documentation for the available methods.
In-Depth¶
As well as the above, the AMTDevice class provides more genearlized/low-level functionality.
-
class
wry.AMTDevice.
AMTDevice
(target=None, is_ssl=True, username=None, password=None, debug=False, showxml=False)[source]¶ A wrapper class which packages AMT functionality into an accessible, device-centric format.
-
bios
¶ A property which returns the BIOS identifiers (for the code, not settings)
-
-
class
wry.AMTPower.
AMTPower
(device)[source]¶ Control over a device’s power state.
-
state
¶ A property which describes the machine’s power state.
A
wry.device.StateMap
as described inwry.device.AMT_POWER_STATE_MAP
.
-
-
class
wry.AMTKVM.
AMTKVM
(device)[source]¶ Control over a device’s KVM (VNC) functionality.
-
default_screen
¶ Default Screen. An integer.
-
enabled
¶ Whether KVM functionality is enabled or disabled.
True/False
Note
This will return True even if KVM is enabled, but no ports for it are.
-
enabled_ports
¶ Tells you (and/or allows you to set) the enabled ports for VNC.
-
opt_in_timeout
¶ User opt-in timeout for KVM access, in seconds.
If set to 0, opt-in will be disabled.
-
password
¶ This doesn’t fail but always appears to return None
-
port_5900_enabled
¶ Whether the standard VNC port (5900) is enabled. True/False.
-
session_timeout
¶ Session timeout. In minutes.
-
-
class
wry.AMTBoot.
AMTBoot
(device)[source]¶ Control how the machine will boot next time.
-
config
¶ Get configuration for the machine’s next boot.
-
supported_media
¶ Media the device can be configured to boot from.
-
-
class
wry.AMTOptIn.
AMTOptIn
(device)[source]¶ Manage user consent and opt-in codes.
-
code_ttl
¶ How long an opt-in code lasts, in seconds.
-
-
class
wry.AMTRedirection.
AMTRedirection
(device)[source]¶ Control over Serial-over-LAN and storage redirection.
-
class
wry.WryDict.
WryDict
(*args, **kwargs)[source]¶ An OrderedDict with the ability to be generated from wman-returned XML
-
to_xml
¶ Return the XML representation of this WryDict
-
-
class
wry.wsmanResource.
wsmanResource
(target=None, is_ssl=False, username=None, password=None, resource=None, debug=False, showxml=False)[source]¶ Class to represent a resource on a wsman compatible server
-
get
(setting='', **kwargs)[source]¶ Send a get request and return the result
@param setting: the setting to get the value of (None for all in this resources)
-
invoke
(method, **kwargs)[source]¶ Call a method and return the result
@param method: the method name to call
-