COT.ovf.name_helper module

Module for handling the differences in XML between OVF spec versions.

Functions

name_helper Generate an instance of the correct OVFNameHelper variant class.

Classes and Exceptions

OVFNameHelper1 Helper class for OVF version 1.x.
OVFNameHelper0 Helper class for OVF of versions prior to 1.0.
OVFNameHelper2 Helper class for OVF of version 2.x.
class OVFNameHelper0[source]

Bases: COT.ovf.name_helper.OVFNameHelper1

Helper class for OVF of versions prior to 1.0.

Provides string constants for easier lookup of various OVF XML elements and attributes.

__init__()[source]

Create a name helper for OVF version 0.x.

NSM = {'vssd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData', 'rasd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData', 'ovf': 'http://www.vmware.com/schema/ovf/1/envelope', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'cim': 'http://schemas.dmtf.org/wbem/wscim/1/common'}

Shorthand for XML namespace URIs usually seen in a version 0.x OVF.

class OVFNameHelper1[source]

Bases: object

Helper class for OVF version 1.x.

Provides string constants for easier lookup of various OVF XML elements and attributes.

Version-specific subclasses below provide variant properties.

__init__()[source]

Create a name helper for OVF version 1.x.

item_tag_for_namespace(ns)[source]

Get the Item tag for the given XML namespace.

Parameters:ns (str) – XML namespace
Returns:str – ‘Item’, ‘StorageItem’, or ‘EthernetPortItem’ as appropriate.
Raises:ValueUnsupportedError – if the namespace is unrecognized
namespace_for_item_tag(tag)[source]

Get the XML namespace for the given item tag.

Parameters:tag (str) – Un-namespaced XML tag.
Returns:str – XML namespace string, or None.
namespace_for_resource_type(resource_type)[source]

Get the XML namespace for the given ResourceType.

Parameters:resource_type (str) – ResourceType value string.
Returns:str – XML namespace string, or None.
NSM = {'vssd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData', 'rasd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'ovf': 'http://schemas.dmtf.org/ovf/envelope/1', 'cim': 'http://schemas.dmtf.org/wbem/wscim/1/common'}

Shorthand for XML namespace URIs usually seen in a version 1.x OVF.

RES_MAP = {'ib': '9', 'usb': '23', 'floppy': '14', 'dvd': '16', 'iscsi': '8', 'harddisk': '17', 'parallel': '22', 'sata': '20', 'fc': '7', 'memory': '4', 'cdrom': '15', 'ethernet': '10', 'scsi': '6', 'ide': '5', 'cpu': '3', 'serial': '21'}

Mapping of human-readable strings to ResourceType values.

See http://schemas.dmtf.org/wbem/cim-html/2/CIM_ResourceAllocationSettingData.html for more details.

class OVFNameHelper2[source]

Bases: COT.ovf.name_helper.OVFNameHelper1

Helper class for OVF of version 2.x. TODO.

Provides string constants for easier lookup of various OVF XML elements and attributes.

__init__()[source]

Create a name helper for OVF version 2.x.

NSM = {'vssd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData', 'rasd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData', 'cim': 'http://schemas.dmtf.org/wbem/wscim/1/common', 'sasd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_StorageAllocationSettingData.xsd', 'ovf': 'http://schemas.dmtf.org/ovf/envelope/2', 'epasd': 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPortAllocationSettingData.xsd', 'xsi': 'http://www.w3.org/2001/XMLSchema-instance'}

Shorthand for XML namespace URIs usually seen in a version 2.x OVF.

name_helper(version)[source]

Generate an instance of the correct OVFNameHelper variant class.

Parameters:version (float) – OVF specification version to use, such as 0.9, 1.0, or 2.0
Returns:Instance of OVFNameHelper[012] as appropriate.