1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[vcloud|compute] add API version 1.5 compability

vCloud version API 1.5 requires us to adapt certain calls. This
patch does all the necessary things to scan a vCloud 1.5 completely
and read all the necessary attributes, as we could already before.
Furthermore, it add tests for the version 1.5 calls.

The API version can now be set as a version param to the vcloud
compute resource. By default it chooses version 1.5.

This has been tested against a vCloud 1.5 and 1.0.
This commit is contained in:
Peter Meier 2012-01-30 18:35:42 +01:00
parent 3e240474ac
commit 30e28d704f
22 changed files with 1106 additions and 255 deletions

View file

@ -74,14 +74,16 @@ module Fog
module Vcloud
class Compute < Fog::Service
PATH = '/api/v1.0'
BASE_PATH = '/api'
DEFAULT_VERSION = '1.5'
SUPPORTED_VERSIONS = [ '1.5', '1.0' ]
PORT = 443
SCHEME = 'https'
attr_writer :default_organization_uri
requires :vcloud_username, :vcloud_password, :vcloud_host
recognizes :vcloud_port, :vcloud_scheme, :vcloud_path, :vcloud_default_vdc
recognizes :vcloud_port, :vcloud_scheme, :vcloud_path, :vcloud_default_vdc, :vcloud_version, :vcloud_base_path
recognizes :provider # remove post deprecation
model_path 'fog/vcloud/models/compute'
@ -173,6 +175,8 @@ module Fog
end
end
attr_reader :version
def initialize(options = {})
require 'builder'
require 'fog/core/parser'
@ -181,13 +185,15 @@ module Fog
@connection_options = options[:connection_options] || {}
@persistent = options[:persistent]
@username = options[:vcloud_username]
@password = options[:vcloud_password]
@host = options[:vcloud_host]
@vdc_href = options[:vcloud_default_vdc]
@path = options[:vcloud_path] || Fog::Vcloud::Compute::PATH
@port = options[:vcloud_port] || Fog::Vcloud::Compute::PORT
@scheme = options[:vcloud_scheme] || Fog::Vcloud::Compute::SCHEME
@username = options[:vcloud_username]
@password = options[:vcloud_password]
@host = options[:vcloud_host]
@vdc_href = options[:vcloud_default_vdc]
@base_path = options[:vcloud_base_path] || Fog::Vcloud::Compute::BASE_PATH
@version = options[:vcloud_version] || Fog::Vcloud::Compute::DEFAULT_VERSION
@path = options[:vcloud_path] || "#{@base_path}/v#{@version}"
@port = options[:vcloud_port] || Fog::Vcloud::Compute::PORT
@scheme = options[:vcloud_scheme] || Fog::Vcloud::Compute::SCHEME
end
def reload
@ -230,10 +236,17 @@ module Fog
end
def xmlns
{ "xmlns" => "http://www.vmware.com/vcloud/v1",
"xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" }
if version == '1.0'
{ "xmlns" => "http://www.vmware.com/vcloud/v1",
"xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" }
else
{ 'xmlns' => "http://www.vmware.com/vcloud/v1.5",
"xmlns:ovf" => "http://schemas.dmtf.org/ovf/envelope/1",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema" }
end
end
# If the cookie isn't set, do a get_organizations call to set it
@ -251,7 +264,6 @@ module Fog
end
end
private
def basic_request_params(uri,*args)
{
@ -264,6 +276,11 @@ module Fog
}
end
def base_path_url
"#{@scheme}://#{@host}:#{@port}#{@base_path}"
end
private
def ensure_parsed(uri)
if uri.is_a?(String)
URI.parse(uri)
@ -300,6 +317,7 @@ module Fog
# Set headers to an empty hash if none are set.
headers = params[:headers] || {}
headers['Accept'] = 'application/*+xml;version=1.5' if version == '1.5'
# Add our auth cookie to the headers
if @cookie
@ -316,7 +334,6 @@ module Fog
})
# Parse the response body into a hash
#puts response.body
unless response.body.empty?
if params[:parse]
document = Fog::ToHashDocument.new

View file

@ -20,7 +20,7 @@ module Fog
data = [connection.get_vdc(self.href).available_networks].flatten.compact.reject{|n| n == '' }
elsif self.href =~ /\/org\//
check_href!("Org")
data = connection.get_organization(self.href).links.select{|l| l[:type] == 'application/vnd.vmware.vcloud.network+xml' }
data = connection.get_organization(self.href).links.select{|l| l[:type] == network_type_id }
elsif self.href =~ /\/vApp\//
check_href!("Vapp")
data = [(connection.get_vapp(self.href).network_configs||{})[:NetworkConfig]].flatten.compact.collect{|n| n[:Configuration][:ParentNetwork] unless n[:Configuration].nil? }.compact
@ -34,6 +34,14 @@ module Fog
nil
end
private
def network_type_id
if connection.version == '1.0'
'application/vnd.vmware.vcloud.network+xml'
else
'application/vnd.vmware.vcloud.orgNetwork+xml'
end
end
end
end
end

View file

@ -11,7 +11,12 @@ module Fog
undef_method :create
def all
data = connection.login.body[:Org].select { |org| org[:type] == "application/vnd.vmware.vcloud.org+xml" }
raw_orgs = if connection.version == '1.0'
connection.login
else
connection.request(connection.basic_request_params("#{connection.base_path_url}/org/"))
end
data = raw_orgs.body[:Org].select { |org| org[:type] == "application/vnd.vmware.vcloud.org+xml" }
data.each { |org| org.delete_if { |key, value| [:rel].include?(key) } }
load(data)
end

View file

@ -6,14 +6,18 @@ module Fog
def login
headers = { 'Authorization' => authorization_header }
uri = if version == '1.0'
"#{base_url}/login"
else
"#{base_path_url}/sessions"
end
unauthenticated_request({
:expects => 200,
:headers => {
'Authorization' => authorization_header
},
:headers => headers,
:method => 'POST',
:parse => true,
:uri => "#{base_url}/login"
:uri => uri
})
end

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ExternalNetwork xmlns="http://www.vmware.com/vcloud/v1.5" name="ParentNetwork1" id="urn:vcloud:network:2" type="application/vnd.vmware.admin.vmwexternalnet+xml" href="https://vcloud.example.com/api/admin/network/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd">
<Description>Internet Connection</Description>
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>172.0.0.1</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>172.0.0.2</Dns1>
<Dns2>172.0.0.190</Dns2>
<IpRanges>
<IpRange>
<StartAddress>172.0.0.142</StartAddress>
<EndAddress>172.0.0.156</EndAddress>
</IpRange>
<IpRange>
<StartAddress>172.0.0.160</StartAddress>
<EndAddress>172.0.0.184</EndAddress>
</IpRange>
<IpRange>
<StartAddress>172.0.0.195</StartAddress>
<EndAddress>172.0.0.235</EndAddress>
</IpRange>
</IpRanges>
<AllocatedIpAddresses>
<IpAddress>172.0.0.153</IpAddress>
<IpAddress>172.0.0.147</IpAddress>
<IpAddress>172.0.0.221</IpAddress>
<IpAddress>172.0.0.226</IpAddress>
<IpAddress>172.0.0.151</IpAddress>
<IpAddress>172.0.0.161</IpAddress>
<IpAddress>172.0.0.164</IpAddress>
<IpAddress>172.0.0.163</IpAddress>
<IpAddress>172.0.0.218</IpAddress>
<IpAddress>172.0.0.173</IpAddress>
<IpAddress>172.0.0.172</IpAddress>
<IpAddress>172.0.0.175</IpAddress>
<IpAddress>172.0.0.178</IpAddress>
<IpAddress>172.0.0.197</IpAddress>
<IpAddress>172.0.0.180</IpAddress>
<IpAddress>172.0.0.201</IpAddress>
<IpAddress>172.0.0.156</IpAddress>
<IpAddress>172.0.0.202</IpAddress>
<IpAddress>172.0.0.183</IpAddress>
<IpAddress>172.0.0.149</IpAddress>
<IpAddress>172.0.0.214</IpAddress>
<IpAddress>172.0.0.171</IpAddress>
<IpAddress>172.0.0.162</IpAddress>
<IpAddress>172.0.0.198</IpAddress>
<IpAddress>172.0.0.224</IpAddress>
<IpAddress>172.0.0.195</IpAddress>
<IpAddress>172.0.0.196</IpAddress>
<IpAddress>172.0.0.150</IpAddress>
<IpAddress>172.0.0.169</IpAddress>
<IpAddress>172.0.0.170</IpAddress>
<IpAddress>172.0.0.176</IpAddress>
<IpAddress>172.0.0.200</IpAddress>
<IpAddress>172.0.0.179</IpAddress>
<IpAddress>172.0.0.205</IpAddress>
<IpAddress>172.0.0.213</IpAddress>
<IpAddress>172.0.0.210</IpAddress>
<IpAddress>172.0.0.215</IpAddress>
<IpAddress>172.0.0.219</IpAddress>
<IpAddress>172.0.0.208</IpAddress>
<IpAddress>172.0.0.216</IpAddress>
<IpAddress>172.0.0.217</IpAddress>
<IpAddress>172.0.0.204</IpAddress>
<IpAddress>172.0.0.232</IpAddress>
<IpAddress>172.0.0.154</IpAddress>
<IpAddress>172.0.0.235</IpAddress>
<IpAddress>172.0.0.146</IpAddress>
<IpAddress>172.0.0.209</IpAddress>
<IpAddress>172.0.0.211</IpAddress>
<IpAddress>172.0.0.199</IpAddress>
<IpAddress>172.0.0.155</IpAddress>
<IpAddress>172.0.0.142</IpAddress>
<IpAddress>172.0.0.160</IpAddress>
<IpAddress>172.0.0.212</IpAddress>
<IpAddress>172.0.0.177</IpAddress>
<IpAddress>172.0.0.167</IpAddress>
<IpAddress>172.0.0.166</IpAddress>
<IpAddress>172.0.0.168</IpAddress>
<IpAddress>172.0.0.165</IpAddress>
<IpAddress>172.0.0.181</IpAddress>
<IpAddress>172.0.0.184</IpAddress>
<IpAddress>172.0.0.143</IpAddress>
<IpAddress>172.0.0.230</IpAddress>
<IpAddress>172.0.0.206</IpAddress>
<IpAddress>172.0.0.233</IpAddress>
<IpAddress>172.0.0.222</IpAddress>
<IpAddress>172.0.0.225</IpAddress>
<IpAddress>172.0.0.220</IpAddress>
<IpAddress>172.0.0.227</IpAddress>
<IpAddress>172.0.0.148</IpAddress>
<IpAddress>172.0.0.228</IpAddress>
<IpAddress>172.0.0.229</IpAddress>
<IpAddress>172.0.0.231</IpAddress>
<IpAddress>172.0.0.152</IpAddress>
<IpAddress>172.0.0.145</IpAddress>
<IpAddress>172.0.0.174</IpAddress>
<IpAddress>172.0.0.182</IpAddress>
<IpAddress>172.0.0.203</IpAddress>
<IpAddress>172.0.0.207</IpAddress>
<IpAddress>172.0.0.144</IpAddress>
</AllocatedIpAddresses>
</IpScope>
<FenceMode>isolated</FenceMode>
</Configuration>
<ProviderInfo>NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555</ProviderInfo>
</ExternalNetwork>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1.5" name="Network1" id="urn:vcloud:network:1" type="application/vnd.vmware.vcloud.orgNetwork+xml" href="https://vcloud.example.com/api/network/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd">
<Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/v1.0/org/1"/>
<Description>Some fancy Network</Description>
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>192.168.0.1</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>172.0.0.2</Dns1>
<Dns2>172.0.0.190</Dns2>
<IpRanges>
<IpRange>
<StartAddress>192.168.0.101</StartAddress>
<EndAddress>192.168.0.150</EndAddress>
</IpRange>
</IpRanges>
<AllocatedIpAddresses>
<IpAddress>192.168.0.1</IpAddress>
</AllocatedIpAddresses>
</IpScope>
<ParentNetwork type="application/vnd.vmware.admin.network+xml" name="ParentNetwork1" href="https://vcloud.example.com/api/v1.0/admin/network/2"/>
<FenceMode>natRouted</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>3600</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange>
<StartAddress>192.168.0.151</StartAddress>
<EndAddress>192.168.0.254</EndAddress>
</IpRange>
</DhcpService>
<FirewallService>
<IsEnabled>true</IsEnabled>
</FirewallService>
<NatService>
<IsEnabled>false</IsEnabled>
<NatType>portForwarding</NatType>
<Policy>allowTraffic</Policy>
</NatService>
</Features>
</Configuration>
</OrgNetwork>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgList xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.orgList+xml" href="https://vcloud.example.com/api/org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd">
<Org type="application/vnd.vmware.vcloud.org+xml" name="Org1" href="https://vcloud.example.com/api/org/1"/>
<Org type="application/vnd.vmware.vcloud.org+xml" name="Org2" href="https://vcloud.example.com/api/org/2"/>
</OrgList>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<Org xmlns="http://www.vmware.com/vcloud/v1.5" name="Org1" id="urn:vcloud:org:1" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/org/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd">
<Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml" name="vDC1" href="https://vcloud.example.com/api/vdc/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.tasksList+xml" href="https://vcloud.example.com/api/tasksList/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Catalog1" href="https://vcloud.example.com/api/catalog/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/org/1/catalog/1/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/org/1/catalog/1/action/controlAccess"/>
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Catalog2" href="https://vcloud.example.com/api/catalog/2"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/org/1/catalog/2/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/org/1/catalog/2/action/controlAccess"/>
<Link rel="down" type="application/vnd.vmware.vcloud.orgNetwork+xml" name="Network1" href="https://vcloud.example.com/api/network/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.orgNetwork+xml" name="Network2" href="https://vcloud.example.com/api/network/2"/>
<Description>Some fancy
Description</Description>
<FullName>My Full Name</FullName>
</Org>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Session xmlns="http://www.vmware.com/vcloud/v1.5" user="username" org="System" type="application/vnd.vmware.vcloud.session+xml" href="https://vcloud.example.com/api/session/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd">
<Link rel="down" type="application/vnd.vmware.vcloud.orgList+xml" href="https://vcloud.example.com/api/org/"/>
<Link rel="down" type="application/vnd.vmware.admin.vcloud+xml" href="https://vcloud.example.com/api/admin/"/>
<Link rel="down" type="application/vnd.vmware.admin.vmwExtension+xml" href="https://vcloud.example.com/api/admin/extension"/>
<Link rel="down" type="application/vnd.vmware.vcloud.query.queryList+xml" href="https://vcloud.example.com/api/query"/>
<Link rel="entityResolver" type="application/vnd.vmware.vcloud.entity+xml" href="https://vcloud.example.com/api/entity/"/>
</Session>

View file

@ -0,0 +1,369 @@
<?xml version="1.0" encoding="UTF-8"?>
<VApp xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" deployed="true" status="8" name="vApp1" id="urn:vcloud:vapp:1" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://vcloud.example.com/api/v1.5/schema/vmwextensions.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">
<Link rel="power:powerOn" href="https://vcloud.example.com/api/vApp/vapp-1/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/vApp/vapp-1/power/action/powerOff"/>
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcloud.example.com/api/vApp/vapp-1/action/deploy"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/vApp/vapp-1/action/undeploy"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/vApp/vapp-1/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/vApp/vapp-1/action/controlAccess"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/vdc/1"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/vApp/vapp-1"/>
<Description>Some Description of a vApp</Description>
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcloud.example.com/api/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
<ovf:Info>Lease settings section</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcloud.example.com/api/vApp/vapp-1/leaseSettingsSection/"/>
<DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
</LeaseSettingsSection>
<ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
<ovf:Info>VApp startup section</ovf:Info>
<ovf:Item ovf:stopDelay="0" ovf:stopAction="guestShutdown" ovf:startDelay="30" ovf:startAction="powerOn" ovf:order="2" ovf:id="vm1"/>
<ovf:Item ovf:stopDelay="30" ovf:stopAction="guestShutdown" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="1" ovf:id="vm2"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcloud.example.com/api/vApp/vapp-1/startupSection/"/>
</ovf:StartupSection>
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
<ovf:Info>The list of logical networks</ovf:Info>
<ovf:Network ovf:name="Network1">
<ovf:Description/>
</ovf:Network>
</ovf:NetworkSection>
<NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcloud.example.com/api/vApp/vapp-1/networkConfigSection/" ovf:required="false">
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcloud.example.com/api/vApp/vapp-1/networkConfigSection/"/>
<NetworkConfig networkName="Network1">
<Description>Some Network Description</Description>
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>192.168.2.1</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>192.168.2.1</Dns1>
<IpRanges>
<IpRange>
<StartAddress>192.168.2.101</StartAddress>
<EndAddress>192.168.2.150</EndAddress>
</IpRange>
</IpRanges>
<AllocatedIpAddresses>
<IpAddress>192.168.2.101</IpAddress>
<IpAddress>192.168.2.1</IpAddress>
<IpAddress>192.168.2.102</IpAddress>
</AllocatedIpAddresses>
</IpScope>
<ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Network1" href="https://vcloud.example.com/api/network/1"/>
<FenceMode>natRouted</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>7200</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange/>
</DhcpService>
<FirewallService>
<IsEnabled>true</IsEnabled>
</FirewallService>
<NatService>
<IsEnabled>true</IsEnabled>
<NatType>ipTranslation</NatType>
<Policy>allowTraffic</Policy>
<NatRule>
<OneToOneVmRule>
<MappingMode>automatic</MappingMode>
<ExternalIP>192.168.1.102</ExternalIP>
<VAppScopedVmId>vm1</VAppScopedVmId>
<VmNicId>0</VmNicId>
</OneToOneVmRule>
</NatRule>
<NatRule>
<OneToOneVmRule>
<MappingMode>automatic</MappingMode>
<ExternalIP>192.168.1.103</ExternalIP>
<VAppScopedVmId>vm2</VAppScopedVmId>
<VmNicId>0</VmNicId>
</OneToOneVmRule>
</NatRule>
</NatService>
</Features>
</Configuration>
<IsDeployed>true</IsDeployed>
</NetworkConfig>
</NetworkConfigSection>
<Children>
<Vm deployed="true" status="8" name="vm2" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/vApp/vm-2">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm2.example.com" href="https://vcloud.example.com/api/admin/extension/vimServer/2"/>
<vmext:MoRef>vm-595</vmext:MoRef>
<vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="power:powerOn" href="https://vcloud.example.com/api/vApp/vm-2/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/vApp/vm-2/power/action/powerOff"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/vApp/vm-2/action/undeploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/vApp/vapp-1"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/vApp/vm-2"/>
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/vApp/vm-2/screen"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/vApp/vm-2/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/vApp/vm-2/media/action/ejectMedia"/>
<Description/>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>vm2</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:03</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="192.168.2.102" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Network1</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-2/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://vcloud.example.com/api/vApp/vm-2/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcloud.example.com/api/vApp/vm-2/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/vApp/vm-2/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="Network1">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.2.102</IpAddress>
<ExternalIpAddress>192.168.1.103</ExternalIpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:00:03</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/vApp/vm-2/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/vApp/vm-2/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>2</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>password</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>vm2</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/vApp/vm-2/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v02</VAppScopedLocalId>
</Vm>
<Vm deployed="true" status="8" name="vm1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/vApp/vm-1">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm1.example.com" href="https://vcloud.example.com/api/admin/extension/vimServer/1"/>
<vmext:MoRef>vm-594</vmext:MoRef>
<vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="power:powerOn" href="https://vcloud.example.com/api/vApp/vm-1/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/vApp/vm-1/power/action/powerOff"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/vApp/vm-1/action/undeploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/vApp/vapp-1"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/vApp/vm-1"/>
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/vApp/vm-1/screen"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/vApp/vm-1/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/vApp/vm-1/media/action/ejectMedia"/>
<Description/>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>vm1</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:04</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="192.168.2.101" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Network1</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/vApp/vm-1/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://vcloud.example.com/api/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcloud.example.com/api/vApp/vm-1/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/vApp/vm-1/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="Network1">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.2.101</IpAddress>
<ExternalIpAddress>192.168.1.102</ExternalIpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:04</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/vApp/vm-1/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>1</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>password</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>vm1</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/vApp/vm-1/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v01</VAppScopedLocalId>
</Vm>
</Children>
</VApp>

