mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
commit
d512ede1d6
34 changed files with 1620 additions and 254 deletions
|
@ -64,6 +64,8 @@ module Fog
|
|||
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 :provider # remove post deprecation
|
||||
|
@ -81,8 +83,12 @@ module Fog
|
|||
collection :servers
|
||||
model :task
|
||||
collection :tasks
|
||||
model :vapp
|
||||
collection :vapps
|
||||
model :vdc
|
||||
collection :vdcs
|
||||
model :organization
|
||||
collection :organizations
|
||||
|
||||
request_path 'fog/vcloud/requests/compute'
|
||||
request :clone_vapp
|
||||
|
@ -101,6 +107,7 @@ module Fog
|
|||
request :get_network_ips
|
||||
request :get_network_extensions
|
||||
request :get_organization
|
||||
request :get_server
|
||||
request :get_task
|
||||
request :get_task_list
|
||||
request :get_vapp
|
||||
|
@ -296,7 +303,6 @@ module Fog
|
|||
parser = Nokogiri::XML::SAX::PushParser.new(document)
|
||||
parser << response.body
|
||||
parser.finish
|
||||
|
||||
response.body = document.body
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,8 +7,11 @@ module Fog
|
|||
|
||||
model Fog::Vcloud::Compute::Catalog
|
||||
|
||||
attribute :organization_uri
|
||||
|
||||
def all
|
||||
data = connection.get_organization(organization_uri).body[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.catalog+xml" }
|
||||
org_uri = self.organization_uri || connection.default_organization_uri
|
||||
data = connection.get_organization(org_uri).body[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.catalog+xml" }
|
||||
load(data)
|
||||
end
|
||||
|
||||
|
@ -20,10 +23,6 @@ module Fog
|
|||
nil
|
||||
end
|
||||
|
||||
def organization_uri
|
||||
@organization_uri ||= connection.default_organization_uri
|
||||
end
|
||||
|
||||
def item_by_name(name)
|
||||
res = nil
|
||||
items = all.collect { |catalog| catalog.catalog_items }
|
||||
|
|
37
lib/fog/vcloud/models/compute/helpers/status.rb
Normal file
37
lib/fog/vcloud/models/compute/helpers/status.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
module Fog
|
||||
module Vcloud
|
||||
class Compute
|
||||
module Helpers
|
||||
module Status
|
||||
def friendly_status
|
||||
load_unless_loaded!
|
||||
case status
|
||||
when '0'
|
||||
'creating'
|
||||
when '8'
|
||||
'off'
|
||||
when '4'
|
||||
'on'
|
||||
else
|
||||
'unknown'
|
||||
end
|
||||
end
|
||||
|
||||
def on?
|
||||
reload_status
|
||||
status == '4'
|
||||
end
|
||||
|
||||
def off?
|
||||
reload_status
|
||||
status == '8'
|
||||
end
|
||||
|
||||
def reload_status
|
||||
reload # always ensure we have the correct status
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,61 +3,25 @@ module Fog
|
|||
class Compute
|
||||
class Network < Fog::Vcloud::Model
|
||||
|
||||
identity :href
|
||||
identity :href, :aliases => :Href
|
||||
|
||||
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd, :xmlns_i, :Configuration, :Id
|
||||
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd, :xmlns_i, :Id
|
||||
|
||||
attribute :name, :aliases => :Name
|
||||
#attribute :id, :aliases => :Id
|
||||
attribute :features, :aliases => :Features, :type => :array
|
||||
|
||||
attribute :description, :aliases => :Description
|
||||
attribute :configuration, :aliases => :Configuration
|
||||
attribute :provider_info, :aliases => :ProviderInfo
|
||||
|
||||
attribute :links, :aliases => :Link, :type => :array
|
||||
attribute :type
|
||||
attribute :gateway, :aliases => :GatewayAddress
|
||||
attribute :broadcast, :aliases => :BroadcastAddress
|
||||
attribute :address, :aliases => :Address
|
||||
attribute :extension_href, :aliases => :Href
|
||||
attribute :network_type, :aliases => :NetworkType
|
||||
attribute :vlan, :aliases => :Vlan
|
||||
attribute :friendly_name, :aliases => :FriendlyName
|
||||
|
||||
def ips
|
||||
load_unless_loaded!
|
||||
Fog::Vcloud::Compute::Ips.new( :connection => connection,
|
||||
:href => links.detect { |link| link[:name] == "IP Addresses" }[:href] )
|
||||
end
|
||||
|
||||
def save
|
||||
if @changed
|
||||
connection.configure_network( extension_href, _compose_network_data )
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def reload
|
||||
super
|
||||
merge_attributes(extension_data.body)
|
||||
self
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def extension_data
|
||||
connection.get_network_extensions( extensions_link[:href] )
|
||||
end
|
||||
|
||||
def extensions_link
|
||||
links.detect { |link| link[:name] == name }
|
||||
end
|
||||
|
||||
def _compose_network_data
|
||||
{
|
||||
:id => id,
|
||||
:href => extension_href,
|
||||
:name => name,
|
||||
:address => address,
|
||||
:broadcast => broadcast,
|
||||
:gateway => gateway
|
||||
}
|
||||
def parent_network
|
||||
return nil if configuration[:ParentNetwork].nil?
|
||||
@parent_network ||= Fog::Vcloud::Compute::Network.new(
|
||||
:connection => connection,
|
||||
:collection => Fog::Vcloud::Compute::Networks.new(:connection => connection),
|
||||
:href => configuration[:ParentNetwork][:href]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,10 +14,19 @@ module Fog
|
|||
|
||||
def all
|
||||
self.href = connection.default_vdc_href unless self.href
|
||||
check_href!("Vdc")
|
||||
if data = connection.get_vdc(href).body[:AvailableNetworks][:Network]
|
||||
load(data)
|
||||
data = nil
|
||||
if self.href =~ /\/vdc\//
|
||||
check_href!("Vdc")
|
||||
data = [connection.get_vdc(self.href).body[:AvailableNetworks][:Network]].flatten.compact
|
||||
elsif self.href =~ /\/org\//
|
||||
check_href!("Org")
|
||||
links = (l=connection.get_organization(self.href).body[:Link]).is_a?(Array) ? l : [l].compact
|
||||
data = links.select{|l| l[:type] == 'application/vnd.vmware.vcloud.network+xml' }
|
||||
elsif self.href =~ /\/vApp\//
|
||||
check_href!("Vapp")
|
||||
data = [(connection.get_vapp(self.href).body[:NetworkConfigSection]||{})[:NetworkConfig]].flatten.compact.collect{|n| n[:Configuration][:ParentNetwork] unless n[:Configuration].nil? }.compact
|
||||
end
|
||||
load([*data]) unless data.nil?
|
||||
end
|
||||
|
||||
def get(uri)
|
||||
|
|
44
lib/fog/vcloud/models/compute/organization.rb
Normal file
44
lib/fog/vcloud/models/compute/organization.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
module Fog
|
||||
module Vcloud
|
||||
class Compute
|
||||
class Organization < Fog::Vcloud::Model
|
||||
|
||||
identity :href
|
||||
|
||||
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd
|
||||
|
||||
attribute :name
|
||||
attribute :description, :aliases => :Description
|
||||
attribute :type
|
||||
attribute :full_name, :aliases => :FullName
|
||||
attribute :other_links, :aliases => :Link
|
||||
|
||||
def networks
|
||||
@networks ||= Fog::Vcloud::Compute::Networks.
|
||||
new( :connection => connection,
|
||||
:href => href )
|
||||
end
|
||||
|
||||
def tasks
|
||||
load_unless_loaded!
|
||||
@tasks ||= Fog::Vcloud::Compute::Tasks.
|
||||
new( :connection => connection,
|
||||
:href => other_links.find{|l| l[:type] == 'application/vnd.vmware.vcloud.tasksList+xml'}[:href] )
|
||||
end
|
||||
|
||||
def vdcs
|
||||
@vdcs ||= Fog::Vcloud::Compute::Vdcs.
|
||||
new( :connection => connection,
|
||||
:href => href )
|
||||
end
|
||||
|
||||
def catalogs
|
||||
@catalogs ||= Fog::Vcloud::Compute::Catalogs.
|
||||
new( :connection => connection,
|
||||
:href => href )
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
29
lib/fog/vcloud/models/compute/organizations.rb
Normal file
29
lib/fog/vcloud/models/compute/organizations.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'fog/vcloud/models/compute/organization'
|
||||
|
||||
module Fog
|
||||
module Vcloud
|
||||
class Compute
|
||||
|
||||
class Organizations < Collection
|
||||
|
||||
model Fog::Vcloud::Compute::Organization
|
||||
|
||||
undef_method :create
|
||||
|
||||
def all
|
||||
data = connection.login.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
|
||||
|
||||
def get(uri)
|
||||
if data = connection.get_organization(uri)
|
||||
new(data.body)
|
||||
end
|
||||
rescue Fog::Errors::NotFound
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +1,11 @@
|
|||
require 'fog/vcloud/models/compute/helpers/status'
|
||||
module Fog
|
||||
module Vcloud
|
||||
class Compute
|
||||
class Server < Fog::Vcloud::Model
|
||||
|
||||
include Fog::Vcloud::Compute::Helpers::Status
|
||||
|
||||
identity :href, :aliases => :Href
|
||||
|
||||
ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd
|
||||
|
@ -10,33 +13,38 @@ module Fog
|
|||
attribute :type
|
||||
attribute :name
|
||||
attribute :status
|
||||
attribute :network_connections, :aliases => :NetworkConnectionSection, :squash => :NetworkConnection
|
||||
attribute :os, :aliases => :OperatingSystemSection
|
||||
attribute :virtual_hardware, :aliases => :VirtualHardwareSection
|
||||
attribute :deployed, :type => :boolean
|
||||
attribute :description, :aliases => :Description
|
||||
attribute :storage_size, :aliases => :size
|
||||
|
||||
attribute :vapp_scoped_local_id, :aliases => :VAppScopedLocalId
|
||||
|
||||
attribute :network_connections, :aliases => :NetworkConnectionSection, :squash => :NetworkConnection
|
||||
attribute :virtual_hardware, :aliases => :'ovf:VirtualHardwareSection', :squash => :'ovf:Item'
|
||||
|
||||
attribute :guest_customization, :aliases => :GuestCustomizationSection
|
||||
attribute :operating_system, :aliases => :'ovf:OperatingSystemSection'
|
||||
|
||||
attribute :links, :aliases => :Link, :type => :array
|
||||
attribute :tasks, :aliases => :Tasks, :type => :array
|
||||
|
||||
attribute :vm_data, :aliases => :Children, :squash => :Vm
|
||||
|
||||
def ip_address
|
||||
def computer_name
|
||||
load_unless_loaded!
|
||||
vm[0][:NetworkConnectionSection][:NetworkConnection][:IpAddress]
|
||||
self.guest_customization[:ComputerName]
|
||||
end
|
||||
|
||||
def friendly_status
|
||||
def os_desc
|
||||
load_unless_loaded!
|
||||
case status
|
||||
when '0'
|
||||
'creating'
|
||||
when '8'
|
||||
'off'
|
||||
when '4'
|
||||
'on'
|
||||
else
|
||||
'unkown'
|
||||
end
|
||||
self.operating_system[:'ovf:Description']
|
||||
end
|
||||
|
||||
def os_type
|
||||
load_unless_loaded!
|
||||
self.operating_system[:vmw_osType]
|
||||
end
|
||||
|
||||
def ip_addresses
|
||||
load_unless_loaded!
|
||||
self.network_connections.collect{|n| n[:IpAddress] }
|
||||
end
|
||||
|
||||
def ready?
|
||||
|
@ -45,16 +53,6 @@ module Fog
|
|||
status != '0' && !running_tasks # 0 is provisioning, and no running tasks
|
||||
end
|
||||
|
||||
def on?
|
||||
reload_status # always ensure we have the correct status
|
||||
status == '4'
|
||||
end
|
||||
|
||||
def off?
|
||||
reload_status # always ensure we have the correct status
|
||||
status == '8'
|
||||
end
|
||||
|
||||
def power_on
|
||||
power_operation( :power_on => :powerOn )
|
||||
end
|
||||
|
@ -83,11 +81,6 @@ module Fog
|
|||
power_on
|
||||
end
|
||||
|
||||
def vm
|
||||
load_unless_loaded!
|
||||
self.vm_data
|
||||
end
|
||||
|
||||
def name=(new_name)
|
||||
attributes[:name] = new_name
|
||||
@changed = true
|
||||
|
@ -120,7 +113,7 @@ module Fog
|
|||
|
||||
def disks
|
||||
disk_mess.map do |dm|
|
||||
{ :number => dm[:"rasd:AddressOnParent"], :size => dm[:"rasd:VirtualQuantity"].to_i, :resource => dm[:"rasd:HostResource"] }
|
||||
{ :number => dm[:"rasd:AddressOnParent"].to_i, :size => dm[:"rasd:HostResource"][:vcloud_capacity].to_i, :resource => dm[:"rasd:HostResource"], :disk_data => dm }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -187,12 +180,12 @@ module Fog
|
|||
vh[:'rasd:ResourceType'] == '17' &&
|
||||
vh[:'rasd:AddressOnParent'].to_s == @remove_disk.to_s
|
||||
end
|
||||
connection.configure_vm_disks(vm_href, data)
|
||||
connection.configure_vm_disks(self.href, data)
|
||||
end
|
||||
if @disk_change == :added
|
||||
data = disk_mess
|
||||
data << @add_disk
|
||||
connection.configure_vm_disks(vm_href, data)
|
||||
connection.configure_vm_disks(self.href, data)
|
||||
end
|
||||
if @name_changed || @description_changed
|
||||
edit_uri = links.select {|i| i[:rel] == 'edit'}
|
||||
|
@ -216,14 +209,6 @@ module Fog
|
|||
end
|
||||
alias :delete :destroy
|
||||
|
||||
def vm_href
|
||||
load_unless_loaded!
|
||||
#require 'pp'
|
||||
#pp vm_data
|
||||
#vm_data[0][:Link].select {|v| v[:rel] == 'edit'}[0][:href]
|
||||
vm_data.kind_of?(Array)? vm_data[0][:href] : vm_data[:href]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def reset_tracking
|
||||
|
@ -242,29 +227,24 @@ module Fog
|
|||
}
|
||||
end
|
||||
|
||||
def virtual_hardware_section
|
||||
load_unless_loaded!
|
||||
vm[0][:"ovf:VirtualHardwareSection"][:"ovf:Item"]
|
||||
end
|
||||
|
||||
def memory_mess
|
||||
load_unless_loaded!
|
||||
if virtual_hardware_section
|
||||
virtual_hardware_section.detect { |item| item[:"rasd:ResourceType"] == "4" }
|
||||
if virtual_hardware
|
||||
virtual_hardware.detect { |item| item[:"rasd:ResourceType"] == "4" }
|
||||
end
|
||||
end
|
||||
|
||||
def cpu_mess
|
||||
load_unless_loaded!
|
||||
if virtual_hardware_section
|
||||
virtual_hardware_section.detect { |item| item[:"rasd:ResourceType"] == "3" }
|
||||
if virtual_hardware
|
||||
virtual_hardware.detect { |item| item[:"rasd:ResourceType"] == "3" }
|
||||
end
|
||||
end
|
||||
|
||||
def disk_mess
|
||||
load_unless_loaded!
|
||||
if virtual_hardware_section
|
||||
virtual_hardware_section.select { |item| item[:"rasd:ResourceType"] == "17" }
|
||||
if virtual_hardware
|
||||
virtual_hardware.select { |item| item[:"rasd:ResourceType"] == "17" }
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
@ -284,7 +264,6 @@ module Fog
|
|||
def reload_status
|
||||
self.status = connection.get_vapp(href).body[:status]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,8 +13,9 @@ module Fog
|
|||
attribute :href, :aliases => :Href
|
||||
|
||||
def all
|
||||
check_href!(:parent => "Vdc")
|
||||
load(_vapps)
|
||||
check_href!("Vapp")
|
||||
vapp.load_unless_loaded!
|
||||
load(vapp.children||[])
|
||||
end
|
||||
|
||||
def get(uri)
|
||||
|
@ -37,19 +38,16 @@ module Fog
|
|||
|
||||
private
|
||||
|
||||
def _resource_entities
|
||||
if Hash === resource_entities = connection.get_vdc(href).body[:ResourceEntities]
|
||||
resource_entities[:ResourceEntity]
|
||||
end
|
||||
def vapp
|
||||
@vapp ||= (attributes[:vapp] || init_vapp)
|
||||
end
|
||||
|
||||
def _vapps
|
||||
resource_entities = _resource_entities
|
||||
if resource_entities.nil?
|
||||
[]
|
||||
else
|
||||
resource_entities.select {|re| re[:type] == 'application/vnd.vmware.vcloud.vApp+xml' }
|
||||
end
|
||||
def init_vapp
|
||||
Fog::Vcloud::Compute::Vapp.new(
|
||||
:connection => connection,
|
||||
:href => self.href,
|
||||
:collection => Fog::Vcloud::Compute::Vapps.new(:connection => connection)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
41
lib/fog/vcloud/models/compute/vapp.rb
Normal file
41
lib/fog/vcloud/models/compute/vapp.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
require 'fog/vcloud/models/compute/helpers/status'
|
||||
module Fog
|
||||
module Vcloud
|
||||
class Compute
|
||||
class Vapp < Fog::Vcloud::Model
|
||||
|
||||
include Fog::Vcloud::Compute::Helpers::Status
|
||||
|
||||
identity :href
|
||||
|
||||
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd
|
||||
|
||||
attribute :name
|
||||
attribute :type
|
||||
attribute :status
|
||||
attribute :description, :aliases => :Description
|
||||
attribute :deployed, :type => :boolean
|
||||
|
||||
attribute :children, :aliases => :Children, :squash => :Vm
|
||||
attribute :lease_settings, :aliases => :LeaseSettingsSection
|
||||
|
||||
attribute :other_links, :aliases => :Link
|
||||
|
||||
def servers
|
||||
@servers ||= Fog::Vcloud::Compute::Servers.
|
||||
new( :connection => connection,
|
||||
:href => href,
|
||||
:vapp => self
|
||||
)
|
||||
end
|
||||
|
||||
def networks
|
||||
@networks ||= Fog::Vcloud::Compute::Networks.
|
||||
new( :connection => connection,
|
||||
:href => href
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
32
lib/fog/vcloud/models/compute/vapps.rb
Normal file
32
lib/fog/vcloud/models/compute/vapps.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
require 'fog/vcloud/models/compute/vapp'
|
||||
|
||||
module Fog
|
||||
module Vcloud
|
||||
class Compute
|
||||
|
||||
class Vapps < Collection
|
||||
|
||||
model Fog::Vcloud::Compute::Vapp
|
||||
|
||||
undef_method :create
|
||||
|
||||
attribute :href
|
||||
|
||||
def all
|
||||
resource_entities = (re=connection.get_vdc(self.href).body[:ResourceEntities][:ResourceEntity]).is_a?(Array) ? re : [re].compact
|
||||
data = resource_entities.select { |re| re[:type] == "application/vnd.vmware.vcloud.vApp+xml" }
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(uri)
|
||||
if data = connection.get_vapp(uri)
|
||||
new(data.body)
|
||||
end
|
||||
rescue Fog::Errors::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,13 +10,17 @@ module Fog
|
|||
attribute :name
|
||||
attribute :type
|
||||
attribute :description, :aliases => :Description
|
||||
attribute :other_links, :aliases => :Link
|
||||
attribute :network_quota, :aliases => :NetworkQuota, :type => :integer
|
||||
attribute :nic_quota, :aliases => :NicQuota, :type => :integer
|
||||
attribute :vm_quota, :aliases => :VmQuota, :type => :integer
|
||||
attribute :is_enabled, :aliases => :IsEnabled, :type => :boolean
|
||||
attribute :compute_capacity, :aliases => :ComputeCapacity
|
||||
attribute :storage_capacity, :aliases => :StorageCapacity
|
||||
attribute :available_networks, :aliases => :AvailableNetworks, :squash => :Network
|
||||
|
||||
attribute :other_links, :aliases => :Link
|
||||
|
||||
attribute :resource_entities, :aliases => :ResourceEntities, :squash => :ResourceEntity
|
||||
attribute :deployed_vm_quota
|
||||
attribute :instantiated_vm_quota
|
||||
|
||||
def networks
|
||||
@networks ||= Fog::Vcloud::Compute::Networks.
|
||||
|
@ -24,32 +28,13 @@ module Fog
|
|||
:href => href )
|
||||
end
|
||||
|
||||
def servers
|
||||
@servers ||= Fog::Vcloud::Compute::Servers.
|
||||
def vapps
|
||||
@vapps ||= Fog::Vcloud::Compute::Vapps.
|
||||
new( :connection => connection,
|
||||
:href => href )
|
||||
:href => href
|
||||
)
|
||||
end
|
||||
|
||||
def tasks
|
||||
@tasks ||= Fog::Vcloud::Compute::Tasks.
|
||||
new( :connection => connection,
|
||||
:href => href + "/tasksList" )
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def collection_based_on_type(type, klass = nil)
|
||||
load_unless_loaded!
|
||||
test_links = other_links.kind_of?(Array) ? other_links : [other_links]
|
||||
if link = test_links.detect { |link| link[:type] == type }
|
||||
case type
|
||||
when "application/vnd.vmware.vcloud.catalog+xml"
|
||||
Fog::Vcloud::Compute::Catalog
|
||||
end.new( :connection => connection, :href => link[:href] )
|
||||
else
|
||||
[ ]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,8 +10,11 @@ module Fog
|
|||
|
||||
undef_method :create
|
||||
|
||||
attribute :href
|
||||
|
||||
def all
|
||||
data = connection.get_organization(organization_uri).body[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" }
|
||||
links = (l=connection.get_organization(org_uri).body[:Link]).is_a?(Array) ? l : [l].compact
|
||||
data = links.select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" }
|
||||
data.each { |link| link.delete_if { |key, value| [:rel].include?(key) } }
|
||||
load(data)
|
||||
end
|
||||
|
@ -24,16 +27,11 @@ module Fog
|
|||
nil
|
||||
end
|
||||
|
||||
def organization_uri
|
||||
@organization_uri ||= connection.default_organization_uri
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def organization_uri=(new_organization_uri)
|
||||
@organization_uri = new_organization_uri
|
||||
def org_uri
|
||||
self.href ||= connection.default_organization_uri
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
10
lib/fog/vcloud/requests/compute/get_server.rb
Normal file
10
lib/fog/vcloud/requests/compute/get_server.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
module Fog
|
||||
module Vcloud
|
||||
class Compute
|
||||
|
||||
class Real
|
||||
basic_request :get_server
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
110
tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2
Normal file
110
tests/vcloud/data/api_+_v1.0_+_admin_+_network_+_2
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ExternalNetwork xmlns="http://www.vmware.com/vcloud/v1" name="ParentNetwork1" type="application/vnd.vmware.admin.network+xml" href="https://vcloud.example.com/api/v1.0/admin/network/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/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>
|
5
tests/vcloud/data/api_+_v1.0_+_login
Normal file
5
tests/vcloud/data/api_+_v1.0_+_login
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OrgList xmlns="http://www.vmware.com/vcloud/v1" type="application/vnd.vmware.vcloud.orgList+xml" href="https://vcloud.example.com/api/v1.0/org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
|
||||
<Org type="application/vnd.vmware.vcloud.org+xml" name="Org1" href="https://vcloud.example.com/api/v1.0/org/1"/>
|
||||
<Org type="application/vnd.vmware.vcloud.org+xml" name="Org2" href="https://vcloud.example.com/api/v1.0/org/2"/>
|
||||
</OrgList>
|
44
tests/vcloud/data/api_+_v1.0_+_network_+_1
Normal file
44
tests/vcloud/data/api_+_v1.0_+_network_+_1
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="Network1" type="application/vnd.vmware.vcloud.network+xml" href="https://vcloud.example.com/api/v1.0/network/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/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>
|
31
tests/vcloud/data/api_+_v1.0_+_network_+_2
Normal file
31
tests/vcloud/data/api_+_v1.0_+_network_+_2
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="Network2" type="application/vnd.vmware.vcloud.network+xml" href="https://vcloud.example.com/api/v1.0/network/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/v1.0/org/1"/>
|
||||
<Description>Description</Description>
|
||||
<Configuration>
|
||||
<IpScope>
|
||||
<IsInherited>false</IsInherited>
|
||||
<Gateway>192.168.251.254</Gateway>
|
||||
<Netmask>255.255.255.0</Netmask>
|
||||
<Dns1>192.168.251.254</Dns1>
|
||||
<IpRanges>
|
||||
<IpRange>
|
||||
<StartAddress>192.168.251.101</StartAddress>
|
||||
<EndAddress>192.168.251.200</EndAddress>
|
||||
</IpRange>
|
||||
</IpRanges>
|
||||
</IpScope>
|
||||
<FenceMode>isolated</FenceMode>
|
||||
<Features>
|
||||
<DhcpService>
|
||||
<IsEnabled>false</IsEnabled>
|
||||
<DefaultLeaseTime>3600</DefaultLeaseTime>
|
||||
<MaxLeaseTime>7200</MaxLeaseTime>
|
||||
<IpRange>
|
||||
<StartAddress>192.168.251.1</StartAddress>
|
||||
<EndAddress>192.168.251.100</EndAddress>
|
||||
</IpRange>
|
||||
</DhcpService>
|
||||
</Features>
|
||||
</Configuration>
|
||||
</OrgNetwork>
|
17
tests/vcloud/data/api_+_v1.0_+_org_+_1
Normal file
17
tests/vcloud/data/api_+_v1.0_+_org_+_1
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Org xmlns="http://www.vmware.com/vcloud/v1" name="Org1" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/v1.0/org/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml" name="vDC1" href="https://vcloud.example.com/api/v1.0/vdc/1"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.tasksList+xml" href="https://vcloud.example.com/api/v1.0/tasksList/1"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Catalog1" href="https://vcloud.example.com/api/v1.0/catalog/1"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/1/controlAccess/"/>
|
||||
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/1/action/controlAccess"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Catalog2" href="https://vcloud.example.com/api/v1.0/catalog/2"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/2/controlAccess/"/>
|
||||
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/2/action/controlAccess"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.network+xml" name="Network1" href="https://vcloud.example.com/api/v1.0/network/1"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.network+xml" name="Network2" href="https://vcloud.example.com/api/v1.0/network/2"/>
|
||||
<Description>Some fancy
|
||||
|
||||
Description</Description>
|
||||
<FullName>My Full Name</FullName>
|
||||
</Org>
|
369
tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1
Normal file
369
tests/vcloud/data/api_+_v1.0_+_vApp_+_vapp-1
Normal file
|
@ -0,0 +1,369 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" deployed="true" status="8" name="vApp1" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/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://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 http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
|
||||
<Link rel="power:powerOn" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/power/action/powerOn"/>
|
||||
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
|
||||
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/action/deploy"/>
|
||||
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/action/undeploy"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/controlAccess/"/>
|
||||
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/action/controlAccess"/>
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/v1.0/vdc/652994200"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1"/>
|
||||
<Description>Some Description of a vApp</Description>
|
||||
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/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/v1.0/vApp/vapp-1/startupSection/"/>
|
||||
</ovf:StartupSection>
|
||||
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/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/v1.0/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/v1.0/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/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/>
|
||||
<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: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:00:03</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>
|
||||
<Vm deployed="true" status="8" name="vm1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/vApp/vm-1/power/action/powerOn"/>
|
||||
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/power/action/powerOff"/>
|
||||
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/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-1"/>
|
||||
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/screen"/>
|
||||
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
|
||||
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
|
||||
<Description/>
|
||||
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
</ovf:Item>
|
||||
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
</ovf:Item>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/vApp/vm-1/operatingSystemSection/"/>
|
||||
</ovf:OperatingSystemSection>
|
||||
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vm-1/networkConnectionSection/"/>
|
||||
</NetworkConnectionSection>
|
||||
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vm-1/guestCustomizationSection/"/>
|
||||
</GuestCustomizationSection>
|
||||
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v01</VAppScopedLocalId>
|
||||
</Vm>
|
||||
</Children>
|
||||
</VApp>
|
139
tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1
Normal file
139
tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-1
Normal file
|
@ -0,0 +1,139 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Vm xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" deployed="true" status="8" name="vm1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/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://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 http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
|
||||
<VCloudExtension required="false">
|
||||
<vmext:VimObjectRef>
|
||||
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm1.example.com" href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vm-1/power/action/powerOn"/>
|
||||
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/power/action/powerOff"/>
|
||||
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/action/undeploy"/>
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1006933678"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1"/>
|
||||
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/screen"/>
|
||||
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
|
||||
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
|
||||
<Description/>
|
||||
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
</ovf:Item>
|
||||
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
</ovf:Item>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/vApp/vm-1/operatingSystemSection/"/>
|
||||
</ovf:OperatingSystemSection>
|
||||
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vm-1/networkConnectionSection/"/>
|
||||
</NetworkConnectionSection>
|
||||
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vm-1/guestCustomizationSection/"/>
|
||||
</GuestCustomizationSection>
|
||||
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v01</VAppScopedLocalId>
|
||||
</Vm>
|
155
tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2
Normal file
155
tests/vcloud/data/api_+_v1.0_+_vApp_+_vm-2
Normal file
|
@ -0,0 +1,155 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Vm xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" deployed="true" status="8" name="vm2" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/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://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 http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.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-1006933678"/>
|
||||
<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>
|
61
tests/vcloud/data/api_+_v1.0_+_vdc_+_1
Normal file
61
tests/vcloud/data/api_+_v1.0_+_vdc_+_1
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Vdc xmlns="http://www.vmware.com/vcloud/v1" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" status="1" name="vDC1" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/v1.0/vdc/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/schema/vmwextensions.xsd http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/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/v1.0/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/v1.0/org/1"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/uploadVAppTemplate"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.media+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/media"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/instantiateVAppTemplate"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/cloneVApp"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/cloneVAppTemplate"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.cloneMediaParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/cloneMedia"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.captureVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/captureVApp"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.composeVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/composeVApp"/>
|
||||
<Link rel="move" type="application/vnd.vmware.vcloud.moveMediaParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/moveMedia"/>
|
||||
<Link rel="move" type="application/vnd.vmware.vcloud.moveVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/moveVApp"/>
|
||||
<Link rel="move" type="application/vnd.vmware.vcloud.moveVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/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/v1.0/vApp/vapp-1"/>
|
||||
<ResourceEntity type="application/vnd.vmware.vcloud.vApp+xml" name="vApp_2" href="https://vcloud.example.com/api/v1.0/vApp/vapp-2"/>
|
||||
<ResourceEntity type="application/vnd.vmware.vcloud.media+xml" name="media1" href="https://vcloud.example.com/api/v1.0/media/1"/>
|
||||
<ResourceEntity type="application/vnd.vmware.vcloud.media+xml" name="media2" href="https://vcloud.example.com/api/v1.0/media/2"/>
|
||||
</ResourceEntities>
|
||||
<AvailableNetworks>
|
||||
<Network type="application/vnd.vmware.vcloud.network+xml" name="network1" href="https://vcloud.example.com/api/v1.0/network/1"/>
|
||||
<Network type="application/vnd.vmware.vcloud.network+xml" name="network2" href="https://vcloud.example.com/api/v1.0/network/2"/>
|
||||
</AvailableNetworks>
|
||||
<NicQuota>10</NicQuota>
|
||||
<NetworkQuota>10</NetworkQuota>
|
||||
<VmQuota>10</VmQuota>
|
||||
<IsEnabled>true</IsEnabled>
|
||||
</Vdc>
|
13
tests/vcloud/models/compute/conn_helper.rb
Normal file
13
tests/vcloud/models/compute/conn_helper.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module Fog
|
||||
class Connection
|
||||
def initialize(url, persistent=false, params={})
|
||||
end
|
||||
|
||||
def request(params, &block)
|
||||
Excon::Response.new(
|
||||
:body => File.read(File.expand_path(File.join(File.dirname(__FILE__),'..','..','data',params[:path].gsub(/^\//,'').gsub('/','_+_')))),
|
||||
:status => 200,
|
||||
:header => '')
|
||||
end
|
||||
end
|
||||
end
|
64
tests/vcloud/models/compute/network_tests.rb
Normal file
64
tests/vcloud/models/compute/network_tests.rb
Normal file
|
@ -0,0 +1,64 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/networks'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | network", ['vcloud']) do
|
||||
connection = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password')
|
||||
tests("an org network") do
|
||||
instance = Fog::Vcloud::Compute::Networks.new(
|
||||
:connection => connection,
|
||||
:href => "https://vcloud.example.com/api/v1.0/vApp/vapp-1"
|
||||
).first
|
||||
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] }
|
||||
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("#parent_network") do
|
||||
tests("returned network name").returns("ParentNetwork1"){ p = instance.parent_network; p.reload; p.name }
|
||||
end
|
||||
end
|
||||
|
||||
tests("an external network") do
|
||||
instance = Fog::Vcloud::Compute::Network.new(
|
||||
:connection => connection,
|
||||
:collection => Fog::Vcloud::Compute::Networks.new(:connection => connection),
|
||||
:href => "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
|
41
tests/vcloud/models/compute/networks_tests.rb
Normal file
41
tests/vcloud/models/compute/networks_tests.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/networks'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | networks", ['vcloud']) 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 }
|
||||
end
|
||||
end
|
||||
end
|
13
tests/vcloud/models/compute/organization_tests.rb
Normal file
13
tests/vcloud/models/compute/organization_tests.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
Shindo.tests("Vcloud::Compute | organization", ['vcloud']) do
|
||||
|
||||
instance = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password').organizations.first
|
||||
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 }
|
||||
|
||||
end
|
14
tests/vcloud/models/compute/organizations_tests.rb
Normal file
14
tests/vcloud/models/compute/organizations_tests.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/organizations'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | organizations", ['vcloud']) do
|
||||
|
||||
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 }
|
||||
end
|
||||
|
||||
end
|
136
tests/vcloud/models/compute/server_tests.rb
Normal file
136
tests/vcloud/models/compute/server_tests.rb
Normal file
|
@ -0,0 +1,136 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/servers'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | server", ['vcloud']) do
|
||||
|
||||
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"
|
||||
).first
|
||||
instance.reload
|
||||
|
||||
tests("#href").returns("https://vcloud.example.com/api/v1.0/vApp/vm-2") { instance.href }
|
||||
tests("#name").returns("vm2") { instance.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
|
||||
|
||||
#old tests
|
||||
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
@svr = Vcloud.servers.create :catalog_item_uri => Vcloud::Compute::TestSupport::template, :name => 'fog_test_run', :password => 'password'
|
||||
print "Waiting for server to be ready"
|
||||
@svr.wait_for(1200) { print '.' ; ready? }
|
||||
puts ""
|
||||
@svr.ready?
|
||||
end
|
||||
|
||||
tests("#svr.power_on()").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
@svr.power_on
|
||||
@svr.wait_for { on? }
|
||||
@svr.wait_for { ready? }
|
||||
@svr.on?
|
||||
end
|
||||
|
||||
tests("#svr.description(\"testing\")").returns("testing") do
|
||||
pending if Fog.mocking?
|
||||
@svr.wait_for { ready? }
|
||||
@svr.description = "testing"
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
@svr.description
|
||||
end
|
||||
|
||||
# Power off only stops the OS, doesn't free up resources. #undeploy is for this.
|
||||
tests("#svr.undeploy()").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
@svr.undeploy
|
||||
@svr.wait_for { off? }
|
||||
@svr.wait_for { ready? }
|
||||
@svr.off?
|
||||
end
|
||||
|
||||
tests("#svr.memory(384)").returns(384) do
|
||||
pending if Fog.mocking?
|
||||
raise 'Server template memory already 384m - change to something different' if @svr.memory[:amount] == 384
|
||||
@svr.wait_for { ready? }
|
||||
@svr.memory = 384
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
# Can take a little while for the VM to know it has different ram, and not tied to a task..
|
||||
(1..20).each do |i|
|
||||
break if @svr.reload.memory[:amount] == '384'
|
||||
sleep 1
|
||||
end
|
||||
@svr.reload.memory[:amount]
|
||||
end
|
||||
|
||||
tests("#svr.add_disk(4096)").returns([2, "4096"]) do
|
||||
pending if Fog.mocking?
|
||||
raise 'Server template already has two disks' if @svr.disks.size == 2
|
||||
@svr.wait_for { ready? }
|
||||
@svr.add_disk(4096)
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
# Can take a little while for the VM to know it has different ram, and not tied to a task..
|
||||
(1..20).each do |i|
|
||||
break if @svr.reload.disks.size == 2
|
||||
sleep 1
|
||||
end
|
||||
[
|
||||
@svr.disks.size,
|
||||
@svr.disks[1][:resource][:vcloud_capacity]
|
||||
]
|
||||
end
|
||||
|
||||
tests("#svr.delete_disk(1)").returns(1) do
|
||||
pending if Fog.mocking?
|
||||
raise "Server doesn't have two disks - did previous step fail? " if @svr.disks.size != 2
|
||||
@svr.wait_for { ready? }
|
||||
sleep 5 # otherwise complains about being busy
|
||||
@svr.delete_disk 1
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
# Can take a little while for the VM to know it has different ram, and not tied to a task..
|
||||
(1..20).each do |i|
|
||||
break if @svr.reload.disks.size == 1
|
||||
sleep 1
|
||||
end
|
||||
@svr.disks.size
|
||||
end
|
||||
|
||||
tests("#svr.destroy").raises(Excon::Errors::Forbidden) do
|
||||
pending if Fog.mocking?
|
||||
@svr.destroy
|
||||
sleep 5 # allow cleanup..
|
||||
Vcloud.servers.get(@svr.href) == nil
|
||||
end
|
||||
end
|
|
@ -1,95 +1,15 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/servers'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do
|
||||
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("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
@svr = Vcloud.servers.create :catalog_item_uri => Vcloud::Compute::TestSupport::template, :name => 'fog_test_run', :password => 'password'
|
||||
print "Waiting for server to be ready"
|
||||
@svr.wait_for(1200) { print '.' ; ready? }
|
||||
puts ""
|
||||
@svr.ready?
|
||||
tests("collection") do
|
||||
returns(2) { instance.size }
|
||||
returns("https://vcloud.example.com/api/v1.0/vApp/vm-2") { instance.first.href }
|
||||
end
|
||||
|
||||
tests("#svr.power_on()").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
@svr.power_on
|
||||
@svr.wait_for { on? }
|
||||
@svr.wait_for { ready? }
|
||||
@svr.on?
|
||||
end
|
||||
|
||||
tests("#svr.description(\"testing\")").returns("testing") do
|
||||
pending if Fog.mocking?
|
||||
@svr.wait_for { ready? }
|
||||
@svr.description = "testing"
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
@svr.description
|
||||
end
|
||||
|
||||
# Power off only stops the OS, doesn't free up resources. #undeploy is for this.
|
||||
tests("#svr.undeploy()").returns(true) do
|
||||
pending if Fog.mocking?
|
||||
@svr.undeploy
|
||||
@svr.wait_for { off? }
|
||||
@svr.wait_for { ready? }
|
||||
@svr.off?
|
||||
end
|
||||
|
||||
tests("#svr.memory(384)").returns(384) do
|
||||
pending if Fog.mocking?
|
||||
raise 'Server template memory already 384m - change to something different' if @svr.memory[:amount] == 384
|
||||
@svr.wait_for { ready? }
|
||||
@svr.memory = 384
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
# Can take a little while for the VM to know it has different ram, and not tied to a task..
|
||||
(1..20).each do |i|
|
||||
break if @svr.reload.memory[:amount] == '384'
|
||||
sleep 1
|
||||
end
|
||||
@svr.reload.memory[:amount]
|
||||
end
|
||||
|
||||
tests("#svr.add_disk(4096)").returns([2, "4096"]) do
|
||||
pending if Fog.mocking?
|
||||
raise 'Server template already has two disks' if @svr.disks.size == 2
|
||||
@svr.wait_for { ready? }
|
||||
@svr.add_disk(4096)
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
# Can take a little while for the VM to know it has different ram, and not tied to a task..
|
||||
(1..20).each do |i|
|
||||
break if @svr.reload.disks.size == 2
|
||||
sleep 1
|
||||
end
|
||||
[
|
||||
@svr.disks.size,
|
||||
@svr.disks[1][:resource][:vcloud_capacity]
|
||||
]
|
||||
end
|
||||
|
||||
tests("#svr.delete_disk(1)").returns(1) do
|
||||
pending if Fog.mocking?
|
||||
raise "Server doesn't have two disks - did previous step fail? " if @svr.disks.size != 2
|
||||
@svr.wait_for { ready? }
|
||||
sleep 5 # otherwise complains about being busy
|
||||
@svr.delete_disk 1
|
||||
@svr.save
|
||||
@svr.wait_for { ready? }
|
||||
# Can take a little while for the VM to know it has different ram, and not tied to a task..
|
||||
(1..20).each do |i|
|
||||
break if @svr.reload.disks.size == 1
|
||||
sleep 1
|
||||
end
|
||||
@svr.disks.size
|
||||
end
|
||||
|
||||
tests("#svr.destroy").raises(Excon::Errors::Forbidden) do
|
||||
pending if Fog.mocking?
|
||||
@svr.destroy
|
||||
sleep 5 # allow cleanup..
|
||||
Vcloud.servers.get(@svr.href) == nil
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
27
tests/vcloud/models/compute/vapp_tests.rb
Normal file
27
tests/vcloud/models/compute/vapp_tests.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/vapps'
|
||||
require 'fog/vcloud/models/compute/vapp'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | vapp", ['vcloud']) 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/v1.0/vdc/1"
|
||||
).first
|
||||
instance.reload
|
||||
|
||||
tests("#href").returns("https://vcloud.example.com/api/v1.0/vApp/vapp-1") { instance.href }
|
||||
tests("#name").returns("vApp1") { instance.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
|
17
tests/vcloud/models/compute/vapps_tests.rb
Normal file
17
tests/vcloud/models/compute/vapps_tests.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/vapps'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | vapps", ['vcloud']) 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/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 }
|
||||
end
|
||||
|
||||
end
|
42
tests/vcloud/models/compute/vdc_tests.rb
Normal file
42
tests/vcloud/models/compute/vdc_tests.rb
Normal file
|
@ -0,0 +1,42 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/vdcs'
|
||||
require 'fog/vcloud/models/compute/vdc'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | vdc", ['vcloud']) 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"
|
||||
).first
|
||||
instance.reload
|
||||
|
||||
tests("#href").returns("https://vcloud.example.com/api/v1.0/vdc/1") { instance.href }
|
||||
tests("#name").returns("vDC1") { instance.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
|
17
tests/vcloud/models/compute/vdcs_tests.rb
Normal file
17
tests/vcloud/models/compute/vdcs_tests.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require "#{File.dirname(__FILE__)}/conn_helper.rb"
|
||||
|
||||
require 'fog/vcloud/models/compute/vdcs'
|
||||
|
||||
Shindo.tests("Vcloud::Compute | vdcs", ['vcloud']) 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 }
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue