From 13d5a56d6160bec2cb9e8e8b7e795c32b69d932b Mon Sep 17 00:00:00 2001 From: Keith Robertson Date: Sun, 4 Dec 2011 11:38:42 -0500 Subject: [PATCH] tools: New tool to upload OVF archives (#xxxxxx) Cc: kroberts@redhat.com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------mime-boundary-string" This is a multi-part message in MIME format. --------------mime-boundary-string Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit https://bugzilla.redhat.com/XXXXXX The tool provided in this patch makes it easier to upload an OVF archive to an export domain. An OVF archive is simply a zipped archive that can contain an image and must contain an XML document decribing the image to be uploaded. The tool has the following behavior: 1. Before unpacking the archive it will check for requisite space on the local system. 2. Before uploading the requisite parts in the archive it will check for space in the target NFS export domain. 3. At this time only NFS as a transport mechanism is supported. This is slightly different behavior than the iso uploader which supports both NFS and SSH/SFTP. 4. The tool will allow you to rename the image. 5. The toll will allow you to change the UUID of the image. Example usage: 1. > python ovirt-image-uploader.py -n 127.0.0.1:/virt/exports --template-name=new-name-here --template-id=new-uuid-here upload keith.ovf --force 2. > python ovirt-image-uploader.py --conf-file=./imageuploader.conf list Please provide the REST API password for RHEV-M (CTRL+D to abort): Export Storage Domain Name | Datacenter | Export Domain Status ExportDomain | LegacyDC | active 3. > python ovirt-image-uploader.py -e ExportDomain --template-name=new-name-here --template-id=new-uuid-here upload keith.ovf --force Change-Id: I3679b44720919aecef457536cc9e19370531c06c --- .../src/engine-image-uploader.py | 960 +++ .../engine-image-uploader/src/imageuploader.conf | 23 + .../src/ovf/CIM_ResourceAllocationSettingData.xsd | 220 + .../src/ovf/CIM_VirtualSystemSettingData.xsd | 147 + .../engine-image-uploader/src/ovf/__init__.py | 1 + .../tools/engine-image-uploader/src/ovf/common.xsd | 229 + .../engine-image-uploader/src/ovf/ovf-envelope.xsd | 996 +++ .../src/ovf/ovf-environment.xsd | 215 + .../engine-image-uploader/src/ovf/ovfenvelope.py | 8031 ++++++++++++++++++++ .../src/ovf/ovfenvelopetest.py | 95 + .../engine-image-uploader/src/ovf/sample-ovf.xml | 109 + .../tools/engine-image-uploader/src/schemas | 1 + .../engine-image-uploader/src/test-ovf-archive.ovf | Bin 0 -> 1826 bytes packaging/fedora/ovirt-engine.spec.in | 14 + 14 files changed, 11041 insertions(+), 0 deletions(-) create mode 100644 backend/manager/tools/engine-image-uploader/src/engine-image-uploader.py create mode 100644 backend/manager/tools/engine-image-uploader/src/imageuploader.conf create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/CIM_ResourceAllocationSettingData.xsd create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/CIM_VirtualSystemSettingData.xsd create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/__init__.py create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/common.xsd create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/ovf-envelope.xsd create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/ovf-environment.xsd create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelope.py create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelopetest.py create mode 100644 backend/manager/tools/engine-image-uploader/src/ovf/sample-ovf.xml create mode 120000 backend/manager/tools/engine-image-uploader/src/schemas create mode 100644 backend/manager/tools/engine-image-uploader/src/test-ovf-archive.ovf --------------mime-boundary-string Content-Type: text/x-patch; name="0001-tools-New-tool-to-upload-OVF-archives-xxxxxx.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-tools-New-tool-to-upload-OVF-archives-xxxxxx.patch" diff --git a/backend/manager/tools/engine-image-uploader/src/engine-image-uploader.py b/backend/manager/tools/engine-image-uploader/src/engine-image-uploader.py new file mode 100644 index 0000000..7fc3be3 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/engine-image-uploader.py @@ -0,0 +1,960 @@ +#!/usr/bin/python + +import sys +import os +from optparse import OptionParser, OptionGroup, SUPPRESS_HELP +import subprocess +import shlex +import logging +import locale +import gettext +import pprint +import urllib +import urllib2 +import base64 +import traceback +import tempfile +import shutil +import fnmatch +from pwd import getpwnam +import getpass +import tarfile +from schemas import api +from ovf import ovfenvelope +from ovf.ovfenvelope import * +from xml.etree.ElementTree import ElementTree + + + +APP_NAME = "engine-image-uploader" +STREAM_LOG_FORMAT = '%(levelname)s: %(message)s' +FILE_LOG_FORMAT = '%(asctime)s::%(levelname)s::%(module)s::%(lineno)d::%(name)s:: %(message)s' +FILE_LOG_DSTMP = '%Y-%m-%d %H:%M:%S' +NFS_MOUNT_OPTS = '-t nfs -o rw,sync,soft' +NFS_UMOUNT_OPTS = '-t nfs -f ' +NFS_USER = 'vdsm' +NUMERIC_VDSM_ID = 36 +MOUNT='/bin/mount' +UMOUNT='/bin/umount' +DEFAULT_CONFIGURATION_FILE='/etc/engine/imageuploader.conf' +DEFAULT_LOG_FILE='/var/log/engine/engine-image-uploader.log' + +def multilog(logger, msg): + for line in str(msg).splitlines(): + logger(line) + +def get_from_prompt(msg, default=None, prompter=raw_input): + try: + return prompter(msg) + except EOFError: + print + return default + +class ExitCodes(): + """ + A simple psudo-enumeration class to hold the current and future exit codes + """ + NOERR=0 + CRITICAL=1 + LIST_IMAGE_ERR=2 + UPLOAD_ERR=3 + CLEANUP_ERR=4 + exit_code=NOERR + +class Commands(): + """ + A simple psudo-enumeration class to facilitate command checking. + """ + LIST = 'list' + UPLOAD = 'upload' + #DELETE = 'delete' + ARY = [LIST, UPLOAD] + +class Caller(object): + """ + Utility class for forking programs. + """ + def __init__(self, configuration): + self.configuration = configuration + + def prep(self, cmd): + _cmd = cmd % self.configuration + logging.debug(_cmd) + return shlex.split(_cmd) + + def call(self, cmds): + """Uses the configuration to fork a subprocess and run cmds""" + _cmds = self.prep(cmds) + logging.debug("_cmds(%s)" % _cmds) + proc = subprocess.Popen(_cmds, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + stdout, stderr = proc.communicate() + returncode = proc.returncode + logging.debug("returncode(%s)" % returncode) + logging.debug("STDOUT(%s)" % stdout) + logging.debug("STDERR(%s)" % stderr) + + if returncode == 0: + return (stdout,returncode) + else: + raise Exception(stderr) + + + +class Configuration(dict): + """This class is a dictionary subclass that knows how to read and """ + """handle our configuration. Resolution order is defaults -> """ + """configuration file -> command line options.""" + + class SkipException(Exception): + "This exception is raised when the user aborts a prompt" + pass + + def __init__(self, + parser=None): + self.command = None + self.parser = parser + self.options = None + self.args = None + self.files = [] + + # Immediately, initialize the logger to the INFO log level and our + # logging format which is : and not the default of + # : + self.__initLogger(logging.INFO) + + if not parser: + raise Exception("Configuration requires a parser") + + self.options, self.args = self.parser.parse_args() + + if os.geteuid() != 0: + raise Exception("This tool requires root permissions to run.") + + # At this point we know enough about the command line options + # to test for verbose and if it is set we should re-initialize + # the logger to DEBUG. This will have the effect of printing + # stack traces if there are any exceptions in this class. + if getattr(self.options, "verbose"): + self.__initLogger(logging.DEBUG) + + self.load_config_file() + + if self.options: + # Need to parse again to override configuration file options + self.options, self.args = self.parser.parse_args(values=self.options) + self.from_options(self.options, self.parser) + # Need to parse out options from the option groups. + self.from_option_groups(self.options, self.parser) + + if self.args: + self.from_args(self.args) + + # Finally, all options from the command line and possibly a configuration + # file have been processed. We need to re-initialize the logger if + # the user has supplied either --quiet processing or supplied a --log-file. + # This will ensure that any further log messages throughout the lifecycle + # of this program go to the log handlers that the user has specified. + if self.options.log_file or self.options.quiet: + level = logging.INFO + if self.options.verbose: + level = logging.DEBUG + self.__initLogger(level, self.options.quiet, self.options.log_file) + + def __missing__(self, key): + return None + + def load_config_file(self): + """Loads the user-supplied config file or the system default. + If the user supplies a bad filename we will stop.""" + + if self.options and getattr(self.options, "conf_file"): + if os.path.isfile(self.options.conf_file): + self.from_file(self.options.conf_file) + else: + raise Exception("The specified configuration file does not exist. File=(%s)" % + self.options.conf_file) + + elif os.path.isfile(DEFAULT_CONFIGURATION_FILE): + self.from_file(DEFAULT_CONFIGURATION_FILE) + + def from_option_groups(self, options, parser): + for optGrp in parser.option_groups: + for optGrpOpts in optGrp.option_list: + opt_value = getattr(options, optGrpOpts.dest) + if opt_value is not None: + self[optGrpOpts.dest] = opt_value + + def from_options(self, options, parser): + for option in parser.option_list: + if option.dest: + opt_value = getattr(options, option.dest) + if opt_value is not None: + self[option.dest] = opt_value + + def from_file(self, filename): + import ConfigParser + cp = ConfigParser.ConfigParser() + cp.read(filename) + + # we want the items from the ImageUploader section only + try: + opts = ["--%s=%s" % (k,v) + for k,v in cp.items("ImageUploader")] + (new_options, args) = self.parser.parse_args(args=opts, values=self.options) + self.from_option_groups(new_options, self.parser) + self.from_options(new_options, self.parser) + except ConfigParser.NoSectionError: + pass + + def from_args(self, args): + self.command = args[0] + if self.command not in Commands.ARY: + raise Exception(_("%s is not a valid command. Valid commands are '%s' or '%s'.") % + (self.command, + Commands.LIST, + Commands.UPLOAD)) + + if self.command == Commands.UPLOAD: + if len(args) <= 1: + raise Exception(_("Files must be supplied for %s commands" % + (Commands.UPLOAD))) + for file in args[1:]: + self.files.append(file) + + def prompt(self, key, msg): + if key not in self: + self._prompt(raw_input, key, msg) + + def getpass(self, key, msg): + if key not in self: + self._prompt(getpass.getpass, key, msg) + + # This doesn't ask for CTRL+C to abort because KeyboardInterrupts don't + # seem to behave the same way every time. Take a look at the link: + # http://stackoverflow.com/questions/4606942/why-cant-i-handle-a-keyboardinterrupt-in-python + def _prompt(self, prompt_function, key, msg=None): + value = get_from_prompt(msg="Please provide the %s (CTRL+D to abort): " % msg, + prompter=prompt_function) + if value: + self[key] = value + else: + raise self.SkipException + + def ensure(self, key, default=""): + if key not in self: + self[key] = default + + def has_all(self, *keys): + return all(self.get(key) for key in keys) + + def has_any(self, *keys): + return any(self.get(key) for key in keys) + + def __ensure_path_to_file(self, file_): + dir_ = os.path.dirname(file_) + if not os.path.exists(dir_): + logging.info("%s does not exists. It will be created." % dir_) + os.makedirs(dir_, 0755) + + def __log_to_file(self, file_, level): + try: + self.__ensure_path_to_file(file_) + hdlr = logging.FileHandler(filename=file_, mode='w') + fmt = logging.Formatter(FILE_LOG_FORMAT, FILE_LOG_DSTMP) + hdlr.setFormatter(fmt) + logging.root.addHandler(hdlr) + logging.root.setLevel(level) + except Exception, e: + logging.error("Could not configure file logging: %s" % e) + + def __log_to_stream(self, level): + sh = logging.StreamHandler() + fmt = logging.Formatter(STREAM_LOG_FORMAT) + sh.setLevel(level) + sh.setFormatter(fmt) + logging.root.addHandler(sh) + + def __initLogger(self, logLevel=logging.INFO, quiet=None, logFile=None): + """ + Initialize the logger based on information supplied from the + command line or configuration file. + """ + + # If you call basicConfig more than once without removing handlers + # it is effectively a noop. In this program it is possible to call + # __initLogger more than once as we learn information about what + # options the user has supplied in either the config file or + # command line; hence, we will need to load and unload the handlers + # to ensure consistently fomatted output. + log = logging.getLogger() + for h in log.handlers: + log.removeHandler(h) + + if quiet: + if logFile: + # Case: Quiet and log file supplied. Log to only file + self.__log_to_file(logFile, logLevel) + else: + # If the user elected quiet mode *and* did not supply + # a file. We will be *mostly* quiet but not completely. + # If there is an exception/error/critical we will print + # to stdout/stderr. + logging.basicConfig(level=logging.ERROR, format=STREAM_LOG_FORMAT) + else: + if logFile: + # Case: Not quiet and log file supplied. Log to both file and + # stdout/stderr + self.__log_to_file(logFile, logLevel) + self.__log_to_stream(logLevel) + else: + # Case: Not quiet and no log file supplied. Log to only stdout/stderr + logging.basicConfig(level=logLevel, format=STREAM_LOG_FORMAT) + +class ImageUploader(object): + + def __init__(self, conf): + self.configuration = conf + self.caller = Caller(self.configuration) + if self.configuration.command == Commands.LIST: + self.list_all_export_storage_domains() + elif self.configuration.command == Commands.UPLOAD: + self.upload_to_storage_domain() + else: + raise Exception(_("A valid command was not specified.")) + + + + def _fetch_from_api(self, method): + """ + Make a RESTful request to the supplied oVirt method. + """ + if not self.configuration: + raise Exception("No configuration.") + + try: + self.configuration.prompt("engine", msg=_("hostname of oVirt Engine")) + self.configuration.prompt("user", msg=_("REST API username for oVirt Engine")) + self.configuration.getpass("passwd", msg=_("REST API password for oVirt Engine")) + except Configuration.SkipException: + raise Exception("Insufficient information provided to communicate with the oVirt Engine REST API.") + + url = "https://" + self.configuration.get("engine") + "/api" + method + req = urllib2.Request(url) + logging.debug("URL is %s" % req.get_full_url()) + + # Not using the AuthHandlers because they actually make two requests + auth = "%s:%s" % (self.configuration.get("user"), self.configuration.get("passwd")) + #logging.debug("HTTP auth is = %s" % auth) + + auth = base64.encodestring(auth).strip() + req.add_header("Authorization", "Basic %s" % auth) + + fp = urllib2.urlopen(req) + return fp.read() + + def list_all_export_storage_domains(self): + """ + List only the Export storage domains in sorted format. + """ + def get_name(ary): + return ary[0] + + dcXML = self._fetch_from_api("/datacenters") + logging.debug("Returned XML is\n%s" % dcXML) + dc = api.parseString(dcXML) + dcAry = dc.get_data_center() + if dcAry is not None: + imageAry = [ ] + for dc in dcAry: + dcName = dc.get_name() + domainXml = self._fetch_from_api("/datacenters/%s/storagedomains" % + dc.get_id()) + logging.debug("Returned XML is\n%s" % domainXml) + sdom = api.parseString(domainXml) + domainAry = sdom.get_storage_domain() + if domainAry is not None: + for domain in domainAry: + if domain.get_type() == 'export': + status = domain.get_status() + if status is not None: + imageAry.append([domain.get_name(), + dcName, + status.get_state()]) + else: + logging.debug("the storage domain didn't have a status element.") + else: + logging.debug(_("DC(%s) does not have a storage domain.") % dcName) + + if len(imageAry) > 0: + imageAry.sort(key=get_name) + fmt = "%-30s | %-25s | %s" + print fmt % (_("Export Storage Domain Name"), _("Datacenter"), _("Export Domain Status")) + print "\n".join(fmt % (name, dcName, status) + for name, dcName, status in imageAry) + else: + ExitCodes.exit_code=ExitCodes.LIST_IMAGE_ERR + logging.error(_("There are no export storage domains.")) + else: + ExitCodes.exit_code=ExitCodes.LIST_IMAGE_ERR + logging.error(_("There are no datacenters with Export storage domains.")) + + def get_host_and_path_from_export_domain(self, exportdomain): + """ + Given a valid export storage domain, this method will return the + hostname/IP, UUID, and path to the domain in a 3 tuple. + Returns: + (host, id, path) + """ + query = urllib.quote("name=%s" % exportdomain) + domainXml = self._fetch_from_api("/storagedomains?search=%s" % query) + logging.debug("Returned XML is\n%s" % domainXml) + sdom = api.parseString(domainXml) + #sdom = api.parse('exportdomain.xml') + domainAry = sdom.get_storage_domain() + if domainAry is not None and len(domainAry) == 1: + if domainAry[0].get_type() != 'export': + raise Exception(_("The %s storage domain supplied is not of type 'export'" % (exportdomain))) + address = None + path = None + id = domainAry[0].get_id() + storage = domainAry[0].get_storage() + if storage is not None: + address = storage.get_address() + path = storage.get_path() + else: + raise Exception(_("A storage element was not found for the %s export domain." % exportdomain)) + + logging.debug('id=%s address=%s path=%s' % (id, address, path)) + return (id, address, path) + else: + raise Exception(_("An export storage domain with a name of %s was not found." % + exportdomain)) + + def unpack_ovf(self, ovf_file, dest_dir): + '''Given a path to an OVF .tgz this function will unpack it into dest_dir. ''' + retVal = True + try: + tar = tarfile.open(ovf_file, "r:gz") + tar.extractall(dest_dir) + except Exception, e: + retVal = False + logging.error(_("Problem unpacking %s. Message %s" + % (ovf_file, + str(e).strip()))) + finally: + tar.close() + return retVal + + def format_nfs_command(self, address, export, dir): + cmd = '%s %s %s:%s %s' % (MOUNT, NFS_MOUNT_OPTS, address, export, dir) + logging.debug('NFS mount command (%s)' % cmd) + return cmd + + def exists_nfs(self, file, uid, gid): + """ + Check for file existence. The file will be tested as the + UID and GID provided which is important for NFS. + """ + try: + os.setegid(gid) + os.seteuid(uid) + return os.path.exists(file) + except Exception, e: + raise Exception("unable to test the available space on %s" % dir) + finally: + os.seteuid(0) + os.setegid(0) + + def space_test_ovf(self, ovf_file, dest_dir): + '''Checks to see if there is enough room to decompress the tgz into dest_dir''' + tar = tarfile.open(ovf_file, "r:gz") + size_in_bytes = 0 + try: + for tarinfo in tar: + if tarinfo.isreg(): + size_in_bytes += tarinfo.size + except: + logging.error(_("Unable to calculate the decompressed size of %s.") % ovf_file) + return False + finally: + tar.close() + + dest_dir_stat = os.statvfs(dest_dir) + dest_dir_size = (dest_dir_stat.f_bavail * dest_dir_stat.f_frsize) + logging.debug("Size of %s:\t%s bytes\t%.1f 1K-blocks\t%.1f MB" % + (ovf_file, size_in_bytes, size_in_bytes/1024, (size_in_bytes/1024)/1024)) + logging.debug("Available space in %s:\t%s bytes\t%.1f 1K-blocks\t%.1f MB" % + (dest_dir, dest_dir_size, dest_dir_size/1024, (dest_dir_size/1024)/1024)) + + if dest_dir_size > size_in_bytes: + return (True,size_in_bytes) + else: + return (False,size_in_bytes) + + def space_test_nfs(self, remote_dir, desired_size, uid, gid): + """ + Checks to see if there is enough space in remote_dir for desired_size. + """ + try: + os.setegid(gid) + os.seteuid(uid) + dir_stat = os.statvfs(remote_dir) + except Exception, e: + raise Exception("unable to test the available space on %s" % remote_dir) + finally: + os.seteuid(0) + os.setegid(0) + + dir_size = (dir_stat.f_bavail * dir_stat.f_frsize) + logging.debug("Desired size:\t%s bytes\t%.1f 1K-blocks\t%.1f MB" % + (desired_size, desired_size/1024, (desired_size/1024)/1024)) + logging.debug("Available space in %s:\t%s bytes\t%.1f 1K-blocks\t%.1f MB" % + (remote_dir, dir_size, dir_size/1024, (dir_size/1024)/1024)) + + if dir_size > desired_size: + return (True,dir_size) + else: + return (False,dir_size) + + def copy_file_nfs(self, src_file_name,dest_file_name, uid, gid): + """ + Copy a file from source to dest via file handles. The destination + file will be opened and written to as the UID and GID provided. + This odd copy operation is important when copying files over NFS. + Read the NFS spec if you want to figure out *why* you need to do this. + Returns: True if successful and false otherwise. + """ + retVal = True + logging.debug("euid(%s) egid(%s)" % (os.geteuid(), os.getegid())) + umask_save = os.umask(0137) # Set to 660 + try: + src = open(src_file_name, 'r') + os.setegid(gid) + os.seteuid(uid) + dest = open(dest_file_name, 'w') + shutil.copyfileobj(src, dest) + except Exception, e: + retVal = False + logging.error(_("Problem copying %s to %s. Message: %s" % + (src_file_name, dest_file_name, e))) + finally: + os.umask(umask_save) + os.seteuid(0) + os.setegid(0) + src.close() + dest.close() + return retVal + + def make_dir_nfs(self, dest_dir, uid, gid, mode): + """ + Make a directory via NFS + """ + retVal = True + logging.debug("euid(%s) egid(%s)" % (os.geteuid(), os.getegid())) + try: + os.setegid(gid) + os.seteuid(uid) + os.makedirs(dest_dir, mode) + except Exception, e: + retVal = False + logging.error(_("Problem making %s. Message: %s" % + (dest_dir, e))) + finally: + os.seteuid(0) + os.setegid(0) + return retVal + + def find_file(self, source_dir, file_name): + for root, dirs, files in os.walk(source_dir, topdown=True): + for name in fnmatch.filter(files, file_name): + logging.debug("File is %s" % os.path.join(root,name)) + rel_dir = root.split(source_dir).pop() + return os.path.join(rel_dir.lstrip('/'),name) + return None + + def update_ovf_xml(self,source_dir): + ''' Check to see if the user supplied template-name or template-id + and update the XML accordingly''' + retVal = True + if self.configuration.get('template_name') or self.configuration.get('template_id'): + ovf_file = self.find_file(source_dir,'*.ovf') + if ovf_file is None: + return False + + ovf_file = os.path.join(source_dir,ovf_file) + tree = ElementTree() + tree.parse(ovf_file) + + if self.configuration.get('template_name'): + iterator = tree.iter('Name') + elem_ary = list(iterator) + if len(elem_ary) != 1: + logging.error("There should only be one Name element in the OVF XML") + return False + else: + logging.debug("tag(%s) text(%s) attr(%s)" % (elem_ary[0].tag, elem_ary[0].text,elem_ary[0].attrib)) + elem_ary[0].text = self.configuration.get('template_name') + tree.write(ovf_file, encoding='utf8') + + if self.configuration.get('template_id'): + old_template_id = None + iterator = tree.iter('TemplateId') + elem_ary = list(iterator) + if len(elem_ary) != 1: + logging.error("There should only be one TemplateId element in the OVF XML") + return False + else: + logging.debug("tag(%s) text(%s) attr(%s)" % (elem_ary[0].tag, elem_ary[0].text,elem_ary[0].attrib)) + old_template_id = elem_ary[0].text + elem_ary[0].text = self.configuration.get('template_id') + + iterator = tree.findall('Content/Section') + for sec in iterator: + logging.debug("tag(%s) text(%s) attr(%s)" % (sec.tag, sec.text,sec.attrib)) + for attr in sec.attrib: + if sec.attrib[attr] == old_template_id: + sec.attrib[attr] = self.configuration.get('template_id') + + new_name = os.path.join(os.path.dirname(ovf_file), + '%s%s' % (self.configuration.get('template_id'), '.ovf')) + tree.write(ovf_file, encoding='utf8') + # Rename the file as required + os.rename(ovf_file, new_name) + # Rename the directory as required + ovf_dir = os.path.dirname(ovf_file) + if os.path.samefile(source_dir, ovf_dir): + logging.warn('OVF XML file does not exist in a named subdirectory in the archive') + else: + logging.debug("Old dirname (%s)" % os.path.dirname(ovf_file)) + new_dir = os.path.join(os.path.dirname(ovf_dir),self.configuration.get('template_id')) + logging.debug("New dir (%s) " % new_dir) + os.rename(ovf_dir, new_dir) + + + #os.rename(os.path.dirname(ovf_file), os.path.join()) + + return retVal + + + def get_files_to_copy(self, source_dir): + '''Search the ovf unpack directory for a .ovf. Open it and look + for those files that need to be copied.''' + retVal = [] + + def href_finder(attr): + if str(attr).endswith('href'): + return attr + else: + return None + + ovf_file = self.find_file(source_dir,'*.ovf') + if ovf_file is None: + logging.error(_("This OVF archive does not have a required OVF XML file.")) + return retVal + if str(ovf_file).startswith("master"): + retVal.append(ovf_file) + else: + retVal.append(os.path.join('master', ovf_file)) + + xmlDoc = ovfenvelope.parse(os.path.join(source_dir,ovf_file)) + ref_type = xmlDoc.get_References() + + file_ary = ref_type.get_File() + for file_type in file_ary: + any_attrs = file_type.get_anyAttributes_() + keys = any_attrs.keys() + href_ary = filter(href_finder, keys) + for href in href_ary: + file_to_copy = any_attrs.get(href) + logging.debug("File to copy: %s" % file_to_copy) + if str(file_to_copy).startswith('images'): + retVal.append(file_to_copy) + else: + retVal.append(os.path.join('images',file_to_copy)) + + return retVal + + + def copy_files_nfs(self, source_dir, remote_dir, address, ovf_size, ovf_file_name): + ''' Copies all of the files in source_dir to remote_dir.''' + files_to_copy = self.get_files_to_copy(source_dir) + # Check for pre-existing files. We can't just overwrite what is already there. + existing_files = False + for root, dirs, files in os.walk(source_dir, topdown=True): + for name in files: + for paths in files_to_copy: + if str(paths).endswith(name): + remote_file = os.path.join(remote_dir, paths) + if self.exists_nfs(remote_file,NUMERIC_VDSM_ID, NUMERIC_VDSM_ID): + if not conf.get('force'): + logging.error(_('%s exists on %s. Either remove it or supply the --force option to overwrite it.') + % (remote_file,address)) + return + else: + # Remove the file. + self.remove_file_nfs(remote_file,NUMERIC_VDSM_ID, NUMERIC_VDSM_ID) + + # Is there enough room for what we want to copy now? + retVal, remote_dir_size = self.space_test_nfs(remote_dir, ovf_size, NUMERIC_VDSM_ID, NUMERIC_VDSM_ID) + if not retVal: + logging.error(_('There is not enough space in %s (%s bytes) for the contents of %s (%s bytes)') % + (address, remote_dir_size, ovf_file_name, ovf_size)) + return + + # Make the remote directories + for valid_files in files_to_copy: + tmp_dir = os.path.join(remote_dir,os.path.dirname(valid_files)) + if not self.exists_nfs(tmp_dir,NUMERIC_VDSM_ID, NUMERIC_VDSM_ID): + self.make_dir_nfs(tmp_dir, NUMERIC_VDSM_ID, NUMERIC_VDSM_ID, 0770) + + # Copy the files with the .ovf being last because we don't want oVirt Engine to find anything until + # it is all there. + local_ovf_file = None + remote_ovf_file = None + for root, dirs, files in os.walk(source_dir, topdown=True): + for name in files: + for paths in files_to_copy: + if str(paths).endswith(name): + remote_file = os.path.join(remote_dir, paths) + if name.endswith('.ovf'): + ovf_file = os.path.join(root,name) + remote_ovf_file = remote_file + else: + if not self.copy_file_nfs(os.path.join(root,name), + remote_file, + NUMERIC_VDSM_ID, + NUMERIC_VDSM_ID): + return + + # Copy the .ovf *last* + self.copy_file_nfs(ovf_file, remote_ovf_file, NUMERIC_VDSM_ID,NUMERIC_VDSM_ID) + + def remove_file_nfs(self, file_name, uid, gid): + """ + Remove a file as the UID and GID provided. + This method will set the euid and egid to that which is provided + and then perform the remove. This is can be important on an + NFS mount. + """ + logging.debug("euid(%s) egid(%s)" % (os.geteuid(), os.getegid())) + try: + os.setegid(gid) + os.seteuid(uid) + os.remove(file_name) + except Exception, e: + logging.error(_("Problem removing %s. Message: %s" % + (file_name, e))) + finally: + os.seteuid(0) + os.setegid(0) + + def upload_to_storage_domain(self): + """ + Method to upload a designated file to an export storage domain. + """ + remote_path = '' + # Did the user give us enough info to do our work? + if self.configuration.get('export_domain') and self.configuration.get('nfs_server'): + raise Exception(_("export-domain and nfs-server are mutually exclusive options")) + if self.configuration.get('ssh_user') and self.configuration.get('nfs_server'): + raise Exception(_("ssh-user and nfs-server are mutually exclusive options")) + elif self.configuration.get('export_domain'): + # Discover the hostname and path from the export domain. + (id, address, path) = self.get_host_and_path_from_export_domain(self.configuration.get('export_domain')) + remote_path = id + elif self.configuration.get('nfs_server'): + mnt = self.configuration.get('nfs_server') + (address, sep, path) = mnt.partition(':') + else: + raise Exception(_("either export-domain or nfs-server must be provided")) + + # NFS support. + mount_dir = tempfile.mkdtemp() + logging.debug('local NFS mount point is %s' % mount_dir) + cmd = self.format_nfs_command(address, path, mount_dir) + try: + self.caller.call(cmd) + passwd = getpwnam(NFS_USER) + dest_dir = os.path.join(mount_dir,remote_path) + for ovf_file in self.configuration.files: + try: + ovf_extract_dir = tempfile.mkdtemp() + logging.debug('local extract directory for OVF is %s' % ovf_extract_dir) + retVal, ovf_file_size = self.space_test_ovf(ovf_file, ovf_extract_dir) + if retVal: + if self.unpack_ovf(ovf_file, ovf_extract_dir): + if (self.update_ovf_xml(ovf_extract_dir)): + self.copy_files_nfs(ovf_extract_dir, dest_dir, address, ovf_file_size, ovf_file) + finally: + try: + logging.debug("Cleaning up OVF extract directory %s" % ovf_extract_dir) + shutil.rmtree(ovf_extract_dir) + except Exception, e: + ExitCodes.exit_code=ExitCodes.CLEANUP_ERR + logging.debug(e) + + except KeyError, k: + ExitCodes.exit_code=ExitCodes.CRITICAL + logging.error(_("A user named %s with a UID and GID of %d must be defined on the system to mount the export storage domain on %s as Read/Write" + % (NFS_USER, + NUMERIC_VDSM_ID, + self.configuration.get('export_domain')))) + except Exception, e: + ExitCodes.exit_code=ExitCodes.CRITICAL + logging.error(e) + finally: + try: + cmd = '%s %s %s' % (UMOUNT, NFS_UMOUNT_OPTS, mount_dir) + logging.debug(cmd) + self.caller.call(cmd) + shutil.rmtree(mount_dir) + except Exception, e: + ExitCodes.exit_code=ExitCodes.CLEANUP_ERR + logging.debug(e) + + +if __name__ == '__main__': + + # i18n setup + gettext.bindtextdomain(APP_NAME) + gettext.textdomain(APP_NAME) + _ = gettext.gettext + + usage_string = "\n".join(("%prog [options] list ", + " %prog [options] upload [file].[file]...[file]")) + + desc = _("""The image uploader can be used to list export storage domains and upload OVF files to +export storage domains. The upload operation supports multiple files (separated by spaces) and +wildcarding.""") + + epilog_string = """\nReturn values: + 0: The program ran to completion with no errors. + 1: The program encountered a critical failure and stopped. + 2: The program did not discover any export domains. + 3: The program encountered a problem uploading to an export domain. + 4: The program encountered a problem un-mounting and removing the temporary directory. +""" + OptionParser.format_epilog = lambda self, formatter: self.epilog + + parser = OptionParser(usage_string, + description=desc, + epilog=epilog_string) + + parser.add_option("", + "--quiet", + dest="quiet", + action="store_true", + help="intended to be used with \"upload\" operations to reduce console output. (default=False)", + default=False) + + parser.add_option("", "--log-file", + dest="log_file", + help=_("path to log file (default=%s)" % DEFAULT_LOG_FILE), + metavar=_("PATH"), + default=DEFAULT_LOG_FILE) + + parser.add_option("", "--conf-file", + dest="conf_file", + help=_("path to configuration file (default=%s)" % DEFAULT_CONFIGURATION_FILE), + metavar=_("PATH")) + + parser.add_option("-v", "--verbose", dest="verbose", + action="store_true", default=False) + + parser.add_option("-f", + "--force", + dest="force", + help=_("replace like named files on the target file server (default=off)"), + action="store_true", + default=False) + + engine_group = OptionGroup(parser, + _("oVirt Engine Configuration"), +_("""The options in the oVirt Engine group are used by the tool to gain authorization to the oVirt Engine REST API. The options in this group are available for both list and upload commands.""")) + + engine_group.add_option("-u", "--user", dest="user", + help=_("username to use with the oVirt Engine REST API. This should be in UPN format."), + metavar=_("user@engine.example.com")) + + engine_group.add_option("-p", + "--passwd", + dest="passwd", + help=SUPPRESS_HELP) + + engine_group.add_option("-r", "--engine", dest="engine", metavar="engine.example.com", + help=_("""hostname or IP address of the oVirt Engine (default=localhost:8443)."""), + default="localhost:8443") + + export_group = OptionGroup(parser, + _("Export Storage Domain Configuration"), +_("""The options in the upload configuration group should be provided to specify the export storage domain to +which OVF files should be uploaded.""")) + + export_group.add_option("-e", "--export-domain", dest="export_domain", + help=_("the export storage domain to which the file(s) should be uploaded"), + metavar=_("EXPORT_STORAGE_DOMAIN")) + + export_group.add_option("-n", "--nfs-server", dest="nfs_server", + help=_("""the NFS server to which the file(s) should be uploaded. +This option is an alternative to export-domain and should not be combined with +export-domain. Use this when you want to upload files to a specific +NFS server (e.g.--nfs-server=example.com:/path/to/some/dir)"""), + metavar=_("NFSSERVER")) + + export_group.add_option("-i", "--template-id", dest="template_id", + help=_("supply this option if you want to rename the template ID (i.e. UUID) of the image"), + metavar=_("TEMPLATE_ID")) + + export_group.add_option("-t", "--template-name", dest="template_name", + help=_("supply this option if you want to rename the template name (i.e. Name) of the image"), + metavar=_("TEMPLATE_NAME")) + +# ssh_group = OptionGroup(parser, +# _("Connection Configuration"), +#_("""By default the program uses NFS to copy files to the ISO storage domain. +#To use SSH file transfer, instead of NFS, provide a ssh-user.""")) +# +# ssh_group.add_option("", "--ssh-user", +# dest="ssh_user", +# help=_("""the SSH user that the program will use +#for SSH file transfers. This user must either be root or a user with a +#UID and GID of 36 on the target file server."""), +# metavar="root") +# +# ssh_group.add_option("", "--ssh-port", dest="ssh_port", +# help=_("the SSH port to connect on"), metavar="PORT", +# default=22) +# +# ssh_group.add_option("-k", "--key-file", dest="key_file", +# help=_("""the identity file (private key) to be used for accessing the file server. +#If a identity file is not supplied the program will prompt for a password. It is strongly recommended +#to use key based authentication with SSH because the program may make multiple SSH connections +#resulting in multiple requests for the SSH password."""), +# metavar="KEYFILE") + + parser.add_option_group(engine_group) + parser.add_option_group(export_group) +# parser.add_option_group(ssh_group) + + try: + # Define configuration so that we don't get a NameError when there is an exception in Configuration + conf = None + conf = Configuration(parser) + + imageup = ImageUploader(conf) + except KeyboardInterrupt, k: + print _("Exiting on user cancel.") + except Exception, e: + logging.error("%s" % e) + logging.info(_("Use the -h option to see usage.")) + parser.print_help() + if conf and (conf.get("verbose")): + logging.debug(_("Configuration:")) + logging.debug(_("command: %s") % conf.command) + #multilog(logging.debug, pprint.pformat(conf)) + multilog(logging.debug, traceback.format_exc()) + sys.exit(ExitCodes.CRITICAL) + + sys.exit(ExitCodes.exit_code) diff --git a/backend/manager/tools/engine-image-uploader/src/imageuploader.conf b/backend/manager/tools/engine-image-uploader/src/imageuploader.conf new file mode 100644 index 0000000..2e800e0 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/imageuploader.conf @@ -0,0 +1,23 @@ +[ImageUploader] +# +### oVirt Engine Configuration: +# +## username to use with the REST API +#user=user@example.com +# the oVirt Engine REST API password. +#passwd=PASSWORD +## hostname or IP address of the oVirt Engine +#engine=localhost:8443 + + +# +### Export Storage Domain Configuration +## the export storage domain to which the file(s) should be uploaded +#export-domain=EXPORT_STORAGE_DOMAIN +## the NFS server to which the file(s) should be uploaded. +#nfs-server=example.com:/path/to/some/dir +## supply this option if you want to rename the template ID (i.e. UUID) of the image +#template-id=TEMPLATE_ID +## supply this option if you want to rename the template name (i.e. Name) of the image +#template-name=TEMPLATE_NAME + diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/CIM_ResourceAllocationSettingData.xsd b/backend/manager/tools/engine-image-uploader/src/ovf/CIM_ResourceAllocationSettingData.xsd new file mode 100644 index 0000000..d8e24de --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/CIM_ResourceAllocationSettingData.xsd @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/CIM_VirtualSystemSettingData.xsd b/backend/manager/tools/engine-image-uploader/src/ovf/CIM_VirtualSystemSettingData.xsd new file mode 100644 index 0000000..7a9e0f3 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/CIM_VirtualSystemSettingData.xsd @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/__init__.py b/backend/manager/tools/engine-image-uploader/src/ovf/__init__.py new file mode 100644 index 0000000..750c887 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/__init__.py @@ -0,0 +1 @@ +__all__ = ["ovfenvelope"] diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/common.xsd b/backend/manager/tools/engine-image-uploader/src/ovf/common.xsd new file mode 100644 index 0000000..c8882eb --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/common.xsd @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/ovf-envelope.xsd b/backend/manager/tools/engine-image-uploader/src/ovf/ovf-envelope.xsd new file mode 100644 index 0000000..f80e955 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/ovf-envelope.xsd @@ -0,0 +1,996 @@ + + + + + + + + + + + + + + Determines whether import should fail if the Section is + not understood + + + + + + Comma-separated list of supported transport types + + + + + + Root element of OVF Descriptor + + + + + + Root OVF descriptor type + + + + + References to all external files + + + + + Package level meta-data + + + + + Content: A VirtualSystem or a + VirtualSystemCollection + + + + + Localized string resource bundles + + + + + + + + + + + + Type for list of external resources + + + + + + + + + + + Type for an external reference to a + resource + + + + + + + Reference key used in other parts of the + package + + + + + Location of external resource + + + + + Size in bytes of the files (if + known) + + + + + Compression type (gzip, bzip2, or none if empty or not + specified) + + + + + Chunk size (except for last chunk) + + + + + + + + Base element for content types. This is the head the + subsitution group + + + + + + Base class for content + + + + + Info element describes the meaning of the content, + this is typically shown if the type is not understood by an + application + + + + + An optional localizable display name of the content + + + + + + Content body is a list of Sections + + + + + + + + + + + + Element substitutable for Content since VirtualSystem_Type + is a derivation of Content_Type + + + + + + Content describing a virtual system + + + + + + + + + Element substitutable for Content since VirtualSystemCollection_Type + is a derivation of Content_Type + + + + + + A collection of Content. + + + + + + + + + + + + + + + Root element of I18N string bundle + + + + + + Type for string resource bundle + + + + + Resource bundle element + + + + + + String element value + + + + String element identifier + + + + + + + + + + + + Locale for this string resource + bundle + + + + + Reference to external resource + bundle + + + + + + + + + + Base elements for OVF sections. This is the head of the + substitution group. + + + + + + + Base type for Sections, subclassing this is the most + common form of extensibility. Subtypes define more specific + elements. + + + + Info element describes the meaning of the Section, + this is typically shown if the Section is not understood by an + application + + + + + + + + + + Type for localizable string + + + + + Default string value + + + + Identifier for lookup in string resource bundle + for alternate locale + + + + + + + + + + + + Element substitutable for Section since + AnnotationSection_Type is a derivation of Section_Type + + + + + + + User defined annotation + + + + + + + + + + + + + + Element substitutable for Section since ProductSection_Type + is a derivation of Section_Type + + + + + + Product information for a virtual + appliance + + + + + + + Name of product + + + + + Name of product vendor + + + + + Product version, short form + + + + + Product version, long form + + + + + URL resolving to product description + + + + + URL resolving to vendor description + + + + + Experimental: URL resolving to deployed product instance + + + + + Experimental: Display icon for product + + + + + + + + + + + + Properties for application-level + customization + + + + Property grouping + delimiter + + + + + Property element + + + + + + Short description of + property + + + + + Description of + property + + + + + Alternative default + property values for different + configuration + + + + + + Property + identifier + + + + + Property + type + + + + + A comma-separated set of type + qualifiers + + + + + Determines whether the property + value is configurable during + installation + + + + + Default value for + property + + + + + Determines whether the property + value should be obscured during deployment + + + + + + + + + + + + Property identifier prefix + + + + + Property identifier suffix + + + + + + + + + Type for alternative default values for properties when + DeploymentOptionSection is used + + + + + + + Alternative default property value + + + + + Configuration from DeploymentOptionSection in which + this value is default + + + + + + + + Element substitutable for Section since NetworkSection_Type + is a derivation of Section_Type + + + + + + Descriptions of logical networks used within the + package + + + + + + + + + + + + + + + + + + + + + + Element substitutable for Section since DiskSection_Type is + a derivation of Section_Type + + + + + + Descriptions of virtual disks used within the + package + + + + + + + + + + + + + + Type for virtual disk descriptor + + + + + + + Identifier for virtual disk + + + + + Reference to virtual disk content. If not specified a + blank virtual disk is created of size given by capacity + attribute + + + + + Virtual disk capacity, can be specified as either an + xs:long size or as a reference to a property using ${property_name}. + + + + + + Unit of allocation for ovf:capacity. If not specified + default value is bytes. Value shall match a recognized value for the + UNITS qualifier in DSP0004. + + + + + Format of virtual disk given as a URI that identifies + the disk type + + + + + Estimated populated size of disk in + bytes + + + + + Reference to potential parent disk + + + + + + + + Element substitutable for Section since + OperatingSystemSection_Type is a derivation of Section_Type + + + + + + + Specification of the operating system installed in the + guest + + + + + + + + + + Identifier defined by the + CIM_OperatingSystem.OsType enumeration + + + + + Version defined by the + CIM_OperatingSystem.Version field + + + + + + + + + Element substitutable for Section since EulaSection_Type is + a derivation of Section_Type + + + + + + End-User License Agreement + + + + + + + + + + + + + + Element substitutable for Section since + VirtualHardwareSection_Type is a derivation of Section_Type + + + + + + + Specifies virtual hardware requirements for a virtual + machine + + + + + + + + + + + Unique identifier of this VirtualHardwareSection + (within a VirtualSystem) + + + + + + + + + + Element substitutable for Section since + ResourceAllocationSection_Type is a derivation of Section_Type + + + + + + + Resource constraints on a + VirtualSystemCollection + + + + + + + + + + + + + + Element substitutable for Section since InstallSection_Type + is a derivation of Section_Type + + + + + + If present indicates that the virtual machine needs to be + initially booted to install and configure the software + + + + + + + + + Delay in seconds to wait for power off to + complete after initial boot + + + + + + + + + Element substitutable for Section since StartupSection_Type + is a derivation of Section_Type + + + + + + Specifies the order in which entities in a + VirtualSystemCollection are powered on and shut down + + + + + + + + + Unique identifier of + the content (within a VirtualSystemCollection) + + + + + + Startup order. Entities are started + up starting with lower-numbers first, starting + from 0. Items with same order identifier may be + started up concurrently or in any order. The + order is reversed for + shutdown. + + + + + Delay in seconds to wait for power + on to complete + + + + + Resumes power-on sequence if guest + software reports ok + + + + + Delay in seconds to wait for power + off to complete + + + + + Start action to use, valid values + are: 'powerOn', 'none' + + + + + Stop action to use, valid values + are: ''powerOff' , 'guestShutdown', + 'none' + + + + + + + + + + + + + + Element substitutable for Section since + DeploymentOptionSection_Type is a derivation of Section_Type + + + + + + + Enumeration of discrete deployment + options + + + + + + + + + + + + + + + + + + + + + + + + Wrapper for + CIM_VirtualSystemSettingData_Type + + + + + + + + + + + + Wrapper for + CIM_ResourceAllocationSettingData_Type + + + + + Determines whether import should fail if entry + is not understood + + + + + Configuration from DeploymentOptionSection this + entry is valid for + + + + + States that this entry is a range + marker + + + + + + + diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/ovf-environment.xsd b/backend/manager/tools/engine-image-uploader/src/ovf/ovf-environment.xsd new file mode 100644 index 0000000..107a313 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/ovf-environment.xsd @@ -0,0 +1,215 @@ + + + + + + + + + + Root element of OVF environment + + + + + + Type for root OVF environment + + + + + Entity independent meta-data + sections + + + + + Meta-data particular to a given + entity + + + + + + + Identifier matching recipient of this + environment + + + + + + + + Container of sections for a specific entity + + + + + + + + + Entity identifier + + + + + + + + + + Base elements for OVF environment sections. This is the + head of the substitution group. + + + + + + Abstract type for all sections in + environment + + + + + + + + + Element substitutable for Section since + PropertySection_Type is a derivation of Section_Type + + + + + + Key/value pairs of assigned properties for an + entity + + + + + + + + + + + + + + + + + + + + Element substitutable for Section since Platform_Type is + a derivation of Section_Type + + + + + + Information about deployment platform + + + + + + + Experimental: Deployment platform + description + + + + + Experimental: Deployment platform + version + + + + + Experimental: Deployment platform + vendor + + + + + Experimental: Current locale + + + + + Experimental: Current timezone offset in minutes + from UTC. Time zones east of Greenwich are positive and time + zones west of Greenwich are negative. + + + + + + + + diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelope.py b/backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelope.py new file mode 100644 index 0000000..101792c --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelope.py @@ -0,0 +1,8031 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Generated Fri Dec 2 15:05:18 2011 by generateDS.py version 2.7b. +# + +import sys +import getopt +import re as re_ + +etree_ = None +Verbose_import_ = False +( XMLParser_import_none, XMLParser_import_lxml, + XMLParser_import_elementtree + ) = range(3) +XMLParser_import_library = None +try: + # lxml + from lxml import etree as etree_ + XMLParser_import_library = XMLParser_import_lxml + if Verbose_import_: + print("running with lxml.etree") +except ImportError: + try: + # cElementTree from Python 2.5+ + import xml.etree.cElementTree as etree_ + XMLParser_import_library = XMLParser_import_elementtree + if Verbose_import_: + print("running with cElementTree on Python 2.5+") + except ImportError: + try: + # ElementTree from Python 2.5+ + import xml.etree.ElementTree as etree_ + XMLParser_import_library = XMLParser_import_elementtree + if Verbose_import_: + print("running with ElementTree on Python 2.5+") + except ImportError: + try: + # normal cElementTree install + import cElementTree as etree_ + XMLParser_import_library = XMLParser_import_elementtree + if Verbose_import_: + print("running with cElementTree") + except ImportError: + try: + # normal ElementTree install + import elementtree.ElementTree as etree_ + XMLParser_import_library = XMLParser_import_elementtree + if Verbose_import_: + print("running with ElementTree") + except ImportError: + raise ImportError("Failed to import ElementTree from any known place") + +def parsexml_(*args, **kwargs): + if (XMLParser_import_library == XMLParser_import_lxml and + 'parser' not in kwargs): + # Use the lxml ElementTree compatible parser so that, e.g., + # we ignore comments. + kwargs['parser'] = etree_.ETCompatXMLParser() + doc = etree_.parse(*args, **kwargs) + return doc + +# +# User methods +# +# Calls to the methods in these classes are generated by generateDS.py. +# You can replace these methods by re-implementing the following class +# in a module named generatedssuper.py. + +try: + from generatedssuper import GeneratedsSuper +except ImportError, exp: + + class GeneratedsSuper(object): + def gds_format_string(self, input_data, input_name=''): + return input_data + def gds_validate_string(self, input_data, node, input_name=''): + return input_data + def gds_format_integer(self, input_data, input_name=''): + return '%d' % input_data + def gds_validate_integer(self, input_data, node, input_name=''): + return input_data + def gds_format_integer_list(self, input_data, input_name=''): + return '%s' % input_data + def gds_validate_integer_list(self, input_data, node, input_name=''): + values = input_data.split() + for value in values: + try: + fvalue = float(value) + except (TypeError, ValueError), exp: + raise_parse_error(node, 'Requires sequence of integers') + return input_data + def gds_format_float(self, input_data, input_name=''): + return '%f' % input_data + def gds_validate_float(self, input_data, node, input_name=''): + return input_data + def gds_format_float_list(self, input_data, input_name=''): + return '%s' % input_data + def gds_validate_float_list(self, input_data, node, input_name=''): + values = input_data.split() + for value in values: + try: + fvalue = float(value) + except (TypeError, ValueError), exp: + raise_parse_error(node, 'Requires sequence of floats') + return input_data + def gds_format_double(self, input_data, input_name=''): + return '%e' % input_data + def gds_validate_double(self, input_data, node, input_name=''): + return input_data + def gds_format_double_list(self, input_data, input_name=''): + return '%s' % input_data + def gds_validate_double_list(self, input_data, node, input_name=''): + values = input_data.split() + for value in values: + try: + fvalue = float(value) + except (TypeError, ValueError), exp: + raise_parse_error(node, 'Requires sequence of doubles') + return input_data + def gds_format_boolean(self, input_data, input_name=''): + return '%s' % input_data + def gds_validate_boolean(self, input_data, node, input_name=''): + return input_data + def gds_format_boolean_list(self, input_data, input_name=''): + return '%s' % input_data + def gds_validate_boolean_list(self, input_data, node, input_name=''): + values = input_data.split() + for value in values: + if value not in ('true', '1', 'false', '0', ): + raise_parse_error(node, 'Requires sequence of booleans ("true", "1", "false", "0")') + return input_data + def gds_str_lower(self, instring): + return instring.lower() + def get_path_(self, node): + path_list = [] + self.get_path_list_(node, path_list) + path_list.reverse() + path = '/'.join(path_list) + return path + Tag_strip_pattern_ = re_.compile(r'\{.*\}') + def get_path_list_(self, node, path_list): + if node is None: + return + tag = GeneratedsSuper.Tag_strip_pattern_.sub('', node.tag) + if tag: + path_list.append(tag) + self.get_path_list_(node.getparent(), path_list) + def get_class_obj_(self, node, default_class=None): + class_obj1 = default_class + if 'xsi' in node.nsmap: + classname = node.get('{%s}type' % node.nsmap['xsi']) + if classname is not None: + names = classname.split(':') + if len(names) == 2: + classname = names[1] + class_obj2 = globals().get(classname) + if class_obj2 is not None: + class_obj1 = class_obj2 + return class_obj1 + def gds_build_any(self, node, type_name=None): + return None + + +# +# If you have installed IPython you can uncomment and use the following. +# IPython is available from http://ipython.scipy.org/. +# + +## from IPython.Shell import IPShellEmbed +## args = '' +## ipshell = IPShellEmbed(args, +## banner = 'Dropping into IPython', +## exit_msg = 'Leaving Interpreter, back to program.') + +# Then use the following line where and when you want to drop into the +# IPython shell: +# ipshell(' -- Entering ipshell.\nHit Ctrl-D to exit') + +# +# Globals +# + +ExternalEncoding = 'ascii' +Tag_pattern_ = re_.compile(r'({.*})?(.*)') +String_cleanup_pat_ = re_.compile(r"[\n\r\s]+") +Namespace_extract_pat_ = re_.compile(r'{(.*)}(.*)') + +# +# Support/utility functions. +# + +def showIndent(outfile, level): + for idx in range(level): + outfile.write(' ') + +def quote_xml(inStr): + if not inStr: + return '' + s1 = (isinstance(inStr, basestring) and inStr or + '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + return s1 + +def quote_attrib(inStr): + s1 = (isinstance(inStr, basestring) and inStr or + '%s' % inStr) + s1 = s1.replace('&', '&') + s1 = s1.replace('<', '<') + s1 = s1.replace('>', '>') + if '"' in s1: + if "'" in s1: + s1 = '"%s"' % s1.replace('"', """) + else: + s1 = "'%s'" % s1 + else: + s1 = '"%s"' % s1 + return s1 + +def quote_python(inStr): + s1 = inStr + if s1.find("'") == -1: + if s1.find('\n') == -1: + return "'%s'" % s1 + else: + return "'''%s'''" % s1 + else: + if s1.find('"') != -1: + s1 = s1.replace('"', '\\"') + if s1.find('\n') == -1: + return '"%s"' % s1 + else: + return '"""%s"""' % s1 + +def get_all_text_(node): + if node.text is not None: + text = node.text + else: + text = '' + for child in node: + if child.tail is not None: + text += child.tail + return text + +def find_attr_value_(attr_name, node): + attrs = node.attrib + attr_parts = attr_name.split(':') + value = None + if len(attr_parts) == 1: + value = attrs.get(attr_name) + elif len(attr_parts) == 2: + prefix, name = attr_parts + namespace = node.nsmap.get(prefix) + if namespace is not None: + value = attrs.get('{%s}%s' % (namespace, name, )) + return value + + +class GDSParseError(Exception): + pass + +def raise_parse_error(node, msg): + if XMLParser_import_library == XMLParser_import_lxml: + msg = '%s (element %s/line %d)' % (msg, node.tag, node.sourceline, ) + else: + msg = '%s (element %s)' % (msg, node.tag, ) + raise GDSParseError(msg) + + +class MixedContainer: + # Constants for category: + CategoryNone = 0 + CategoryText = 1 + CategorySimple = 2 + CategoryComplex = 3 + # Constants for content_type: + TypeNone = 0 + TypeText = 1 + TypeString = 2 + TypeInteger = 3 + TypeFloat = 4 + TypeDecimal = 5 + TypeDouble = 6 + TypeBoolean = 7 + def __init__(self, category, content_type, name, value): + self.category = category + self.content_type = content_type + self.name = name + self.value = value + def getCategory(self): + return self.category + def getContenttype(self, content_type): + return self.content_type + def getValue(self): + return self.value + def getName(self): + return self.name + def export(self, outfile, level, name, namespace): + if self.category == MixedContainer.CategoryText: + # Prevent exporting empty content as empty lines. + if self.value.strip(): + outfile.write(self.value) + elif self.category == MixedContainer.CategorySimple: + self.exportSimple(outfile, level, name) + else: # category == MixedContainer.CategoryComplex + self.value.export(outfile, level, namespace,name) + def exportSimple(self, outfile, level, name): + if self.content_type == MixedContainer.TypeString: + outfile.write('<%s>%s' % (self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeInteger or \ + self.content_type == MixedContainer.TypeBoolean: + outfile.write('<%s>%d' % (self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeFloat or \ + self.content_type == MixedContainer.TypeDecimal: + outfile.write('<%s>%f' % (self.name, self.value, self.name)) + elif self.content_type == MixedContainer.TypeDouble: + outfile.write('<%s>%g' % (self.name, self.value, self.name)) + def exportLiteral(self, outfile, level, name): + if self.category == MixedContainer.CategoryText: + showIndent(outfile, level) + outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \ + (self.category, self.content_type, self.name, self.value)) + elif self.category == MixedContainer.CategorySimple: + showIndent(outfile, level) + outfile.write('model_.MixedContainer(%d, %d, "%s", "%s"),\n' % \ + (self.category, self.content_type, self.name, self.value)) + else: # category == MixedContainer.CategoryComplex + showIndent(outfile, level) + outfile.write('model_.MixedContainer(%d, %d, "%s",\n' % \ + (self.category, self.content_type, self.name,)) + self.value.exportLiteral(outfile, level + 1) + showIndent(outfile, level) + outfile.write(')\n') + + +class MemberSpec_(object): + def __init__(self, name='', data_type='', container=0): + self.name = name + self.data_type = data_type + self.container = container + def set_name(self, name): self.name = name + def get_name(self): return self.name + def set_data_type(self, data_type): self.data_type = data_type + def get_data_type_chain(self): return self.data_type + def get_data_type(self): + if isinstance(self.data_type, list): + if len(self.data_type) > 0: + return self.data_type[-1] + else: + return 'xs:string' + else: + return self.data_type + def set_container(self, container): self.container = container + def get_container(self): return self.container + +def _cast(typ, value): + if typ is None or value is None: + return value + return typ(value) + +# +# Data representation classes. +# + +class EnvelopeType(GeneratedsSuper): + """Root OVF descriptor type""" + subclass = None + superclass = None + def __init__(self, lang='en-US', References=None, Section=None, Content=None, Strings=None): + self.lang = _cast(None, lang) + self.References = References + if Section is None: + self.Section = [] + else: + self.Section = Section + self.Content = Content + if Strings is None: + self.Strings = [] + else: + self.Strings = Strings + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if EnvelopeType.subclass: + return EnvelopeType.subclass(*args_, **kwargs_) + else: + return EnvelopeType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_References(self): return self.References + def set_References(self, References): self.References = References + def get_Section(self): return self.Section + def set_Section(self, Section): self.Section = Section + def add_Section(self, value): self.Section.append(value) + def insert_Section(self, index, value): self.Section[index] = value + def get_Content(self): return self.Content + def set_Content(self, Content): self.Content = Content + def get_Strings(self): return self.Strings + def set_Strings(self, Strings): self.Strings = Strings + def add_Strings(self, value): self.Strings.append(value) + def insert_Strings(self, index, value): self.Strings[index] = value + def get_lang(self): return self.lang + def set_lang(self, lang): self.lang = lang + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='EnvelopeType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='EnvelopeType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='EnvelopeType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.lang is not None and 'lang' not in already_processed: + already_processed.append('lang') + outfile.write(' lang=%s' % (self.gds_format_string(quote_attrib(self.lang).encode(ExternalEncoding), input_name='lang'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='EnvelopeType', fromsubclass_=False): + if self.References is not None: + self.References.export(outfile, level, namespace_, name_='References', ) + for Section_ in self.Section: + Section_.export(outfile, level, namespace_, name_='Section') + if self.Content is not None: + self.Content.export(outfile, level, namespace_, name_='Content', ) + for Strings_ in self.Strings: + Strings_.export(outfile, level, namespace_, name_='Strings') + def hasContent_(self): + if ( + self.References is not None or + self.Section or + self.Content is not None or + self.Strings + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='EnvelopeType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.lang is not None and 'lang' not in already_processed: + already_processed.append('lang') + showIndent(outfile, level) + outfile.write('lang = "%s",\n' % (self.lang,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.References is not None: + showIndent(outfile, level) + outfile.write('References=model_.References_Type(\n') + self.References.exportLiteral(outfile, level, name_='References') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Section=[\n') + level += 1 + for Section_ in self.Section: + showIndent(outfile, level) + outfile.write('model_.Section(\n') + Section_.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + if self.Content is not None: + showIndent(outfile, level) + outfile.write('Content=model_.Content(\n') + self.Content.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Strings=[\n') + level += 1 + for Strings_ in self.Strings: + showIndent(outfile, level) + outfile.write('model_.Strings_Type(\n') + Strings_.exportLiteral(outfile, level, name_='Strings_Type') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('lang', node) + if value is not None and 'lang' not in already_processed: + already_processed.append('lang') + self.lang = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'References': + obj_ = References_Type.factory() + obj_.build(child_) + self.set_References(obj_) + elif nodeName_ == 'Section': + class_obj_ = self.get_class_obj_(child_, Section_Type) + obj_ = class_obj_.factory() + obj_.build(child_) + self.Section.append(obj_) + elif nodeName_ == 'Content': + class_obj_ = self.get_class_obj_(child_, Content_Type) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_Content(obj_) + elif nodeName_ == 'Strings': + obj_ = Strings_Type.factory() + obj_.build(child_) + self.Strings.append(obj_) +# end class EnvelopeType + + +class References_Type(GeneratedsSuper): + """Type for list of external resources""" + subclass = None + superclass = None + def __init__(self, File=None, anytypeobjs_=None): + if File is None: + self.File = [] + else: + self.File = File + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if References_Type.subclass: + return References_Type.subclass(*args_, **kwargs_) + else: + return References_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_File(self): return self.File + def set_File(self, File): self.File = File + def add_File(self, value): self.File.append(value) + def insert_File(self, index, value): self.File[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='References_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='References_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='References_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='References_Type', fromsubclass_=False): + for File_ in self.File: + File_.export(outfile, level, namespace_, name_='File') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.File or + self.anytypeobjs_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='References_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + showIndent(outfile, level) + outfile.write('File=[\n') + level += 1 + for File_ in self.File: + showIndent(outfile, level) + outfile.write('model_.File_Type(\n') + File_.exportLiteral(outfile, level, name_='File_Type') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'File': + obj_ = File_Type.factory() + obj_.build(child_) + self.File.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'References_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) +# end class References_Type + + +class File_Type(GeneratedsSuper): + """Type for an external reference to a resourceReference key used in + other parts of the packageLocation of external resourceSize in + bytes of the files (if known)Compression type (gzip, bzip2, or + none if empty or not specified)Chunk size (except for last + chunk)""" + subclass = None + superclass = None + def __init__(self, compression='', href=None, chunkSize=None, id=None, size=None, anytypeobjs_=None): + self.compression = _cast(None, compression) + self.href = _cast(None, href) + self.chunkSize = _cast(int, chunkSize) + self.id = _cast(None, id) + self.size = _cast(int, size) + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if File_Type.subclass: + return File_Type.subclass(*args_, **kwargs_) + else: + return File_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_compression(self): return self.compression + def set_compression(self, compression): self.compression = compression + def get_href(self): return self.href + def set_href(self, href): self.href = href + def get_chunkSize(self): return self.chunkSize + def set_chunkSize(self, chunkSize): self.chunkSize = chunkSize + def get_id(self): return self.id + def set_id(self, id): self.id = id + def get_size(self): return self.size + def set_size(self, size): self.size = size + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='File_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='File_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='File_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.compression is not None and 'compression' not in already_processed: + already_processed.append('compression') + outfile.write(' compression=%s' % (self.gds_format_string(quote_attrib(self.compression).encode(ExternalEncoding), input_name='compression'), )) + if self.href is not None and 'href' not in already_processed: + already_processed.append('href') + outfile.write(' href=%s' % (self.gds_format_string(quote_attrib(self.href).encode(ExternalEncoding), input_name='href'), )) + if self.chunkSize is not None and 'chunkSize' not in already_processed: + already_processed.append('chunkSize') + outfile.write(' chunkSize="%s"' % self.gds_format_integer(self.chunkSize, input_name='chunkSize')) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + outfile.write(' id=%s' % (self.gds_format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + if self.size is not None and 'size' not in already_processed: + already_processed.append('size') + outfile.write(' size="%s"' % self.gds_format_integer(self.size, input_name='size')) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='File_Type', fromsubclass_=False): + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.anytypeobjs_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='File_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.compression is not None and 'compression' not in already_processed: + already_processed.append('compression') + showIndent(outfile, level) + outfile.write('compression = "%s",\n' % (self.compression,)) + if self.href is not None and 'href' not in already_processed: + already_processed.append('href') + showIndent(outfile, level) + outfile.write('href = "%s",\n' % (self.href,)) + if self.chunkSize is not None and 'chunkSize' not in already_processed: + already_processed.append('chunkSize') + showIndent(outfile, level) + outfile.write('chunkSize = %d,\n' % (self.chunkSize,)) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + showIndent(outfile, level) + outfile.write('id = "%s",\n' % (self.id,)) + if self.size is not None and 'size' not in already_processed: + already_processed.append('size') + showIndent(outfile, level) + outfile.write('size = %d,\n' % (self.size,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('compression', node) + if value is not None and 'compression' not in already_processed: + already_processed.append('compression') + self.compression = value + value = find_attr_value_('href', node) + if value is not None and 'href' not in already_processed: + already_processed.append('href') + self.href = value + value = find_attr_value_('chunkSize', node) + if value is not None and 'chunkSize' not in already_processed: + already_processed.append('chunkSize') + try: + self.chunkSize = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + value = find_attr_value_('id', node) + if value is not None and 'id' not in already_processed: + already_processed.append('id') + self.id = value + value = find_attr_value_('size', node) + if value is not None and 'size' not in already_processed: + already_processed.append('size') + try: + self.size = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + obj_ = self.gds_build_any(child_, 'File_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) +# end class File_Type + + +class Content_Type(GeneratedsSuper): + """Base class for content""" + subclass = None + superclass = None + def __init__(self, id=None, Info=None, Name=None, Section=None, extensiontype_=None): + self.id = _cast(None, id) + self.Info = Info + self.Name = Name + if Section is None: + self.Section = [] + else: + self.Section = Section + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if Content_Type.subclass: + return Content_Type.subclass(*args_, **kwargs_) + else: + return Content_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Info(self): return self.Info + def set_Info(self, Info): self.Info = Info + def get_Name(self): return self.Name + def set_Name(self, Name): self.Name = Name + def get_Section(self): return self.Section + def set_Section(self, Section): self.Section = Section + def add_Section(self, value): self.Section.append(value) + def insert_Section(self, index, value): self.Section[index] = value + def get_id(self): return self.id + def set_id(self, id): self.id = id + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='Content_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='Content_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='Content_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + outfile.write(' id=%s' % (self.gds_format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='Content_Type', fromsubclass_=False): + if self.Info is not None: + self.Info.export(outfile, level, namespace_, name_='Info', ) + if self.Name is not None: + self.Name.export(outfile, level, namespace_, name_='Name') + for Section_ in self.Section: + Section_.export(outfile, level, namespace_, name_='Section') + def hasContent_(self): + if ( + self.Info is not None or + self.Name is not None or + self.Section + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='Content_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + showIndent(outfile, level) + outfile.write('id = "%s",\n' % (self.id,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.Info is not None: + showIndent(outfile, level) + outfile.write('Info=model_.Msg_Type(\n') + self.Info.exportLiteral(outfile, level, name_='Info') + showIndent(outfile, level) + outfile.write('),\n') + if self.Name is not None: + showIndent(outfile, level) + outfile.write('Name=model_.Msg_Type(\n') + self.Name.exportLiteral(outfile, level, name_='Name') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Section=[\n') + level += 1 + for Section_ in self.Section: + showIndent(outfile, level) + outfile.write('model_.Section(\n') + Section_.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('id', node) + if value is not None and 'id' not in already_processed: + already_processed.append('id') + self.id = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Info': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Info(obj_) + elif nodeName_ == 'Name': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Name(obj_) + elif nodeName_ == 'Section': + class_obj_ = self.get_class_obj_(child_, Section_Type) + obj_ = class_obj_.factory() + obj_.build(child_) + self.Section.append(obj_) +# end class Content_Type + + +class VirtualSystem_Type(Content_Type): + """Content describing a virtual system""" + subclass = None + superclass = Content_Type + def __init__(self, id=None, Info=None, Name=None, Section=None): + super(VirtualSystem_Type, self).__init__(id, Info, Name, Section, ) + pass + def factory(*args_, **kwargs_): + if VirtualSystem_Type.subclass: + return VirtualSystem_Type.subclass(*args_, **kwargs_) + else: + return VirtualSystem_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def export(self, outfile, level, namespace_='ovf:', name_='VirtualSystem_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='VirtualSystem_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='VirtualSystem_Type'): + super(VirtualSystem_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='VirtualSystem_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='VirtualSystem_Type', fromsubclass_=False): + super(VirtualSystem_Type, self).exportChildren(outfile, level, namespace_, name_, True) + def hasContent_(self): + if ( + super(VirtualSystem_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='VirtualSystem_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(VirtualSystem_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(VirtualSystem_Type, self).exportLiteralChildren(outfile, level, name_) + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(VirtualSystem_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + super(VirtualSystem_Type, self).buildChildren(child_, node, nodeName_, True) + pass +# end class VirtualSystem_Type + + +class VirtualSystemCollection_Type(Content_Type): + """A collection of Content.""" + subclass = None + superclass = Content_Type + def __init__(self, id=None, Info=None, Name=None, Section=None, Content=None): + super(VirtualSystemCollection_Type, self).__init__(id, Info, Name, Section, ) + if Content is None: + self.Content = [] + else: + self.Content = Content + def factory(*args_, **kwargs_): + if VirtualSystemCollection_Type.subclass: + return VirtualSystemCollection_Type.subclass(*args_, **kwargs_) + else: + return VirtualSystemCollection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Content(self): return self.Content + def set_Content(self, Content): self.Content = Content + def add_Content(self, value): self.Content.append(value) + def insert_Content(self, index, value): self.Content[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='VirtualSystemCollection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='VirtualSystemCollection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='VirtualSystemCollection_Type'): + super(VirtualSystemCollection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='VirtualSystemCollection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='VirtualSystemCollection_Type', fromsubclass_=False): + super(VirtualSystemCollection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + for Content_ in self.Content: + Content_.export(outfile, level, namespace_, name_='Content') + def hasContent_(self): + if ( + self.Content or + super(VirtualSystemCollection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='VirtualSystemCollection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(VirtualSystemCollection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(VirtualSystemCollection_Type, self).exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('Content=[\n') + level += 1 + for Content_ in self.Content: + showIndent(outfile, level) + outfile.write('model_.Content(\n') + Content_.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(VirtualSystemCollection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Content': + class_obj_ = self.get_class_obj_(child_, Content_Type) + obj_ = class_obj_.factory() + obj_.build(child_) + self.Content.append(obj_) + super(VirtualSystemCollection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class VirtualSystemCollection_Type + + +class Strings_Type(GeneratedsSuper): + """Type for string resource bundleLocale for this string resource + bundleReference to external resource bundle""" + subclass = None + superclass = None + def __init__(self, lang=None, fileRef=None, Msg=None): + self.lang = _cast(None, lang) + self.fileRef = _cast(None, fileRef) + if Msg is None: + self.Msg = [] + else: + self.Msg = Msg + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if Strings_Type.subclass: + return Strings_Type.subclass(*args_, **kwargs_) + else: + return Strings_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Msg(self): return self.Msg + def set_Msg(self, Msg): self.Msg = Msg + def add_Msg(self, value): self.Msg.append(value) + def insert_Msg(self, index, value): self.Msg[index] = value + def get_lang(self): return self.lang + def set_lang(self, lang): self.lang = lang + def get_fileRef(self): return self.fileRef + def set_fileRef(self, fileRef): self.fileRef = fileRef + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='Strings_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='Strings_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='Strings_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.lang is not None and 'lang' not in already_processed: + already_processed.append('lang') + outfile.write(' lang=%s' % (self.gds_format_string(quote_attrib(self.lang).encode(ExternalEncoding), input_name='lang'), )) + if self.fileRef is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + outfile.write(' fileRef=%s' % (self.gds_format_string(quote_attrib(self.fileRef).encode(ExternalEncoding), input_name='fileRef'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='Strings_Type', fromsubclass_=False): + for Msg_ in self.Msg: + Msg_.export(outfile, level, namespace_, name_='Msg') + def hasContent_(self): + if ( + self.Msg + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='Strings_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.lang is not None and 'lang' not in already_processed: + already_processed.append('lang') + showIndent(outfile, level) + outfile.write('lang = "%s",\n' % (self.lang,)) + if self.fileRef is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + showIndent(outfile, level) + outfile.write('fileRef = "%s",\n' % (self.fileRef,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + showIndent(outfile, level) + outfile.write('Msg=[\n') + level += 1 + for Msg_ in self.Msg: + showIndent(outfile, level) + outfile.write('model_.MsgType(\n') + Msg_.exportLiteral(outfile, level, name_='MsgType') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('lang', node) + if value is not None and 'lang' not in already_processed: + already_processed.append('lang') + self.lang = value + value = find_attr_value_('fileRef', node) + if value is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + self.fileRef = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Msg': + obj_ = MsgType.factory() + obj_.build(child_) + self.Msg.append(obj_) +# end class Strings_Type + + +class Section_Type(GeneratedsSuper): + """Base type for Sections, subclassing this is the most common form of + extensibility. Subtypes define more specific elements.""" + subclass = None + superclass = None + def __init__(self, required=None, Info=None, extensiontype_=None): + self.required = _cast(None, required) + self.Info = Info + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if Section_Type.subclass: + return Section_Type.subclass(*args_, **kwargs_) + else: + return Section_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Info(self): return self.Info + def set_Info(self, Info): self.Info = Info + def get_required(self): return self.required + def set_required(self, required): self.required = required + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='Section_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='Section_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='Section_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.required is not None and 'required' not in already_processed: + already_processed.append('required') + outfile.write(' required=%s' % (self.gds_format_string(quote_attrib(self.required).encode(ExternalEncoding), input_name='required'), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='Section_Type', fromsubclass_=False): + if self.Info is not None: + self.Info.export(outfile, level, namespace_, name_='Info', ) + def hasContent_(self): + if ( + self.Info is not None + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='Section_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.required is not None and 'required' not in already_processed: + already_processed.append('required') + showIndent(outfile, level) + outfile.write('required = "%s",\n' % (self.required,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.Info is not None: + showIndent(outfile, level) + outfile.write('Info=model_.Msg_Type(\n') + self.Info.exportLiteral(outfile, level, name_='Info') + showIndent(outfile, level) + outfile.write('),\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('required', node) + if value is not None and 'required' not in already_processed: + already_processed.append('required') + self.required = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Info': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Info(obj_) +# end class Section_Type + + +class Msg_Type(GeneratedsSuper): + """Type for localizable stringDefault string valueIdentifier for lookup + in string resource bundle for alternate locale""" + subclass = None + superclass = None + def __init__(self, msgid='', valueOf_=None): + self.msgid = _cast(None, msgid) + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if Msg_Type.subclass: + return Msg_Type.subclass(*args_, **kwargs_) + else: + return Msg_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_msgid(self): return self.msgid + def set_msgid(self, msgid): self.msgid = msgid + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='Msg_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='Msg_Type') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='Msg_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.msgid is not None and 'msgid' not in already_processed: + already_processed.append('msgid') + outfile.write(' msgid=%s' % (self.gds_format_string(quote_attrib(self.msgid).encode(ExternalEncoding), input_name='msgid'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='Msg_Type', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='Msg_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.msgid is not None and 'msgid' not in already_processed: + already_processed.append('msgid') + showIndent(outfile, level) + outfile.write('msgid = "%s",\n' % (self.msgid,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('msgid', node) + if value is not None and 'msgid' not in already_processed: + already_processed.append('msgid') + self.msgid = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class Msg_Type + + +class AnnotationSection_Type(Section_Type): + """User defined annotation""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, Annotation=None, anytypeobjs_=None): + super(AnnotationSection_Type, self).__init__(required, Info, ) + self.Annotation = Annotation + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if AnnotationSection_Type.subclass: + return AnnotationSection_Type.subclass(*args_, **kwargs_) + else: + return AnnotationSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Annotation(self): return self.Annotation + def set_Annotation(self, Annotation): self.Annotation = Annotation + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='AnnotationSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='AnnotationSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='AnnotationSection_Type'): + super(AnnotationSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='AnnotationSection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='AnnotationSection_Type', fromsubclass_=False): + super(AnnotationSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + if self.Annotation is not None: + self.Annotation.export(outfile, level, namespace_, name_='Annotation', ) + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Annotation is not None or + self.anytypeobjs_ or + super(AnnotationSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='AnnotationSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(AnnotationSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(AnnotationSection_Type, self).exportLiteralChildren(outfile, level, name_) + if self.Annotation is not None: + showIndent(outfile, level) + outfile.write('Annotation=model_.Msg_Type(\n') + self.Annotation.exportLiteral(outfile, level, name_='Annotation') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(AnnotationSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Annotation': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Annotation(obj_) + else: + obj_ = self.gds_build_any(child_, 'AnnotationSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(AnnotationSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class AnnotationSection_Type + + +class ProductSection_Type(Section_Type): + """Product information for a virtual applianceProperties for + application-level customizationProperty identifier + prefixProperty identifier suffix""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, instance='', classxx='', Product=None, Vendor=None, Version=None, FullVersion=None, ProductUrl=None, VendorUrl=None, AppUrl=None, Icon=None, Category=None, Property=None, anytypeobjs_=None): + super(ProductSection_Type, self).__init__(required, Info, ) + self.instance = _cast(None, instance) + self.classxx = _cast(None, classxx) + self.Product = Product + self.Vendor = Vendor + self.Version = Version + self.FullVersion = FullVersion + self.ProductUrl = ProductUrl + self.VendorUrl = VendorUrl + self.AppUrl = AppUrl + if Icon is None: + self.Icon = [] + else: + self.Icon = Icon + if Category is None: + self.Category = [] + else: + self.Category = Category + if Property is None: + self.Property = [] + else: + self.Property = Property + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if ProductSection_Type.subclass: + return ProductSection_Type.subclass(*args_, **kwargs_) + else: + return ProductSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Product(self): return self.Product + def set_Product(self, Product): self.Product = Product + def get_Vendor(self): return self.Vendor + def set_Vendor(self, Vendor): self.Vendor = Vendor + def get_Version(self): return self.Version + def set_Version(self, Version): self.Version = Version + def get_FullVersion(self): return self.FullVersion + def set_FullVersion(self, FullVersion): self.FullVersion = FullVersion + def get_ProductUrl(self): return self.ProductUrl + def set_ProductUrl(self, ProductUrl): self.ProductUrl = ProductUrl + def get_VendorUrl(self): return self.VendorUrl + def set_VendorUrl(self, VendorUrl): self.VendorUrl = VendorUrl + def get_AppUrl(self): return self.AppUrl + def set_AppUrl(self, AppUrl): self.AppUrl = AppUrl + def get_Icon(self): return self.Icon + def set_Icon(self, Icon): self.Icon = Icon + def add_Icon(self, value): self.Icon.append(value) + def insert_Icon(self, index, value): self.Icon[index] = value + def get_Category(self): return self.Category + def set_Category(self, Category): self.Category = Category + def add_Category(self, value): self.Category.append(value) + def insert_Category(self, index, value): self.Category[index] = value + def get_Property(self): return self.Property + def set_Property(self, Property): self.Property = Property + def add_Property(self, value): self.Property.append(value) + def insert_Property(self, index, value): self.Property[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_instance(self): return self.instance + def set_instance(self, instance): self.instance = instance + def get_class(self): return self.classxx + def set_class(self, classxx): self.classxx = classxx + def export(self, outfile, level, namespace_='ovf:', name_='ProductSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='ProductSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='ProductSection_Type'): + super(ProductSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ProductSection_Type') + if self.instance is not None and 'instance' not in already_processed: + already_processed.append('instance') + outfile.write(' instance=%s' % (self.gds_format_string(quote_attrib(self.instance).encode(ExternalEncoding), input_name='instance'), )) + if self.classxx is not None and 'classxx' not in already_processed: + already_processed.append('classxx') + outfile.write(' class=%s' % (self.gds_format_string(quote_attrib(self.classxx).encode(ExternalEncoding), input_name='class'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='ProductSection_Type', fromsubclass_=False): + super(ProductSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + if self.Product is not None: + self.Product.export(outfile, level, namespace_, name_='Product') + if self.Vendor is not None: + self.Vendor.export(outfile, level, namespace_, name_='Vendor') + if self.Version is not None: + self.Version.export(outfile, level, namespace_, name_='Version') + if self.FullVersion is not None: + self.FullVersion.export(outfile, level, namespace_, name_='FullVersion') + if self.ProductUrl is not None: + self.ProductUrl.export(outfile, level, namespace_, name_='ProductUrl') + if self.VendorUrl is not None: + self.VendorUrl.export(outfile, level, namespace_, name_='VendorUrl') + if self.AppUrl is not None: + self.AppUrl.export(outfile, level, namespace_, name_='AppUrl') + for Icon_ in self.Icon: + Icon_.export(outfile, level, namespace_, name_='Icon') + for Category_ in self.Category: + Category_.export(outfile, level, namespace_, name_='Category') + for Property_ in self.Property: + Property_.export(outfile, level, namespace_, name_='Property') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Product is not None or + self.Vendor is not None or + self.Version is not None or + self.FullVersion is not None or + self.ProductUrl is not None or + self.VendorUrl is not None or + self.AppUrl is not None or + self.Icon or + self.Category or + self.Property or + self.anytypeobjs_ or + super(ProductSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='ProductSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.instance is not None and 'instance' not in already_processed: + already_processed.append('instance') + showIndent(outfile, level) + outfile.write('instance = "%s",\n' % (self.instance,)) + if self.classxx is not None and 'classxx' not in already_processed: + already_processed.append('classxx') + showIndent(outfile, level) + outfile.write('classxx = "%s",\n' % (self.classxx,)) + super(ProductSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(ProductSection_Type, self).exportLiteralChildren(outfile, level, name_) + if self.Product is not None: + showIndent(outfile, level) + outfile.write('Product=model_.Msg_Type(\n') + self.Product.exportLiteral(outfile, level, name_='Product') + showIndent(outfile, level) + outfile.write('),\n') + if self.Vendor is not None: + showIndent(outfile, level) + outfile.write('Vendor=model_.Msg_Type(\n') + self.Vendor.exportLiteral(outfile, level, name_='Vendor') + showIndent(outfile, level) + outfile.write('),\n') + if self.Version is not None: + showIndent(outfile, level) + outfile.write('Version=model_.cimString(\n') + self.Version.exportLiteral(outfile, level, name_='Version') + showIndent(outfile, level) + outfile.write('),\n') + if self.FullVersion is not None: + showIndent(outfile, level) + outfile.write('FullVersion=model_.cimString(\n') + self.FullVersion.exportLiteral(outfile, level, name_='FullVersion') + showIndent(outfile, level) + outfile.write('),\n') + if self.ProductUrl is not None: + showIndent(outfile, level) + outfile.write('ProductUrl=model_.cimString(\n') + self.ProductUrl.exportLiteral(outfile, level, name_='ProductUrl') + showIndent(outfile, level) + outfile.write('),\n') + if self.VendorUrl is not None: + showIndent(outfile, level) + outfile.write('VendorUrl=model_.cimString(\n') + self.VendorUrl.exportLiteral(outfile, level, name_='VendorUrl') + showIndent(outfile, level) + outfile.write('),\n') + if self.AppUrl is not None: + showIndent(outfile, level) + outfile.write('AppUrl=model_.cimString(\n') + self.AppUrl.exportLiteral(outfile, level, name_='AppUrl') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Icon=[\n') + level += 1 + for Icon_ in self.Icon: + showIndent(outfile, level) + outfile.write('model_.IconType(\n') + Icon_.exportLiteral(outfile, level, name_='IconType') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('Category=[\n') + level += 1 + for Category_ in self.Category: + showIndent(outfile, level) + outfile.write('model_.Msg_Type(\n') + Category_.exportLiteral(outfile, level, name_='Msg_Type') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('Property=[\n') + level += 1 + for Property_ in self.Property: + showIndent(outfile, level) + outfile.write('model_.PropertyType(\n') + Property_.exportLiteral(outfile, level, name_='PropertyType') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('instance', node) + if value is not None and 'instance' not in already_processed: + already_processed.append('instance') + self.instance = value + value = find_attr_value_('class', node) + if value is not None and 'class' not in already_processed: + already_processed.append('class') + self.classxx = value + super(ProductSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Product': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Product(obj_) + elif nodeName_ == 'Vendor': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Vendor(obj_) + elif nodeName_ == 'Version': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_Version(obj_) + elif nodeName_ == 'FullVersion': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_FullVersion(obj_) + elif nodeName_ == 'ProductUrl': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_ProductUrl(obj_) + elif nodeName_ == 'VendorUrl': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_VendorUrl(obj_) + elif nodeName_ == 'AppUrl': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_AppUrl(obj_) + elif nodeName_ == 'Icon': + obj_ = IconType.factory() + obj_.build(child_) + self.Icon.append(obj_) + elif nodeName_ == 'Category': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.Category.append(obj_) + elif nodeName_ == 'Property': + obj_ = PropertyType.factory() + obj_.build(child_) + self.Property.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'ProductSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(ProductSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class ProductSection_Type + + +class PropertyConfigurationValue_Type(GeneratedsSuper): + """Type for alternative default values for properties when + DeploymentOptionSection is usedAlternative default property + valueConfiguration from DeploymentOptionSection in which this + value is default""" + subclass = None + superclass = None + def __init__(self, configuration=None, value=None, anytypeobjs_=None): + self.configuration = _cast(None, configuration) + self.value = _cast(None, value) + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if PropertyConfigurationValue_Type.subclass: + return PropertyConfigurationValue_Type.subclass(*args_, **kwargs_) + else: + return PropertyConfigurationValue_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_configuration(self): return self.configuration + def set_configuration(self, configuration): self.configuration = configuration + def get_value(self): return self.value + def set_value(self, value): self.value = value + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='PropertyConfigurationValue_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='PropertyConfigurationValue_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='PropertyConfigurationValue_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.configuration is not None and 'configuration' not in already_processed: + already_processed.append('configuration') + outfile.write(' configuration=%s' % (self.gds_format_string(quote_attrib(self.configuration).encode(ExternalEncoding), input_name='configuration'), )) + if self.value is not None and 'value' not in already_processed: + already_processed.append('value') + outfile.write(' value=%s' % (self.gds_format_string(quote_attrib(self.value).encode(ExternalEncoding), input_name='value'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='PropertyConfigurationValue_Type', fromsubclass_=False): + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.anytypeobjs_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='PropertyConfigurationValue_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.configuration is not None and 'configuration' not in already_processed: + already_processed.append('configuration') + showIndent(outfile, level) + outfile.write('configuration = "%s",\n' % (self.configuration,)) + if self.value is not None and 'value' not in already_processed: + already_processed.append('value') + showIndent(outfile, level) + outfile.write('value = "%s",\n' % (self.value,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('configuration', node) + if value is not None and 'configuration' not in already_processed: + already_processed.append('configuration') + self.configuration = value + value = find_attr_value_('value', node) + if value is not None and 'value' not in already_processed: + already_processed.append('value') + self.value = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + obj_ = self.gds_build_any(child_, 'PropertyConfigurationValue_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) +# end class PropertyConfigurationValue_Type + + +class NetworkSection_Type(Section_Type): + """Descriptions of logical networks used within the package""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, Network=None, anytypeobjs_=None): + super(NetworkSection_Type, self).__init__(required, Info, ) + if Network is None: + self.Network = [] + else: + self.Network = Network + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if NetworkSection_Type.subclass: + return NetworkSection_Type.subclass(*args_, **kwargs_) + else: + return NetworkSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Network(self): return self.Network + def set_Network(self, Network): self.Network = Network + def add_Network(self, value): self.Network.append(value) + def insert_Network(self, index, value): self.Network[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='NetworkSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='NetworkSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='NetworkSection_Type'): + super(NetworkSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='NetworkSection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='NetworkSection_Type', fromsubclass_=False): + super(NetworkSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + for Network_ in self.Network: + Network_.export(outfile, level, namespace_, name_='Network') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Network or + self.anytypeobjs_ or + super(NetworkSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='NetworkSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(NetworkSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(NetworkSection_Type, self).exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('Network=[\n') + level += 1 + for Network_ in self.Network: + showIndent(outfile, level) + outfile.write('model_.NetworkType(\n') + Network_.exportLiteral(outfile, level, name_='NetworkType') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(NetworkSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Network': + obj_ = NetworkType.factory() + obj_.build(child_) + self.Network.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'NetworkSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(NetworkSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class NetworkSection_Type + + +class DiskSection_Type(Section_Type): + """Descriptions of virtual disks used within the package""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, Disk=None, anytypeobjs_=None): + super(DiskSection_Type, self).__init__(required, Info, ) + if Disk is None: + self.Disk = [] + else: + self.Disk = Disk + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if DiskSection_Type.subclass: + return DiskSection_Type.subclass(*args_, **kwargs_) + else: + return DiskSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Disk(self): return self.Disk + def set_Disk(self, Disk): self.Disk = Disk + def add_Disk(self, value): self.Disk.append(value) + def insert_Disk(self, index, value): self.Disk[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='DiskSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='DiskSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='DiskSection_Type'): + super(DiskSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DiskSection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='DiskSection_Type', fromsubclass_=False): + super(DiskSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + for Disk_ in self.Disk: + Disk_.export(outfile, level, namespace_, name_='Disk') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Disk or + self.anytypeobjs_ or + super(DiskSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='DiskSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(DiskSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(DiskSection_Type, self).exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('Disk=[\n') + level += 1 + for Disk_ in self.Disk: + showIndent(outfile, level) + outfile.write('model_.VirtualDiskDesc_Type(\n') + Disk_.exportLiteral(outfile, level, name_='VirtualDiskDesc_Type') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(DiskSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Disk': + obj_ = VirtualDiskDesc_Type.factory() + obj_.build(child_) + self.Disk.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'DiskSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(DiskSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class DiskSection_Type + + +class VirtualDiskDesc_Type(GeneratedsSuper): + """Type for virtual disk descriptorIdentifier for virtual diskReference + to virtual disk content. If not specified a blank virtual disk + is created of size given by capacity attributeVirtual disk + capacity, can be specified as either an xs:long size or as a + reference to a property using ${property_name}. Unit of + allocation for ovf:capacity. If not specified default value is + bytes. Value shall match a recognized value for the UNITS + qualifier in DSP0004.Format of virtual disk given as a URI that + identifies the disk typeEstimated populated size of disk in + bytesReference to potential parent disk""" + subclass = None + superclass = None + def __init__(self, capacityAllocationUnits='byte', capacity=None, format=None, parentRef=None, fileRef=None, populatedSize=None, diskId=None, anytypeobjs_=None): + self.capacityAllocationUnits = _cast(None, capacityAllocationUnits) + self.capacity = _cast(None, capacity) + self.format = _cast(None, format) + self.parentRef = _cast(None, parentRef) + self.fileRef = _cast(None, fileRef) + self.populatedSize = _cast(int, populatedSize) + self.diskId = _cast(None, diskId) + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if VirtualDiskDesc_Type.subclass: + return VirtualDiskDesc_Type.subclass(*args_, **kwargs_) + else: + return VirtualDiskDesc_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_capacityAllocationUnits(self): return self.capacityAllocationUnits + def set_capacityAllocationUnits(self, capacityAllocationUnits): self.capacityAllocationUnits = capacityAllocationUnits + def get_capacity(self): return self.capacity + def set_capacity(self, capacity): self.capacity = capacity + def get_format(self): return self.format + def set_format(self, format): self.format = format + def get_parentRef(self): return self.parentRef + def set_parentRef(self, parentRef): self.parentRef = parentRef + def get_fileRef(self): return self.fileRef + def set_fileRef(self, fileRef): self.fileRef = fileRef + def get_populatedSize(self): return self.populatedSize + def set_populatedSize(self, populatedSize): self.populatedSize = populatedSize + def get_diskId(self): return self.diskId + def set_diskId(self, diskId): self.diskId = diskId + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='VirtualDiskDesc_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='VirtualDiskDesc_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='VirtualDiskDesc_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.capacityAllocationUnits is not None and 'capacityAllocationUnits' not in already_processed: + already_processed.append('capacityAllocationUnits') + outfile.write(' capacityAllocationUnits=%s' % (self.gds_format_string(quote_attrib(self.capacityAllocationUnits).encode(ExternalEncoding), input_name='capacityAllocationUnits'), )) + if self.capacity is not None and 'capacity' not in already_processed: + already_processed.append('capacity') + outfile.write(' capacity=%s' % (self.gds_format_string(quote_attrib(self.capacity).encode(ExternalEncoding), input_name='capacity'), )) + if self.format is not None and 'format' not in already_processed: + already_processed.append('format') + outfile.write(' format=%s' % (self.gds_format_string(quote_attrib(self.format).encode(ExternalEncoding), input_name='format'), )) + if self.parentRef is not None and 'parentRef' not in already_processed: + already_processed.append('parentRef') + outfile.write(' parentRef=%s' % (self.gds_format_string(quote_attrib(self.parentRef).encode(ExternalEncoding), input_name='parentRef'), )) + if self.fileRef is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + outfile.write(' fileRef=%s' % (self.gds_format_string(quote_attrib(self.fileRef).encode(ExternalEncoding), input_name='fileRef'), )) + if self.populatedSize is not None and 'populatedSize' not in already_processed: + already_processed.append('populatedSize') + outfile.write(' populatedSize="%s"' % self.gds_format_integer(self.populatedSize, input_name='populatedSize')) + if self.diskId is not None and 'diskId' not in already_processed: + already_processed.append('diskId') + outfile.write(' diskId=%s' % (self.gds_format_string(quote_attrib(self.diskId).encode(ExternalEncoding), input_name='diskId'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='VirtualDiskDesc_Type', fromsubclass_=False): + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.anytypeobjs_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='VirtualDiskDesc_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.capacityAllocationUnits is not None and 'capacityAllocationUnits' not in already_processed: + already_processed.append('capacityAllocationUnits') + showIndent(outfile, level) + outfile.write('capacityAllocationUnits = "%s",\n' % (self.capacityAllocationUnits,)) + if self.capacity is not None and 'capacity' not in already_processed: + already_processed.append('capacity') + showIndent(outfile, level) + outfile.write('capacity = "%s",\n' % (self.capacity,)) + if self.format is not None and 'format' not in already_processed: + already_processed.append('format') + showIndent(outfile, level) + outfile.write('format = "%s",\n' % (self.format,)) + if self.parentRef is not None and 'parentRef' not in already_processed: + already_processed.append('parentRef') + showIndent(outfile, level) + outfile.write('parentRef = "%s",\n' % (self.parentRef,)) + if self.fileRef is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + showIndent(outfile, level) + outfile.write('fileRef = "%s",\n' % (self.fileRef,)) + if self.populatedSize is not None and 'populatedSize' not in already_processed: + already_processed.append('populatedSize') + showIndent(outfile, level) + outfile.write('populatedSize = %d,\n' % (self.populatedSize,)) + if self.diskId is not None and 'diskId' not in already_processed: + already_processed.append('diskId') + showIndent(outfile, level) + outfile.write('diskId = "%s",\n' % (self.diskId,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('capacityAllocationUnits', node) + if value is not None and 'capacityAllocationUnits' not in already_processed: + already_processed.append('capacityAllocationUnits') + self.capacityAllocationUnits = value + value = find_attr_value_('capacity', node) + if value is not None and 'capacity' not in already_processed: + already_processed.append('capacity') + self.capacity = value + value = find_attr_value_('format', node) + if value is not None and 'format' not in already_processed: + already_processed.append('format') + self.format = value + value = find_attr_value_('parentRef', node) + if value is not None and 'parentRef' not in already_processed: + already_processed.append('parentRef') + self.parentRef = value + value = find_attr_value_('fileRef', node) + if value is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + self.fileRef = value + value = find_attr_value_('populatedSize', node) + if value is not None and 'populatedSize' not in already_processed: + already_processed.append('populatedSize') + try: + self.populatedSize = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + value = find_attr_value_('diskId', node) + if value is not None and 'diskId' not in already_processed: + already_processed.append('diskId') + self.diskId = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + obj_ = self.gds_build_any(child_, 'VirtualDiskDesc_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) +# end class VirtualDiskDesc_Type + + +class OperatingSystemSection_Type(Section_Type): + """Specification of the operating system installed in the + guestIdentifier defined by the CIM_OperatingSystem.OsType + enumerationVersion defined by the CIM_OperatingSystem.Version + field""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, version=None, id=None, Description=None, anytypeobjs_=None): + super(OperatingSystemSection_Type, self).__init__(required, Info, ) + self.version = _cast(None, version) + self.id = _cast(int, id) + self.Description = Description + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if OperatingSystemSection_Type.subclass: + return OperatingSystemSection_Type.subclass(*args_, **kwargs_) + else: + return OperatingSystemSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Description(self): return self.Description + def set_Description(self, Description): self.Description = Description + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_version(self): return self.version + def set_version(self, version): self.version = version + def get_id(self): return self.id + def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='ovf:', name_='OperatingSystemSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='OperatingSystemSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='OperatingSystemSection_Type'): + super(OperatingSystemSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='OperatingSystemSection_Type') + if self.version is not None and 'version' not in already_processed: + already_processed.append('version') + outfile.write(' version=%s' % (self.gds_format_string(quote_attrib(self.version).encode(ExternalEncoding), input_name='version'), )) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + outfile.write(' id="%s"' % self.gds_format_integer(self.id, input_name='id')) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='OperatingSystemSection_Type', fromsubclass_=False): + super(OperatingSystemSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + if self.Description is not None: + self.Description.export(outfile, level, namespace_, name_='Description') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Description is not None or + self.anytypeobjs_ or + super(OperatingSystemSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='OperatingSystemSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.version is not None and 'version' not in already_processed: + already_processed.append('version') + showIndent(outfile, level) + outfile.write('version = "%s",\n' % (self.version,)) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + showIndent(outfile, level) + outfile.write('id = %d,\n' % (self.id,)) + super(OperatingSystemSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(OperatingSystemSection_Type, self).exportLiteralChildren(outfile, level, name_) + if self.Description is not None: + showIndent(outfile, level) + outfile.write('Description=model_.Msg_Type(\n') + self.Description.exportLiteral(outfile, level, name_='Description') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('version', node) + if value is not None and 'version' not in already_processed: + already_processed.append('version') + self.version = value + value = find_attr_value_('id', node) + if value is not None and 'id' not in already_processed: + already_processed.append('id') + try: + self.id = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + super(OperatingSystemSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Description': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Description(obj_) + else: + obj_ = self.gds_build_any(child_, 'OperatingSystemSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(OperatingSystemSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class OperatingSystemSection_Type + + +class EulaSection_Type(Section_Type): + """End-User License Agreement""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, License=None, anytypeobjs_=None): + super(EulaSection_Type, self).__init__(required, Info, ) + self.License = License + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if EulaSection_Type.subclass: + return EulaSection_Type.subclass(*args_, **kwargs_) + else: + return EulaSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_License(self): return self.License + def set_License(self, License): self.License = License + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='EulaSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='EulaSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='EulaSection_Type'): + super(EulaSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='EulaSection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='EulaSection_Type', fromsubclass_=False): + super(EulaSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + if self.License is not None: + self.License.export(outfile, level, namespace_, name_='License', ) + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.License is not None or + self.anytypeobjs_ or + super(EulaSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='EulaSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(EulaSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(EulaSection_Type, self).exportLiteralChildren(outfile, level, name_) + if self.License is not None: + showIndent(outfile, level) + outfile.write('License=model_.Msg_Type(\n') + self.License.exportLiteral(outfile, level, name_='License') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(EulaSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'License': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_License(obj_) + else: + obj_ = self.gds_build_any(child_, 'EulaSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(EulaSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class EulaSection_Type + + +class VirtualHardwareSection_Type(Section_Type): + """Specifies virtual hardware requirements for a virtual machineUnique + identifier of this VirtualHardwareSection (within a + VirtualSystem)""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, id='', transport=None, System=None, Item=None, anytypeobjs_=None): + super(VirtualHardwareSection_Type, self).__init__(required, Info, ) + self.id = _cast(None, id) + self.transport = _cast(None, transport) + self.System = System + if Item is None: + self.Item = [] + else: + self.Item = Item + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if VirtualHardwareSection_Type.subclass: + return VirtualHardwareSection_Type.subclass(*args_, **kwargs_) + else: + return VirtualHardwareSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_System(self): return self.System + def set_System(self, System): self.System = System + def get_Item(self): return self.Item + def set_Item(self, Item): self.Item = Item + def add_Item(self, value): self.Item.append(value) + def insert_Item(self, index, value): self.Item[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_id(self): return self.id + def set_id(self, id): self.id = id + def get_transport(self): return self.transport + def set_transport(self, transport): self.transport = transport + def export(self, outfile, level, namespace_='ovf:', name_='VirtualHardwareSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='VirtualHardwareSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='VirtualHardwareSection_Type'): + super(VirtualHardwareSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='VirtualHardwareSection_Type') + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + outfile.write(' id=%s' % (self.gds_format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + if self.transport is not None and 'transport' not in already_processed: + already_processed.append('transport') + outfile.write(' transport=%s' % (self.gds_format_string(quote_attrib(self.transport).encode(ExternalEncoding), input_name='transport'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='VirtualHardwareSection_Type', fromsubclass_=False): + super(VirtualHardwareSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + if self.System is not None: + self.System.export(outfile, level, namespace_, name_='System') + for Item_ in self.Item: + Item_.export(outfile, level, namespace_, name_='Item') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.System is not None or + self.Item or + self.anytypeobjs_ or + super(VirtualHardwareSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='VirtualHardwareSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + showIndent(outfile, level) + outfile.write('id = "%s",\n' % (self.id,)) + if self.transport is not None and 'transport' not in already_processed: + already_processed.append('transport') + showIndent(outfile, level) + outfile.write('transport = "%s",\n' % (self.transport,)) + super(VirtualHardwareSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(VirtualHardwareSection_Type, self).exportLiteralChildren(outfile, level, name_) + if self.System is not None: + showIndent(outfile, level) + outfile.write('System=model_.VSSD_Type(\n') + self.System.exportLiteral(outfile, level, name_='System') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Item=[\n') + level += 1 + for Item_ in self.Item: + showIndent(outfile, level) + outfile.write('model_.RASD_Type(\n') + Item_.exportLiteral(outfile, level, name_='RASD_Type') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('id', node) + if value is not None and 'id' not in already_processed: + already_processed.append('id') + self.id = value + value = find_attr_value_('transport', node) + if value is not None and 'transport' not in already_processed: + already_processed.append('transport') + self.transport = value + super(VirtualHardwareSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'System': + obj_ = VSSD_Type.factory() + obj_.build(child_) + self.set_System(obj_) + elif nodeName_ == 'Item': + obj_ = RASD_Type.factory() + obj_.build(child_) + self.Item.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'VirtualHardwareSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(VirtualHardwareSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class VirtualHardwareSection_Type + + +class ResourceAllocationSection_Type(Section_Type): + """Resource constraints on a VirtualSystemCollection""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, Item=None, anytypeobjs_=None): + super(ResourceAllocationSection_Type, self).__init__(required, Info, ) + if Item is None: + self.Item = [] + else: + self.Item = Item + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if ResourceAllocationSection_Type.subclass: + return ResourceAllocationSection_Type.subclass(*args_, **kwargs_) + else: + return ResourceAllocationSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Item(self): return self.Item + def set_Item(self, Item): self.Item = Item + def add_Item(self, value): self.Item.append(value) + def insert_Item(self, index, value): self.Item[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='ResourceAllocationSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='ResourceAllocationSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='ResourceAllocationSection_Type'): + super(ResourceAllocationSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='ResourceAllocationSection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='ResourceAllocationSection_Type', fromsubclass_=False): + super(ResourceAllocationSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + for Item_ in self.Item: + Item_.export(outfile, level, namespace_, name_='Item') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Item or + self.anytypeobjs_ or + super(ResourceAllocationSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='ResourceAllocationSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(ResourceAllocationSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(ResourceAllocationSection_Type, self).exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('Item=[\n') + level += 1 + for Item_ in self.Item: + showIndent(outfile, level) + outfile.write('model_.RASD_Type(\n') + Item_.exportLiteral(outfile, level, name_='RASD_Type') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(ResourceAllocationSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Item': + obj_ = RASD_Type.factory() + obj_.build(child_) + self.Item.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'ResourceAllocationSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(ResourceAllocationSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class ResourceAllocationSection_Type + + +class InstallSection_Type(Section_Type): + """If present indicates that the virtual machine needs to be initially + booted to install and configure the softwareDelay in seconds to + wait for power off to complete after initial boot""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, initialBootStopDelay=0, anytypeobjs_=None): + super(InstallSection_Type, self).__init__(required, Info, ) + self.initialBootStopDelay = _cast(int, initialBootStopDelay) + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if InstallSection_Type.subclass: + return InstallSection_Type.subclass(*args_, **kwargs_) + else: + return InstallSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_initialBootStopDelay(self): return self.initialBootStopDelay + def set_initialBootStopDelay(self, initialBootStopDelay): self.initialBootStopDelay = initialBootStopDelay + def export(self, outfile, level, namespace_='ovf:', name_='InstallSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='InstallSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='InstallSection_Type'): + super(InstallSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='InstallSection_Type') + if self.initialBootStopDelay is not None and 'initialBootStopDelay' not in already_processed: + already_processed.append('initialBootStopDelay') + outfile.write(' initialBootStopDelay="%s"' % self.gds_format_integer(self.initialBootStopDelay, input_name='initialBootStopDelay')) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='InstallSection_Type', fromsubclass_=False): + super(InstallSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.anytypeobjs_ or + super(InstallSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='InstallSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.initialBootStopDelay is not None and 'initialBootStopDelay' not in already_processed: + already_processed.append('initialBootStopDelay') + showIndent(outfile, level) + outfile.write('initialBootStopDelay = %d,\n' % (self.initialBootStopDelay,)) + super(InstallSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(InstallSection_Type, self).exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('initialBootStopDelay', node) + if value is not None and 'initialBootStopDelay' not in already_processed: + already_processed.append('initialBootStopDelay') + try: + self.initialBootStopDelay = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + super(InstallSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + obj_ = self.gds_build_any(child_, 'InstallSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(InstallSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class InstallSection_Type + + +class StartupSection_Type(Section_Type): + """Specifies the order in which entities in a VirtualSystemCollection + are powered on and shut down""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, Item=None, anytypeobjs_=None): + super(StartupSection_Type, self).__init__(required, Info, ) + if Item is None: + self.Item = [] + else: + self.Item = Item + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if StartupSection_Type.subclass: + return StartupSection_Type.subclass(*args_, **kwargs_) + else: + return StartupSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Item(self): return self.Item + def set_Item(self, Item): self.Item = Item + def add_Item(self, value): self.Item.append(value) + def insert_Item(self, index, value): self.Item[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='StartupSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='StartupSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='StartupSection_Type'): + super(StartupSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='StartupSection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='StartupSection_Type', fromsubclass_=False): + super(StartupSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + for Item_ in self.Item: + Item_.export(outfile, level, namespace_, name_='Item') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Item or + self.anytypeobjs_ or + super(StartupSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='StartupSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(StartupSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(StartupSection_Type, self).exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('Item=[\n') + level += 1 + for Item_ in self.Item: + showIndent(outfile, level) + outfile.write('model_.ItemType(\n') + Item_.exportLiteral(outfile, level, name_='ItemType') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(StartupSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Item': + obj_ = ItemType.factory() + obj_.build(child_) + self.Item.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'StartupSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(StartupSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class StartupSection_Type + + +class DeploymentOptionSection_Type(Section_Type): + """Enumeration of discrete deployment options""" + subclass = None + superclass = Section_Type + def __init__(self, required=None, Info=None, Configuration=None, anytypeobjs_=None): + super(DeploymentOptionSection_Type, self).__init__(required, Info, ) + if Configuration is None: + self.Configuration = [] + else: + self.Configuration = Configuration + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + def factory(*args_, **kwargs_): + if DeploymentOptionSection_Type.subclass: + return DeploymentOptionSection_Type.subclass(*args_, **kwargs_) + else: + return DeploymentOptionSection_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Configuration(self): return self.Configuration + def set_Configuration(self, Configuration): self.Configuration = Configuration + def add_Configuration(self, value): self.Configuration.append(value) + def insert_Configuration(self, index, value): self.Configuration[index] = value + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def export(self, outfile, level, namespace_='ovf:', name_='DeploymentOptionSection_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='DeploymentOptionSection_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='DeploymentOptionSection_Type'): + super(DeploymentOptionSection_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='DeploymentOptionSection_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='DeploymentOptionSection_Type', fromsubclass_=False): + super(DeploymentOptionSection_Type, self).exportChildren(outfile, level, namespace_, name_, True) + for Configuration_ in self.Configuration: + Configuration_.export(outfile, level, namespace_, name_='Configuration') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Configuration or + self.anytypeobjs_ or + super(DeploymentOptionSection_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='DeploymentOptionSection_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(DeploymentOptionSection_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(DeploymentOptionSection_Type, self).exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('Configuration=[\n') + level += 1 + for Configuration_ in self.Configuration: + showIndent(outfile, level) + outfile.write('model_.ConfigurationType(\n') + Configuration_.exportLiteral(outfile, level, name_='ConfigurationType') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(DeploymentOptionSection_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Configuration': + obj_ = ConfigurationType.factory() + obj_.build(child_) + self.Configuration.append(obj_) + else: + obj_ = self.gds_build_any(child_, 'DeploymentOptionSection_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) + super(DeploymentOptionSection_Type, self).buildChildren(child_, node, nodeName_, True) +# end class DeploymentOptionSection_Type + + +class cimDateTime(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, CIM_DateTime=None, Interval=None, Date=None, Time=None, Datetime=None): + self.CIM_DateTime = CIM_DateTime + self.Interval = Interval + self.Date = Date + self.Time = Time + self.Datetime = Datetime + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimDateTime.subclass: + return cimDateTime.subclass(*args_, **kwargs_) + else: + return cimDateTime(*args_, **kwargs_) + factory = staticmethod(factory) + def get_CIM_DateTime(self): return self.CIM_DateTime + def set_CIM_DateTime(self, CIM_DateTime): self.CIM_DateTime = CIM_DateTime + def get_Interval(self): return self.Interval + def set_Interval(self, Interval): self.Interval = Interval + def get_Date(self): return self.Date + def set_Date(self, Date): self.Date = Date + def get_Time(self): return self.Time + def set_Time(self, Time): self.Time = Time + def get_Datetime(self): return self.Datetime + def set_Datetime(self, Datetime): self.Datetime = Datetime + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimDateTime', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimDateTime') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimDateTime'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimDateTime', fromsubclass_=False): + if self.CIM_DateTime is not None: + showIndent(outfile, level) + outfile.write('<%sCIM_DateTime>%s\n' % (namespace_, self.gds_format_string(quote_xml(self.CIM_DateTime).encode(ExternalEncoding), input_name='CIM_DateTime'), namespace_)) + if self.Interval is not None: + showIndent(outfile, level) + outfile.write('<%sInterval>%s\n' % (namespace_, self.gds_format_string(quote_xml(self.Interval).encode(ExternalEncoding), input_name='Interval'), namespace_)) + if self.Date is not None: + showIndent(outfile, level) + outfile.write('<%sDate>%s\n' % (namespace_, self.gds_format_string(quote_xml(self.Date).encode(ExternalEncoding), input_name='Date'), namespace_)) + if self.Time is not None: + showIndent(outfile, level) + outfile.write('<%sTime>%s\n' % (namespace_, self.gds_format_string(quote_xml(self.Time).encode(ExternalEncoding), input_name='Time'), namespace_)) + if self.Datetime is not None: + showIndent(outfile, level) + outfile.write('<%sDatetime>%s\n' % (namespace_, self.gds_format_string(quote_xml(self.Datetime).encode(ExternalEncoding), input_name='Datetime'), namespace_)) + def hasContent_(self): + if ( + self.CIM_DateTime is not None or + self.Interval is not None or + self.Date is not None or + self.Time is not None or + self.Datetime is not None + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimDateTime'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.CIM_DateTime is not None: + showIndent(outfile, level) + outfile.write('CIM_DateTime=%s,\n' % quote_python(self.CIM_DateTime).encode(ExternalEncoding)) + if self.Interval is not None: + showIndent(outfile, level) + outfile.write('Interval=%s,\n' % quote_python(self.Interval).encode(ExternalEncoding)) + if self.Date is not None: + showIndent(outfile, level) + outfile.write('Date=%s,\n' % quote_python(self.Date).encode(ExternalEncoding)) + if self.Time is not None: + showIndent(outfile, level) + outfile.write('Time=%s,\n' % quote_python(self.Time).encode(ExternalEncoding)) + if self.Datetime is not None: + showIndent(outfile, level) + outfile.write('Datetime=%s,\n' % quote_python(self.Datetime).encode(ExternalEncoding)) + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'CIM_DateTime': + CIM_DateTime_ = child_.text + CIM_DateTime_ = self.gds_validate_string(CIM_DateTime_, node, 'CIM_DateTime') + self.CIM_DateTime = CIM_DateTime_ + elif nodeName_ == 'Interval': + Interval_ = child_.text + Interval_ = self.gds_validate_string(Interval_, node, 'Interval') + self.Interval = Interval_ + elif nodeName_ == 'Date': + Date_ = child_.text + Date_ = self.gds_validate_string(Date_, node, 'Date') + self.Date = Date_ + elif nodeName_ == 'Time': + Time_ = child_.text + Time_ = self.gds_validate_string(Time_, node, 'Time') + self.Time = Time_ + elif nodeName_ == 'Datetime': + Datetime_ = child_.text + Datetime_ = self.gds_validate_string(Datetime_, node, 'Datetime') + self.Datetime = Datetime_ +# end class cimDateTime + + +class cimUnsignedByte(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimUnsignedByte.subclass: + return cimUnsignedByte.subclass(*args_, **kwargs_) + else: + return cimUnsignedByte(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimUnsignedByte', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimUnsignedByte') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimUnsignedByte'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimUnsignedByte', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimUnsignedByte'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimUnsignedByte + + +class cimByte(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimByte.subclass: + return cimByte.subclass(*args_, **kwargs_) + else: + return cimByte(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimByte', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimByte') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimByte'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimByte', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimByte'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimByte + + +class cimUnsignedShort(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimUnsignedShort.subclass: + return cimUnsignedShort.subclass(*args_, **kwargs_) + else: + return cimUnsignedShort(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimUnsignedShort', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimUnsignedShort') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimUnsignedShort'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimUnsignedShort', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimUnsignedShort'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimUnsignedShort + + +class cimShort(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimShort.subclass: + return cimShort.subclass(*args_, **kwargs_) + else: + return cimShort(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimShort', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimShort') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimShort'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimShort', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimShort'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimShort + + +class cimUnsignedInt(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None, extensiontype_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if cimUnsignedInt.subclass: + return cimUnsignedInt.subclass(*args_, **kwargs_) + else: + return cimUnsignedInt(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='cimUnsignedInt', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimUnsignedInt') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimUnsignedInt'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimUnsignedInt', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimUnsignedInt'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimUnsignedInt + + +class cimInt(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimInt.subclass: + return cimInt.subclass(*args_, **kwargs_) + else: + return cimInt(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimInt', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimInt') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimInt'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimInt', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimInt'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimInt + + +class cimUnsignedLong(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimUnsignedLong.subclass: + return cimUnsignedLong.subclass(*args_, **kwargs_) + else: + return cimUnsignedLong(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimUnsignedLong', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimUnsignedLong') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimUnsignedLong'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimUnsignedLong', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimUnsignedLong'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimUnsignedLong + + +class cimLong(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None, extensiontype_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if cimLong.subclass: + return cimLong.subclass(*args_, **kwargs_) + else: + return cimLong(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='cimLong', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimLong') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimLong'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimLong', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimLong'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimLong + + +class cimString(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None, extensiontype_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if cimString.subclass: + return cimString.subclass(*args_, **kwargs_) + else: + return cimString(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='cimString', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimString') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimString'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimString', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimString'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimString + + +class cimBoolean(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None, extensiontype_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if cimBoolean.subclass: + return cimBoolean.subclass(*args_, **kwargs_) + else: + return cimBoolean(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='cimBoolean', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimBoolean') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimBoolean'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimBoolean', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimBoolean'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimBoolean + + +class cimFloat(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimFloat.subclass: + return cimFloat.subclass(*args_, **kwargs_) + else: + return cimFloat(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimFloat', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimFloat') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimFloat'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimFloat', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimFloat'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimFloat + + +class cimDouble(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimDouble.subclass: + return cimDouble.subclass(*args_, **kwargs_) + else: + return cimDouble(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimDouble', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimDouble') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimDouble'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimDouble', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimDouble'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimDouble + + +class cimChar16(cimString): + subclass = None + superclass = cimString + def __init__(self, valueOf_=None): + super(cimChar16, self).__init__(valueOf_, ) + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimChar16.subclass: + return cimChar16.subclass(*args_, **kwargs_) + else: + return cimChar16(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimChar16', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimChar16') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimChar16'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + super(cimChar16, self).exportAttributes(outfile, level, already_processed, namespace_, name_='cimChar16') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimChar16', fromsubclass_=False): + super(cimChar16, self).exportChildren(outfile, level, namespace_, name_, True) + pass + def hasContent_(self): + if ( + self.valueOf_ or + super(cimChar16, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimChar16'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + super(cimChar16, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(cimChar16, self).exportLiteralChildren(outfile, level, name_) + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + super(cimChar16, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimChar16 + + +class cimBase64Binary(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimBase64Binary.subclass: + return cimBase64Binary.subclass(*args_, **kwargs_) + else: + return cimBase64Binary(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimBase64Binary', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimBase64Binary') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimBase64Binary'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimBase64Binary', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimBase64Binary'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimBase64Binary + + +class cimReference(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, anytypeobjs_=None): + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimReference.subclass: + return cimReference.subclass(*args_, **kwargs_) + else: + return cimReference(*args_, **kwargs_) + factory = staticmethod(factory) + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimReference', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimReference') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimReference'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimReference', fromsubclass_=False): + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.anytypeobjs_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimReference'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + obj_ = self.gds_build_any(child_, 'cimReference') + if obj_ is not None: + self.add_anytypeobjs_(obj_) +# end class cimReference + + +class cimHexBinary(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimHexBinary.subclass: + return cimHexBinary.subclass(*args_, **kwargs_) + else: + return cimHexBinary(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimHexBinary', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimHexBinary') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimHexBinary'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimHexBinary', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimHexBinary'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimHexBinary + + +class cimAnySimpleType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, valueOf_=None): + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if cimAnySimpleType.subclass: + return cimAnySimpleType.subclass(*args_, **kwargs_) + else: + return cimAnySimpleType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='cimAnySimpleType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='cimAnySimpleType') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='cimAnySimpleType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='cimAnySimpleType', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='cimAnySimpleType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class cimAnySimpleType + + +class qualifierString(cimString): + subclass = None + superclass = cimString + def __init__(self, qualifier=None, valueOf_=None, extensiontype_=None): + super(qualifierString, self).__init__(valueOf_, extensiontype_, ) + self.qualifier = _cast(None, qualifier) + self.valueOf_ = valueOf_ + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if qualifierString.subclass: + return qualifierString.subclass(*args_, **kwargs_) + else: + return qualifierString(*args_, **kwargs_) + factory = staticmethod(factory) + def get_qualifier(self): return self.qualifier + def set_qualifier(self, qualifier): self.qualifier = qualifier + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='qualifierString', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierString') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='qualifierString'): + super(qualifierString, self).exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierString') + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + outfile.write(' qualifier=%s' % (self.gds_format_string(quote_attrib(self.qualifier).encode(ExternalEncoding), input_name='qualifier'), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='qualifierString', fromsubclass_=False): + super(qualifierString, self).exportChildren(outfile, level, namespace_, name_, True) + pass + def hasContent_(self): + if ( + self.valueOf_ or + super(qualifierString, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='qualifierString'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + showIndent(outfile, level) + outfile.write('qualifier = "%s",\n' % (self.qualifier,)) + super(qualifierString, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(qualifierString, self).exportLiteralChildren(outfile, level, name_) + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('qualifier', node) + if value is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + self.qualifier = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + super(qualifierString, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class qualifierString + + +class qualifierBoolean(cimBoolean): + subclass = None + superclass = cimBoolean + def __init__(self, qualifier=None, valueOf_=None): + super(qualifierBoolean, self).__init__(valueOf_, ) + self.qualifier = _cast(None, qualifier) + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if qualifierBoolean.subclass: + return qualifierBoolean.subclass(*args_, **kwargs_) + else: + return qualifierBoolean(*args_, **kwargs_) + factory = staticmethod(factory) + def get_qualifier(self): return self.qualifier + def set_qualifier(self, qualifier): self.qualifier = qualifier + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='ovf:', name_='qualifierBoolean', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierBoolean') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='qualifierBoolean'): + super(qualifierBoolean, self).exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierBoolean') + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + outfile.write(' qualifier=%s' % (self.gds_format_string(quote_attrib(self.qualifier).encode(ExternalEncoding), input_name='qualifier'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='qualifierBoolean', fromsubclass_=False): + super(qualifierBoolean, self).exportChildren(outfile, level, namespace_, name_, True) + pass + def hasContent_(self): + if ( + self.valueOf_ or + super(qualifierBoolean, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='qualifierBoolean'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + showIndent(outfile, level) + outfile.write('qualifier = "%s",\n' % (self.qualifier,)) + super(qualifierBoolean, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(qualifierBoolean, self).exportLiteralChildren(outfile, level, name_) + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('qualifier', node) + if value is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + self.qualifier = value + super(qualifierBoolean, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class qualifierBoolean + + +class qualifierUInt32(cimUnsignedInt): + subclass = None + superclass = cimUnsignedInt + def __init__(self, qualifier=None, valueOf_=None): + super(qualifierUInt32, self).__init__(valueOf_, ) + self.qualifier = _cast(None, qualifier) + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if qualifierUInt32.subclass: + return qualifierUInt32.subclass(*args_, **kwargs_) + else: + return qualifierUInt32(*args_, **kwargs_) + factory = staticmethod(factory) + def get_qualifier(self): return self.qualifier + def set_qualifier(self, qualifier): self.qualifier = qualifier + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='ovf:', name_='qualifierUInt32', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierUInt32') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='qualifierUInt32'): + super(qualifierUInt32, self).exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierUInt32') + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + outfile.write(' qualifier=%s' % (self.gds_format_string(quote_attrib(self.qualifier).encode(ExternalEncoding), input_name='qualifier'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='qualifierUInt32', fromsubclass_=False): + super(qualifierUInt32, self).exportChildren(outfile, level, namespace_, name_, True) + pass + def hasContent_(self): + if ( + self.valueOf_ or + super(qualifierUInt32, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='qualifierUInt32'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + showIndent(outfile, level) + outfile.write('qualifier = "%s",\n' % (self.qualifier,)) + super(qualifierUInt32, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(qualifierUInt32, self).exportLiteralChildren(outfile, level, name_) + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('qualifier', node) + if value is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + self.qualifier = value + super(qualifierUInt32, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class qualifierUInt32 + + +class qualifierSInt64(cimLong): + subclass = None + superclass = cimLong + def __init__(self, qualifier=None, valueOf_=None): + super(qualifierSInt64, self).__init__(valueOf_, ) + self.qualifier = _cast(None, qualifier) + self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): + if qualifierSInt64.subclass: + return qualifierSInt64.subclass(*args_, **kwargs_) + else: + return qualifierSInt64(*args_, **kwargs_) + factory = staticmethod(factory) + def get_qualifier(self): return self.qualifier + def set_qualifier(self, qualifier): self.qualifier = qualifier + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='ovf:', name_='qualifierSInt64', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierSInt64') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='qualifierSInt64'): + super(qualifierSInt64, self).exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierSInt64') + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + outfile.write(' qualifier=%s' % (self.gds_format_string(quote_attrib(self.qualifier).encode(ExternalEncoding), input_name='qualifier'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='qualifierSInt64', fromsubclass_=False): + super(qualifierSInt64, self).exportChildren(outfile, level, namespace_, name_, True) + pass + def hasContent_(self): + if ( + self.valueOf_ or + super(qualifierSInt64, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='qualifierSInt64'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.qualifier is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + showIndent(outfile, level) + outfile.write('qualifier = "%s",\n' % (self.qualifier,)) + super(qualifierSInt64, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(qualifierSInt64, self).exportLiteralChildren(outfile, level, name_) + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('qualifier', node) + if value is not None and 'qualifier' not in already_processed: + already_processed.append('qualifier') + self.qualifier = value + super(qualifierSInt64, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class qualifierSInt64 + + +class qualifierSArray(qualifierString): + subclass = None + superclass = qualifierString + def __init__(self, qualifier=None): + super(qualifierSArray, self).__init__(qualifier, ) + pass + def factory(*args_, **kwargs_): + if qualifierSArray.subclass: + return qualifierSArray.subclass(*args_, **kwargs_) + else: + return qualifierSArray(*args_, **kwargs_) + factory = staticmethod(factory) + def export(self, outfile, level, namespace_='ovf:', name_='qualifierSArray', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierSArray') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='qualifierSArray'): + super(qualifierSArray, self).exportAttributes(outfile, level, already_processed, namespace_, name_='qualifierSArray') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='qualifierSArray', fromsubclass_=False): + super(qualifierSArray, self).exportChildren(outfile, level, namespace_, name_, True) + pass + def hasContent_(self): + if ( + super(qualifierSArray, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='qualifierSArray'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + super(qualifierSArray, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(qualifierSArray, self).exportLiteralChildren(outfile, level, name_) + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + super(qualifierSArray, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + super(qualifierSArray, self).buildChildren(child_, node, nodeName_, True) + pass +# end class qualifierSArray + + +class Caption(cimString): + subclass = None + superclass = cimString + def __init__(self, valueOf_=None): + super(Caption, self).__init__(valueOf_, ) + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if Caption.subclass: + return Caption.subclass(*args_, **kwargs_) + else: + return Caption(*args_, **kwargs_) + factory = staticmethod(factory) + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='Caption', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='Caption') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='Caption'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + super(Caption, self).exportAttributes(outfile, level, already_processed, namespace_, name_='Caption') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='Caption', fromsubclass_=False): + super(Caption, self).exportChildren(outfile, level, namespace_, name_, True) + pass + def hasContent_(self): + if ( + self.valueOf_ or + super(Caption, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='Caption'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + super(Caption, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(Caption, self).exportLiteralChildren(outfile, level, name_) + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + super(Caption, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class Caption + + +class CIM_VirtualSystemSettingData_Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, AutomaticRecoveryAction=None, AutomaticShutdownAction=None, AutomaticStartupAction=None, AutomaticStartupActionDelay=None, AutomaticStartupActionSequenceNumber=None, Caption=None, ConfigurationDataRoot=None, ConfigurationFile=None, ConfigurationID=None, CreationTime=None, Description=None, ElementName=None, InstanceID=None, LogDataRoot=None, Notes=None, RecoveryFile=None, SnapshotDataRoot=None, SuspendDataRoot=None, SwapFileDataRoot=None, VirtualSystemIdentifier=None, VirtualSystemType=None, anytypeobjs_=None, extensiontype_=None): + self.AutomaticRecoveryAction = AutomaticRecoveryAction + self.AutomaticShutdownAction = AutomaticShutdownAction + self.AutomaticStartupAction = AutomaticStartupAction + self.AutomaticStartupActionDelay = AutomaticStartupActionDelay + self.AutomaticStartupActionSequenceNumber = AutomaticStartupActionSequenceNumber + self.Caption = Caption + self.ConfigurationDataRoot = ConfigurationDataRoot + self.ConfigurationFile = ConfigurationFile + self.ConfigurationID = ConfigurationID + self.CreationTime = CreationTime + self.Description = Description + self.ElementName = ElementName + self.InstanceID = InstanceID + self.LogDataRoot = LogDataRoot + if Notes is None: + self.Notes = [] + else: + self.Notes = Notes + self.RecoveryFile = RecoveryFile + self.SnapshotDataRoot = SnapshotDataRoot + self.SuspendDataRoot = SuspendDataRoot + self.SwapFileDataRoot = SwapFileDataRoot + self.VirtualSystemIdentifier = VirtualSystemIdentifier + self.VirtualSystemType = VirtualSystemType + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if CIM_VirtualSystemSettingData_Type.subclass: + return CIM_VirtualSystemSettingData_Type.subclass(*args_, **kwargs_) + else: + return CIM_VirtualSystemSettingData_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_AutomaticRecoveryAction(self): return self.AutomaticRecoveryAction + def set_AutomaticRecoveryAction(self, AutomaticRecoveryAction): self.AutomaticRecoveryAction = AutomaticRecoveryAction + def validate_AutomaticRecoveryAction(self, value): + # Validate type AutomaticRecoveryAction, a restriction on xs:unsignedShort. + pass + def get_AutomaticShutdownAction(self): return self.AutomaticShutdownAction + def set_AutomaticShutdownAction(self, AutomaticShutdownAction): self.AutomaticShutdownAction = AutomaticShutdownAction + def validate_AutomaticShutdownAction(self, value): + # Validate type AutomaticShutdownAction, a restriction on xs:unsignedShort. + pass + def get_AutomaticStartupAction(self): return self.AutomaticStartupAction + def set_AutomaticStartupAction(self, AutomaticStartupAction): self.AutomaticStartupAction = AutomaticStartupAction + def validate_AutomaticStartupAction(self, value): + # Validate type AutomaticStartupAction, a restriction on xs:unsignedShort. + pass + def get_AutomaticStartupActionDelay(self): return self.AutomaticStartupActionDelay + def set_AutomaticStartupActionDelay(self, AutomaticStartupActionDelay): self.AutomaticStartupActionDelay = AutomaticStartupActionDelay + def get_AutomaticStartupActionSequenceNumber(self): return self.AutomaticStartupActionSequenceNumber + def set_AutomaticStartupActionSequenceNumber(self, AutomaticStartupActionSequenceNumber): self.AutomaticStartupActionSequenceNumber = AutomaticStartupActionSequenceNumber + def get_Caption(self): return self.Caption + def set_Caption(self, Caption): self.Caption = Caption + def get_ConfigurationDataRoot(self): return self.ConfigurationDataRoot + def set_ConfigurationDataRoot(self, ConfigurationDataRoot): self.ConfigurationDataRoot = ConfigurationDataRoot + def get_ConfigurationFile(self): return self.ConfigurationFile + def set_ConfigurationFile(self, ConfigurationFile): self.ConfigurationFile = ConfigurationFile + def get_ConfigurationID(self): return self.ConfigurationID + def set_ConfigurationID(self, ConfigurationID): self.ConfigurationID = ConfigurationID + def get_CreationTime(self): return self.CreationTime + def set_CreationTime(self, CreationTime): self.CreationTime = CreationTime + def get_Description(self): return self.Description + def set_Description(self, Description): self.Description = Description + def get_ElementName(self): return self.ElementName + def set_ElementName(self, ElementName): self.ElementName = ElementName + def get_InstanceID(self): return self.InstanceID + def set_InstanceID(self, InstanceID): self.InstanceID = InstanceID + def get_LogDataRoot(self): return self.LogDataRoot + def set_LogDataRoot(self, LogDataRoot): self.LogDataRoot = LogDataRoot + def get_Notes(self): return self.Notes + def set_Notes(self, Notes): self.Notes = Notes + def add_Notes(self, value): self.Notes.append(value) + def insert_Notes(self, index, value): self.Notes[index] = value + def get_RecoveryFile(self): return self.RecoveryFile + def set_RecoveryFile(self, RecoveryFile): self.RecoveryFile = RecoveryFile + def get_SnapshotDataRoot(self): return self.SnapshotDataRoot + def set_SnapshotDataRoot(self, SnapshotDataRoot): self.SnapshotDataRoot = SnapshotDataRoot + def get_SuspendDataRoot(self): return self.SuspendDataRoot + def set_SuspendDataRoot(self, SuspendDataRoot): self.SuspendDataRoot = SuspendDataRoot + def get_SwapFileDataRoot(self): return self.SwapFileDataRoot + def set_SwapFileDataRoot(self, SwapFileDataRoot): self.SwapFileDataRoot = SwapFileDataRoot + def get_VirtualSystemIdentifier(self): return self.VirtualSystemIdentifier + def set_VirtualSystemIdentifier(self, VirtualSystemIdentifier): self.VirtualSystemIdentifier = VirtualSystemIdentifier + def get_VirtualSystemType(self): return self.VirtualSystemType + def set_VirtualSystemType(self, VirtualSystemType): self.VirtualSystemType = VirtualSystemType + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='CIM_VirtualSystemSettingData_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='CIM_VirtualSystemSettingData_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='CIM_VirtualSystemSettingData_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='CIM_VirtualSystemSettingData_Type', fromsubclass_=False): + if self.AutomaticRecoveryAction is not None: + showIndent(outfile, level) + outfile.write('<%sAutomaticRecoveryAction>%s\n' % (namespace_, self.gds_format_integer(self.AutomaticRecoveryAction, input_name='AutomaticRecoveryAction'), namespace_)) + if self.AutomaticShutdownAction is not None: + showIndent(outfile, level) + outfile.write('<%sAutomaticShutdownAction>%s\n' % (namespace_, self.gds_format_integer(self.AutomaticShutdownAction, input_name='AutomaticShutdownAction'), namespace_)) + if self.AutomaticStartupAction is not None: + showIndent(outfile, level) + outfile.write('<%sAutomaticStartupAction>%s\n' % (namespace_, self.gds_format_integer(self.AutomaticStartupAction, input_name='AutomaticStartupAction'), namespace_)) + if self.AutomaticStartupActionDelay is not None: + self.AutomaticStartupActionDelay.export(outfile, level, namespace_, name_='AutomaticStartupActionDelay') + if self.AutomaticStartupActionSequenceNumber is not None: + self.AutomaticStartupActionSequenceNumber.export(outfile, level, namespace_, name_='AutomaticStartupActionSequenceNumber') + if self.Caption is not None: + self.Caption.export(outfile, level, namespace_, name_='Caption') + if self.ConfigurationDataRoot is not None: + self.ConfigurationDataRoot.export(outfile, level, namespace_, name_='ConfigurationDataRoot') + if self.ConfigurationFile is not None: + self.ConfigurationFile.export(outfile, level, namespace_, name_='ConfigurationFile') + if self.ConfigurationID is not None: + self.ConfigurationID.export(outfile, level, namespace_, name_='ConfigurationID') + if self.CreationTime is not None: + self.CreationTime.export(outfile, level, namespace_, name_='CreationTime') + if self.Description is not None: + self.Description.export(outfile, level, namespace_, name_='Description') + if self.ElementName is not None: + self.ElementName.export(outfile, level, namespace_, name_='ElementName', ) + if self.InstanceID is not None: + self.InstanceID.export(outfile, level, namespace_, name_='InstanceID', ) + if self.LogDataRoot is not None: + self.LogDataRoot.export(outfile, level, namespace_, name_='LogDataRoot') + for Notes_ in self.Notes: + Notes_.export(outfile, level, namespace_, name_='Notes') + if self.RecoveryFile is not None: + self.RecoveryFile.export(outfile, level, namespace_, name_='RecoveryFile') + if self.SnapshotDataRoot is not None: + self.SnapshotDataRoot.export(outfile, level, namespace_, name_='SnapshotDataRoot') + if self.SuspendDataRoot is not None: + self.SuspendDataRoot.export(outfile, level, namespace_, name_='SuspendDataRoot') + if self.SwapFileDataRoot is not None: + self.SwapFileDataRoot.export(outfile, level, namespace_, name_='SwapFileDataRoot') + if self.VirtualSystemIdentifier is not None: + self.VirtualSystemIdentifier.export(outfile, level, namespace_, name_='VirtualSystemIdentifier') + if self.VirtualSystemType is not None: + self.VirtualSystemType.export(outfile, level, namespace_, name_='VirtualSystemType') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.AutomaticRecoveryAction is not None or + self.AutomaticShutdownAction is not None or + self.AutomaticStartupAction is not None or + self.AutomaticStartupActionDelay is not None or + self.AutomaticStartupActionSequenceNumber is not None or + self.Caption is not None or + self.ConfigurationDataRoot is not None or + self.ConfigurationFile is not None or + self.ConfigurationID is not None or + self.CreationTime is not None or + self.Description is not None or + self.ElementName is not None or + self.InstanceID is not None or + self.LogDataRoot is not None or + self.Notes or + self.RecoveryFile is not None or + self.SnapshotDataRoot is not None or + self.SuspendDataRoot is not None or + self.SwapFileDataRoot is not None or + self.VirtualSystemIdentifier is not None or + self.VirtualSystemType is not None or + self.anytypeobjs_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='CIM_VirtualSystemSettingData_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.AutomaticRecoveryAction is not None: + showIndent(outfile, level) + outfile.write('AutomaticRecoveryAction=%d,\n' % self.AutomaticRecoveryAction) + if self.AutomaticShutdownAction is not None: + showIndent(outfile, level) + outfile.write('AutomaticShutdownAction=%d,\n' % self.AutomaticShutdownAction) + if self.AutomaticStartupAction is not None: + showIndent(outfile, level) + outfile.write('AutomaticStartupAction=%d,\n' % self.AutomaticStartupAction) + if self.AutomaticStartupActionDelay is not None: + showIndent(outfile, level) + outfile.write('AutomaticStartupActionDelay=model_.AutomaticStartupActionDelay(\n') + self.AutomaticStartupActionDelay.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.AutomaticStartupActionSequenceNumber is not None: + showIndent(outfile, level) + outfile.write('AutomaticStartupActionSequenceNumber=model_.AutomaticStartupActionSequenceNumber(\n') + self.AutomaticStartupActionSequenceNumber.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.Caption is not None: + showIndent(outfile, level) + outfile.write('Caption=model_.Caption(\n') + self.Caption.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.ConfigurationDataRoot is not None: + showIndent(outfile, level) + outfile.write('ConfigurationDataRoot=model_.ConfigurationDataRoot(\n') + self.ConfigurationDataRoot.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.ConfigurationFile is not None: + showIndent(outfile, level) + outfile.write('ConfigurationFile=model_.ConfigurationFile(\n') + self.ConfigurationFile.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.ConfigurationID is not None: + showIndent(outfile, level) + outfile.write('ConfigurationID=model_.ConfigurationID(\n') + self.ConfigurationID.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.CreationTime is not None: + showIndent(outfile, level) + outfile.write('CreationTime=model_.CreationTime(\n') + self.CreationTime.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.Description is not None: + showIndent(outfile, level) + outfile.write('Description=model_.Description(\n') + self.Description.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.ElementName is not None: + showIndent(outfile, level) + outfile.write('ElementName=model_.ElementName(\n') + self.ElementName.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.InstanceID is not None: + showIndent(outfile, level) + outfile.write('InstanceID=model_.InstanceID(\n') + self.InstanceID.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.LogDataRoot is not None: + showIndent(outfile, level) + outfile.write('LogDataRoot=model_.LogDataRoot(\n') + self.LogDataRoot.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Notes=[\n') + level += 1 + for Notes_ in self.Notes: + showIndent(outfile, level) + outfile.write('model_.Notes(\n') + Notes_.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + if self.RecoveryFile is not None: + showIndent(outfile, level) + outfile.write('RecoveryFile=model_.RecoveryFile(\n') + self.RecoveryFile.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.SnapshotDataRoot is not None: + showIndent(outfile, level) + outfile.write('SnapshotDataRoot=model_.SnapshotDataRoot(\n') + self.SnapshotDataRoot.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.SuspendDataRoot is not None: + showIndent(outfile, level) + outfile.write('SuspendDataRoot=model_.SuspendDataRoot(\n') + self.SuspendDataRoot.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.SwapFileDataRoot is not None: + showIndent(outfile, level) + outfile.write('SwapFileDataRoot=model_.SwapFileDataRoot(\n') + self.SwapFileDataRoot.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.VirtualSystemIdentifier is not None: + showIndent(outfile, level) + outfile.write('VirtualSystemIdentifier=model_.VirtualSystemIdentifier(\n') + self.VirtualSystemIdentifier.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.VirtualSystemType is not None: + showIndent(outfile, level) + outfile.write('VirtualSystemType=model_.VirtualSystemType(\n') + self.VirtualSystemType.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'AutomaticRecoveryAction': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError), exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'AutomaticRecoveryAction') + self.AutomaticRecoveryAction = ival_ + self.validate_AutomaticRecoveryAction(self.AutomaticRecoveryAction) # validate type AutomaticRecoveryAction + elif nodeName_ == 'AutomaticShutdownAction': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError), exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'AutomaticShutdownAction') + self.AutomaticShutdownAction = ival_ + self.validate_AutomaticShutdownAction(self.AutomaticShutdownAction) # validate type AutomaticShutdownAction + elif nodeName_ == 'AutomaticStartupAction': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError), exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'AutomaticStartupAction') + self.AutomaticStartupAction = ival_ + self.validate_AutomaticStartupAction(self.AutomaticStartupAction) # validate type AutomaticStartupAction + elif nodeName_ == 'AutomaticStartupActionDelay': + obj_ = cimDateTime.factory() + obj_.build(child_) + self.set_AutomaticStartupActionDelay(obj_) + elif nodeName_ == 'AutomaticStartupActionSequenceNumber': + obj_ = cimUnsignedShort.factory() + obj_.build(child_) + self.set_AutomaticStartupActionSequenceNumber(obj_) + elif nodeName_ == 'Caption': + obj_ = Caption.factory() + obj_.build(child_) + self.set_Caption(obj_) + elif nodeName_ == 'ConfigurationDataRoot': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_ConfigurationDataRoot(obj_) + elif nodeName_ == 'ConfigurationFile': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_ConfigurationFile(obj_) + elif nodeName_ == 'ConfigurationID': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_ConfigurationID(obj_) + elif nodeName_ == 'CreationTime': + obj_ = cimDateTime.factory() + obj_.build(child_) + self.set_CreationTime(obj_) + elif nodeName_ == 'Description': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_Description(obj_) + elif nodeName_ == 'ElementName': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_ElementName(obj_) + elif nodeName_ == 'InstanceID': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_InstanceID(obj_) + elif nodeName_ == 'LogDataRoot': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_LogDataRoot(obj_) + elif nodeName_ == 'Notes': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.Notes.append(obj_) + elif nodeName_ == 'RecoveryFile': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_RecoveryFile(obj_) + elif nodeName_ == 'SnapshotDataRoot': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_SnapshotDataRoot(obj_) + elif nodeName_ == 'SuspendDataRoot': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_SuspendDataRoot(obj_) + elif nodeName_ == 'SwapFileDataRoot': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_SwapFileDataRoot(obj_) + elif nodeName_ == 'VirtualSystemIdentifier': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_VirtualSystemIdentifier(obj_) + elif nodeName_ == 'VirtualSystemType': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_VirtualSystemType(obj_) + else: + obj_ = self.gds_build_any(child_, 'CIM_VirtualSystemSettingData_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) +# end class CIM_VirtualSystemSettingData_Type + + +class CIM_ResourceAllocationSettingData_Type(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, Address=None, AddressOnParent=None, AllocationUnits=None, AutomaticAllocation=None, AutomaticDeallocation=None, Caption=None, Connection=None, ConsumerVisibility=None, Description=None, ElementName=None, HostResource=None, InstanceID=None, Limit=None, MappingBehavior=None, OtherResourceType=None, Parent=None, PoolID=None, Reservation=None, ResourceSubType=None, ResourceType=None, VirtualQuantity=None, VirtualQuantityUnits=None, Weight=None, anytypeobjs_=None, extensiontype_=None): + self.Address = Address + self.AddressOnParent = AddressOnParent + self.AllocationUnits = AllocationUnits + self.AutomaticAllocation = AutomaticAllocation + self.AutomaticDeallocation = AutomaticDeallocation + self.Caption = Caption + if Connection is None: + self.Connection = [] + else: + self.Connection = Connection + self.ConsumerVisibility = ConsumerVisibility + self.Description = Description + self.ElementName = ElementName + if HostResource is None: + self.HostResource = [] + else: + self.HostResource = HostResource + self.InstanceID = InstanceID + self.Limit = Limit + self.MappingBehavior = MappingBehavior + self.OtherResourceType = OtherResourceType + self.Parent = Parent + self.PoolID = PoolID + self.Reservation = Reservation + self.ResourceSubType = ResourceSubType + self.ResourceType = ResourceType + self.VirtualQuantity = VirtualQuantity + self.VirtualQuantityUnits = VirtualQuantityUnits + self.Weight = Weight + if anytypeobjs_ is None: + self.anytypeobjs_ = [] + else: + self.anytypeobjs_ = anytypeobjs_ + self.anyAttributes_ = {} + self.extensiontype_ = extensiontype_ + def factory(*args_, **kwargs_): + if CIM_ResourceAllocationSettingData_Type.subclass: + return CIM_ResourceAllocationSettingData_Type.subclass(*args_, **kwargs_) + else: + return CIM_ResourceAllocationSettingData_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Address(self): return self.Address + def set_Address(self, Address): self.Address = Address + def get_AddressOnParent(self): return self.AddressOnParent + def set_AddressOnParent(self, AddressOnParent): self.AddressOnParent = AddressOnParent + def get_AllocationUnits(self): return self.AllocationUnits + def set_AllocationUnits(self, AllocationUnits): self.AllocationUnits = AllocationUnits + def get_AutomaticAllocation(self): return self.AutomaticAllocation + def set_AutomaticAllocation(self, AutomaticAllocation): self.AutomaticAllocation = AutomaticAllocation + def get_AutomaticDeallocation(self): return self.AutomaticDeallocation + def set_AutomaticDeallocation(self, AutomaticDeallocation): self.AutomaticDeallocation = AutomaticDeallocation + def get_Caption(self): return self.Caption + def set_Caption(self, Caption): self.Caption = Caption + def get_Connection(self): return self.Connection + def set_Connection(self, Connection): self.Connection = Connection + def add_Connection(self, value): self.Connection.append(value) + def insert_Connection(self, index, value): self.Connection[index] = value + def get_ConsumerVisibility(self): return self.ConsumerVisibility + def set_ConsumerVisibility(self, ConsumerVisibility): self.ConsumerVisibility = ConsumerVisibility + def validate_ConsumerVisibility(self, value): + # Validate type ConsumerVisibility, a restriction on xs:unsignedShort. + pass + def get_Description(self): return self.Description + def set_Description(self, Description): self.Description = Description + def get_ElementName(self): return self.ElementName + def set_ElementName(self, ElementName): self.ElementName = ElementName + def get_HostResource(self): return self.HostResource + def set_HostResource(self, HostResource): self.HostResource = HostResource + def add_HostResource(self, value): self.HostResource.append(value) + def insert_HostResource(self, index, value): self.HostResource[index] = value + def get_InstanceID(self): return self.InstanceID + def set_InstanceID(self, InstanceID): self.InstanceID = InstanceID + def get_Limit(self): return self.Limit + def set_Limit(self, Limit): self.Limit = Limit + def get_MappingBehavior(self): return self.MappingBehavior + def set_MappingBehavior(self, MappingBehavior): self.MappingBehavior = MappingBehavior + def validate_MappingBehavior(self, value): + # Validate type MappingBehavior, a restriction on xs:unsignedShort. + pass + def get_OtherResourceType(self): return self.OtherResourceType + def set_OtherResourceType(self, OtherResourceType): self.OtherResourceType = OtherResourceType + def get_Parent(self): return self.Parent + def set_Parent(self, Parent): self.Parent = Parent + def get_PoolID(self): return self.PoolID + def set_PoolID(self, PoolID): self.PoolID = PoolID + def get_Reservation(self): return self.Reservation + def set_Reservation(self, Reservation): self.Reservation = Reservation + def get_ResourceSubType(self): return self.ResourceSubType + def set_ResourceSubType(self, ResourceSubType): self.ResourceSubType = ResourceSubType + def get_ResourceType(self): return self.ResourceType + def set_ResourceType(self, ResourceType): self.ResourceType = ResourceType + def validate_ResourceType(self, value): + # Validate type ResourceType, a restriction on xs:unsignedShort. + pass + def get_VirtualQuantity(self): return self.VirtualQuantity + def set_VirtualQuantity(self, VirtualQuantity): self.VirtualQuantity = VirtualQuantity + def get_VirtualQuantityUnits(self): return self.VirtualQuantityUnits + def set_VirtualQuantityUnits(self, VirtualQuantityUnits): self.VirtualQuantityUnits = VirtualQuantityUnits + def get_Weight(self): return self.Weight + def set_Weight(self, Weight): self.Weight = Weight + def get_anytypeobjs_(self): return self.anytypeobjs_ + def set_anytypeobjs_(self, anytypeobjs_): self.anytypeobjs_ = anytypeobjs_ + def add_anytypeobjs_(self, value): self.anytypeobjs_.append(value) + def insert_anytypeobjs_(self, index, value): self._anytypeobjs_[index] = value + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def get_extensiontype_(self): return self.extensiontype_ + def set_extensiontype_(self, extensiontype_): self.extensiontype_ = extensiontype_ + def export(self, outfile, level, namespace_='ovf:', name_='CIM_ResourceAllocationSettingData_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='CIM_ResourceAllocationSettingData_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='CIM_ResourceAllocationSettingData_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.extensiontype_ is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + outfile.write(' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') + outfile.write(' xsi:type="%s"' % self.extensiontype_) + pass + def exportChildren(self, outfile, level, namespace_='ovf:', name_='CIM_ResourceAllocationSettingData_Type', fromsubclass_=False): + if self.Address is not None: + self.Address.export(outfile, level, namespace_, name_='Address') + if self.AddressOnParent is not None: + self.AddressOnParent.export(outfile, level, namespace_, name_='AddressOnParent') + if self.AllocationUnits is not None: + self.AllocationUnits.export(outfile, level, namespace_, name_='AllocationUnits') + if self.AutomaticAllocation is not None: + self.AutomaticAllocation.export(outfile, level, namespace_, name_='AutomaticAllocation') + if self.AutomaticDeallocation is not None: + self.AutomaticDeallocation.export(outfile, level, namespace_, name_='AutomaticDeallocation') + if self.Caption is not None: + self.Caption.export(outfile, level, namespace_, name_='Caption') + for Connection_ in self.Connection: + Connection_.export(outfile, level, namespace_, name_='Connection') + if self.ConsumerVisibility is not None: + showIndent(outfile, level) + outfile.write('<%sConsumerVisibility>%s\n' % (namespace_, self.gds_format_integer(self.ConsumerVisibility, input_name='ConsumerVisibility'), namespace_)) + if self.Description is not None: + self.Description.export(outfile, level, namespace_, name_='Description') + if self.ElementName is not None: + self.ElementName.export(outfile, level, namespace_, name_='ElementName', ) + for HostResource_ in self.HostResource: + HostResource_.export(outfile, level, namespace_, name_='HostResource') + if self.InstanceID is not None: + self.InstanceID.export(outfile, level, namespace_, name_='InstanceID', ) + if self.Limit is not None: + self.Limit.export(outfile, level, namespace_, name_='Limit') + if self.MappingBehavior is not None: + showIndent(outfile, level) + outfile.write('<%sMappingBehavior>%s\n' % (namespace_, self.gds_format_integer(self.MappingBehavior, input_name='MappingBehavior'), namespace_)) + if self.OtherResourceType is not None: + self.OtherResourceType.export(outfile, level, namespace_, name_='OtherResourceType') + if self.Parent is not None: + self.Parent.export(outfile, level, namespace_, name_='Parent') + if self.PoolID is not None: + self.PoolID.export(outfile, level, namespace_, name_='PoolID') + if self.Reservation is not None: + self.Reservation.export(outfile, level, namespace_, name_='Reservation') + if self.ResourceSubType is not None: + self.ResourceSubType.export(outfile, level, namespace_, name_='ResourceSubType') + if self.ResourceType is not None: + showIndent(outfile, level) + outfile.write('<%sResourceType>%s\n' % (namespace_, self.gds_format_integer(self.ResourceType, input_name='ResourceType'), namespace_)) + if self.VirtualQuantity is not None: + self.VirtualQuantity.export(outfile, level, namespace_, name_='VirtualQuantity') + if self.VirtualQuantityUnits is not None: + self.VirtualQuantityUnits.export(outfile, level, namespace_, name_='VirtualQuantityUnits') + if self.Weight is not None: + self.Weight.export(outfile, level, namespace_, name_='Weight') + for obj_ in self.anytypeobjs_: + obj_.export(outfile, level, namespace_) + def hasContent_(self): + if ( + self.Address is not None or + self.AddressOnParent is not None or + self.AllocationUnits is not None or + self.AutomaticAllocation is not None or + self.AutomaticDeallocation is not None or + self.Caption is not None or + self.Connection or + self.ConsumerVisibility is not None or + self.Description is not None or + self.ElementName is not None or + self.HostResource or + self.InstanceID is not None or + self.Limit is not None or + self.MappingBehavior is not None or + self.OtherResourceType is not None or + self.Parent is not None or + self.PoolID is not None or + self.Reservation is not None or + self.ResourceSubType is not None or + self.ResourceType is not None or + self.VirtualQuantity is not None or + self.VirtualQuantityUnits is not None or + self.Weight is not None or + self.anytypeobjs_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='CIM_ResourceAllocationSettingData_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.Address is not None: + showIndent(outfile, level) + outfile.write('Address=model_.Address(\n') + self.Address.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.AddressOnParent is not None: + showIndent(outfile, level) + outfile.write('AddressOnParent=model_.AddressOnParent(\n') + self.AddressOnParent.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.AllocationUnits is not None: + showIndent(outfile, level) + outfile.write('AllocationUnits=model_.AllocationUnits(\n') + self.AllocationUnits.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.AutomaticAllocation is not None: + showIndent(outfile, level) + outfile.write('AutomaticAllocation=model_.AutomaticAllocation(\n') + self.AutomaticAllocation.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.AutomaticDeallocation is not None: + showIndent(outfile, level) + outfile.write('AutomaticDeallocation=model_.AutomaticDeallocation(\n') + self.AutomaticDeallocation.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.Caption is not None: + showIndent(outfile, level) + outfile.write('Caption=model_.Caption(\n') + self.Caption.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Connection=[\n') + level += 1 + for Connection_ in self.Connection: + showIndent(outfile, level) + outfile.write('model_.Connection(\n') + Connection_.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + if self.ConsumerVisibility is not None: + showIndent(outfile, level) + outfile.write('ConsumerVisibility=%d,\n' % self.ConsumerVisibility) + if self.Description is not None: + showIndent(outfile, level) + outfile.write('Description=model_.Description(\n') + self.Description.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.ElementName is not None: + showIndent(outfile, level) + outfile.write('ElementName=model_.ElementName(\n') + self.ElementName.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('HostResource=[\n') + level += 1 + for HostResource_ in self.HostResource: + showIndent(outfile, level) + outfile.write('model_.HostResource(\n') + HostResource_.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + if self.InstanceID is not None: + showIndent(outfile, level) + outfile.write('InstanceID=model_.InstanceID(\n') + self.InstanceID.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.Limit is not None: + showIndent(outfile, level) + outfile.write('Limit=model_.Limit(\n') + self.Limit.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.MappingBehavior is not None: + showIndent(outfile, level) + outfile.write('MappingBehavior=%d,\n' % self.MappingBehavior) + if self.OtherResourceType is not None: + showIndent(outfile, level) + outfile.write('OtherResourceType=model_.OtherResourceType(\n') + self.OtherResourceType.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.Parent is not None: + showIndent(outfile, level) + outfile.write('Parent=model_.Parent(\n') + self.Parent.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.PoolID is not None: + showIndent(outfile, level) + outfile.write('PoolID=model_.PoolID(\n') + self.PoolID.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.Reservation is not None: + showIndent(outfile, level) + outfile.write('Reservation=model_.Reservation(\n') + self.Reservation.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.ResourceSubType is not None: + showIndent(outfile, level) + outfile.write('ResourceSubType=model_.ResourceSubType(\n') + self.ResourceSubType.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.ResourceType is not None: + showIndent(outfile, level) + outfile.write('ResourceType=%d,\n' % self.ResourceType) + if self.VirtualQuantity is not None: + showIndent(outfile, level) + outfile.write('VirtualQuantity=model_.VirtualQuantity(\n') + self.VirtualQuantity.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.VirtualQuantityUnits is not None: + showIndent(outfile, level) + outfile.write('VirtualQuantityUnits=model_.VirtualQuantityUnits(\n') + self.VirtualQuantityUnits.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + if self.Weight is not None: + showIndent(outfile, level) + outfile.write('Weight=model_.Weight(\n') + self.Weight.exportLiteral(outfile, level) + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('anytypeobjs_=[\n') + level += 1 + for anytypeobjs_ in self.anytypeobjs_: + anytypeobjs_.exportLiteral(outfile, level) + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + value = find_attr_value_('xsi:type', node) + if value is not None and 'xsi:type' not in already_processed: + already_processed.append('xsi:type') + self.extensiontype_ = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Address': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_Address(obj_) + elif nodeName_ == 'AddressOnParent': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_AddressOnParent(obj_) + elif nodeName_ == 'AllocationUnits': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_AllocationUnits(obj_) + elif nodeName_ == 'AutomaticAllocation': + class_obj_ = self.get_class_obj_(child_, cimBoolean) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_AutomaticAllocation(obj_) + elif nodeName_ == 'AutomaticDeallocation': + class_obj_ = self.get_class_obj_(child_, cimBoolean) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_AutomaticDeallocation(obj_) + elif nodeName_ == 'Caption': + obj_ = Caption.factory() + obj_.build(child_) + self.set_Caption(obj_) + elif nodeName_ == 'Connection': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.Connection.append(obj_) + elif nodeName_ == 'ConsumerVisibility': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError), exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'ConsumerVisibility') + self.ConsumerVisibility = ival_ + self.validate_ConsumerVisibility(self.ConsumerVisibility) # validate type ConsumerVisibility + elif nodeName_ == 'Description': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_Description(obj_) + elif nodeName_ == 'ElementName': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_ElementName(obj_) + elif nodeName_ == 'HostResource': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.HostResource.append(obj_) + elif nodeName_ == 'InstanceID': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_InstanceID(obj_) + elif nodeName_ == 'Limit': + obj_ = cimUnsignedLong.factory() + obj_.build(child_) + self.set_Limit(obj_) + elif nodeName_ == 'MappingBehavior': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError), exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'MappingBehavior') + self.MappingBehavior = ival_ + self.validate_MappingBehavior(self.MappingBehavior) # validate type MappingBehavior + elif nodeName_ == 'OtherResourceType': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_OtherResourceType(obj_) + elif nodeName_ == 'Parent': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_Parent(obj_) + elif nodeName_ == 'PoolID': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_PoolID(obj_) + elif nodeName_ == 'Reservation': + obj_ = cimUnsignedLong.factory() + obj_.build(child_) + self.set_Reservation(obj_) + elif nodeName_ == 'ResourceSubType': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_ResourceSubType(obj_) + elif nodeName_ == 'ResourceType': + sval_ = child_.text + try: + ival_ = int(sval_) + except (TypeError, ValueError), exp: + raise_parse_error(child_, 'requires integer: %s' % exp) + ival_ = self.gds_validate_integer(ival_, node, 'ResourceType') + self.ResourceType = ival_ + self.validate_ResourceType(self.ResourceType) # validate type ResourceType + elif nodeName_ == 'VirtualQuantity': + obj_ = cimUnsignedLong.factory() + obj_.build(child_) + self.set_VirtualQuantity(obj_) + elif nodeName_ == 'VirtualQuantityUnits': + class_obj_ = self.get_class_obj_(child_, cimString) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_VirtualQuantityUnits(obj_) + elif nodeName_ == 'Weight': + class_obj_ = self.get_class_obj_(child_, cimUnsignedInt) + obj_ = class_obj_.factory() + obj_.build(child_) + self.set_Weight(obj_) + else: + obj_ = self.gds_build_any(child_, 'CIM_ResourceAllocationSettingData_Type') + if obj_ is not None: + self.add_anytypeobjs_(obj_) +# end class CIM_ResourceAllocationSettingData_Type + + +class MsgType(GeneratedsSuper): + """String element valueString element identifier""" + subclass = None + superclass = None + def __init__(self, msgid=None, valueOf_=None): + self.msgid = _cast(None, msgid) + self.valueOf_ = valueOf_ + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if MsgType.subclass: + return MsgType.subclass(*args_, **kwargs_) + else: + return MsgType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_msgid(self): return self.msgid + def set_msgid(self, msgid): self.msgid = msgid + def get_valueOf_(self): return self.valueOf_ + def set_valueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='MsgType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='MsgType') + if self.hasContent_(): + outfile.write('>') + outfile.write(str(self.valueOf_).encode(ExternalEncoding)) + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='MsgType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.msgid is not None and 'msgid' not in already_processed: + already_processed.append('msgid') + outfile.write(' msgid=%s' % (self.gds_format_string(quote_attrib(self.msgid).encode(ExternalEncoding), input_name='msgid'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='MsgType', fromsubclass_=False): + pass + def hasContent_(self): + if ( + self.valueOf_ + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='MsgType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + showIndent(outfile, level) + outfile.write('valueOf_ = """%s""",\n' % (self.valueOf_,)) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.msgid is not None and 'msgid' not in already_processed: + already_processed.append('msgid') + showIndent(outfile, level) + outfile.write('msgid = "%s",\n' % (self.msgid,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + self.valueOf_ = get_all_text_(node) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('msgid', node) + if value is not None and 'msgid' not in already_processed: + already_processed.append('msgid') + self.msgid = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class MsgType + + +class IconType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, mimeType=None, width=None, fileRef=None, height=None): + self.mimeType = _cast(None, mimeType) + self.width = _cast(int, width) + self.fileRef = _cast(None, fileRef) + self.height = _cast(int, height) + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if IconType.subclass: + return IconType.subclass(*args_, **kwargs_) + else: + return IconType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_mimeType(self): return self.mimeType + def set_mimeType(self, mimeType): self.mimeType = mimeType + def get_width(self): return self.width + def set_width(self, width): self.width = width + def get_fileRef(self): return self.fileRef + def set_fileRef(self, fileRef): self.fileRef = fileRef + def get_height(self): return self.height + def set_height(self, height): self.height = height + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='IconType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='IconType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='IconType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.mimeType is not None and 'mimeType' not in already_processed: + already_processed.append('mimeType') + outfile.write(' mimeType=%s' % (self.gds_format_string(quote_attrib(self.mimeType).encode(ExternalEncoding), input_name='mimeType'), )) + if self.width is not None and 'width' not in already_processed: + already_processed.append('width') + outfile.write(' width="%s"' % self.gds_format_integer(self.width, input_name='width')) + if self.fileRef is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + outfile.write(' fileRef=%s' % (self.gds_format_string(quote_attrib(self.fileRef).encode(ExternalEncoding), input_name='fileRef'), )) + if self.height is not None and 'height' not in already_processed: + already_processed.append('height') + outfile.write(' height="%s"' % self.gds_format_integer(self.height, input_name='height')) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='IconType', fromsubclass_=False): + pass + def hasContent_(self): + if ( + + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='IconType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.mimeType is not None and 'mimeType' not in already_processed: + already_processed.append('mimeType') + showIndent(outfile, level) + outfile.write('mimeType = "%s",\n' % (self.mimeType,)) + if self.width is not None and 'width' not in already_processed: + already_processed.append('width') + showIndent(outfile, level) + outfile.write('width = %d,\n' % (self.width,)) + if self.fileRef is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + showIndent(outfile, level) + outfile.write('fileRef = "%s",\n' % (self.fileRef,)) + if self.height is not None and 'height' not in already_processed: + already_processed.append('height') + showIndent(outfile, level) + outfile.write('height = %d,\n' % (self.height,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('mimeType', node) + if value is not None and 'mimeType' not in already_processed: + already_processed.append('mimeType') + self.mimeType = value + value = find_attr_value_('width', node) + if value is not None and 'width' not in already_processed: + already_processed.append('width') + try: + self.width = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + value = find_attr_value_('fileRef', node) + if value is not None and 'fileRef' not in already_processed: + already_processed.append('fileRef') + self.fileRef = value + value = find_attr_value_('height', node) + if value is not None and 'height' not in already_processed: + already_processed.append('height') + try: + self.height = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class IconType + + +class PropertyType(GeneratedsSuper): + """Property identifierProperty typeA comma-separated set of type + qualifiersDetermines whether the property value is configurable + during installationDefault value for propertyDetermines whether + the property value should be obscured during deployment""" + subclass = None + superclass = None + def __init__(self, userConfigurable=False, value='', key=None, password=False, type_=None, qualifiers=None, Label=None, Description=None, Value=None): + self.userConfigurable = _cast(bool, userConfigurable) + self.value = _cast(None, value) + self.key = _cast(None, key) + self.password = _cast(bool, password) + self.type_ = _cast(None, type_) + self.qualifiers = _cast(None, qualifiers) + self.Label = Label + self.Description = Description + if Value is None: + self.Value = [] + else: + self.Value = Value + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if PropertyType.subclass: + return PropertyType.subclass(*args_, **kwargs_) + else: + return PropertyType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Label(self): return self.Label + def set_Label(self, Label): self.Label = Label + def get_Description(self): return self.Description + def set_Description(self, Description): self.Description = Description + def get_Value(self): return self.Value + def set_Value(self, Value): self.Value = Value + def add_Value(self, value): self.Value.append(value) + def insert_Value(self, index, value): self.Value[index] = value + def get_userConfigurable(self): return self.userConfigurable + def set_userConfigurable(self, userConfigurable): self.userConfigurable = userConfigurable + def get_value(self): return self.value + def set_value(self, value): self.value = value + def get_key(self): return self.key + def set_key(self, key): self.key = key + def get_password(self): return self.password + def set_password(self, password): self.password = password + def get_type(self): return self.type_ + def set_type(self, type_): self.type_ = type_ + def get_qualifiers(self): return self.qualifiers + def set_qualifiers(self, qualifiers): self.qualifiers = qualifiers + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='PropertyType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='PropertyType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='PropertyType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.userConfigurable is not None and 'userConfigurable' not in already_processed: + already_processed.append('userConfigurable') + outfile.write(' userConfigurable="%s"' % self.gds_format_boolean(self.gds_str_lower(str(self.userConfigurable)), input_name='userConfigurable')) + if self.value is not None and 'value' not in already_processed: + already_processed.append('value') + outfile.write(' value=%s' % (self.gds_format_string(quote_attrib(self.value).encode(ExternalEncoding), input_name='value'), )) + if self.key is not None and 'key' not in already_processed: + already_processed.append('key') + outfile.write(' key=%s' % (self.gds_format_string(quote_attrib(self.key).encode(ExternalEncoding), input_name='key'), )) + if self.password is not None and 'password' not in already_processed: + already_processed.append('password') + outfile.write(' password="%s"' % self.gds_format_boolean(self.gds_str_lower(str(self.password)), input_name='password')) + if self.type_ is not None and 'type_' not in already_processed: + already_processed.append('type_') + outfile.write(' type=%s' % (self.gds_format_string(quote_attrib(self.type_).encode(ExternalEncoding), input_name='type'), )) + if self.qualifiers is not None and 'qualifiers' not in already_processed: + already_processed.append('qualifiers') + outfile.write(' qualifiers=%s' % (self.gds_format_string(quote_attrib(self.qualifiers).encode(ExternalEncoding), input_name='qualifiers'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='PropertyType', fromsubclass_=False): + if self.Label is not None: + self.Label.export(outfile, level, namespace_, name_='Label') + if self.Description is not None: + self.Description.export(outfile, level, namespace_, name_='Description') + for Value_ in self.Value: + Value_.export(outfile, level, namespace_, name_='Value') + def hasContent_(self): + if ( + self.Label is not None or + self.Description is not None or + self.Value + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='PropertyType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.userConfigurable is not None and 'userConfigurable' not in already_processed: + already_processed.append('userConfigurable') + showIndent(outfile, level) + outfile.write('userConfigurable = %s,\n' % (self.userConfigurable,)) + if self.value is not None and 'value' not in already_processed: + already_processed.append('value') + showIndent(outfile, level) + outfile.write('value = "%s",\n' % (self.value,)) + if self.key is not None and 'key' not in already_processed: + already_processed.append('key') + showIndent(outfile, level) + outfile.write('key = "%s",\n' % (self.key,)) + if self.password is not None and 'password' not in already_processed: + already_processed.append('password') + showIndent(outfile, level) + outfile.write('password = %s,\n' % (self.password,)) + if self.type_ is not None and 'type_' not in already_processed: + already_processed.append('type_') + showIndent(outfile, level) + outfile.write('type_ = "%s",\n' % (self.type_,)) + if self.qualifiers is not None and 'qualifiers' not in already_processed: + already_processed.append('qualifiers') + showIndent(outfile, level) + outfile.write('qualifiers = "%s",\n' % (self.qualifiers,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.Label is not None: + showIndent(outfile, level) + outfile.write('Label=model_.Msg_Type(\n') + self.Label.exportLiteral(outfile, level, name_='Label') + showIndent(outfile, level) + outfile.write('),\n') + if self.Description is not None: + showIndent(outfile, level) + outfile.write('Description=model_.Msg_Type(\n') + self.Description.exportLiteral(outfile, level, name_='Description') + showIndent(outfile, level) + outfile.write('),\n') + showIndent(outfile, level) + outfile.write('Value=[\n') + level += 1 + for Value_ in self.Value: + showIndent(outfile, level) + outfile.write('model_.PropertyConfigurationValue_Type(\n') + Value_.exportLiteral(outfile, level, name_='PropertyConfigurationValue_Type') + showIndent(outfile, level) + outfile.write('),\n') + level -= 1 + showIndent(outfile, level) + outfile.write('],\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('userConfigurable', node) + if value is not None and 'userConfigurable' not in already_processed: + already_processed.append('userConfigurable') + if value in ('true', '1'): + self.userConfigurable = True + elif value in ('false', '0'): + self.userConfigurable = False + else: + raise_parse_error(node, 'Bad boolean attribute') + value = find_attr_value_('value', node) + if value is not None and 'value' not in already_processed: + already_processed.append('value') + self.value = value + value = find_attr_value_('key', node) + if value is not None and 'key' not in already_processed: + already_processed.append('key') + self.key = value + value = find_attr_value_('password', node) + if value is not None and 'password' not in already_processed: + already_processed.append('password') + if value in ('true', '1'): + self.password = True + elif value in ('false', '0'): + self.password = False + else: + raise_parse_error(node, 'Bad boolean attribute') + value = find_attr_value_('type', node) + if value is not None and 'type' not in already_processed: + already_processed.append('type') + self.type_ = value + value = find_attr_value_('qualifiers', node) + if value is not None and 'qualifiers' not in already_processed: + already_processed.append('qualifiers') + self.qualifiers = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Label': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Label(obj_) + elif nodeName_ == 'Description': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Description(obj_) + elif nodeName_ == 'Value': + obj_ = PropertyConfigurationValue_Type.factory() + obj_.build(child_) + self.Value.append(obj_) +# end class PropertyType + + +class NetworkType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, name=None, Description=None): + self.name = _cast(None, name) + self.Description = Description + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if NetworkType.subclass: + return NetworkType.subclass(*args_, **kwargs_) + else: + return NetworkType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Description(self): return self.Description + def set_Description(self, Description): self.Description = Description + def get_name(self): return self.name + def set_name(self, name): self.name = name + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='NetworkType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='NetworkType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='NetworkType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.name is not None and 'name' not in already_processed: + already_processed.append('name') + outfile.write(' name=%s' % (self.gds_format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='NetworkType', fromsubclass_=False): + if self.Description is not None: + self.Description.export(outfile, level, namespace_, name_='Description') + def hasContent_(self): + if ( + self.Description is not None + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='NetworkType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.name is not None and 'name' not in already_processed: + already_processed.append('name') + showIndent(outfile, level) + outfile.write('name = "%s",\n' % (self.name,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.Description is not None: + showIndent(outfile, level) + outfile.write('Description=model_.Msg_Type(\n') + self.Description.exportLiteral(outfile, level, name_='Description') + showIndent(outfile, level) + outfile.write('),\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('name', node) + if value is not None and 'name' not in already_processed: + already_processed.append('name') + self.name = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Description': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Description(obj_) +# end class NetworkType + + +class ItemType(GeneratedsSuper): + """Unique identifier of the content (within a VirtualSystemCollection) + Startup order. Entities are started up starting with lower- + numbers first, starting from 0. Items with same order identifier + may be started up concurrently or in any order. The order is + reversed for shutdown.Delay in seconds to wait for power on to + completeResumes power-on sequence if guest software reports + okDelay in seconds to wait for power off to completeStart action + to use, valid values are: 'powerOn', 'none' Stop action to use, + valid values are: ''powerOff' , 'guestShutdown', 'none'""" + subclass = None + superclass = None + def __init__(self, stopDelay=0, order=None, startAction='powerOn', startDelay=0, waitingForGuest=False, stopAction='powerOff', id=None): + self.stopDelay = _cast(int, stopDelay) + self.order = _cast(int, order) + self.startAction = _cast(None, startAction) + self.startDelay = _cast(int, startDelay) + self.waitingForGuest = _cast(bool, waitingForGuest) + self.stopAction = _cast(None, stopAction) + self.id = _cast(None, id) + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if ItemType.subclass: + return ItemType.subclass(*args_, **kwargs_) + else: + return ItemType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_stopDelay(self): return self.stopDelay + def set_stopDelay(self, stopDelay): self.stopDelay = stopDelay + def get_order(self): return self.order + def set_order(self, order): self.order = order + def get_startAction(self): return self.startAction + def set_startAction(self, startAction): self.startAction = startAction + def get_startDelay(self): return self.startDelay + def set_startDelay(self, startDelay): self.startDelay = startDelay + def get_waitingForGuest(self): return self.waitingForGuest + def set_waitingForGuest(self, waitingForGuest): self.waitingForGuest = waitingForGuest + def get_stopAction(self): return self.stopAction + def set_stopAction(self, stopAction): self.stopAction = stopAction + def get_id(self): return self.id + def set_id(self, id): self.id = id + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='ItemType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='ItemType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='ItemType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.stopDelay is not None and 'stopDelay' not in already_processed: + already_processed.append('stopDelay') + outfile.write(' stopDelay="%s"' % self.gds_format_integer(self.stopDelay, input_name='stopDelay')) + if self.order is not None and 'order' not in already_processed: + already_processed.append('order') + outfile.write(' order="%s"' % self.gds_format_integer(self.order, input_name='order')) + if self.startAction is not None and 'startAction' not in already_processed: + already_processed.append('startAction') + outfile.write(' startAction=%s' % (self.gds_format_string(quote_attrib(self.startAction).encode(ExternalEncoding), input_name='startAction'), )) + if self.startDelay is not None and 'startDelay' not in already_processed: + already_processed.append('startDelay') + outfile.write(' startDelay="%s"' % self.gds_format_integer(self.startDelay, input_name='startDelay')) + if self.waitingForGuest is not None and 'waitingForGuest' not in already_processed: + already_processed.append('waitingForGuest') + outfile.write(' waitingForGuest="%s"' % self.gds_format_boolean(self.gds_str_lower(str(self.waitingForGuest)), input_name='waitingForGuest')) + if self.stopAction is not None and 'stopAction' not in already_processed: + already_processed.append('stopAction') + outfile.write(' stopAction=%s' % (self.gds_format_string(quote_attrib(self.stopAction).encode(ExternalEncoding), input_name='stopAction'), )) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + outfile.write(' id=%s' % (self.gds_format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='ItemType', fromsubclass_=False): + pass + def hasContent_(self): + if ( + + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='ItemType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.stopDelay is not None and 'stopDelay' not in already_processed: + already_processed.append('stopDelay') + showIndent(outfile, level) + outfile.write('stopDelay = %d,\n' % (self.stopDelay,)) + if self.order is not None and 'order' not in already_processed: + already_processed.append('order') + showIndent(outfile, level) + outfile.write('order = %d,\n' % (self.order,)) + if self.startAction is not None and 'startAction' not in already_processed: + already_processed.append('startAction') + showIndent(outfile, level) + outfile.write('startAction = "%s",\n' % (self.startAction,)) + if self.startDelay is not None and 'startDelay' not in already_processed: + already_processed.append('startDelay') + showIndent(outfile, level) + outfile.write('startDelay = %d,\n' % (self.startDelay,)) + if self.waitingForGuest is not None and 'waitingForGuest' not in already_processed: + already_processed.append('waitingForGuest') + showIndent(outfile, level) + outfile.write('waitingForGuest = %s,\n' % (self.waitingForGuest,)) + if self.stopAction is not None and 'stopAction' not in already_processed: + already_processed.append('stopAction') + showIndent(outfile, level) + outfile.write('stopAction = "%s",\n' % (self.stopAction,)) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + showIndent(outfile, level) + outfile.write('id = "%s",\n' % (self.id,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + pass + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('stopDelay', node) + if value is not None and 'stopDelay' not in already_processed: + already_processed.append('stopDelay') + try: + self.stopDelay = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + value = find_attr_value_('order', node) + if value is not None and 'order' not in already_processed: + already_processed.append('order') + try: + self.order = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + value = find_attr_value_('startAction', node) + if value is not None and 'startAction' not in already_processed: + already_processed.append('startAction') + self.startAction = value + value = find_attr_value_('startDelay', node) + if value is not None and 'startDelay' not in already_processed: + already_processed.append('startDelay') + try: + self.startDelay = int(value) + except ValueError, exp: + raise_parse_error(node, 'Bad integer attribute: %s' % exp) + value = find_attr_value_('waitingForGuest', node) + if value is not None and 'waitingForGuest' not in already_processed: + already_processed.append('waitingForGuest') + if value in ('true', '1'): + self.waitingForGuest = True + elif value in ('false', '0'): + self.waitingForGuest = False + else: + raise_parse_error(node, 'Bad boolean attribute') + value = find_attr_value_('stopAction', node) + if value is not None and 'stopAction' not in already_processed: + already_processed.append('stopAction') + self.stopAction = value + value = find_attr_value_('id', node) + if value is not None and 'id' not in already_processed: + already_processed.append('id') + self.id = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + pass +# end class ItemType + + +class ConfigurationType(GeneratedsSuper): + subclass = None + superclass = None + def __init__(self, default=False, id=None, Label=None, Description=None): + self.default = _cast(bool, default) + self.id = _cast(None, id) + self.Label = Label + self.Description = Description + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if ConfigurationType.subclass: + return ConfigurationType.subclass(*args_, **kwargs_) + else: + return ConfigurationType(*args_, **kwargs_) + factory = staticmethod(factory) + def get_Label(self): return self.Label + def set_Label(self, Label): self.Label = Label + def get_Description(self): return self.Description + def set_Description(self, Description): self.Description = Description + def get_default(self): return self.default + def set_default(self, default): self.default = default + def get_id(self): return self.id + def set_id(self, id): self.id = id + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='ConfigurationType', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='ConfigurationType') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='ConfigurationType'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + if self.default is not None and 'default' not in already_processed: + already_processed.append('default') + outfile.write(' default="%s"' % self.gds_format_boolean(self.gds_str_lower(str(self.default)), input_name='default')) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + outfile.write(' id=%s' % (self.gds_format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='ConfigurationType', fromsubclass_=False): + if self.Label is not None: + self.Label.export(outfile, level, namespace_, name_='Label', ) + if self.Description is not None: + self.Description.export(outfile, level, namespace_, name_='Description', ) + def hasContent_(self): + if ( + self.Label is not None or + self.Description is not None + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='ConfigurationType'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.default is not None and 'default' not in already_processed: + already_processed.append('default') + showIndent(outfile, level) + outfile.write('default = %s,\n' % (self.default,)) + if self.id is not None and 'id' not in already_processed: + already_processed.append('id') + showIndent(outfile, level) + outfile.write('id = "%s",\n' % (self.id,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + def exportLiteralChildren(self, outfile, level, name_): + if self.Label is not None: + showIndent(outfile, level) + outfile.write('Label=model_.Msg_Type(\n') + self.Label.exportLiteral(outfile, level, name_='Label') + showIndent(outfile, level) + outfile.write('),\n') + if self.Description is not None: + showIndent(outfile, level) + outfile.write('Description=model_.Msg_Type(\n') + self.Description.exportLiteral(outfile, level, name_='Description') + showIndent(outfile, level) + outfile.write('),\n') + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('default', node) + if value is not None and 'default' not in already_processed: + already_processed.append('default') + if value in ('true', '1'): + self.default = True + elif value in ('false', '0'): + self.default = False + else: + raise_parse_error(node, 'Bad boolean attribute') + value = find_attr_value_('id', node) + if value is not None and 'id' not in already_processed: + already_processed.append('id') + self.id = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + if nodeName_ == 'Label': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Label(obj_) + elif nodeName_ == 'Description': + obj_ = Msg_Type.factory() + obj_.build(child_) + self.set_Description(obj_) +# end class ConfigurationType + + +class RASD_Type(CIM_ResourceAllocationSettingData_Type): + """Wrapper for CIM_ResourceAllocationSettingData_TypeDetermines whether + import should fail if entry is not understoodConfiguration from + DeploymentOptionSection this entry is valid forStates that this + entry is a range marker""" + subclass = None + superclass = CIM_ResourceAllocationSettingData_Type + def __init__(self, Address=None, AddressOnParent=None, AllocationUnits=None, AutomaticAllocation=None, AutomaticDeallocation=None, Caption=None, Connection=None, ConsumerVisibility=None, Description=None, ElementName=None, HostResource=None, InstanceID=None, Limit=None, MappingBehavior=None, OtherResourceType=None, Parent=None, PoolID=None, Reservation=None, ResourceSubType=None, ResourceType=None, VirtualQuantity=None, VirtualQuantityUnits=None, Weight=None, anytypeobjs_=None, required=True, bound=None, configuration=None): + super(RASD_Type, self).__init__(Address, AddressOnParent, AllocationUnits, AutomaticAllocation, AutomaticDeallocation, Caption, Connection, ConsumerVisibility, Description, ElementName, HostResource, InstanceID, Limit, MappingBehavior, OtherResourceType, Parent, PoolID, Reservation, ResourceSubType, ResourceType, VirtualQuantity, VirtualQuantityUnits, Weight, anytypeobjs_, ) + self.required = _cast(bool, required) + self.bound = _cast(None, bound) + self.configuration = _cast(None, configuration) + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if RASD_Type.subclass: + return RASD_Type.subclass(*args_, **kwargs_) + else: + return RASD_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_required(self): return self.required + def set_required(self, required): self.required = required + def get_bound(self): return self.bound + def set_bound(self, bound): self.bound = bound + def get_configuration(self): return self.configuration + def set_configuration(self, configuration): self.configuration = configuration + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='RASD_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='RASD_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='RASD_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + super(RASD_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='RASD_Type') + if self.required is not None and 'required' not in already_processed: + already_processed.append('required') + outfile.write(' required="%s"' % self.gds_format_boolean(self.gds_str_lower(str(self.required)), input_name='required')) + if self.bound is not None and 'bound' not in already_processed: + already_processed.append('bound') + outfile.write(' bound=%s' % (self.gds_format_string(quote_attrib(self.bound).encode(ExternalEncoding), input_name='bound'), )) + if self.configuration is not None and 'configuration' not in already_processed: + already_processed.append('configuration') + outfile.write(' configuration=%s' % (self.gds_format_string(quote_attrib(self.configuration).encode(ExternalEncoding), input_name='configuration'), )) + def exportChildren(self, outfile, level, namespace_='ovf:', name_='RASD_Type', fromsubclass_=False): + super(RASD_Type, self).exportChildren(outfile, level, namespace_, name_, True) + def hasContent_(self): + if ( + super(RASD_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='RASD_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + if self.required is not None and 'required' not in already_processed: + already_processed.append('required') + showIndent(outfile, level) + outfile.write('required = %s,\n' % (self.required,)) + if self.bound is not None and 'bound' not in already_processed: + already_processed.append('bound') + showIndent(outfile, level) + outfile.write('bound = "%s",\n' % (self.bound,)) + if self.configuration is not None and 'configuration' not in already_processed: + already_processed.append('configuration') + showIndent(outfile, level) + outfile.write('configuration = "%s",\n' % (self.configuration,)) + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + super(RASD_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(RASD_Type, self).exportLiteralChildren(outfile, level, name_) + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + value = find_attr_value_('required', node) + if value is not None and 'required' not in already_processed: + already_processed.append('required') + if value in ('true', '1'): + self.required = True + elif value in ('false', '0'): + self.required = False + else: + raise_parse_error(node, 'Bad boolean attribute') + value = find_attr_value_('bound', node) + if value is not None and 'bound' not in already_processed: + already_processed.append('bound') + self.bound = value + value = find_attr_value_('configuration', node) + if value is not None and 'configuration' not in already_processed: + already_processed.append('configuration') + self.configuration = value + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + super(RASD_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + super(RASD_Type, self).buildChildren(child_, node, nodeName_, True) + pass +# end class RASD_Type + + +class VSSD_Type(CIM_VirtualSystemSettingData_Type): + """Wrapper for CIM_VirtualSystemSettingData_Type""" + subclass = None + superclass = CIM_VirtualSystemSettingData_Type + def __init__(self, AutomaticRecoveryAction=None, AutomaticShutdownAction=None, AutomaticStartupAction=None, AutomaticStartupActionDelay=None, AutomaticStartupActionSequenceNumber=None, Caption=None, ConfigurationDataRoot=None, ConfigurationFile=None, ConfigurationID=None, CreationTime=None, Description=None, ElementName=None, InstanceID=None, LogDataRoot=None, Notes=None, RecoveryFile=None, SnapshotDataRoot=None, SuspendDataRoot=None, SwapFileDataRoot=None, VirtualSystemIdentifier=None, VirtualSystemType=None, anytypeobjs_=None): + super(VSSD_Type, self).__init__(AutomaticRecoveryAction, AutomaticShutdownAction, AutomaticStartupAction, AutomaticStartupActionDelay, AutomaticStartupActionSequenceNumber, Caption, ConfigurationDataRoot, ConfigurationFile, ConfigurationID, CreationTime, Description, ElementName, InstanceID, LogDataRoot, Notes, RecoveryFile, SnapshotDataRoot, SuspendDataRoot, SwapFileDataRoot, VirtualSystemIdentifier, VirtualSystemType, anytypeobjs_, ) + self.anyAttributes_ = {} + def factory(*args_, **kwargs_): + if VSSD_Type.subclass: + return VSSD_Type.subclass(*args_, **kwargs_) + else: + return VSSD_Type(*args_, **kwargs_) + factory = staticmethod(factory) + def get_anyAttributes_(self): return self.anyAttributes_ + def set_anyAttributes_(self, anyAttributes_): self.anyAttributes_ = anyAttributes_ + def export(self, outfile, level, namespace_='ovf:', name_='VSSD_Type', namespacedef_=''): + showIndent(outfile, level) + outfile.write('<%s%s%s' % (namespace_, name_, namespacedef_ and ' ' + namespacedef_ or '', )) + already_processed = [] + self.exportAttributes(outfile, level, already_processed, namespace_, name_='VSSD_Type') + if self.hasContent_(): + outfile.write('>\n') + self.exportChildren(outfile, level + 1, namespace_, name_) + showIndent(outfile, level) + outfile.write('\n' % (namespace_, name_)) + else: + outfile.write('/>\n') + def exportAttributes(self, outfile, level, already_processed, namespace_='ovf:', name_='VSSD_Type'): + unique_counter = 0 + for name, value in self.anyAttributes_.items(): + xsinamespaceprefix = 'xsi' + xsinamespace1 = 'http://www.w3.org/2001/XMLSchema-instance' + xsinamespace2 = '{%s}' % (xsinamespace1, ) + if name.startswith(xsinamespace2): + name1 = name[len(xsinamespace2):] + name2 = '%s:%s' % (xsinamespaceprefix, name1, ) + if name2 not in already_processed: + already_processed.append(name2) + outfile.write(' %s=%s' % (name2, quote_attrib(value), )) + else: + mo = re_.match(Namespace_extract_pat_, name) + if mo is not None: + namespace, name = mo.group(1, 2) + if name not in already_processed: + already_processed.append(name) + if namespace == 'http://www.w3.org/XML/1998/namespace': + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + else: + unique_counter += 1 + outfile.write(' xmlns:yyy%d="%s"' % (unique_counter, namespace, )) + outfile.write(' yyy%d:%s=%s' % (unique_counter, name, quote_attrib(value), )) + else: + if name not in already_processed: + already_processed.append(name) + outfile.write(' %s=%s' % (name, quote_attrib(value), )) + super(VSSD_Type, self).exportAttributes(outfile, level, already_processed, namespace_, name_='VSSD_Type') + def exportChildren(self, outfile, level, namespace_='ovf:', name_='VSSD_Type', fromsubclass_=False): + super(VSSD_Type, self).exportChildren(outfile, level, namespace_, name_, True) + def hasContent_(self): + if ( + super(VSSD_Type, self).hasContent_() + ): + return True + else: + return False + def exportLiteral(self, outfile, level, name_='VSSD_Type'): + level += 1 + self.exportLiteralAttributes(outfile, level, [], name_) + if self.hasContent_(): + self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, already_processed, name_): + for name, value in self.anyAttributes_.items(): + showIndent(outfile, level) + outfile.write('%s = "%s",\n' % (name, value,)) + super(VSSD_Type, self).exportLiteralAttributes(outfile, level, already_processed, name_) + def exportLiteralChildren(self, outfile, level, name_): + super(VSSD_Type, self).exportLiteralChildren(outfile, level, name_) + def build(self, node): + self.buildAttributes(node, node.attrib, []) + for child in node: + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] + self.buildChildren(child, node, nodeName_) + def buildAttributes(self, node, attrs, already_processed): + self.anyAttributes_ = {} + for name, value in attrs.items(): + if name not in already_processed: + self.anyAttributes_[name] = value + super(VSSD_Type, self).buildAttributes(node, attrs, already_processed) + def buildChildren(self, child_, node, nodeName_, fromsubclass_=False): + super(VSSD_Type, self).buildChildren(child_, node, nodeName_, True) + pass +# end class VSSD_Type + + +USAGE_TEXT = """ +Usage: python .py [ -s ] +""" + +def usage(): + print USAGE_TEXT + sys.exit(1) + + +def get_root_tag(node): + tag = Tag_pattern_.match(node.tag).groups()[-1] + rootClass = globals().get(tag) + return tag, rootClass + + +def parse(inFileName): + doc = parsexml_(inFileName) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'Envelope' + rootClass = EnvelopeType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None +# sys.stdout.write('\n') +# rootObj.export(sys.stdout, 0, name_=rootTag, +# namespacedef_='') + return rootObj + + +def parseString(inString): + from StringIO import StringIO + doc = parsexml_(StringIO(inString)) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'Envelope' + rootClass = EnvelopeType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('\n') + rootObj.export(sys.stdout, 0, name_="Envelope", + namespacedef_='') + return rootObj + + +def parseLiteral(inFileName): + doc = parsexml_(inFileName) + rootNode = doc.getroot() + rootTag, rootClass = get_root_tag(rootNode) + if rootClass is None: + rootTag = 'Envelope' + rootClass = EnvelopeType + rootObj = rootClass.factory() + rootObj.build(rootNode) + # Enable Python to collect the space used by the DOM. + doc = None + sys.stdout.write('#from ovfenvelope import *\n\n') + sys.stdout.write('import ovfenvelope as model_\n\n') + sys.stdout.write('rootObj = model_.rootTag(\n') + rootObj.exportLiteral(sys.stdout, 0, name_=rootTag) + sys.stdout.write(')\n') + return rootObj + + +def main(): + args = sys.argv[1:] + if len(args) == 1: + parse(args[0]) + else: + usage() + + +if __name__ == '__main__': + #import pdb; pdb.set_trace() + main() + + +__all__ = [ + "AnnotationSection_Type", + "CIM_ResourceAllocationSettingData_Type", + "CIM_VirtualSystemSettingData_Type", + "Caption", + "ConfigurationType", + "Content_Type", + "DeploymentOptionSection_Type", + "DiskSection_Type", + "EnvelopeType", + "EulaSection_Type", + "File_Type", + "IconType", + "InstallSection_Type", + "ItemType", + "MsgType", + "Msg_Type", + "NetworkSection_Type", + "NetworkType", + "OperatingSystemSection_Type", + "ProductSection_Type", + "PropertyConfigurationValue_Type", + "PropertyType", + "RASD_Type", + "References_Type", + "ResourceAllocationSection_Type", + "Section_Type", + "StartupSection_Type", + "Strings_Type", + "VSSD_Type", + "VirtualDiskDesc_Type", + "VirtualHardwareSection_Type", + "VirtualSystemCollection_Type", + "VirtualSystem_Type", + "cimAnySimpleType", + "cimBase64Binary", + "cimBoolean", + "cimByte", + "cimChar16", + "cimDateTime", + "cimDouble", + "cimFloat", + "cimHexBinary", + "cimInt", + "cimLong", + "cimReference", + "cimShort", + "cimString", + "cimUnsignedByte", + "cimUnsignedInt", + "cimUnsignedLong", + "cimUnsignedShort", + "qualifierBoolean", + "qualifierSArray", + "qualifierSInt64", + "qualifierString", + "qualifierUInt32" + ] diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelopetest.py b/backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelopetest.py new file mode 100644 index 0000000..8c969c5 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelopetest.py @@ -0,0 +1,95 @@ +''' +Created on May 17, 2011 +''' +import unittest +import ovfenvelope +from ovfenvelope import * +import pprint +import sys + +class Test(unittest.TestCase): + + + def setUp(self): + self.xmlDoc = ovfenvelope.parse("sample-ovf.xml") + self.section_ary = self.xmlDoc.get_Section() + self.content_ary = self.xmlDoc.get_Content() + self.ref_ary = self.xmlDoc.get_References() + + + + pass + + + def tearDown(self): + pass + + def test_rewrite(self): + self.content_ary.get_Name().set_valueOf_("NEW-NAME-HERE") + self.xmlDoc.export(sys.stdout,1) + + def test_get_file(self): + def attr_finder(attr): + if str(attr).endswith('href'): + return attr + else: + return None + file_ary = self.ref_ary.get_File() + for file_type in file_ary: + any_attrs = file_type.get_anyAttributes_() + keys = any_attrs.keys() + href_ary = filter(attr_finder, keys) + pprint.pprint(href_ary) + + pass + + def test_get_section_ary(self): + self.assertEqual(len(self.section_ary), 2, "Error: there should be 2 section elements in sample-ovf.xml.xml.") + pass + + def test_get_DiskSection_Type(self): + found = False + for section in self.section_ary: + if isinstance(section, DiskSection_Type): + self.assertEqual(len(self.section_ary), 2, "Error: there should be 2 section elements in sample-ovf.xml.xml.") + found = True + if found: + pass + else: + self.fail("No DiskSection_Type found.") + + def test_get_DiskSection_Type_Meta(self): + def attr_finder(attr): + if str(attr).endswith('diskId'): + return attr + else: + return None + + found = False + for section in self.section_ary: + if isinstance(section, DiskSection_Type): + disk_ary = section.get_Disk() + if disk_ary is not None: + for disk in disk_ary: + any_attrs = disk.get_anyAttributes_() + if any_attrs is not None: + keys = any_attrs.keys() + diskID_ary = filter(attr_finder, keys) + if diskID_ary is not None: + pprint.pprint(diskID_ary) + found = True + else: + print "Nothing in any" + if found: + pass + else: + self.fail("No DiskSection_Type found.") + pass + + def test_content_ary(self): + pprint.pprint(self.content_ary.get_Name().get_valueOf_()) + pass + +if __name__ == "__main__": + #import sys;sys.argv = ['', 'Test.testName'] + unittest.main() diff --git a/backend/manager/tools/engine-image-uploader/src/ovf/sample-ovf.xml b/backend/manager/tools/engine-image-uploader/src/ovf/sample-ovf.xml new file mode 100644 index 0000000..7e8fc14 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/ovf/sample-ovf.xml @@ -0,0 +1,109 @@ + + + + + + + + +
+ List of networks + +
+
+ List of Virtual Disks + +
+ + tmcowrhel6 + 5272b689-cd9f-4532-9b5d-2413eb7b9402 + + + 2011/10/28 11:01:24 + false + + 1 + 1 + 0 +
+ Guest Operating System + RHEL6x64 +
+
+ 1 CPU, 1024 Memeory + + RHEVM 3.0.0.0 + + + 1 virtual cpu + Number of virtual CPU + 1 + 3 + 1 + 1 + + + 1024 MB of memory + Memory Size + 2 + 4 + MegaBytes + 1024 + + + Drive 1 + c0e51e1b-004e-4d10-abc0-8b9f5e21f3ad + + 17 + 2b30e705-c1d6-4bd8-a6cd-a1fe8a70614f/c0e51e1b-004e-4d10-abc0-8b9f5e21f3ad + + 00000000-0000-0000-0000-000000000000 + 00000000-0000-0000-0000-000000000000 + + 1fc3879e-15a3-4dd7-9054-90aec81c5331 + + 94faa67c-e5b7-11e0-b9b4-5254001ce785 + + 2011/10/28 11:09:20 + 2011/10/28 11:09:20 + + + Ethernet adapter on rhevm + 3 + 10 + 3 + rhevm + nic1 + 1000 + + + USB Controller + 4 + 23 + Enabled + + + Graphical Controller + 5 + 20 + 1 + +
+
+
diff --git a/backend/manager/tools/engine-image-uploader/src/schemas b/backend/manager/tools/engine-image-uploader/src/schemas new file mode 120000 index 0000000..390efd6 --- /dev/null +++ b/backend/manager/tools/engine-image-uploader/src/schemas @@ -0,0 +1 @@ +../../engine-tools-common-lib/src/rhev/schemas \ No newline at end of file diff --git a/backend/manager/tools/engine-image-uploader/src/test-ovf-archive.ovf b/backend/manager/tools/engine-image-uploader/src/test-ovf-archive.ovf new file mode 100644 index 0000000000000000000000000000000000000000..2b43aa953439004dd1f5c196f517cf8d59155a6a GIT binary patch literal 1826 zcmV+-2i^D|iwFSw^~6p91MOMebJ|7_&oh68hL^llmQLUD2z4C5iKfO-gwrN3%t<=g zn&^W{2gH5o-`-ERKb)3<~`(f{xsOk(H_m@g7>P&8KoI$S%3;uzRW^}HG?=P;L*{5Fh&>6LDkvo&| z_-bCM>$uKmn9_6|dW+VncQCn_y2H+3==P`1Waf;odvluj**d=?u{OWVBW~!mopBNzP3M#(ix^YV8ICW1_jDk4R}dGGVyfJR7B}TL2~5%kM(~Y@Q22L zPWQjp7|+H37^bsq74EL_#Q9GzbH0VYB+HU^I{&@KuzvoU#N3MHMU_7BJmAm4*%L#b%o87|d#UpUV@!Uo9C+T$!)i6z2QBA3)2Bh%w zXhEw@JpYW`eYp_)+slr#Mf z5fx^6f@v!YZqqCwRU-VA;QUMC3x7b2@YU}Me9eD$N0XTCF^iW;L+^Frs@S5}=(w<- zf^DtzGvpNXs1W-wSEAyKcjlN#m9#b4gOggXOYMo>>-W|vKJ-& z3|2|$CUdeS?e2w4t3otEa}BX)Zxh23DuOj*8Q=u=F+I}~b_A@!HtWE|*4rRUa8yy* zLq8`~HH1<{>@xWTBno9#qB<)rp~Yc2#l@0l?y^{rG_WgAKye$%|A%raF_VZ3-ZUZtO&NaWp7Vx(zXHQ7&q34=b$6X zNw5LB4dZx0a$HvTrqutl2)thsr~(^CuIAiSfgM1mABI=jS54W2>8a|&Lg@p}gEeID zLpC6;Ke_pdLn2hx5lKjv-!}%-=Ga!*?%GjV0RuLD9C57WSi&P*U?WrGRG(#YKJVjt z1BhF(`sXi}me883Id`{vy-YlkmsPWo0@ImP%PkefVJ#9O9WkaIQq9wJ`^r+8akYpw zU%E`@SvW5;{|lkTM&BN}=7pWi0Z~TX@a~bp$B#Otg5q7d&x9lu9#1%CRIza`)cIrF zAsyuo<#Bgx4@Wm?1REcbTm0^xl7fls&(~5cHhx{=lt%Qv+9wm(pE}^3K_0CLhaU9F z&W4WZHb=Pu>5u#2Lsrm+Y=5&R$kuBquh*MY9oRnRr%R@UNz~#^?SGDfjSNG6v52D@ z+VTWrH-PVxE2>Mg9Qt#afT1rNx=DDXVi~p_=)5Va3VdMV8^~8>xj}R*)KW6ZvKVNl z5@M|BK2KCn=Mf?z@0p&$tCFg~3E3yQp|%w-gm)?VAuc0%8vovKrre)uj zT=P}Oku>rf80+In^$6V_oPoA6RTB<)=f-`*% zdzfM`CQS-%=?9E`pX0?H1b_Stlhxx)K7issis=)TbbC?|*bx+-cJJHv5C2bw(>RUO Q_)m_%0T(i`ZvZF&0P#hOx&QzG literal 0 HcmV?d00001 diff --git a/packaging/fedora/ovirt-engine.spec.in b/packaging/fedora/ovirt-engine.spec.in index c0deffa..110cbaf 100644 --- a/packaging/fedora/ovirt-engine.spec.in +++ b/packaging/fedora/ovirt-engine.spec.in @@ -35,6 +35,7 @@ Requires: %{name}-userportal Requires: %{name}-config Requires: %{name}-notification-service Requires: %{name}-iso-uploader +Requires: %{name}-image-uploader Requires: %{name}-log-collector Requires: %{name}-dbscripts Requires: %{name}-webadmin-portal @@ -89,6 +90,14 @@ Requires: %{name} %description iso-uploader ISO Uploader tool for Open Virtualization Manager +%package image-uploader +Summary: Image Uploader tool for Open Virtualization Manager +Group: Virtualization/Management +Requires: %{name} + +%description image-uploader +Image Uploader tool for Open Virtualization Manager + %package log-collector Summary: Log Collector tool for Open Virtualization Manager Group: Virtualization/Management @@ -273,6 +282,11 @@ rm -rf %{buildroot} %config(noreplace) %{_sysconfdir}/%{name}/isouploader.conf %doc %{_mandir}/man8/engine-iso-uploader.8.gz +%files image-uploader +%{_datadir}/%{name}/image-uploader +%{_bindir}/engine-image-uploader +%config(noreplace) %{_sysconfdir}/%{name}/imageuploader.conf + %files log-collector %attr (755,root,root) %{_datadir}/%{name}/log-collector %attr (755,root,root) %{py_site_pkgs}/sos/plugins/engine.py* --------------mime-boundary-string--