testing: demonstrates basic container views
This test attempts to reproduce a bug report using the code currently in `master`. The issue does not appear to occur on the development branch. closes: https://github.com/vmware/pyvmomi/issues/50
This commit is contained in:
357
tests/fixtures/basic_container_view.yaml
vendored
Normal file
357
tests/fixtures/basic_container_view.yaml
vendored
Normal file
@@ -0,0 +1,357 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept: ['*/*']
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
User-Agent: [python-requests/2.3.0 CPython/3.4.1 Darwin/13.3.0]
|
||||
method: GET
|
||||
uri: https://vcsa:443//sdk/vimServiceVersions.xml
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n Copyright
|
||||
2008-2012 VMware, Inc. All rights reserved.\n-->\n<namespaces version=\"1.0\">\n
|
||||
\ <namespace>\n <name>urn:vim25</name>\n <version>5.5</version>\n <priorVersions>\n
|
||||
\ <version>5.1</version>\n <version>5.0</version>\n <version>4.1</version>\n
|
||||
\ <version>4.0</version>\n <version>2.5u2</version>\n <version>2.5</version>\n
|
||||
\ </priorVersions>\n </namespace>\n <namespace>\n <name>urn:vim2</name>\n
|
||||
\ <version>2.0</version>\n </namespace>\n</namespaces>\n"}
|
||||
headers:
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['530']
|
||||
Content-Type: [text/xml]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:04 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><RetrieveServiceContent xmlns="urn:vim25"><_this type="ServiceInstance">ServiceInstance</_this></RetrieveServiceContent></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrieveServiceContentResponse
|
||||
xmlns=\"urn:vim25\"><returnval><rootFolder type=\"Folder\">group-d1</rootFolder><propertyCollector
|
||||
type=\"PropertyCollector\">propertyCollector</propertyCollector><viewManager
|
||||
type=\"ViewManager\">ViewManager</viewManager><about><name>VMware vCenter
|
||||
Server</name><fullName>VMware vCenter Server 5.5.0 build-1750787 (Sim)</fullName><vendor>VMware,
|
||||
Inc.</vendor><version>5.5.0</version><build>1750787 (Sim)</build><localeVersion>INTL</localeVersion><localeBuild>000</localeBuild><osType>linux-x64</osType><productLineId>vpx</productLineId><apiType>VirtualCenter</apiType><apiVersion>5.5</apiVersion><instanceUuid>EAB4D846-C243-426B-A021-0547644CE59D</instanceUuid><licenseProductName>VMware
|
||||
VirtualCenter Server</licenseProductName><licenseProductVersion>5.0</licenseProductVersion></about><setting
|
||||
type=\"OptionManager\">VpxSettings</setting><userDirectory type=\"UserDirectory\">UserDirectory</userDirectory><sessionManager
|
||||
type=\"SessionManager\">SessionManager</sessionManager><authorizationManager
|
||||
type=\"AuthorizationManager\">AuthorizationManager</authorizationManager><serviceManager
|
||||
type=\"ServiceManager\">ServiceMgr</serviceManager><perfManager type=\"PerformanceManager\">PerfMgr</perfManager><scheduledTaskManager
|
||||
type=\"ScheduledTaskManager\">ScheduledTaskManager</scheduledTaskManager><alarmManager
|
||||
type=\"AlarmManager\">AlarmManager</alarmManager><eventManager type=\"EventManager\">EventManager</eventManager><taskManager
|
||||
type=\"TaskManager\">TaskManager</taskManager><extensionManager type=\"ExtensionManager\">ExtensionManager</extensionManager><customizationSpecManager
|
||||
type=\"CustomizationSpecManager\">CustomizationSpecManager</customizationSpecManager><customFieldsManager
|
||||
type=\"CustomFieldsManager\">CustomFieldsManager</customFieldsManager><diagnosticManager
|
||||
type=\"DiagnosticManager\">DiagMgr</diagnosticManager><licenseManager type=\"LicenseManager\">LicenseManager</licenseManager><searchIndex
|
||||
type=\"SearchIndex\">SearchIndex</searchIndex><fileManager type=\"FileManager\">FileManager</fileManager><datastoreNamespaceManager
|
||||
type=\"DatastoreNamespaceManager\">DatastoreNamespaceManager</datastoreNamespaceManager><virtualDiskManager
|
||||
type=\"VirtualDiskManager\">virtualDiskManager</virtualDiskManager><snmpSystem
|
||||
type=\"HostSnmpSystem\">SnmpSystem</snmpSystem><vmProvisioningChecker type=\"VirtualMachineProvisioningChecker\">ProvChecker</vmProvisioningChecker><vmCompatibilityChecker
|
||||
type=\"VirtualMachineCompatibilityChecker\">CompatChecker</vmCompatibilityChecker><ovfManager
|
||||
type=\"OvfManager\">OvfManager</ovfManager><ipPoolManager type=\"IpPoolManager\">IpPoolManager</ipPoolManager><dvSwitchManager
|
||||
type=\"DistributedVirtualSwitchManager\">DVSManager</dvSwitchManager><hostProfileManager
|
||||
type=\"HostProfileManager\">HostProfileManager</hostProfileManager><clusterProfileManager
|
||||
type=\"ClusterProfileManager\">ClusterProfileManager</clusterProfileManager><complianceManager
|
||||
type=\"ProfileComplianceManager\">MoComplianceManager</complianceManager><localizationManager
|
||||
type=\"LocalizationManager\">LocalizationManager</localizationManager><storageResourceManager
|
||||
type=\"StorageResourceManager\">StorageResourceManager</storageResourceManager><guestOperationsManager
|
||||
type=\"GuestOperationsManager\">guestOperationsManager</guestOperationsManager></returnval></RetrieveServiceContentResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['3611']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:04 GMT']
|
||||
Set-Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><Login xmlns="urn:vim25"><_this type="SessionManager">SessionManager</_this><userName>my_user</userName><password>my_password</password></Login></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<LoginResponse
|
||||
xmlns=\"urn:vim25\"><returnval><key>52dc4501-0677-e49d-f836-92045c1e5335</key><userName>my_user</userName><fullName>my_user
|
||||
</fullName><loginTime>2014-07-31T17:32:04.959361Z</loginTime><lastActiveTime>2014-07-31T17:32:04.959361Z</lastActiveTime><locale>en</locale><messageLocale>en</messageLocale><extensionSession>false</extensionSession><ipAddress>172.16.16.1</ipAddress><userAgent></userAgent><callCount>0</callCount></returnval></LoginResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['788']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:04 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><RetrieveServiceContent xmlns="urn:vim25"><_this type="ServiceInstance">ServiceInstance</_this></RetrieveServiceContent></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrieveServiceContentResponse
|
||||
xmlns=\"urn:vim25\"><returnval><rootFolder type=\"Folder\">group-d1</rootFolder><propertyCollector
|
||||
type=\"PropertyCollector\">propertyCollector</propertyCollector><viewManager
|
||||
type=\"ViewManager\">ViewManager</viewManager><about><name>VMware vCenter
|
||||
Server</name><fullName>VMware vCenter Server 5.5.0 build-1750787 (Sim)</fullName><vendor>VMware,
|
||||
Inc.</vendor><version>5.5.0</version><build>1750787 (Sim)</build><localeVersion>INTL</localeVersion><localeBuild>000</localeBuild><osType>linux-x64</osType><productLineId>vpx</productLineId><apiType>VirtualCenter</apiType><apiVersion>5.5</apiVersion><instanceUuid>EAB4D846-C243-426B-A021-0547644CE59D</instanceUuid><licenseProductName>VMware
|
||||
VirtualCenter Server</licenseProductName><licenseProductVersion>5.0</licenseProductVersion></about><setting
|
||||
type=\"OptionManager\">VpxSettings</setting><userDirectory type=\"UserDirectory\">UserDirectory</userDirectory><sessionManager
|
||||
type=\"SessionManager\">SessionManager</sessionManager><authorizationManager
|
||||
type=\"AuthorizationManager\">AuthorizationManager</authorizationManager><serviceManager
|
||||
type=\"ServiceManager\">ServiceMgr</serviceManager><perfManager type=\"PerformanceManager\">PerfMgr</perfManager><scheduledTaskManager
|
||||
type=\"ScheduledTaskManager\">ScheduledTaskManager</scheduledTaskManager><alarmManager
|
||||
type=\"AlarmManager\">AlarmManager</alarmManager><eventManager type=\"EventManager\">EventManager</eventManager><taskManager
|
||||
type=\"TaskManager\">TaskManager</taskManager><extensionManager type=\"ExtensionManager\">ExtensionManager</extensionManager><customizationSpecManager
|
||||
type=\"CustomizationSpecManager\">CustomizationSpecManager</customizationSpecManager><customFieldsManager
|
||||
type=\"CustomFieldsManager\">CustomFieldsManager</customFieldsManager><diagnosticManager
|
||||
type=\"DiagnosticManager\">DiagMgr</diagnosticManager><licenseManager type=\"LicenseManager\">LicenseManager</licenseManager><searchIndex
|
||||
type=\"SearchIndex\">SearchIndex</searchIndex><fileManager type=\"FileManager\">FileManager</fileManager><datastoreNamespaceManager
|
||||
type=\"DatastoreNamespaceManager\">DatastoreNamespaceManager</datastoreNamespaceManager><virtualDiskManager
|
||||
type=\"VirtualDiskManager\">virtualDiskManager</virtualDiskManager><snmpSystem
|
||||
type=\"HostSnmpSystem\">SnmpSystem</snmpSystem><vmProvisioningChecker type=\"VirtualMachineProvisioningChecker\">ProvChecker</vmProvisioningChecker><vmCompatibilityChecker
|
||||
type=\"VirtualMachineCompatibilityChecker\">CompatChecker</vmCompatibilityChecker><ovfManager
|
||||
type=\"OvfManager\">OvfManager</ovfManager><ipPoolManager type=\"IpPoolManager\">IpPoolManager</ipPoolManager><dvSwitchManager
|
||||
type=\"DistributedVirtualSwitchManager\">DVSManager</dvSwitchManager><hostProfileManager
|
||||
type=\"HostProfileManager\">HostProfileManager</hostProfileManager><clusterProfileManager
|
||||
type=\"ClusterProfileManager\">ClusterProfileManager</clusterProfileManager><complianceManager
|
||||
type=\"ProfileComplianceManager\">MoComplianceManager</complianceManager><localizationManager
|
||||
type=\"LocalizationManager\">LocalizationManager</localizationManager><storageResourceManager
|
||||
type=\"StorageResourceManager\">StorageResourceManager</storageResourceManager><guestOperationsManager
|
||||
type=\"GuestOperationsManager\">guestOperationsManager</guestOperationsManager></returnval></RetrieveServiceContentResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['3611']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:04 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><CreateContainerView xmlns="urn:vim25"><_this type="ViewManager">ViewManager</_this><container
|
||||
type="Folder">group-d1</container><type>Datacenter</type><recursive>true</recursive></CreateContainerView></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<CreateContainerViewResponse
|
||||
xmlns=\"urn:vim25\"><returnval type=\"ContainerView\">session[1c697f87-8ba4-8cf9-7be1-fd21ab003a42]528c1847-b0c0-7a9b-63c1-2c6cd72956b4</returnval></CreateContainerViewResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['529']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:05 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><RetrieveServiceContent xmlns="urn:vim25"><_this type="ServiceInstance">ServiceInstance</_this></RetrieveServiceContent></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrieveServiceContentResponse
|
||||
xmlns=\"urn:vim25\"><returnval><rootFolder type=\"Folder\">group-d1</rootFolder><propertyCollector
|
||||
type=\"PropertyCollector\">propertyCollector</propertyCollector><viewManager
|
||||
type=\"ViewManager\">ViewManager</viewManager><about><name>VMware vCenter
|
||||
Server</name><fullName>VMware vCenter Server 5.5.0 build-1750787 (Sim)</fullName><vendor>VMware,
|
||||
Inc.</vendor><version>5.5.0</version><build>1750787 (Sim)</build><localeVersion>INTL</localeVersion><localeBuild>000</localeBuild><osType>linux-x64</osType><productLineId>vpx</productLineId><apiType>VirtualCenter</apiType><apiVersion>5.5</apiVersion><instanceUuid>EAB4D846-C243-426B-A021-0547644CE59D</instanceUuid><licenseProductName>VMware
|
||||
VirtualCenter Server</licenseProductName><licenseProductVersion>5.0</licenseProductVersion></about><setting
|
||||
type=\"OptionManager\">VpxSettings</setting><userDirectory type=\"UserDirectory\">UserDirectory</userDirectory><sessionManager
|
||||
type=\"SessionManager\">SessionManager</sessionManager><authorizationManager
|
||||
type=\"AuthorizationManager\">AuthorizationManager</authorizationManager><serviceManager
|
||||
type=\"ServiceManager\">ServiceMgr</serviceManager><perfManager type=\"PerformanceManager\">PerfMgr</perfManager><scheduledTaskManager
|
||||
type=\"ScheduledTaskManager\">ScheduledTaskManager</scheduledTaskManager><alarmManager
|
||||
type=\"AlarmManager\">AlarmManager</alarmManager><eventManager type=\"EventManager\">EventManager</eventManager><taskManager
|
||||
type=\"TaskManager\">TaskManager</taskManager><extensionManager type=\"ExtensionManager\">ExtensionManager</extensionManager><customizationSpecManager
|
||||
type=\"CustomizationSpecManager\">CustomizationSpecManager</customizationSpecManager><customFieldsManager
|
||||
type=\"CustomFieldsManager\">CustomFieldsManager</customFieldsManager><diagnosticManager
|
||||
type=\"DiagnosticManager\">DiagMgr</diagnosticManager><licenseManager type=\"LicenseManager\">LicenseManager</licenseManager><searchIndex
|
||||
type=\"SearchIndex\">SearchIndex</searchIndex><fileManager type=\"FileManager\">FileManager</fileManager><datastoreNamespaceManager
|
||||
type=\"DatastoreNamespaceManager\">DatastoreNamespaceManager</datastoreNamespaceManager><virtualDiskManager
|
||||
type=\"VirtualDiskManager\">virtualDiskManager</virtualDiskManager><snmpSystem
|
||||
type=\"HostSnmpSystem\">SnmpSystem</snmpSystem><vmProvisioningChecker type=\"VirtualMachineProvisioningChecker\">ProvChecker</vmProvisioningChecker><vmCompatibilityChecker
|
||||
type=\"VirtualMachineCompatibilityChecker\">CompatChecker</vmCompatibilityChecker><ovfManager
|
||||
type=\"OvfManager\">OvfManager</ovfManager><ipPoolManager type=\"IpPoolManager\">IpPoolManager</ipPoolManager><dvSwitchManager
|
||||
type=\"DistributedVirtualSwitchManager\">DVSManager</dvSwitchManager><hostProfileManager
|
||||
type=\"HostProfileManager\">HostProfileManager</hostProfileManager><clusterProfileManager
|
||||
type=\"ClusterProfileManager\">ClusterProfileManager</clusterProfileManager><complianceManager
|
||||
type=\"ProfileComplianceManager\">MoComplianceManager</complianceManager><localizationManager
|
||||
type=\"LocalizationManager\">LocalizationManager</localizationManager><storageResourceManager
|
||||
type=\"StorageResourceManager\">StorageResourceManager</storageResourceManager><guestOperationsManager
|
||||
type=\"GuestOperationsManager\">guestOperationsManager</guestOperationsManager></returnval></RetrieveServiceContentResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['3611']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:05 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><RetrievePropertiesEx xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>ContainerView</type><all>false</all><pathSet>view</pathSet></propSet><objectSet><obj
|
||||
type="ContainerView">session[1c697f87-8ba4-8cf9-7be1-fd21ab003a42]528c1847-b0c0-7a9b-63c1-2c6cd72956b4</obj><skip>false</skip></objectSet></specSet><options><maxObjects>1</maxObjects></options></RetrievePropertiesEx></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrievePropertiesExResponse
|
||||
xmlns=\"urn:vim25\"><returnval><objects><obj type=\"ContainerView\">session[1c697f87-8ba4-8cf9-7be1-fd21ab003a42]528c1847-b0c0-7a9b-63c1-2c6cd72956b4</obj><propSet><name>view</name><val
|
||||
xsi:type=\"ArrayOfManagedObjectReference\"><ManagedObjectReference type=\"Datacenter\"
|
||||
xsi:type=\"ManagedObjectReference\">datacenter-2</ManagedObjectReference></val></propSet></objects></returnval></RetrievePropertiesExResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['762']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:05 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><RetrievePropertiesEx xmlns="urn:vim25"><_this type="PropertyCollector">propertyCollector</_this><specSet><propSet><type>Datacenter</type><all>false</all><pathSet>datastore</pathSet></propSet><objectSet><obj
|
||||
type="Datacenter">datacenter-2</obj><skip>false</skip></objectSet></specSet><options><maxObjects>1</maxObjects></options></RetrievePropertiesEx></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrievePropertiesExResponse
|
||||
xmlns=\"urn:vim25\"><returnval><objects><obj type=\"Datacenter\">datacenter-2</obj><propSet><name>datastore</name><val
|
||||
xsi:type=\"ArrayOfManagedObjectReference\"><ManagedObjectReference type=\"Datastore\"
|
||||
xsi:type=\"ManagedObjectReference\">datastore-11</ManagedObjectReference></val></propSet></objects></returnval></RetrievePropertiesExResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['694']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:05 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: '<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<soapenv:Body><DestroyView xmlns="urn:vim25"><_this type="ContainerView">session[1c697f87-8ba4-8cf9-7be1-fd21ab003a42]528c1847-b0c0-7a9b-63c1-2c6cd72956b4</_this></DestroyView></soapenv:Body>
|
||||
|
||||
</soapenv:Envelope>'
|
||||
headers:
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Content-Type: [text/xml; charset=UTF-8]
|
||||
Cookie: ['vmware_soap_session="52b88a08-629d-c211-6863-551af1238da8"; Path=/;
|
||||
HttpOnly; Secure; ']
|
||||
SOAPAction: ['"urn:vim25/5.5"']
|
||||
method: POST
|
||||
uri: https://vcsa:443/sdk
|
||||
response:
|
||||
body: {string: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope
|
||||
xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
|
||||
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<DestroyViewResponse
|
||||
xmlns=\"urn:vim25\"></DestroyViewResponse>\n</soapenv:Body>\n</soapenv:Envelope>"}
|
||||
headers:
|
||||
Cache-Control: [no-cache]
|
||||
Connection: [Keep-Alive]
|
||||
Content-Length: ['388']
|
||||
Content-Type: [text/xml; charset=utf-8]
|
||||
Date: ['Thu, 31 Jul 2014 17:32:05 GMT']
|
||||
status: {code: 200, message: OK}
|
||||
version: 1
|
54
tests/test_container_view.py
Normal file
54
tests/test_container_view.py
Normal file
@@ -0,0 +1,54 @@
|
||||
# VMware vSphere Python SDK
|
||||
# Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import atexit
|
||||
from tests import fixtures_path
|
||||
import logging
|
||||
from pprint import pprint
|
||||
import unittest
|
||||
import vcr
|
||||
|
||||
from pyVim import connect
|
||||
from pyVmomi import vim
|
||||
|
||||
|
||||
class ContainerViewTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
logging.basicConfig()
|
||||
vcr_log = logging.getLogger('vcr')
|
||||
vcr_log.setLevel(logging.DEBUG)
|
||||
|
||||
@vcr.use_cassette('basic_container_view.yaml',
|
||||
cassette_library_dir=fixtures_path, record_mode='once')
|
||||
def test_basic_container_view(self):
|
||||
# see: http://python3porting.com/noconv.html
|
||||
si = connect.SmartConnect(host='vcsa',
|
||||
user='my_user',
|
||||
pwd='my_password')
|
||||
atexit.register(connect.Disconnect, si)
|
||||
|
||||
content = si.RetrieveContent()
|
||||
|
||||
datacenter_object_view = content.viewManager.CreateContainerView(
|
||||
content.rootFolder, [vim.Datacenter], True)
|
||||
|
||||
for datacenter in datacenter_object_view.view:
|
||||
datastores = datacenter.datastore
|
||||
# NOTE (hartsocks): the object handle here is a managed object
|
||||
# reference, until we ask for more details, no other detail is
|
||||
# transmitted. Our sample fixture is quite small.
|
||||
self.assertEqual(1, len(datastores))
|
||||
|
||||
datacenter_object_view.Destroy()
|
Reference in New Issue
Block a user