def test_getPropertiesForNode(self): """ Test OvfProperty.getPropertiesForNode """ propertiesNoConfig = [('org.linuxdistx.hostname', None), ('org.linuxdistx.ip', None), ('org.linuxdistx.subnet', None), ('org.linuxdistx.gateway', None), ('org.linuxdistx.dns', None), ('org.linuxdistx.netCoreRmemMaxMB', None), ('org.apache.httpd.httpPort', '80'), ('org.apache.httpd.httpsPort', '443'), ('org.apache.httpd.startThreads', '50'), ('org.apache.httpd.minSpareThreads', '15'), ('org.apache.httpd.maxSpareThreads', '30'), ('org.apache.httpd.maxClients', '256'), ('org.mysql.db.queryCacheSizeMB', '32'), ('org.mysql.db.maxConnections', '500'), ('org.mysql.db.waitTimeout', '100'), ('org.mysql.db.waitTimeout', '100'), ('net.php.sessionTimeout', '5'), ('net.php.concurrentSessions', '500'), ('net.php.memoryLimit', '32')] propertiesMinConfig = [('org.linuxdistx.hostname', None), ('org.linuxdistx.ip', None), ('org.linuxdistx.subnet', None), ('org.linuxdistx.gateway', None), ('org.linuxdistx.dns', None), ('org.linuxdistx.netCoreRmemMaxMB', None), ('org.apache.httpd.httpPort', '80'), ('org.apache.httpd.httpsPort', '443'), ('org.apache.httpd.startThreads', '10'), ('org.apache.httpd.minSpareThreads', '5'), ('org.apache.httpd.maxSpareThreads', '15'), ('org.apache.httpd.maxClients', '128'), ('org.mysql.db.queryCacheSizeMB', '32'), ('org.mysql.db.maxConnections', '500'), ('org.mysql.db.waitTimeout', '100'), ('org.mysql.db.waitTimeout', '100'), ('net.php.sessionTimeout', '5'), ('net.php.concurrentSessions', '500'), ('net.php.memoryLimit', '32')] propertiesMaxConfig = [('org.linuxdistx.hostname', None), ('org.linuxdistx.ip', None), ('org.linuxdistx.subnet', None), ('org.linuxdistx.gateway', None), ('org.linuxdistx.dns', None), ('org.linuxdistx.netCoreRmemMaxMB', None), ('org.apache.httpd.httpPort', '80'), ('org.apache.httpd.httpsPort', '443'), ('org.apache.httpd.startThreads', '100'), ('org.apache.httpd.minSpareThreads', '25'), ('org.apache.httpd.maxSpareThreads', '45'), ('org.apache.httpd.maxClients', '512'), ('org.mysql.db.queryCacheSizeMB', '32'), ('org.mysql.db.maxConnections', '500'), ('org.mysql.db.waitTimeout', '100'), ('org.mysql.db.waitTimeout', '100'), ('net.php.sessionTimeout', '5'), ('net.php.concurrentSessions', '500'), ('net.php.memoryLimit', '32')] ovfFileName = self.path + "/" + self.ovf ovfFile = OvfFile(ovfFileName) # Get the virtual system from the ovf vsNodes = Ovf.getNodes(ovfFile.envelope, (Ovf.hasTagName, 'VirtualSystem'), (Ovf.hasAttribute, 'ovf:id', 'MyLampService')) vsNode = vsNodes[0] # Get the environment for the node properties = OvfProperty.getPropertiesForNode(vsNode, None) # validate the returned data propOffset = 0 for (key, node, value) in properties: assert key == propertiesNoConfig[propOffset][0], "key mismatch" assert node != None, "failed with invalid property node" assert value == propertiesNoConfig[propOffset][1], "value mismatch" propOffset = propOffset + 1 # Get the environment for the node with configuration properties = OvfProperty.getPropertiesForNode(vsNode, 'Minimal') # validate the returned data propOffset = 0 for (key, node, value) in properties: assert key == propertiesMinConfig[propOffset][0], "key mismatch" assert value == propertiesMinConfig[propOffset][1], "value mismatch" propOffset = propOffset + 1 # Get the environment for the node with configuration properties = OvfProperty.getPropertiesForNode(vsNode, 'Maximum') # validate the returned data propOffset = 0 for (key, node, value) in properties: assert key == propertiesMaxConfig[propOffset][0], "key mismatch" assert value == propertiesMaxConfig[propOffset][1], "value mismatch" propOffset = propOffset + 1