View file

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<Vm xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" needsCustomization="false" deployed="true" status="8" name="vm2" id="urn:vcloud:vm:1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/vApp/vm-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://vcloud.example.com/api/v1.5/schema/vmwextensions.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm2.example.com" href="https://vcloud.example.com/api/v1.0/admin/extension/vimServer/2"/>
<vmext:MoRef>vm-595</vmext:MoRef>
<vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="power:powerOn" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/power/action/powerOff"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/action/undeploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2"/>
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/screen"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/media/action/ejectMedia"/>
<Description>Some VM Description</Description>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>vm2</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:03</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="192.168.2.102" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Network1</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>1</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 2</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>3000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="Network1">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.2.102</IpAddress>
<ExternalIpAddress>192.168.1.103</ExternalIpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:03</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<NetworkConnection network="Network2">
<NetworkConnectionIndex>1</NetworkConnectionIndex>
<IpAddress>192.168.3.102</IpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:04</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>2</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>password</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>vm2</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v02</VAppScopedLocalId>
</Vm>

View file

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<Vdc xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" status="1" name="vDC1" id="urn:vcloud:vdc:1" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/vdc/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://vcloud.example.com/api/v1.5/schema/vmwextensions.xsd http://www.vmware.com/vcloud/v1.5 http://vcloud.example.com/api/v1.5/schema/master.xsd">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="host.example.com" href="https://vcloud.example.com/api/admin/extension/vimServer/1"/>
<vmext:MoRef>resgroup-1</vmext:MoRef>
<vmext:VimObjectType>RESOURCE_POOL</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/org/1"/>
<Link rel="add" type="application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml" href="https://vcloud.example.com/api/vdc/1/action/uploadVAppTemplate"/>
<Link rel="add" type="application/vnd.vmware.vcloud.media+xml" href="https://vcloud.example.com/api/vdc/1/media"/>
<Link rel="add" type="application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml" href="https://vcloud.example.com/api/vdc/1/action/instantiateVAppTemplate"/>
<Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppParams+xml" href="https://vcloud.example.com/api/vdc/1/action/cloneVApp"/>
<Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml" href="https://vcloud.example.com/api/vdc/1/action/cloneVAppTemplate"/>
<Link rel="add" type="application/vnd.vmware.vcloud.cloneMediaParams+xml" href="https://vcloud.example.com/api/vdc/1/action/cloneMedia"/>
<Link rel="add" type="application/vnd.vmware.vcloud.captureVAppParams+xml" href="https://vcloud.example.com/api/vdc/1/action/captureVApp"/>
<Link rel="add" type="application/vnd.vmware.vcloud.composeVAppParams+xml" href="https://vcloud.example.com/api/vdc/1/action/composeVApp"/>
<Link rel="move" type="application/vnd.vmware.vcloud.moveMediaParams+xml" href="https://vcloud.example.com/api/vdc/1/action/moveMedia"/>
<Link rel="move" type="application/vnd.vmware.vcloud.moveVAppParams+xml" href="https://vcloud.example.com/api/vdc/1/action/moveVApp"/>
<Link rel="move" type="application/vnd.vmware.vcloud.moveVAppTemplateParams+xml" href="https://vcloud.example.com/api/vdc/1/action/moveVAppTemplate"/>
<Description>Some Description</Description>
<AllocationModel>AllocationVApp</AllocationModel>
<StorageCapacity>
<Units>MB</Units>
<Allocated>10240</Allocated>
<Limit>102400</Limit>
<Used>101650</Used>
<Overhead>0</Overhead>
</StorageCapacity>
<ComputeCapacity>
<Cpu>
<Units>MHz</Units>
<Allocated>20000</Allocated>
<Limit>40000</Limit>
<Used>2000</Used>
<Overhead>0</Overhead>
</Cpu>
<Memory>
<Units>MB</Units>
<Allocated>1024</Allocated>
<Limit>10240</Limit>
<Used>8385</Used>
<Overhead>0</Overhead>
</Memory>
</ComputeCapacity>
<ResourceEntities>
<ResourceEntity type="application/vnd.vmware.vcloud.vApp+xml" name="vApp_1" href="https://vcloud.example.com/api/vApp/vapp-1"/>
<ResourceEntity type="application/vnd.vmware.vcloud.vApp+xml" name="vApp_2" href="https://vcloud.example.com/api/vApp/vapp-2"/>
<ResourceEntity type="application/vnd.vmware.vcloud.media+xml" name="media1" href="https://vcloud.example.com/api/media/1"/>
<ResourceEntity type="application/vnd.vmware.vcloud.media+xml" name="media2" href="https://vcloud.example.com/api/media/2"/>
</ResourceEntities>
<AvailableNetworks>
<Network type="application/vnd.vmware.vcloud.network+xml" name="network1" href="https://vcloud.example.com/api/network/1"/>
<Network type="application/vnd.vmware.vcloud.network+xml" name="network2" href="https://vcloud.example.com/api/network/2"/>
</AvailableNetworks>
<NicQuota>10</NicQuota>
<NetworkQuota>10</NetworkQuota>
<VmQuota>10</VmQuota>
<IsEnabled>true</IsEnabled>
</Vdc>

