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.

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'}
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.

item_tag_for_namespace(ns)[source]

Get the item tag for the given XML namespace.

namespace_for_item_tag(tag)[source]

Get the XML namespace for the given item tag.

namespace_for_resource_type(resource_type)[source]

Get the XML namespace for the given ResourceType.

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'}
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'}
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.

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'}
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.