View file

@ -2,57 +2,65 @@ require 'fog/vcloud/models/compute/networks'
Shindo.tests("Vcloud::Compute | network", ['vcloud']) do
pending if Fog.mocking?
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
connection = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password')
tests("an org network") do
instance = connection.get_network('https://vcloud.example.com/api/v1.0/network/1')
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/network/1") { instance.href }
tests("#name").returns("Network1") { instance.name }
tests("#description").returns("Some fancy Network") { instance.description }
tests("configuration") do
tests("parent network").returns("ParentNetwork1") { instance.configuration[:ParentNetwork][:name]}
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}
tests("#fence_mode").returns("natRouted") { instance.configuration[:FenceMode] }
tests("features") do
tests("dhcp_service") do
tests("#is_enabled").returns("false") { instance.configuration[:Features][:DhcpService][:IsEnabled] }
tests("ip_range") do
tests("#start_address").returns("192.168.0.151") { instance.configuration[:Features][:DhcpService][:IpRange][:StartAddress] }
connection = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
)
tests("an org network") do
instance = connection.get_network("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1")
instance.reload
tests("#href").returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.href }
tests("#name").returns("Network1") { instance.name }
tests("#description").returns("Some fancy Network") { instance.description }
tests("configuration") do
tests("parent network").returns("ParentNetwork1") { instance.configuration[:ParentNetwork][:name]}
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}
tests("#fence_mode").returns("natRouted") { instance.configuration[:FenceMode] }
tests("features") do
tests("dhcp_service") do
tests("#is_enabled").returns("false") { instance.configuration[:Features][:DhcpService][:IsEnabled] }
tests("ip_range") do
tests("#start_address").returns("192.168.0.151") { instance.configuration[:Features][:DhcpService][:IpRange][:StartAddress] }
end
end
tests("firewall_server") do
tests("is_enabled").returns("true"){ instance.configuration[:Features][:FirewallService][:IsEnabled] }
end
tests("nat_service") do
tests("is_enabled").returns("false"){ instance.configuration[:Features][:NatService][:IsEnabled] }
end
end
end
tests("firewall_server") do
tests("is_enabled").returns("true"){ instance.configuration[:Features][:FirewallService][:IsEnabled] }
end
tests("nat_service") do
tests("is_enabled").returns("false"){ instance.configuration[:Features][:NatService][:IsEnabled] }
tests("#parent_network") do
tests("returned network name").returns("ParentNetwork1"){ p = instance.parent_network; p.name }
end
end
end
tests("#parent_network") do
tests("returned network name").returns("ParentNetwork1"){ p = instance.parent_network; p.name }
tests("an external network") do
instance = connection.get_network("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/admin/network/2")
instance.reload
tests("#href").returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/admin/network/2") { instance.href }
tests("#name").returns("ParentNetwork1") { instance.name }
tests("#description").returns("Internet Connection") { instance.description }
tests("#provider_info").returns("NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555") { instance.provider_info }
tests("configuration") do
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}
tests("allocated addresses").returns("172.0.0.144") { instance.configuration[:IpScope][:AllocatedIpAddresses][:IpAddress].first }
end
tests("#parent_network").returns(nil){ instance.parent_network }
end
end
end
tests("an external network") do
instance = connection.get_network('https://vcloud.example.com/api/v1.0/admin/network/2')
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/admin/network/2") { instance.href }
tests("#name").returns("ParentNetwork1") { instance.name }
tests("#description").returns("Internet Connection") { instance.description }
tests("#provider_info").returns("NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555") { instance.provider_info }
tests("configuration") do
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}
tests("allocated addresses").returns("172.0.0.144") { instance.configuration[:IpScope][:AllocatedIpAddresses][:IpAddress].first }
end
tests("#parent_network").returns(nil){ instance.parent_network }
end
end

View file

@ -2,41 +2,59 @@ require 'fog/vcloud/models/compute/networks'
Shindo.tests("Vcloud::Compute | networks", ['vcloud']) do
pending if Fog.mocking?
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
tests("from an org perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/org/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/network/1") { instance.first.href }
end
end
tests("from a vdc perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vdc/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/network/1") { instance.first.href }
end
end
tests("from a vapp perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vApp/vapp-1"
)
tests("collection") do
returns(1) { instance.size }
returns("https://vcloud.example.com/api/v1.0/network/1") { instance.first.href }
tests("from an org perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
),
:href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/org/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href }
end
end
tests("from a vdc perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
),
:href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/vdc/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href }
end
end
tests("from a vapp perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
),
:href => "https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/vApp/vapp-1"
)
tests("collection") do
returns(1) { instance.size }
returns("https://vcloud.example.com/api#{version == '1.0' ? '/v1.0' : ''}/network/1") { instance.first.href }
end
end
end
end
end

View file

@ -1,17 +1,19 @@
Shindo.tests("Vcloud::Compute | organization", ['vcloud']) do
pending if Fog.mocking?
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password'
).get_organization('https://vcloud.example.com/api/v1.0/org/1')
instance.reload
tests("#href").returns('https://vcloud.example.com/api/v1.0/org/1'){ instance.href }
tests("#name").returns('Org1'){ instance.name }
tests("#full_name").returns('My Full Name'){ instance.full_name }
tests("#description").returns("Some fancy\n\nDescription"){ instance.description }
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
).get_organization("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1")
instance.reload
tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1"){ instance.href }
tests("#name").returns('Org1'){ instance.name }
tests("#full_name").returns('My Full Name'){ instance.full_name }
tests("#description").returns("Some fancy\n\nDescription"){ instance.description }
end
end
end

View file

@ -2,13 +2,14 @@ require 'fog/vcloud/models/compute/organizations'
Shindo.tests("Vcloud::Compute | organizations", ['vcloud']) do
pending if Fog.mocking?
instance = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password').organizations
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/org/1") { instance.first.href }
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password', :vcloud_version => version).organizations
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1") { instance.first.href }
end
end
end
end

View file

@ -2,49 +2,51 @@ require 'fog/vcloud/models/compute/servers'
Shindo.tests("Vcloud::Compute | server", ['vcloud']) do
pending if Fog.mocking?
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password'
).get_server('https://vcloud.example.com/api/v1.0/vApp/vm-2')
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/vApp/vm-2") { instance.href }
tests("#name").returns("vm2") { instance.name }
tests("#vapp").returns("vApp1") { instance.vapp.name }
tests("#description").returns("Some VM Description") { instance.description }
tests("#status").returns('8') { instance.status }
tests("#deployed").returns(true) { instance.deployed }
tests("#os_desc").returns("Red Hat Enterprise Linux 5 (64-bit)") { instance.os_desc }
tests("#os_type").returns("rhel5_64Guest") { instance.os_type }
tests("#computer_name").returns("vm2") { instance.computer_name }
tests("cpu count").returns(1) { instance.cpus[:count] }
tests("amount of memory").returns(512){ instance.memory[:amount] }
tests("#disks") do
tests("#size").returns(2){ instance.disks.size }
tests("#number").returns(0){ instance.disks.first[:number] }
tests("#size").returns(1600){ instance.disks.first[:size] }
tests("#ElementName").returns("Hard disk 1"){ instance.disks.first[:disk_data][:'rasd:ElementName'] }
tests("#InstanceID").returns("2000"){ instance.disks.first[:disk_data][:'rasd:InstanceID'] }
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
).get_server("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2")
instance.reload
tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") { instance.href }
tests("#name").returns("vm2") { instance.name }
tests("#vapp").returns("vApp1") { instance.vapp.name }
tests("#description").returns("Some VM Description") { instance.description }
tests("#status").returns('8') { instance.status }
tests("#deployed").returns(true) { instance.deployed }
tests("#os_desc").returns("Red Hat Enterprise Linux 5 (64-bit)") { instance.os_desc }
tests("#os_type").returns("rhel5_64Guest") { instance.os_type }
tests("#computer_name").returns("vm2") { instance.computer_name }
tests("cpu count").returns(1) { instance.cpus[:count] }
tests("amount of memory").returns(512){ instance.memory[:amount] }
tests("#disks") do
tests("#size").returns(2){ instance.disks.size }
tests("#number").returns(0){ instance.disks.first[:number] }
tests("#size").returns(1600){ instance.disks.first[:size] }
tests("#ElementName").returns("Hard disk 1"){ instance.disks.first[:disk_data][:'rasd:ElementName'] }
tests("#InstanceID").returns("2000"){ instance.disks.first[:disk_data][:'rasd:InstanceID'] }
end
tests("#vapp_scoped_local_id").returns("vmware_RHEL5-U5-64-small_v02") { instance.vapp_scoped_local_id }
tests("#friendly_status").returns('off') { instance.friendly_status }
tests("#on?").returns(false) { instance.on? }
tests("#off?").returns(true) { instance.off? }
tests("#network_connections") do
tests("#size").returns(2) { instance.network_connections.size }
end
end
end
tests("#vapp_scoped_local_id").returns("vmware_RHEL5-U5-64-small_v02") { instance.vapp_scoped_local_id }
tests("#friendly_status").returns('off') { instance.friendly_status }
tests("#on?").returns(false) { instance.on? }
tests("#off?").returns(true) { instance.off? }
tests("#network_connections") do
tests("#size").returns(2) { instance.network_connections.size }
end
#old tests
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
pending if Fog.mocking?

View file

@ -2,15 +2,21 @@ require 'fog/vcloud/models/compute/servers'
Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do
pending if Fog.mocking?
instance = Fog::Vcloud::Compute::Servers.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vApp/vapp-1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/vApp/vm-2") { instance.first.href }
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute::Servers.new(
:connection => Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version),
:href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vm-2") { instance.first.href }
end
end
end
end

View file

@ -3,27 +3,29 @@ require 'fog/vcloud/models/compute/vapp'
Shindo.tests("Vcloud::Compute | vapp", ['vcloud']) do
pending if Fog.mocking?
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password'
).get_vapp('https://vcloud.example.com/api/v1.0/vApp/vapp-1')
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/vApp/vapp-1") { instance.href }
tests("#name").returns("vApp1") { instance.name }
tests("#vdc").returns("vDC1"){ instance.vdc.name }
tests("#description").returns("Some Description of a vApp") { instance.description }
tests("#status").returns('8') { instance.status }
tests("#deployed").returns(true) { instance.deployed }
tests("#children").returns(2) { instance.children.size }
tests("#servers").returns(2) { instance.servers.size }
tests("#friendly_status").returns('off') { instance.friendly_status }
tests("#on?").returns(false) { instance.on? }
tests("#off?").returns(true) { instance.off? }
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
).get_vapp("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1")
instance.reload
tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") { instance.href }
tests("#name").returns("vApp1") { instance.name }
tests("#vdc").returns("vDC1"){ instance.vdc.name }
tests("#description").returns("Some Description of a vApp") { instance.description }
tests("#status").returns('8') { instance.status }
tests("#deployed").returns(true) { instance.deployed }
tests("#children").returns(2) { instance.children.size }
tests("#servers").returns(2) { instance.servers.size }
tests("#friendly_status").returns('off') { instance.friendly_status }
tests("#on?").returns(false) { instance.on? }
tests("#off?").returns(true) { instance.off? }
end
end
end

View file

@ -2,16 +2,17 @@ require 'fog/vcloud/models/compute/vapps'
Shindo.tests("Vcloud::Compute | vapps", ['vcloud']) do
pending if Fog.mocking?
instance = Fog::Vcloud::Compute::Vapps.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vdc/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/vApp/vapp-1") { instance.first.href }
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute::Vapps.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vApp/vapp-1") { instance.first.href }
end
end
end
end

View file

@ -3,43 +3,45 @@ require 'fog/vcloud/models/compute/vdc'
Shindo.tests("Vcloud::Compute | vdc", ['vcloud']) do
pending if Fog.mocking?
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password'
).get_vdc('https://vcloud.example.com/api/v1.0/vdc/1')
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/vdc/1") { instance.href }
tests("#name").returns("vDC1") { instance.name }
tests('#organization').returns("Org1") { instance.organization.name }
tests("#description").returns("Some Description") { instance.description }
tests("#network_quota").returns(10) { instance.network_quota }
tests("#nic_quota").returns(10) { instance.nic_quota }
tests("#vm_quota").returns(10) { instance.vm_quota }
tests("#is_enabled").returns(true) { instance.is_enabled }
tests("#available_networks") do
tests("#size").returns(2) { instance.available_networks.size }
end
tests("#storage_capacity") do
tests("units").returns("MB") { instance.storage_capacity[:Units] }
tests("allocated").returns("10240") { instance.storage_capacity[:Allocated] }
end
tests("#compute_capacity") do
tests("cpu") do
tests("allocated").returns("20000") { instance.compute_capacity[:Cpu][:Allocated] }
tests("units").returns("MHz") { instance.compute_capacity[:Cpu][:Units] }
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version
).get_vdc("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1")
instance.reload
tests("#href").returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") { instance.href }
tests("#name").returns("vDC1") { instance.name }
tests('#organization').returns("Org1") { instance.organization.name }
tests("#description").returns("Some Description") { instance.description }
tests("#network_quota").returns(10) { instance.network_quota }
tests("#nic_quota").returns(10) { instance.nic_quota }
tests("#vm_quota").returns(10) { instance.vm_quota }
tests("#is_enabled").returns(true) { instance.is_enabled }
tests("#available_networks") do
tests("#size").returns(2) { instance.available_networks.size }
end
tests("#storage_capacity") do
tests("units").returns("MB") { instance.storage_capacity[:Units] }
tests("allocated").returns("10240") { instance.storage_capacity[:Allocated] }
end
tests("#compute_capacity") do
tests("cpu") do
tests("allocated").returns("20000") { instance.compute_capacity[:Cpu][:Allocated] }
tests("units").returns("MHz") { instance.compute_capacity[:Cpu][:Units] }
end
tests("memory") do
tests("allocated").returns("1024") { instance.compute_capacity[:Memory][:Allocated] }
tests("units").returns("MB") { instance.compute_capacity[:Memory][:Units] }
end
end
end
tests("memory") do
tests("allocated").returns("1024") { instance.compute_capacity[:Memory][:Allocated] }
tests("units").returns("MB") { instance.compute_capacity[:Memory][:Units] }
end
end
end

View file

@ -2,16 +2,22 @@ require 'fog/vcloud/models/compute/vdcs'
Shindo.tests("Vcloud::Compute | vdcs", ['vcloud']) do
pending if Fog.mocking?
Fog::Vcloud::Compute::SUPPORTED_VERSIONS.each do |version|
tests("api version #{version}") do
instance = Fog::Vcloud::Compute::Vdcs.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/org/1"
)
tests("collection") do
returns(1) { instance.size }
returns("https://vcloud.example.com/api/v1.0/vdc/1") { instance.first.href }
instance = Fog::Vcloud::Compute::Vdcs.new(
:connection => Fog::Vcloud::Compute.new(
:vcloud_host => 'vcloud.example.com',
:vcloud_username => 'username',
:vcloud_password => 'password',
:vcloud_version => version),
:href => "https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/org/1"
)
tests("collection") do
returns(1) { instance.size }
returns("https://vcloud.example.com/api#{(version == '1.0') ? '/v1.0' : ''}/vdc/1") { instance.first.href }
end
end
end
end